claudekit-cli 3.41.4-dev.1 → 3.41.4-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/index.js +4576 -2738
- package/dist/ui/assets/index-DxBGb68M.js +261 -0
- package/dist/ui/assets/index-oW0QypIz.css +1 -0
- package/dist/ui/index.html +2 -2
- package/package.json +1 -1
- package/dist/ui/assets/index-BLo8rjEQ.js +0 -254
- package/dist/ui/assets/index-C0MkXKn3.css +0 -1
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/event-BR0sBAas.js","assets/core-B8a0kdWx.js","assets/index-Bnd1bUG3.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var ov=Object.defineProperty;var av=(t,e,n)=>e in t?ov(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Yu=(t,e,n)=>av(t,typeof e!="symbol"?e+"":e,n);import{r as m,a as Tr,R as lv,b as Re}from"./vendor-DNUgy55u.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var e0={exports:{}},Fl={};/**
|
|
3
|
+
* @license React
|
|
4
|
+
* react-jsx-runtime.production.min.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/var cv=m,dv=Symbol.for("react.element"),hv=Symbol.for("react.fragment"),uv=Object.prototype.hasOwnProperty,fv=cv.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,pv={key:!0,ref:!0,__self:!0,__source:!0};function t0(t,e,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)uv.call(e,r)&&!pv.hasOwnProperty(r)&&(s[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)s[r]===void 0&&(s[r]=e[r]);return{$$typeof:dv,type:t,key:i,ref:o,props:s,_owner:fv.current}}Fl.Fragment=hv;Fl.jsx=t0;Fl.jsxs=t0;e0.exports=Fl;var c=e0.exports,Nd={},Ju=Tr;Nd.createRoot=Ju.createRoot,Nd.hydrateRoot=Ju.hydrateRoot;/**
|
|
11
|
+
* react-router v7.11.0
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Remix Software Inc.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
17
|
+
*
|
|
18
|
+
* @license MIT
|
|
19
|
+
*/var n0=t=>{throw TypeError(t)},mv=(t,e,n)=>e.has(t)||n0("Cannot "+n),pc=(t,e,n)=>(mv(t,e,"read from private field"),n?n.call(t):e.get(t)),gv=(t,e,n)=>e.has(t)?n0("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Qu="popstate";function xv(t={}){function e(r,s){let{pathname:i,search:o,hash:a}=r.location;return Ci("",{pathname:i,search:o,hash:a},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function n(r,s){return typeof s=="string"?s:En(s)}return yv(e,n,null,t)}function ge(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function $e(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function bv(){return Math.random().toString(36).substring(2,10)}function Xu(t,e){return{usr:t.state,key:t.key,idx:e}}function Ci(t,e,n=null,r){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?gr(e):e,state:n,key:e&&e.key||r||bv()}}function En({pathname:t="/",search:e="",hash:n=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function gr(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substring(n),t=t.substring(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substring(r),t=t.substring(0,r)),t&&(e.pathname=t)}return e}function yv(t,e,n,r={}){let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,a="POP",l=null,d=h();d==null&&(d=0,o.replaceState({...o.state,idx:d},""));function h(){return(o.state||{idx:null}).idx}function u(){a="POP";let b=h(),y=b==null?null:b-d;d=b,l&&l({action:a,location:x.location,delta:y})}function f(b,y){a="PUSH";let w=Ci(x.location,b,y);d=h()+1;let C=Xu(w,d),S=x.createHref(w);try{o.pushState(C,"",S)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;s.location.assign(S)}i&&l&&l({action:a,location:x.location,delta:1})}function p(b,y){a="REPLACE";let w=Ci(x.location,b,y);d=h();let C=Xu(w,d),S=x.createHref(w);o.replaceState(C,"",S),i&&l&&l({action:a,location:x.location,delta:0})}function g(b){return r0(b)}let x={get action(){return a},get location(){return t(s,o)},listen(b){if(l)throw new Error("A history only accepts one active listener");return s.addEventListener(Qu,u),l=b,()=>{s.removeEventListener(Qu,u),l=null}},createHref(b){return e(s,b)},createURL:g,encodeLocation(b){let y=g(b);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:f,replace:p,go(b){return o.go(b)}};return x}function r0(t,e=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),ge(n,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:En(t);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=n+r),new URL(r,n)}var oi,Zu=class{constructor(t){if(gv(this,oi,new Map),t)for(let[e,n]of t)this.set(e,n)}get(t){if(pc(this,oi).has(t))return pc(this,oi).get(t);if(t.defaultValue!==void 0)return t.defaultValue;throw new Error("No value found for context")}set(t,e){pc(this,oi).set(t,e)}};oi=new WeakMap;var vv=new Set(["lazy","caseSensitive","path","id","index","children"]);function wv(t){return vv.has(t)}var kv=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function Sv(t){return kv.has(t)}function Cv(t){return t.index===!0}function ji(t,e,n=[],r={},s=!1){return t.map((i,o)=>{let a=[...n,String(o)],l=typeof i.id=="string"?i.id:a.join("-");if(ge(i.index!==!0||!i.children,"Cannot specify children on an index route"),ge(s||!r[l],`Found a route id collision on id "${l}". Route id's must be globally unique within Data Router usages`),Cv(i)){let d={...i,id:l};return r[l]=ef(d,e(d)),d}else{let d={...i,id:l,children:void 0};return r[l]=ef(d,e(d)),i.children&&(d.children=ji(i.children,e,a,r,s)),d}})}function ef(t,e){return Object.assign(t,{...e,...typeof e.lazy=="object"&&e.lazy!=null?{lazy:{...t.lazy,...e.lazy}}:{}})}function er(t,e,n="/"){return ai(t,e,n,!1)}function ai(t,e,n,r){let s=typeof e=="string"?gr(e):e,i=Xt(s.pathname||"/",n);if(i==null)return null;let o=s0(t);Nv(o);let a=null;for(let l=0;a==null&&l<o.length;++l){let d=$v(i);a=Rv(o[l],d,r)}return a}function jv(t,e){let{route:n,pathname:r,params:s}=t;return{id:n.id,pathname:r,params:s,data:e[n.id],loaderData:e[n.id],handle:n.handle}}function s0(t,e=[],n=[],r="",s=!1){let i=(o,a,l=s,d)=>{let h={relativePath:d===void 0?o.path||"":d,caseSensitive:o.caseSensitive===!0,childrenIndex:a,route:o};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(r)&&l)return;ge(h.relativePath.startsWith(r),`Absolute route path "${h.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(r.length)}let u=Dn([r,h.relativePath]),f=n.concat(h);o.children&&o.children.length>0&&(ge(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),s0(o.children,e,f,u,l)),!(o.path==null&&!o.index)&&e.push({path:u,score:Ev(u,o.index),routesMeta:f})};return t.forEach((o,a)=>{if(o.path===""||!o.path?.includes("?"))i(o,a);else for(let l of i0(o.path))i(o,a,!0,l)}),e}function i0(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=i0(r.join("/")),a=[];return a.push(...o.map(l=>l===""?i:[i,l].join("/"))),s&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function Nv(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:Lv(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var Pv=/^:[\w-]+$/,Ov=3,Mv=2,Av=1,Dv=10,Tv=-2,tf=t=>t==="*";function Ev(t,e){let n=t.split("/"),r=n.length;return n.some(tf)&&(r+=Tv),e&&(r+=Mv),n.filter(s=>!tf(s)).reduce((s,i)=>s+(Pv.test(i)?Ov:i===""?Av:Dv),r)}function Lv(t,e){return t.length===e.length&&t.slice(0,-1).every((r,s)=>r===e[s])?t[t.length-1]-e[e.length-1]:0}function Rv(t,e,n=!1){let{routesMeta:r}=t,s={},i="/",o=[];for(let a=0;a<r.length;++a){let l=r[a],d=a===r.length-1,h=i==="/"?e:e.slice(i.length)||"/",u=rl({path:l.relativePath,caseSensitive:l.caseSensitive,end:d},h),f=l.route;if(!u&&d&&n&&!r[r.length-1].route.index&&(u=rl({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},h)),!u)return null;Object.assign(s,u.params),o.push({params:s,pathname:Dn([i,u.pathname]),pathnameBase:zv(Dn([i,u.pathnameBase])),route:f}),u.pathnameBase!=="/"&&(i=Dn([i,u.pathnameBase]))}return o}function rl(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=Iv(t.path,t.caseSensitive,t.end),s=e.match(n);if(!s)return null;let i=s[0],o=i.replace(/(.)\/+$/,"$1"),a=s.slice(1);return{params:r.reduce((d,{paramName:h,isOptional:u},f)=>{if(h==="*"){let g=a[f]||"";o=i.slice(0,i.length-g.length).replace(/(.)\/+$/,"$1")}const p=a[f];return u&&!p?d[h]=void 0:d[h]=(p||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:o,pattern:t}}function Iv(t,e=!1,n=!0){$e(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let r=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),r]}function $v(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return $e(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function Xt(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}function Bv({basename:t,pathname:e}){return e==="/"?t:Dn([t,e])}var o0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,zl=t=>o0.test(t);function Fv(t,e="/"){let{pathname:n,search:r="",hash:s=""}=typeof t=="string"?gr(t):t,i;if(n)if(zl(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),$e(!1,`Pathnames cannot have embedded double slashes - normalizing ${o} -> ${n}`)}n.startsWith("/")?i=nf(n.substring(1),"/"):i=nf(n,e)}else i=e;return{pathname:i,search:Vv(r),hash:Hv(s)}}function nf(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function mc(t,e,n,r){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function a0(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Vl(t){let e=a0(t);return e.map((n,r)=>r===e.length-1?n.pathname:n.pathnameBase)}function Hl(t,e,n,r=!1){let s;typeof t=="string"?s=gr(t):(s={...t},ge(!s.pathname||!s.pathname.includes("?"),mc("?","pathname","search",s)),ge(!s.pathname||!s.pathname.includes("#"),mc("#","pathname","hash",s)),ge(!s.search||!s.search.includes("#"),mc("#","search","hash",s)));let i=t===""||s.pathname==="",o=i?"/":s.pathname,a;if(o==null)a=n;else{let u=e.length-1;if(!r&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),u-=1;s.pathname=f.join("/")}a=u>=0?e[u]:"/"}let l=Fv(s,a),d=o&&o!=="/"&&o.endsWith("/"),h=(i||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(d||h)&&(l.pathname+="/"),l}var Dn=t=>t.join("/").replace(/\/\/+/g,"/"),zv=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Vv=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Hv=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,Eo=class{constructor(t,e,n,r=!1){this.status=t,this.statusText=e||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Ni(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Lo(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var l0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function c0(t,e){let n=t;if(typeof n!="string"||!o0.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(l0)try{let i=new URL(window.location.href),o=n.startsWith("//")?new URL(i.protocol+n):new URL(n),a=Xt(o.pathname,e);o.origin===i.origin&&a!=null?n=a+o.search+o.hash:s=!0}catch{$e(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:s,to:n}}var sr=Symbol("Uninstrumented");function _v(t,e){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};t.forEach(s=>s({id:e.id,index:e.index,path:e.path,instrument(i){let o=Object.keys(n);for(let a of o)i[a]&&n[a].push(i[a])}}));let r={};if(typeof e.lazy=="function"&&n.lazy.length>0){let s=ss(n.lazy,e.lazy,()=>{});s&&(r.lazy=s)}if(typeof e.lazy=="object"){let s=e.lazy;["middleware","loader","action"].forEach(i=>{let o=s[i],a=n[`lazy.${i}`];if(typeof o=="function"&&a.length>0){let l=ss(a,o,()=>{});l&&(r.lazy=Object.assign(r.lazy||{},{[i]:l}))}})}return["loader","action"].forEach(s=>{let i=e[s];if(typeof i=="function"&&n[s].length>0){let o=i[sr]??i,a=ss(n[s],o,(...l)=>rf(l[0]));a&&(a[sr]=o,r[s]=a)}}),e.middleware&&e.middleware.length>0&&n.middleware.length>0&&(r.middleware=e.middleware.map(s=>{let i=s[sr]??s,o=ss(n.middleware,i,(...a)=>rf(a[0]));return o?(o[sr]=i,o):s})),r}function Wv(t,e){let n={navigate:[],fetch:[]};if(e.forEach(r=>r({instrument(s){let i=Object.keys(s);for(let o of i)s[o]&&n[o].push(s[o])}})),n.navigate.length>0){let r=t.navigate[sr]??t.navigate,s=ss(n.navigate,r,(...i)=>{let[o,a]=i;return{to:typeof o=="number"||typeof o=="string"?o:o?En(o):".",...sf(t,a??{})}});s&&(s[sr]=r,t.navigate=s)}if(n.fetch.length>0){let r=t.fetch[sr]??t.fetch,s=ss(n.fetch,r,(...i)=>{let[o,,a,l]=i;return{href:a??".",fetcherKey:o,...sf(t,l??{})}});s&&(s[sr]=r,t.fetch=s)}return t}function ss(t,e,n){return t.length===0?null:async(...r)=>{let s=await d0(t,n(...r),()=>e(...r),t.length-1);if(s.type==="error")throw s.value;return s.value}}async function d0(t,e,n,r){let s=t[r],i;if(s){let o,a=async()=>(o?console.error("You cannot call instrumented handlers more than once"):o=d0(t,e,n,r-1),i=await o,ge(i,"Expected a result"),i.type==="error"&&i.value instanceof Error?{status:"error",error:i.value}:{status:"success",error:void 0});try{await s(a,e)}catch(l){console.error("An instrumentation function threw an error:",l)}o||await a(),await o}else try{i={type:"success",value:await n()}}catch(o){i={type:"error",value:o}}return i||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function rf(t){let{request:e,context:n,params:r,unstable_pattern:s}=t;return{request:Uv(e),params:{...r},unstable_pattern:s,context:Kv(n)}}function sf(t,e){return{currentUrl:En(t.state.location),..."formMethod"in e?{formMethod:e.formMethod}:{},..."formEncType"in e?{formEncType:e.formEncType}:{},..."formData"in e?{formData:e.formData}:{},..."body"in e?{body:e.body}:{}}}function Uv(t){return{method:t.method,url:t.url,headers:{get:(...e)=>t.headers.get(...e)}}}function Kv(t){if(qv(t)){let e={...t};return Object.freeze(e),e}else return{get:e=>t.get(e)}}var Gv=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function qv(t){if(t===null||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||e===null||Object.getOwnPropertyNames(e).sort().join("\0")===Gv}var h0=["POST","PUT","PATCH","DELETE"],Yv=new Set(h0),Jv=["GET",...h0],Qv=new Set(Jv),u0=new Set([301,302,303,307,308]),Xv=new Set([307,308]),gc={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Zv={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},qs={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},ew=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),f0="remix-router-transitions",p0=Symbol("ResetLoaderData");function tw(t){const e=t.window?t.window:typeof window<"u"?window:void 0,n=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u";ge(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=t.hydrationRouteProperties||[],s=t.mapRouteProperties||ew,i=s;if(t.unstable_instrumentations){let j=t.unstable_instrumentations;i=A=>({...s(A),..._v(j.map(T=>T.route).filter(Boolean),A)})}let o={},a=ji(t.routes,i,void 0,o),l,d=t.basename||"/";d.startsWith("/")||(d=`/${d}`);let h=t.dataStrategy||ow,u={...t.future},f=null,p=new Set,g=null,x=null,b=null,y=t.hydrationData!=null,w=er(a,t.history.location,d),C=!1,S=null,k;if(w==null&&!t.patchRoutesOnNavigation){let j=_t(404,{pathname:t.history.location.pathname}),{matches:A,route:T}=da(a);k=!0,w=A,S={[T.id]:j}}else if(w&&!t.hydrationData&&Xe(w,a,t.history.location.pathname).active&&(w=null),w)if(w.some(j=>j.route.lazy))k=!1;else if(!w.some(j=>Eh(j.route)))k=!0;else{let j=t.hydrationData?t.hydrationData.loaderData:null,A=t.hydrationData?t.hydrationData.errors:null;if(A){let T=w.findIndex(B=>A[B.route.id]!==void 0);k=w.slice(0,T+1).every(B=>!Od(B.route,j,A))}else k=w.every(T=>!Od(T.route,j,A))}else{k=!1,w=[];let j=Xe(null,a,t.history.location.pathname);j.active&&j.matches&&(C=!0,w=j.matches)}let N,v={historyAction:t.history.action,location:t.history.location,matches:w,initialized:k,navigation:gc,restoreScrollPosition:t.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:t.hydrationData&&t.hydrationData.loaderData||{},actionData:t.hydrationData&&t.hydrationData.actionData||null,errors:t.hydrationData&&t.hydrationData.errors||S,fetchers:new Map,blockers:new Map},P="POP",O=null,E=!1,M,D=!1,$=new Map,F=null,z=!1,G=!1,le=new Set,Z=new Map,Q=0,ce=-1,fe=new Map,W=new Set,oe=new Map,ue=new Map,be=new Set,Pe=new Map,Qe,U=null;function ve(){if(f=t.history.listen(({action:j,location:A,delta:T})=>{if(Qe){Qe(),Qe=void 0;return}$e(Pe.size===0||T!=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 B=oa({currentLocation:v.location,nextLocation:A,historyAction:j});if(B&&T!=null){let V=new Promise(ee=>{Qe=ee});t.history.go(T*-1),Qr(B,{state:"blocked",location:A,proceed(){Qr(B,{state:"proceeding",proceed:void 0,reset:void 0,location:A}),V.then(()=>t.history.go(T))},reset(){let ee=new Map(v.blockers);ee.set(B,qs),pe({blockers:ee})}}),O?.resolve(),O=null;return}return de(j,A)}),n){Cw(e,$);let j=()=>jw(e,$);e.addEventListener("pagehide",j),F=()=>e.removeEventListener("pagehide",j)}return v.initialized||de("POP",v.location,{initialHydration:!0}),N}function te(){f&&f(),F&&F(),p.clear(),M&&M.abort(),v.fetchers.forEach((j,A)=>Yr(A)),v.blockers.forEach((j,A)=>ia(A))}function Ae(j){return p.add(j),()=>p.delete(j)}function pe(j,A={}){j.matches&&(j.matches=j.matches.map(V=>{let ee=o[V.route.id],J=V.route;return J.element!==ee.element||J.errorElement!==ee.errorElement||J.hydrateFallbackElement!==ee.hydrateFallbackElement?{...V,route:ee}:V})),v={...v,...j};let T=[],B=[];v.fetchers.forEach((V,ee)=>{V.state==="idle"&&(be.has(ee)?T.push(ee):B.push(ee))}),be.forEach(V=>{!v.fetchers.has(V)&&!Z.has(V)&&T.push(V)}),[...p].forEach(V=>V(v,{deletedFetchers:T,newErrors:j.errors??null,viewTransitionOpts:A.viewTransitionOpts,flushSync:A.flushSync===!0})),T.forEach(V=>Yr(V)),B.forEach(V=>v.fetchers.delete(V))}function _e(j,A,{flushSync:T}={}){let B=v.actionData!=null&&v.navigation.formMethod!=null&&dt(v.navigation.formMethod)&&v.navigation.state==="loading"&&j.state?._isRedirect!==!0,V;A.actionData?Object.keys(A.actionData).length>0?V=A.actionData:V=null:B?V=v.actionData:V=null;let ee=A.loaderData?mf(v.loaderData,A.loaderData,A.matches||[],A.errors):v.loaderData,J=v.blockers;J.size>0&&(J=new Map(J),J.forEach((he,se)=>J.set(se,qs)));let ne=z?!1:gt(j,A.matches||v.matches),re=E===!0||v.navigation.formMethod!=null&&dt(v.navigation.formMethod)&&j.state?._isRedirect!==!0;l&&(a=l,l=void 0),z||P==="POP"||(P==="PUSH"?t.history.push(j,j.state):P==="REPLACE"&&t.history.replace(j,j.state));let ae;if(P==="POP"){let he=$.get(v.location.pathname);he&&he.has(j.pathname)?ae={currentLocation:v.location,nextLocation:j}:$.has(j.pathname)&&(ae={currentLocation:j,nextLocation:v.location})}else if(D){let he=$.get(v.location.pathname);he?he.add(j.pathname):(he=new Set([j.pathname]),$.set(v.location.pathname,he)),ae={currentLocation:v.location,nextLocation:j}}pe({...A,actionData:V,loaderData:ee,historyAction:P,location:j,initialized:!0,navigation:gc,revalidation:"idle",restoreScrollPosition:ne,preventScrollReset:re,blockers:J},{viewTransitionOpts:ae,flushSync:T===!0}),P="POP",E=!1,D=!1,z=!1,G=!1,O?.resolve(),O=null,U?.resolve(),U=null}async function I(j,A){if(O?.resolve(),O=null,typeof j=="number"){O||(O=yf());let je=O.promise;return t.history.go(j),je}let T=Pd(v.location,v.matches,d,j,A?.fromRouteId,A?.relative),{path:B,submission:V,error:ee}=of(!1,T,A),J=v.location,ne=Ci(v.location,B,A&&A.state);ne={...ne,...t.history.encodeLocation(ne)};let re=A&&A.replace!=null?A.replace:void 0,ae="PUSH";re===!0?ae="REPLACE":re===!1||V!=null&&dt(V.formMethod)&&V.formAction===v.location.pathname+v.location.search&&(ae="REPLACE");let he=A&&"preventScrollReset"in A?A.preventScrollReset===!0:void 0,se=(A&&A.flushSync)===!0,Ce=oa({currentLocation:J,nextLocation:ne,historyAction:ae});if(Ce){Qr(Ce,{state:"blocked",location:ne,proceed(){Qr(Ce,{state:"proceeding",proceed:void 0,reset:void 0,location:ne}),I(j,A)},reset(){let je=new Map(v.blockers);je.set(Ce,qs),pe({blockers:je})}});return}await de(ae,ne,{submission:V,pendingError:ee,preventScrollReset:he,replace:A&&A.replace,enableViewTransition:A&&A.viewTransition,flushSync:se,callSiteDefaultShouldRevalidate:A&&A.unstable_defaultShouldRevalidate})}function K(){U||(U=yf()),gn(),pe({revalidation:"loading"});let j=U.promise;return v.navigation.state==="submitting"?j:v.navigation.state==="idle"?(de(v.historyAction,v.location,{startUninterruptedRevalidation:!0}),j):(de(P||v.historyAction,v.navigation.location,{overrideNavigation:v.navigation,enableViewTransition:D===!0}),j)}async function de(j,A,T){M&&M.abort(),M=null,P=j,z=(T&&T.startUninterruptedRevalidation)===!0,bn(v.location,v.matches),E=(T&&T.preventScrollReset)===!0,D=(T&&T.enableViewTransition)===!0;let B=l||a,V=T&&T.overrideNavigation,ee=T?.initialHydration&&v.matches&&v.matches.length>0&&!C?v.matches:er(B,A,d),J=(T&&T.flushSync)===!0;if(ee&&v.initialized&&!G&&pw(v.location,A)&&!(T&&T.submission&&dt(T.submission.formMethod))){_e(A,{matches:ee},{flushSync:J});return}let ne=Xe(ee,B,A.pathname);if(ne.active&&ne.matches&&(ee=ne.matches),!ee){let{error:Ze,notFoundMatches:bt,route:Me}=We(A.pathname);_e(A,{matches:bt,loaderData:{},errors:{[Me.id]:Ze}},{flushSync:J});return}M=new AbortController;let re=ts(t.history,A,M.signal,T&&T.submission),ae=t.getContext?await t.getContext():new Zu,he;if(T&&T.pendingError)he=[tr(ee).route.id,{type:"error",error:T.pendingError}];else if(T&&T.submission&&dt(T.submission.formMethod)){let Ze=await Oe(re,A,T.submission,ee,ae,ne.active,T&&T.initialHydration===!0,{replace:T.replace,flushSync:J});if(Ze.shortCircuited)return;if(Ze.pendingActionResult){let[bt,Me]=Ze.pendingActionResult;if($t(Me)&&Ni(Me.error)&&Me.error.status===404){M=null,_e(A,{matches:Ze.matches,loaderData:{},errors:{[bt]:Me.error}});return}}ee=Ze.matches||ee,he=Ze.pendingActionResult,V=xc(A,T.submission),J=!1,ne.active=!1,re=ts(t.history,re.url,re.signal)}let{shortCircuited:se,matches:Ce,loaderData:je,errors:nt}=await Tt(re,A,ee,ae,ne.active,V,T&&T.submission,T&&T.fetcherSubmission,T&&T.replace,T&&T.initialHydration===!0,J,he,T&&T.callSiteDefaultShouldRevalidate);se||(M=null,_e(A,{matches:Ce||ee,...gf(he),loaderData:je,errors:nt}))}async function Oe(j,A,T,B,V,ee,J,ne={}){gn();let re=kw(A,T);if(pe({navigation:re},{flushSync:ne.flushSync===!0}),ee){let se=await xt(B,A.pathname,j.signal);if(se.type==="aborted")return{shortCircuited:!0};if(se.type==="error"){if(se.partialMatches.length===0){let{matches:je,route:nt}=da(a);return{matches:je,pendingActionResult:[nt.id,{type:"error",error:se.error}]}}let Ce=tr(se.partialMatches).route.id;return{matches:se.partialMatches,pendingActionResult:[Ce,{type:"error",error:se.error}]}}else if(se.matches)B=se.matches;else{let{notFoundMatches:Ce,error:je,route:nt}=We(A.pathname);return{matches:Ce,pendingActionResult:[nt.id,{type:"error",error:je}]}}}let ae,he=_a(B,A);if(!he.route.action&&!he.route.lazy)ae={type:"error",error:_t(405,{method:j.method,pathname:A.pathname,routeId:he.route.id})};else{let se=ds(i,o,j,B,he,J?[]:r,V),Ce=await vr(j,se,V,null);if(ae=Ce[he.route.id],!ae){for(let je of B)if(Ce[je.route.id]){ae=Ce[je.route.id];break}}if(j.signal.aborted)return{shortCircuited:!0}}if(Er(ae)){let se;return ne&&ne.replace!=null?se=ne.replace:se=uf(ae.response.headers.get("Location"),new URL(j.url),d)===v.location.pathname+v.location.search,await mn(j,ae,!0,{submission:T,replace:se}),{shortCircuited:!0}}if($t(ae)){let se=tr(B,he.route.id);return(ne&&ne.replace)!==!0&&(P="PUSH"),{matches:B,pendingActionResult:[se.route.id,ae,he.route.id]}}return{matches:B,pendingActionResult:[he.route.id,ae]}}async function Tt(j,A,T,B,V,ee,J,ne,re,ae,he,se,Ce){let je=ee||xc(A,J),nt=J||ne||bf(je),Ze=!z&&!ae;if(V){if(Ze){let ct=Kn(se);pe({navigation:je,...ct!==void 0?{actionData:ct}:{}},{flushSync:he})}let Se=await xt(T,A.pathname,j.signal);if(Se.type==="aborted")return{shortCircuited:!0};if(Se.type==="error"){if(Se.partialMatches.length===0){let{matches:Xr,route:Sr}=da(a);return{matches:Xr,loaderData:{},errors:{[Sr.id]:Se.error}}}let ct=tr(Se.partialMatches).route.id;return{matches:Se.partialMatches,loaderData:{},errors:{[ct]:Se.error}}}else if(Se.matches)T=Se.matches;else{let{error:ct,notFoundMatches:Xr,route:Sr}=We(A.pathname);return{matches:Xr,loaderData:{},errors:{[Sr.id]:ct}}}}let bt=l||a,{dsMatches:Me,revalidatingFetchers:Vt}=af(j,B,i,o,t.history,v,T,nt,A,ae?[]:r,ae===!0,G,le,be,oe,W,bt,d,t.patchRoutesOnNavigation!=null,se,Ce);if(ce=++Q,!t.dataStrategy&&!Me.some(Se=>Se.shouldLoad)&&!Me.some(Se=>Se.route.middleware&&Se.route.middleware.length>0)&&Vt.length===0){let Se=Us();return _e(A,{matches:T,loaderData:{},errors:se&&$t(se[1])?{[se[0]]:se[1].error}:null,...gf(se),...Se?{fetchers:new Map(v.fetchers)}:{}},{flushSync:he}),{shortCircuited:!0}}if(Ze){let Se={};if(!V){Se.navigation=je;let ct=Kn(se);ct!==void 0&&(Se.actionData=ct)}Vt.length>0&&(Se.fetchers=Ct(Vt)),pe(Se,{flushSync:he})}Vt.forEach(Se=>{sn(Se.key),Se.controller&&Z.set(Se.key,Se.controller)});let wr=()=>Vt.forEach(Se=>sn(Se.key));M&&M.signal.addEventListener("abort",wr);let{loaderResults:Ks,fetcherResults:Gn}=await na(Me,Vt,j,B);if(j.signal.aborted)return{shortCircuited:!0};M&&M.signal.removeEventListener("abort",wr),Vt.forEach(Se=>Z.delete(Se.key));let vn=ha(Ks);if(vn)return await mn(j,vn.result,!0,{replace:re}),{shortCircuited:!0};if(vn=ha(Gn),vn)return W.add(vn.key),await mn(j,vn.result,!0,{replace:re}),{shortCircuited:!0};let{loaderData:fc,errors:Gs}=pf(v,T,Ks,se,Vt,Gn);ae&&v.errors&&(Gs={...v.errors,...Gs});let kr=Us(),aa=ra(ce),la=kr||aa||Vt.length>0;return{matches:T,loaderData:fc,errors:Gs,...la?{fetchers:new Map(v.fetchers)}:{}}}function Kn(j){if(j&&!$t(j[1]))return{[j[0]]:j[1].data};if(v.actionData)return Object.keys(v.actionData).length===0?null:v.actionData}function Ct(j){return j.forEach(A=>{let T=v.fetchers.get(A.key),B=Ys(void 0,T?T.data:void 0);v.fetchers.set(A.key,B)}),new Map(v.fetchers)}async function Gr(j,A,T,B){sn(j);let V=(B&&B.flushSync)===!0,ee=l||a,J=Pd(v.location,v.matches,d,T,A,B?.relative),ne=er(ee,J,d),re=Xe(ne,ee,J);if(re.active&&re.matches&&(ne=re.matches),!ne){pt(j,A,_t(404,{pathname:J}),{flushSync:V});return}let{path:ae,submission:he,error:se}=of(!0,J,B);if(se){pt(j,A,se,{flushSync:V});return}let Ce=t.getContext?await t.getContext():new Zu,je=(B&&B.preventScrollReset)===!0;if(he&&dt(he.formMethod)){await qr(j,A,ae,ne,Ce,re.active,V,je,he,B&&B.unstable_defaultShouldRevalidate);return}oe.set(j,{routeId:A,path:ae}),await ta(j,A,ae,ne,Ce,re.active,V,je,he)}async function qr(j,A,T,B,V,ee,J,ne,re,ae){gn(),oe.delete(j);let he=v.fetchers.get(j);at(j,Sw(re,he),{flushSync:J});let se=new AbortController,Ce=ts(t.history,T,se.signal,re);if(ee){let Be=await xt(B,new URL(Ce.url).pathname,Ce.signal,j);if(Be.type==="aborted")return;if(Be.type==="error"){pt(j,A,Be.error,{flushSync:J});return}else if(Be.matches)B=Be.matches;else{pt(j,A,_t(404,{pathname:T}),{flushSync:J});return}}let je=_a(B,T);if(!je.route.action&&!je.route.lazy){let Be=_t(405,{method:re.formMethod,pathname:T,routeId:A});pt(j,A,Be,{flushSync:J});return}Z.set(j,se);let nt=Q,Ze=ds(i,o,Ce,B,je,r,V),bt=await vr(Ce,Ze,V,j),Me=bt[je.route.id];if(!Me){for(let Be of Ze)if(bt[Be.route.id]){Me=bt[Be.route.id];break}}if(Ce.signal.aborted){Z.get(j)===se&&Z.delete(j);return}if(be.has(j)){if(Er(Me)||$t(Me)){at(j,Fn(void 0));return}}else{if(Er(Me))if(Z.delete(j),ce>nt){at(j,Fn(void 0));return}else return W.add(j),at(j,Ys(re)),mn(Ce,Me,!1,{fetcherSubmission:re,preventScrollReset:ne});if($t(Me)){pt(j,A,Me.error);return}}let Vt=v.navigation.location||v.location,wr=ts(t.history,Vt,se.signal),Ks=l||a,Gn=v.navigation.state!=="idle"?er(Ks,v.navigation.location,d):v.matches;ge(Gn,"Didn't find any matches after fetcher action");let vn=++Q;fe.set(j,vn);let fc=Ys(re,Me.data);v.fetchers.set(j,fc);let{dsMatches:Gs,revalidatingFetchers:kr}=af(wr,V,i,o,t.history,v,Gn,re,Vt,r,!1,G,le,be,oe,W,Ks,d,t.patchRoutesOnNavigation!=null,[je.route.id,Me],ae);kr.filter(Be=>Be.key!==j).forEach(Be=>{let ca=Be.key,qu=v.fetchers.get(ca),iv=Ys(void 0,qu?qu.data:void 0);v.fetchers.set(ca,iv),sn(ca),Be.controller&&Z.set(ca,Be.controller)}),pe({fetchers:new Map(v.fetchers)});let aa=()=>kr.forEach(Be=>sn(Be.key));se.signal.addEventListener("abort",aa);let{loaderResults:la,fetcherResults:Se}=await na(Gs,kr,wr,V);if(se.signal.aborted)return;if(se.signal.removeEventListener("abort",aa),fe.delete(j),Z.delete(j),kr.forEach(Be=>Z.delete(Be.key)),v.fetchers.has(j)){let Be=Fn(Me.data);v.fetchers.set(j,Be)}let ct=ha(la);if(ct)return mn(wr,ct.result,!1,{preventScrollReset:ne});if(ct=ha(Se),ct)return W.add(ct.key),mn(wr,ct.result,!1,{preventScrollReset:ne});let{loaderData:Xr,errors:Sr}=pf(v,Gn,la,void 0,kr,Se);ra(vn),v.navigation.state==="loading"&&vn>ce?(ge(P,"Expected pending action"),M&&M.abort(),_e(v.navigation.location,{matches:Gn,loaderData:Xr,errors:Sr,fetchers:new Map(v.fetchers)})):(pe({errors:Sr,loaderData:mf(v.loaderData,Xr,Gn,Sr),fetchers:new Map(v.fetchers)}),G=!1)}async function ta(j,A,T,B,V,ee,J,ne,re){let ae=v.fetchers.get(j);at(j,Ys(re,ae?ae.data:void 0),{flushSync:J});let he=new AbortController,se=ts(t.history,T,he.signal);if(ee){let Me=await xt(B,new URL(se.url).pathname,se.signal,j);if(Me.type==="aborted")return;if(Me.type==="error"){pt(j,A,Me.error,{flushSync:J});return}else if(Me.matches)B=Me.matches;else{pt(j,A,_t(404,{pathname:T}),{flushSync:J});return}}let Ce=_a(B,T);Z.set(j,he);let je=Q,nt=ds(i,o,se,B,Ce,r,V),bt=(await vr(se,nt,V,j))[Ce.route.id];if(Z.get(j)===he&&Z.delete(j),!se.signal.aborted){if(be.has(j)){at(j,Fn(void 0));return}if(Er(bt))if(ce>je){at(j,Fn(void 0));return}else{W.add(j),await mn(se,bt,!1,{preventScrollReset:ne});return}if($t(bt)){pt(j,A,bt.error);return}at(j,Fn(bt.data))}}async function mn(j,A,T,{submission:B,fetcherSubmission:V,preventScrollReset:ee,replace:J}={}){T||(O?.resolve(),O=null),A.response.headers.has("X-Remix-Revalidate")&&(G=!0);let ne=A.response.headers.get("Location");ge(ne,"Expected a Location header on the redirect Response"),ne=uf(ne,new URL(j.url),d);let re=Ci(v.location,ne,{_isRedirect:!0});if(n){let nt=!1;if(A.response.headers.has("X-Remix-Reload-Document"))nt=!0;else if(zl(ne)){const Ze=r0(ne,!0);nt=Ze.origin!==e.location.origin||Xt(Ze.pathname,d)==null}if(nt){J?e.location.replace(ne):e.location.assign(ne);return}}M=null;let ae=J===!0||A.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:he,formAction:se,formEncType:Ce}=v.navigation;!B&&!V&&he&&se&&Ce&&(B=bf(v.navigation));let je=B||V;if(Xv.has(A.response.status)&&je&&dt(je.formMethod))await de(ae,re,{submission:{...je,formAction:ne},preventScrollReset:ee||E,enableViewTransition:T?D:void 0});else{let nt=xc(re,B);await de(ae,re,{overrideNavigation:nt,fetcherSubmission:V,preventScrollReset:ee||E,enableViewTransition:T?D:void 0})}}async function vr(j,A,T,B){let V,ee={};try{V=await lw(h,j,A,B,T,!1)}catch(J){return A.filter(ne=>ne.shouldLoad).forEach(ne=>{ee[ne.route.id]={type:"error",error:J}}),ee}if(j.signal.aborted)return ee;if(!dt(j.method))for(let J of A){if(V[J.route.id]?.type==="error")break;!V.hasOwnProperty(J.route.id)&&!v.loaderData.hasOwnProperty(J.route.id)&&(!v.errors||!v.errors.hasOwnProperty(J.route.id))&&J.shouldCallHandler()&&(V[J.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${J.route.id}`)})}for(let[J,ne]of Object.entries(V))if(bw(ne)){let re=ne.result;ee[J]={type:"redirect",response:uw(re,j,J,A,d)}}else ee[J]=await hw(ne);return ee}async function na(j,A,T,B){let V=vr(T,j,B,null),ee=Promise.all(A.map(async re=>{if(re.matches&&re.match&&re.request&&re.controller){let he=(await vr(re.request,re.matches,B,re.key))[re.match.route.id];return{[re.key]:he}}else return Promise.resolve({[re.key]:{type:"error",error:_t(404,{pathname:re.path})}})})),J=await V,ne=(await ee).reduce((re,ae)=>Object.assign(re,ae),{});return{loaderResults:J,fetcherResults:ne}}function gn(){G=!0,oe.forEach((j,A)=>{Z.has(A)&&le.add(A),sn(A)})}function at(j,A,T={}){v.fetchers.set(j,A),pe({fetchers:new Map(v.fetchers)},{flushSync:(T&&T.flushSync)===!0})}function pt(j,A,T,B={}){let V=tr(v.matches,A);Yr(j),pe({errors:{[V.route.id]:T},fetchers:new Map(v.fetchers)},{flushSync:(B&&B.flushSync)===!0})}function Ws(j){return ue.set(j,(ue.get(j)||0)+1),be.has(j)&&be.delete(j),v.fetchers.get(j)||Zv}function xn(j,A){sn(j,A?.reason),at(j,Fn(null))}function Yr(j){let A=v.fetchers.get(j);Z.has(j)&&!(A&&A.state==="loading"&&fe.has(j))&&sn(j),oe.delete(j),fe.delete(j),W.delete(j),be.delete(j),le.delete(j),v.fetchers.delete(j)}function uc(j){let A=(ue.get(j)||0)-1;A<=0?(ue.delete(j),be.add(j)):ue.set(j,A),pe({fetchers:new Map(v.fetchers)})}function sn(j,A){let T=Z.get(j);T&&(T.abort(A),Z.delete(j))}function Jr(j){for(let A of j){let T=Ws(A),B=Fn(T.data);v.fetchers.set(A,B)}}function Us(){let j=[],A=!1;for(let T of W){let B=v.fetchers.get(T);ge(B,`Expected fetcher: ${T}`),B.state==="loading"&&(W.delete(T),j.push(T),A=!0)}return Jr(j),A}function ra(j){let A=[];for(let[T,B]of fe)if(B<j){let V=v.fetchers.get(T);ge(V,`Expected fetcher: ${T}`),V.state==="loading"&&(sn(T),fe.delete(T),A.push(T))}return Jr(A),A.length>0}function sa(j,A){let T=v.blockers.get(j)||qs;return Pe.get(j)!==A&&Pe.set(j,A),T}function ia(j){v.blockers.delete(j),Pe.delete(j)}function Qr(j,A){let T=v.blockers.get(j)||qs;ge(T.state==="unblocked"&&A.state==="blocked"||T.state==="blocked"&&A.state==="blocked"||T.state==="blocked"&&A.state==="proceeding"||T.state==="blocked"&&A.state==="unblocked"||T.state==="proceeding"&&A.state==="unblocked",`Invalid blocker state transition: ${T.state} -> ${A.state}`);let B=new Map(v.blockers);B.set(j,A),pe({blockers:B})}function oa({currentLocation:j,nextLocation:A,historyAction:T}){if(Pe.size===0)return;Pe.size>1&&$e(!1,"A router only supports one blocker at a time");let B=Array.from(Pe.entries()),[V,ee]=B[B.length-1],J=v.blockers.get(V);if(!(J&&J.state==="proceeding")&&ee({currentLocation:j,nextLocation:A,historyAction:T}))return V}function We(j){let A=_t(404,{pathname:j}),T=l||a,{matches:B,route:V}=da(T);return{notFoundMatches:B,route:V,error:A}}function mt(j,A,T){if(g=j,b=A,x=T||null,!y&&v.navigation===gc){y=!0;let B=gt(v.location,v.matches);B!=null&&pe({restoreScrollPosition:B})}return()=>{g=null,b=null,x=null}}function lt(j,A){return x&&x(j,A.map(B=>jv(B,v.loaderData)))||j.key}function bn(j,A){if(g&&b){let T=lt(j,A);g[T]=b()}}function gt(j,A){if(g){let T=lt(j,A),B=g[T];if(typeof B=="number")return B}return null}function Xe(j,A,T){if(t.patchRoutesOnNavigation)if(j){if(Object.keys(j[0].params).length>0)return{active:!0,matches:ai(A,T,d,!0)}}else return{active:!0,matches:ai(A,T,d,!0)||[]};return{active:!1,matches:null}}async function xt(j,A,T,B){if(!t.patchRoutesOnNavigation)return{type:"success",matches:j};let V=j;for(;;){let ee=l==null,J=l||a,ne=o;try{await t.patchRoutesOnNavigation({signal:T,path:A,matches:V,fetcherKey:B,patch:(he,se)=>{T.aborted||lf(he,se,J,ne,i,!1)}})}catch(he){return{type:"error",error:he,partialMatches:V}}finally{ee&&!T.aborted&&(a=[...a])}if(T.aborted)return{type:"aborted"};let re=er(J,A,d),ae=null;if(re){if(Object.keys(re[0].params).length===0)return{type:"success",matches:re};if(ae=ai(J,A,d,!0),!(ae&&V.length<ae.length&&$n(V,ae.slice(0,V.length))))return{type:"success",matches:re}}if(ae||(ae=ai(J,A,d,!0)),!ae||$n(V,ae))return{type:"success",matches:null};V=ae}}function $n(j,A){return j.length===A.length&&j.every((T,B)=>T.route.id===A[B].route.id)}function Ke(j){o={},l=ji(j,i,void 0,o)}function yn(j,A,T=!1){let B=l==null;lf(j,A,l||a,o,i,T),B&&(a=[...a],pe({}))}return N={get basename(){return d},get future(){return u},get state(){return v},get routes(){return a},get window(){return e},initialize:ve,subscribe:Ae,enableScrollRestoration:mt,navigate:I,fetch:Gr,revalidate:K,createHref:j=>t.history.createHref(j),encodeLocation:j=>t.history.encodeLocation(j),getFetcher:Ws,resetFetcher:xn,deleteFetcher:uc,dispose:te,getBlocker:sa,deleteBlocker:ia,patchRoutes:yn,_internalFetchControllers:Z,_internalSetRoutes:Ke,_internalSetStateDoNotUseOrYouWillBreakYourApp(j){pe(j)}},t.unstable_instrumentations&&(N=Wv(N,t.unstable_instrumentations.map(j=>j.router).filter(Boolean))),N}function nw(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function Pd(t,e,n,r,s,i){let o,a;if(s){o=[];for(let d of e)if(o.push(d),d.route.id===s){a=d;break}}else o=e,a=e[e.length-1];let l=Hl(r||".",Vl(o),Xt(t.pathname,n)||t.pathname,i==="path");if(r==null&&(l.search=t.search,l.hash=t.hash),(r==null||r===""||r===".")&&a){let d=Rh(l.search);if(a.route.index&&!d)l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index";else if(!a.route.index&&d){let h=new URLSearchParams(l.search),u=h.getAll("index");h.delete("index"),u.filter(p=>p).forEach(p=>h.append("index",p));let f=h.toString();l.search=f?`?${f}`:""}}return n!=="/"&&(l.pathname=Bv({basename:n,pathname:l.pathname})),En(l)}function of(t,e,n){if(!n||!nw(n))return{path:e};if(n.formMethod&&!ww(n.formMethod))return{path:e,error:_t(405,{method:n.formMethod})};let r=()=>({path:e,error:_t(400,{type:"invalid-body"})}),i=(n.formMethod||"get").toUpperCase(),o=v0(e);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!dt(i))return r();let u=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((f,[p,g])=>`${f}${p}=${g}
|
|
20
|
+
`,""):String(n.body);return{path:e,submission:{formMethod:i,formAction:o,formEncType:n.formEncType,formData:void 0,json:void 0,text:u}}}else if(n.formEncType==="application/json"){if(!dt(i))return r();try{let u=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:e,submission:{formMethod:i,formAction:o,formEncType:n.formEncType,formData:void 0,json:u,text:void 0}}}catch{return r()}}}ge(typeof FormData=="function","FormData is not available in this environment");let a,l;if(n.formData)a=Ad(n.formData),l=n.formData;else if(n.body instanceof FormData)a=Ad(n.body),l=n.body;else if(n.body instanceof URLSearchParams)a=n.body,l=ff(a);else if(n.body==null)a=new URLSearchParams,l=new FormData;else try{a=new URLSearchParams(n.body),l=ff(a)}catch{return r()}let d={formMethod:i,formAction:o,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:l,json:void 0,text:void 0};if(dt(d.formMethod))return{path:e,submission:d};let h=gr(e);return t&&h.search&&Rh(h.search)&&a.append("index",""),h.search=`?${a}`,{path:En(h),submission:d}}function af(t,e,n,r,s,i,o,a,l,d,h,u,f,p,g,x,b,y,w,C,S){let k=C?$t(C[1])?C[1].error:C[1].data:void 0,N=s.createURL(i.location),v=s.createURL(l),P;if(h&&i.errors){let z=Object.keys(i.errors)[0];P=o.findIndex(G=>G.route.id===z)}else if(C&&$t(C[1])){let z=C[0];P=o.findIndex(G=>G.route.id===z)-1}let O=C?C[1].statusCode:void 0,E=O&&O>=400,M={currentUrl:N,currentParams:i.matches[0]?.params||{},nextUrl:v,nextParams:o[0].params,...a,actionResult:k,actionStatus:O},D=Lo(o),$=o.map((z,G)=>{let{route:le}=z,Z=null;if(P!=null&&G>P?Z=!1:le.lazy?Z=!0:Eh(le)?h?Z=Od(le,i.loaderData,i.errors):rw(i.loaderData,i.matches[G],z)&&(Z=!0):Z=!1,Z!==null)return Md(n,r,t,D,z,d,e,Z);let Q=!1;typeof S=="boolean"?Q=S:E?Q=!1:(u||N.pathname+N.search===v.pathname+v.search||N.search!==v.search||sw(i.matches[G],z))&&(Q=!0);let ce={...M,defaultShouldRevalidate:Q},fe=ui(z,ce);return Md(n,r,t,D,z,d,e,fe,ce,S)}),F=[];return g.forEach((z,G)=>{if(h||!o.some(ue=>ue.route.id===z.routeId)||p.has(G))return;let le=i.fetchers.get(G),Z=le&&le.state!=="idle"&&le.data===void 0,Q=er(b,z.path,y);if(!Q){if(w&&Z)return;F.push({key:G,routeId:z.routeId,path:z.path,matches:null,match:null,request:null,controller:null});return}if(x.has(G))return;let ce=_a(Q,z.path),fe=new AbortController,W=ts(s,z.path,fe.signal),oe=null;if(f.has(G))f.delete(G),oe=ds(n,r,W,Q,ce,d,e);else if(Z)u&&(oe=ds(n,r,W,Q,ce,d,e));else{let ue;typeof S=="boolean"?ue=S:E?ue=!1:ue=u;let be={...M,defaultShouldRevalidate:ue};ui(ce,be)&&(oe=ds(n,r,W,Q,ce,d,e,be))}oe&&F.push({key:G,routeId:z.routeId,path:z.path,matches:oe,match:ce,request:W,controller:fe})}),{dsMatches:$,revalidatingFetchers:F}}function Eh(t){return t.loader!=null||t.middleware!=null&&t.middleware.length>0}function Od(t,e,n){if(t.lazy)return!0;if(!Eh(t))return!1;let r=e!=null&&t.id in e,s=n!=null&&n[t.id]!==void 0;return!r&&s?!1:typeof t.loader=="function"&&t.loader.hydrate===!0?!0:!r&&!s}function rw(t,e,n){let r=!e||n.route.id!==e.route.id,s=!t.hasOwnProperty(n.route.id);return r||s}function sw(t,e){let n=t.route.path;return t.pathname!==e.pathname||n!=null&&n.endsWith("*")&&t.params["*"]!==e.params["*"]}function ui(t,e){if(t.route.shouldRevalidate){let n=t.route.shouldRevalidate(e);if(typeof n=="boolean")return n}return e.defaultShouldRevalidate}function lf(t,e,n,r,s,i){let o;if(t){let d=r[t];ge(d,`No route found to patch children into: routeId = ${t}`),d.children||(d.children=[]),o=d.children}else o=n;let a=[],l=[];if(e.forEach(d=>{let h=o.find(u=>m0(d,u));h?l.push({existingRoute:h,newRoute:d}):a.push(d)}),a.length>0){let d=ji(a,s,[t||"_","patch",String(o?.length||"0")],r);o.push(...d)}if(i&&l.length>0)for(let d=0;d<l.length;d++){let{existingRoute:h,newRoute:u}=l[d],f=h,[p]=ji([u],s,[],{},!0);Object.assign(f,{element:p.element?p.element:f.element,errorElement:p.errorElement?p.errorElement:f.errorElement,hydrateFallbackElement:p.hydrateFallbackElement?p.hydrateFallbackElement:f.hydrateFallbackElement})}}function m0(t,e){return"id"in t&&"id"in e&&t.id===e.id?!0:t.index===e.index&&t.path===e.path&&t.caseSensitive===e.caseSensitive?(!t.children||t.children.length===0)&&(!e.children||e.children.length===0)?!0:t.children.every((n,r)=>e.children?.some(s=>m0(n,s))):!1}var cf=new WeakMap,g0=({key:t,route:e,manifest:n,mapRouteProperties:r})=>{let s=n[e.id];if(ge(s,"No route found in manifest"),!s.lazy||typeof s.lazy!="object")return;let i=s.lazy[t];if(!i)return;let o=cf.get(s);o||(o={},cf.set(s,o));let a=o[t];if(a)return a;let l=(async()=>{let d=wv(t),u=s[t]!==void 0&&t!=="hasErrorBoundary";if(d)$e(!d,"Route property "+t+" is not a supported lazy route property. This property will be ignored."),o[t]=Promise.resolve();else if(u)$e(!1,`Route "${s.id}" has a static property "${t}" defined. The lazy property will be ignored.`);else{let f=await i();f!=null&&(Object.assign(s,{[t]:f}),Object.assign(s,r(s)))}typeof s.lazy=="object"&&(s.lazy[t]=void 0,Object.values(s.lazy).every(f=>f===void 0)&&(s.lazy=void 0))})();return o[t]=l,l},df=new WeakMap;function iw(t,e,n,r,s){let i=n[t.id];if(ge(i,"No route found in manifest"),!t.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof t.lazy=="function"){let h=df.get(i);if(h)return{lazyRoutePromise:h,lazyHandlerPromise:h};let u=(async()=>{ge(typeof t.lazy=="function","No lazy route function found");let f=await t.lazy(),p={};for(let g in f){let x=f[g];if(x===void 0)continue;let b=Sv(g),w=i[g]!==void 0&&g!=="hasErrorBoundary";b?$e(!b,"Route property "+g+" is not a supported property to be returned from a lazy route function. This property will be ignored."):w?$e(!w,`Route "${i.id}" has a static property "${g}" defined but its lazy function is also returning a value for this property. The lazy route property "${g}" will be ignored.`):p[g]=x}Object.assign(i,p),Object.assign(i,{...r(i),lazy:void 0})})();return df.set(i,u),u.catch(()=>{}),{lazyRoutePromise:u,lazyHandlerPromise:u}}let o=Object.keys(t.lazy),a=[],l;for(let h of o){if(s&&s.includes(h))continue;let u=g0({key:h,route:t,manifest:n,mapRouteProperties:r});u&&(a.push(u),h===e&&(l=u))}let d=a.length>0?Promise.all(a).then(()=>{}):void 0;return d?.catch(()=>{}),l?.catch(()=>{}),{lazyRoutePromise:d,lazyHandlerPromise:l}}async function hf(t){let e=t.matches.filter(s=>s.shouldLoad),n={};return(await Promise.all(e.map(s=>s.resolve()))).forEach((s,i)=>{n[e[i].route.id]=s}),n}async function ow(t){return t.matches.some(e=>e.route.middleware)?x0(t,()=>hf(t)):hf(t)}function x0(t,e){return aw(t,e,r=>{if(vw(r))throw r;return r},gw,n);function n(r,s,i){if(i)return Promise.resolve(Object.assign(i.value,{[s]:{type:"error",result:r}}));{let{matches:o}=t,a=Math.min(Math.max(o.findIndex(d=>d.route.id===s),0),Math.max(o.findIndex(d=>d.shouldCallHandler()),0)),l=tr(o,o[a].route.id).route.id;return Promise.resolve({[l]:{type:"error",result:r}})}}}async function aw(t,e,n,r,s){let{matches:i,request:o,params:a,context:l,unstable_pattern:d}=t,h=i.flatMap(f=>f.route.middleware?f.route.middleware.map(p=>[f.route.id,p]):[]);return await b0({request:o,params:a,context:l,unstable_pattern:d},h,e,n,r,s)}async function b0(t,e,n,r,s,i,o=0){let{request:a}=t;if(a.signal.aborted)throw a.signal.reason??new Error(`Request aborted: ${a.method} ${a.url}`);let l=e[o];if(!l)return await n();let[d,h]=l,u,f=async()=>{if(u)throw new Error("You may only call `next()` once per middleware");try{return u={value:await b0(t,e,n,r,s,i,o+1)},u.value}catch(p){return u={value:await i(p,d,u)},u.value}};try{let p=await h(t,f),g=p!=null?r(p):void 0;return s(g)?g:u?g??u.value:(u={value:await f()},u.value)}catch(p){return await i(p,d,u)}}function y0(t,e,n,r,s){let i=g0({key:"middleware",route:r.route,manifest:e,mapRouteProperties:t}),o=iw(r.route,dt(n.method)?"action":"loader",e,t,s);return{middleware:i,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function Md(t,e,n,r,s,i,o,a,l=null,d){let h=!1,u=y0(t,e,n,s,i);return{...s,_lazyPromises:u,shouldLoad:a,shouldRevalidateArgs:l,shouldCallHandler(f){return h=!0,l?typeof d=="boolean"?ui(s,{...l,defaultShouldRevalidate:d}):typeof f=="boolean"?ui(s,{...l,defaultShouldRevalidate:f}):ui(s,l):a},resolve(f){let{lazy:p,loader:g,middleware:x}=s.route,b=h||a||f&&!dt(n.method)&&(p||g),y=x&&x.length>0&&!g&&!p;return b&&(dt(n.method)||!y)?cw({request:n,unstable_pattern:r,match:s,lazyHandlerPromise:u?.handler,lazyRoutePromise:u?.route,handlerOverride:f,scopedContext:o}):Promise.resolve({type:"data",result:void 0})}}}function ds(t,e,n,r,s,i,o,a=null){return r.map(l=>l.route.id!==s.route.id?{...l,shouldLoad:!1,shouldRevalidateArgs:a,shouldCallHandler:()=>!1,_lazyPromises:y0(t,e,n,l,i),resolve:()=>Promise.resolve({type:"data",result:void 0})}:Md(t,e,n,Lo(r),l,i,o,!0,a))}async function lw(t,e,n,r,s,i){n.some(d=>d._lazyPromises?.middleware)&&await Promise.all(n.map(d=>d._lazyPromises?.middleware));let o={request:e,unstable_pattern:Lo(n),params:n[0].params,context:s,matches:n},l=await t({...o,fetcherKey:r,runClientMiddleware:d=>{let h=o;return x0(h,()=>d({...h,fetcherKey:r,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(n.flatMap(d=>[d._lazyPromises?.handler,d._lazyPromises?.route]))}catch{}return l}async function cw({request:t,unstable_pattern:e,match:n,lazyHandlerPromise:r,lazyRoutePromise:s,handlerOverride:i,scopedContext:o}){let a,l,d=dt(t.method),h=d?"action":"loader",u=f=>{let p,g=new Promise((y,w)=>p=w);l=()=>p(),t.signal.addEventListener("abort",l);let x=y=>typeof f!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${h}" [routeId: ${n.route.id}]`)):f({request:t,unstable_pattern:e,params:n.params,context:o},...y!==void 0?[y]:[]),b=(async()=>{try{return{type:"data",result:await(i?i(w=>x(w)):x())}}catch(y){return{type:"error",result:y}}})();return Promise.race([b,g])};try{let f=d?n.route.action:n.route.loader;if(r||s)if(f){let p,[g]=await Promise.all([u(f).catch(x=>{p=x}),r,s]);if(p!==void 0)throw p;a=g}else{await r;let p=d?n.route.action:n.route.loader;if(p)[a]=await Promise.all([u(p),s]);else if(h==="action"){let g=new URL(t.url),x=g.pathname+g.search;throw _t(405,{method:t.method,pathname:x,routeId:n.route.id})}else return{type:"data",result:void 0}}else if(f)a=await u(f);else{let p=new URL(t.url),g=p.pathname+p.search;throw _t(404,{pathname:g})}}catch(f){return{type:"error",result:f}}finally{l&&t.signal.removeEventListener("abort",l)}return a}async function dw(t){let e=t.headers.get("Content-Type");return e&&/\bapplication\/json\b/.test(e)?t.body==null?null:t.json():t.text()}async function hw(t){let{result:e,type:n}=t;if(Lh(e)){let r;try{r=await dw(e)}catch(s){return{type:"error",error:s}}return n==="error"?{type:"error",error:new Eo(e.status,e.statusText,r),statusCode:e.status,headers:e.headers}:{type:"data",data:r,statusCode:e.status,headers:e.headers}}return n==="error"?xf(e)?e.data instanceof Error?{type:"error",error:e.data,statusCode:e.init?.status,headers:e.init?.headers?new Headers(e.init.headers):void 0}:{type:"error",error:mw(e),statusCode:Ni(e)?e.status:void 0,headers:e.init?.headers?new Headers(e.init.headers):void 0}:{type:"error",error:e,statusCode:Ni(e)?e.status:void 0}:xf(e)?{type:"data",data:e.data,statusCode:e.init?.status,headers:e.init?.headers?new Headers(e.init.headers):void 0}:{type:"data",data:e}}function uw(t,e,n,r,s){let i=t.headers.get("Location");if(ge(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!zl(i)){let o=r.slice(0,r.findIndex(a=>a.route.id===n)+1);i=Pd(new URL(e.url),o,s,i),t.headers.set("Location",i)}return t}function uf(t,e,n){if(zl(t)){let r=t,s=r.startsWith("//")?new URL(e.protocol+r):new URL(r),i=Xt(s.pathname,n)!=null;if(s.origin===e.origin&&i)return s.pathname+s.search+s.hash}return t}function ts(t,e,n,r){let s=t.createURL(v0(e)).toString(),i={signal:n};if(r&&dt(r.formMethod)){let{formMethod:o,formEncType:a}=r;i.method=o.toUpperCase(),a==="application/json"?(i.headers=new Headers({"Content-Type":a}),i.body=JSON.stringify(r.json)):a==="text/plain"?i.body=r.text:a==="application/x-www-form-urlencoded"&&r.formData?i.body=Ad(r.formData):i.body=r.formData}return new Request(s,i)}function Ad(t){let e=new URLSearchParams;for(let[n,r]of t.entries())e.append(n,typeof r=="string"?r:r.name);return e}function ff(t){let e=new FormData;for(let[n,r]of t.entries())e.append(n,r);return e}function fw(t,e,n,r=!1,s=!1){let i={},o=null,a,l=!1,d={},h=n&&$t(n[1])?n[1].error:void 0;return t.forEach(u=>{if(!(u.route.id in e))return;let f=u.route.id,p=e[f];if(ge(!Er(p),"Cannot handle redirect results in processLoaderData"),$t(p)){let g=p.error;if(h!==void 0&&(g=h,h=void 0),o=o||{},s)o[f]=g;else{let x=tr(t,f);o[x.route.id]==null&&(o[x.route.id]=g)}r||(i[f]=p0),l||(l=!0,a=Ni(p.error)?p.error.status:500),p.headers&&(d[f]=p.headers)}else i[f]=p.data,p.statusCode&&p.statusCode!==200&&!l&&(a=p.statusCode),p.headers&&(d[f]=p.headers)}),h!==void 0&&n&&(o={[n[0]]:h},n[2]&&(i[n[2]]=void 0)),{loaderData:i,errors:o,statusCode:a||200,loaderHeaders:d}}function pf(t,e,n,r,s,i){let{loaderData:o,errors:a}=fw(e,n,r);return s.filter(l=>!l.matches||l.matches.some(d=>d.shouldLoad)).forEach(l=>{let{key:d,match:h,controller:u}=l;if(u&&u.signal.aborted)return;let f=i[d];if(ge(f,"Did not find corresponding fetcher result"),$t(f)){let p=tr(t.matches,h?.route.id);a&&a[p.route.id]||(a={...a,[p.route.id]:f.error}),t.fetchers.delete(d)}else if(Er(f))ge(!1,"Unhandled fetcher revalidation redirect");else{let p=Fn(f.data);t.fetchers.set(d,p)}}),{loaderData:o,errors:a}}function mf(t,e,n,r){let s=Object.entries(e).filter(([,i])=>i!==p0).reduce((i,[o,a])=>(i[o]=a,i),{});for(let i of n){let o=i.route.id;if(!e.hasOwnProperty(o)&&t.hasOwnProperty(o)&&i.route.loader&&(s[o]=t[o]),r&&r.hasOwnProperty(o))break}return s}function gf(t){return t?$t(t[1])?{actionData:{}}:{actionData:{[t[0]]:t[1].data}}:{}}function tr(t,e){return(e?t.slice(0,t.findIndex(r=>r.route.id===e)+1):[...t]).reverse().find(r=>r.route.hasErrorBoundary===!0)||t[0]}function da(t){let e=t.length===1?t[0]:t.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:e}],route:e}}function _t(t,{pathname:e,routeId:n,method:r,type:s,message:i}={}){let o="Unknown Server Error",a="Unknown @remix-run/router error";return t===400?(o="Bad Request",r&&e&&n?a=`You made a ${r} request to "${e}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:s==="invalid-body"&&(a="Unable to encode submission body")):t===403?(o="Forbidden",a=`Route "${n}" does not match URL "${e}"`):t===404?(o="Not Found",a=`No route matches URL "${e}"`):t===405&&(o="Method Not Allowed",r&&e&&n?a=`You made a ${r.toUpperCase()} request to "${e}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(a=`Invalid request method "${r.toUpperCase()}"`)),new Eo(t||500,o,new Error(a),!0)}function ha(t){let e=Object.entries(t);for(let n=e.length-1;n>=0;n--){let[r,s]=e[n];if(Er(s))return{key:r,result:s}}}function v0(t){let e=typeof t=="string"?gr(t):t;return En({...e,hash:""})}function pw(t,e){return t.pathname!==e.pathname||t.search!==e.search?!1:t.hash===""?e.hash!=="":t.hash===e.hash?!0:e.hash!==""}function mw(t){return new Eo(t.init?.status??500,t.init?.statusText??"Internal Server Error",t.data)}function gw(t){return t!=null&&typeof t=="object"&&Object.entries(t).every(([e,n])=>typeof e=="string"&&xw(n))}function xw(t){return t!=null&&typeof t=="object"&&"type"in t&&"result"in t&&(t.type==="data"||t.type==="error")}function bw(t){return Lh(t.result)&&u0.has(t.result.status)}function $t(t){return t.type==="error"}function Er(t){return(t&&t.type)==="redirect"}function xf(t){return typeof t=="object"&&t!=null&&"type"in t&&"data"in t&&"init"in t&&t.type==="DataWithResponseInit"}function Lh(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.headers=="object"&&typeof t.body<"u"}function yw(t){return u0.has(t)}function vw(t){return Lh(t)&&yw(t.status)&&t.headers.has("Location")}function ww(t){return Qv.has(t.toUpperCase())}function dt(t){return Yv.has(t.toUpperCase())}function Rh(t){return new URLSearchParams(t).getAll("index").some(e=>e==="")}function _a(t,e){let n=typeof e=="string"?gr(e).search:e.search;if(t[t.length-1].route.index&&Rh(n||""))return t[t.length-1];let r=a0(t);return r[r.length-1]}function bf(t){let{formMethod:e,formAction:n,formEncType:r,text:s,formData:i,json:o}=t;if(!(!e||!n||!r)){if(s!=null)return{formMethod:e,formAction:n,formEncType:r,formData:void 0,json:void 0,text:s};if(i!=null)return{formMethod:e,formAction:n,formEncType:r,formData:i,json:void 0,text:void 0};if(o!==void 0)return{formMethod:e,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function xc(t,e){return e?{state:"loading",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}:{state:"loading",location:t,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function kw(t,e){return{state:"submitting",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}}function Ys(t,e){return t?{state:"loading",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Sw(t,e){return{state:"submitting",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e?e.data:void 0}}function Fn(t){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Cw(t,e){try{let n=t.sessionStorage.getItem(f0);if(n){let r=JSON.parse(n);for(let[s,i]of Object.entries(r||{}))i&&Array.isArray(i)&&e.set(s,new Set(i||[]))}}catch{}}function jw(t,e){if(e.size>0){let n={};for(let[r,s]of e)n[r]=[...s];try{t.sessionStorage.setItem(f0,JSON.stringify(n))}catch(r){$e(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function yf(){let t,e,n=new Promise((r,s)=>{t=async i=>{r(i);try{await n}catch{}},e=async i=>{s(i);try{await n}catch{}}});return{promise:n,resolve:t,reject:e}}var _r=m.createContext(null);_r.displayName="DataRouter";var Ro=m.createContext(null);Ro.displayName="DataRouterState";var w0=m.createContext(!1);function Nw(){return m.useContext(w0)}var Ih=m.createContext({isTransitioning:!1});Ih.displayName="ViewTransition";var k0=m.createContext(new Map);k0.displayName="Fetchers";var Pw=m.createContext(null);Pw.displayName="Await";var Ft=m.createContext(null);Ft.displayName="Navigation";var _l=m.createContext(null);_l.displayName="Location";var en=m.createContext({outlet:null,matches:[],isDataRoute:!1});en.displayName="Route";var $h=m.createContext(null);$h.displayName="RouteError";var S0="REACT_ROUTER_ERROR",Ow="REDIRECT",Mw="ROUTE_ERROR_RESPONSE";function Aw(t){if(t.startsWith(`${S0}:${Ow}:{`))try{let e=JSON.parse(t.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function Dw(t){if(t.startsWith(`${S0}:${Mw}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new Eo(e.status,e.statusText,e.data)}catch{}}function Tw(t,{relative:e}={}){ge(Os(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=m.useContext(Ft),{hash:s,pathname:i,search:o}=Io(t,{relative:e}),a=i;return n!=="/"&&(a=i==="/"?n:Dn([n,i])),r.createHref({pathname:a,search:o,hash:s})}function Os(){return m.useContext(_l)!=null}function un(){return ge(Os(),"useLocation() may be used only in the context of a <Router> component."),m.useContext(_l).location}var C0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function j0(t){m.useContext(Ft).static||m.useLayoutEffect(t)}function tn(){let{isDataRoute:t}=m.useContext(en);return t?Gw():Ew()}function Ew(){ge(Os(),"useNavigate() may be used only in the context of a <Router> component.");let t=m.useContext(_r),{basename:e,navigator:n}=m.useContext(Ft),{matches:r}=m.useContext(en),{pathname:s}=un(),i=JSON.stringify(Vl(r)),o=m.useRef(!1);return j0(()=>{o.current=!0}),m.useCallback((l,d={})=>{if($e(o.current,C0),!o.current)return;if(typeof l=="number"){n.go(l);return}let h=Hl(l,JSON.parse(i),s,d.relative==="path");t==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:Dn([e,h.pathname])),(d.replace?n.replace:n.push)(h,d.state,d)},[e,n,i,s,t])}var N0=m.createContext(null);function Lw(){return m.useContext(N0)}function Rw(t){let e=m.useContext(en).outlet;return m.useMemo(()=>e&&m.createElement(N0.Provider,{value:t},e),[e,t])}function Bh(){let{matches:t}=m.useContext(en),e=t[t.length-1];return e?e.params:{}}function Io(t,{relative:e}={}){let{matches:n}=m.useContext(en),{pathname:r}=un(),s=JSON.stringify(Vl(n));return m.useMemo(()=>Hl(t,JSON.parse(s),r,e==="path"),[t,s,r,e])}function Iw(t,e,n,r,s){ge(Os(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=m.useContext(Ft),{matches:o}=m.useContext(en),a=o[o.length-1],l=a?a.params:{},d=a?a.pathname:"/",h=a?a.pathnameBase:"/",u=a&&a.route;{let w=u&&u.path||"";O0(d,!u||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${w}">) 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.
|
|
21
|
+
|
|
22
|
+
Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let f=un(),p;p=f;let g=p.pathname||"/",x=g;if(h!=="/"){let w=h.replace(/^\//,"").split("/");x="/"+g.replace(/^\//,"").split("/").slice(w.length).join("/")}let b=er(t,{pathname:x});return $e(u||b!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),$e(b==null||b[b.length-1].route.element!==void 0||b[b.length-1].route.Component!==void 0||b[b.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.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.`),Vw(b&&b.map(w=>Object.assign({},w,{params:Object.assign({},l,w.params),pathname:Dn([h,i.encodeLocation?i.encodeLocation(w.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?h:Dn([h,i.encodeLocation?i.encodeLocation(w.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),o,n,r,s)}function $w(){let t=Kw(),e=Ni(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",t),o=m.createElement(m.Fragment,null,m.createElement("p",null,"💿 Hey developer 👋"),m.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",m.createElement("code",{style:i},"ErrorBoundary")," or"," ",m.createElement("code",{style:i},"errorElement")," prop on your route.")),m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},e),n?m.createElement("pre",{style:s},n):null,o)}var Bw=m.createElement($w,null),P0=class extends m.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.onError?this.props.onError(t,e):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const n=Dw(t.digest);n&&(t=n)}let e=t!==void 0?m.createElement(en.Provider,{value:this.props.routeContext},m.createElement($h.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?m.createElement(Fw,{error:t},e):e}};P0.contextType=w0;var bc=new WeakMap;function Fw({children:t,error:e}){let{basename:n}=m.useContext(Ft);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=Aw(e.digest);if(r){let s=bc.get(e);if(s)throw s;let i=c0(r.location,n);if(l0&&!bc.get(e))if(i.isExternal||r.reloadDocument)window.location.href=i.absoluteURL||i.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:r.replace}));throw bc.set(e,o),o}return m.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return t}function zw({routeContext:t,match:e,children:n}){let r=m.useContext(_r);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),m.createElement(en.Provider,{value:t},n)}function Vw(t,e=[],n=null,r=null,s=null){if(t==null){if(!n)return null;if(n.errors)t=n.matches;else if(e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let i=t,o=n?.errors;if(o!=null){let h=i.findIndex(u=>u.route.id&&o?.[u.route.id]!==void 0);ge(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),i=i.slice(0,Math.min(i.length,h+1))}let a=!1,l=-1;if(n)for(let h=0;h<i.length;h++){let u=i[h];if((u.route.HydrateFallback||u.route.hydrateFallbackElement)&&(l=h),u.route.id){let{loaderData:f,errors:p}=n,g=u.route.loader&&!f.hasOwnProperty(u.route.id)&&(!p||p[u.route.id]===void 0);if(u.route.lazy||g){a=!0,l>=0?i=i.slice(0,l+1):i=[i[0]];break}}}let d=n&&r?(h,u)=>{r(h,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:Lo(n.matches),errorInfo:u})}:void 0;return i.reduceRight((h,u,f)=>{let p,g=!1,x=null,b=null;n&&(p=o&&u.route.id?o[u.route.id]:void 0,x=u.route.errorElement||Bw,a&&(l<0&&f===0?(O0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),g=!0,b=null):l===f&&(g=!0,b=u.route.hydrateFallbackElement||null)));let y=e.concat(i.slice(0,f+1)),w=()=>{let C;return p?C=x:g?C=b:u.route.Component?C=m.createElement(u.route.Component,null):u.route.element?C=u.route.element:C=h,m.createElement(zw,{match:u,routeContext:{outlet:h,matches:y,isDataRoute:n!=null},children:C})};return n&&(u.route.ErrorBoundary||u.route.errorElement||f===0)?m.createElement(P0,{location:n.location,revalidation:n.revalidation,component:x,error:p,children:w(),routeContext:{outlet:null,matches:y,isDataRoute:!0},onError:d}):w()},null)}function Fh(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Hw(t){let e=m.useContext(_r);return ge(e,Fh(t)),e}function _w(t){let e=m.useContext(Ro);return ge(e,Fh(t)),e}function Ww(t){let e=m.useContext(en);return ge(e,Fh(t)),e}function zh(t){let e=Ww(t),n=e.matches[e.matches.length-1];return ge(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function Uw(){return zh("useRouteId")}function Kw(){let t=m.useContext($h),e=_w("useRouteError"),n=zh("useRouteError");return t!==void 0?t:e.errors?.[n]}function Gw(){let{router:t}=Hw("useNavigate"),e=zh("useNavigate"),n=m.useRef(!1);return j0(()=>{n.current=!0}),m.useCallback(async(s,i={})=>{$e(n.current,C0),n.current&&(typeof s=="number"?await t.navigate(s):await t.navigate(s,{fromRouteId:e,...i}))},[t,e])}var vf={};function O0(t,e,n){!e&&!vf[t]&&(vf[t]=!0,$e(!1,n))}var wf={};function kf(t,e){!t&&!wf[e]&&(wf[e]=!0,console.warn(e))}var qw="useOptimistic",Sf=lv[qw],Yw=()=>{};function Jw(t){return Sf?Sf(t):[t,Yw]}function Qw(t){let e={hasErrorBoundary:t.hasErrorBoundary||t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&(t.element&&$e(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(e,{element:m.createElement(t.Component),Component:void 0})),t.HydrateFallback&&(t.hydrateFallbackElement&&$e(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(e,{hydrateFallbackElement:m.createElement(t.HydrateFallback),HydrateFallback:void 0})),t.ErrorBoundary&&(t.errorElement&&$e(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(e,{errorElement:m.createElement(t.ErrorBoundary),ErrorBoundary:void 0})),e}var Xw=["HydrateFallback","hydrateFallbackElement"],Zw=class{constructor(){this.status="pending",this.promise=new Promise((t,e)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",t(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",e(n))}})}};function e2({router:t,flushSync:e,onError:n,unstable_useTransitions:r}){r=Nw()||r;let[i,o]=m.useState(t.state),[a,l]=Jw(i),[d,h]=m.useState(),[u,f]=m.useState({isTransitioning:!1}),[p,g]=m.useState(),[x,b]=m.useState(),[y,w]=m.useState(),C=m.useRef(new Map),S=m.useCallback((P,{deletedFetchers:O,newErrors:E,flushSync:M,viewTransitionOpts:D})=>{E&&n&&Object.values(E).forEach(F=>n(F,{location:P.location,params:P.matches[0]?.params??{},unstable_pattern:Lo(P.matches)})),P.fetchers.forEach((F,z)=>{F.data!==void 0&&C.current.set(z,F.data)}),O.forEach(F=>C.current.delete(F)),kf(M===!1||e!=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 $=t.window!=null&&t.window.document!=null&&typeof t.window.document.startViewTransition=="function";if(kf(D==null||$,"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."),!D||!$){e&&M?e(()=>o(P)):r===!1?o(P):m.startTransition(()=>{r===!0&&l(F=>Cf(F,P)),o(P)});return}if(e&&M){e(()=>{x&&(p?.resolve(),x.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:D.currentLocation,nextLocation:D.nextLocation})});let F=t.window.document.startViewTransition(()=>{e(()=>o(P))});F.finished.finally(()=>{e(()=>{g(void 0),b(void 0),h(void 0),f({isTransitioning:!1})})}),e(()=>b(F));return}x?(p?.resolve(),x.skipTransition(),w({state:P,currentLocation:D.currentLocation,nextLocation:D.nextLocation})):(h(P),f({isTransitioning:!0,flushSync:!1,currentLocation:D.currentLocation,nextLocation:D.nextLocation}))},[t.window,e,x,p,r,l,n]);m.useLayoutEffect(()=>t.subscribe(S),[t,S]),m.useEffect(()=>{u.isTransitioning&&!u.flushSync&&g(new Zw)},[u]),m.useEffect(()=>{if(p&&d&&t.window){let P=d,O=p.promise,E=t.window.document.startViewTransition(async()=>{r===!1?o(P):m.startTransition(()=>{r===!0&&l(M=>Cf(M,P)),o(P)}),await O});E.finished.finally(()=>{g(void 0),b(void 0),h(void 0),f({isTransitioning:!1})}),b(E)}},[d,p,t.window,r,l]),m.useEffect(()=>{p&&d&&a.location.key===d.location.key&&p.resolve()},[p,x,a.location,d]),m.useEffect(()=>{!u.isTransitioning&&y&&(h(y.state),f({isTransitioning:!0,flushSync:!1,currentLocation:y.currentLocation,nextLocation:y.nextLocation}),w(void 0))},[u.isTransitioning,y]);let k=m.useMemo(()=>({createHref:t.createHref,encodeLocation:t.encodeLocation,go:P=>t.navigate(P),push:(P,O,E)=>t.navigate(P,{state:O,preventScrollReset:E?.preventScrollReset}),replace:(P,O,E)=>t.navigate(P,{replace:!0,state:O,preventScrollReset:E?.preventScrollReset})}),[t]),N=t.basename||"/",v=m.useMemo(()=>({router:t,navigator:k,static:!1,basename:N,onError:n}),[t,k,N,n]);return m.createElement(m.Fragment,null,m.createElement(_r.Provider,{value:v},m.createElement(Ro.Provider,{value:a},m.createElement(k0.Provider,{value:C.current},m.createElement(Ih.Provider,{value:u},m.createElement(i2,{basename:N,location:a.location,navigationType:a.historyAction,navigator:k,unstable_useTransitions:r},m.createElement(t2,{routes:t.routes,future:t.future,state:a,onError:n})))))),null)}function Cf(t,e){return{...t,navigation:e.navigation.state!=="idle"?e.navigation:t.navigation,revalidation:e.revalidation!=="idle"?e.revalidation:t.revalidation,actionData:e.navigation.state!=="submitting"?e.actionData:t.actionData,fetchers:e.fetchers}}var t2=m.memo(n2);function n2({routes:t,future:e,state:n,onError:r}){return Iw(t,void 0,n,r,e)}function r2({to:t,replace:e,state:n,relative:r}){ge(Os(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=m.useContext(Ft);$e(!s,"<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}=m.useContext(en),{pathname:o}=un(),a=tn(),l=Hl(t,Vl(i),o,r==="path"),d=JSON.stringify(l);return m.useEffect(()=>{a(JSON.parse(d),{replace:e,state:n,relative:r})},[a,d,r,e,n]),null}function s2(t){return Rw(t.context)}function i2({basename:t="/",children:e=null,location:n,navigationType:r="POP",navigator:s,static:i=!1,unstable_useTransitions:o}){ge(!Os(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let a=t.replace(/^\/*/,"/"),l=m.useMemo(()=>({basename:a,navigator:s,static:i,unstable_useTransitions:o,future:{}}),[a,s,i,o]);typeof n=="string"&&(n=gr(n));let{pathname:d="/",search:h="",hash:u="",state:f=null,key:p="default"}=n,g=m.useMemo(()=>{let x=Xt(d,a);return x==null?null:{location:{pathname:x,search:h,hash:u,state:f,key:p},navigationType:r}},[a,d,h,u,f,p,r]);return $e(g!=null,`<Router basename="${a}"> is not able to match the URL "${d}${h}${u}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:m.createElement(Ft.Provider,{value:l},m.createElement(_l.Provider,{children:e,value:g}))}var Wa="get",Ua="application/x-www-form-urlencoded";function Wl(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function o2(t){return Wl(t)&&t.tagName.toLowerCase()==="button"}function a2(t){return Wl(t)&&t.tagName.toLowerCase()==="form"}function l2(t){return Wl(t)&&t.tagName.toLowerCase()==="input"}function c2(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function d2(t,e){return t.button===0&&(!e||e==="_self")&&!c2(t)}function Dd(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function h2(t,e){let n=Dd(t);return e&&e.forEach((r,s)=>{n.has(s)||e.getAll(s).forEach(i=>{n.append(s,i)})}),n}var ua=null;function u2(){if(ua===null)try{new FormData(document.createElement("form"),0),ua=!1}catch{ua=!0}return ua}var f2=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function yc(t){return t!=null&&!f2.has(t)?($e(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ua}"`),null):t}function p2(t,e){let n,r,s,i,o;if(a2(t)){let a=t.getAttribute("action");r=a?Xt(a,e):null,n=t.getAttribute("method")||Wa,s=yc(t.getAttribute("enctype"))||Ua,i=new FormData(t)}else if(o2(t)||l2(t)&&(t.type==="submit"||t.type==="image")){let a=t.form;if(a==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=t.getAttribute("formaction")||a.getAttribute("action");if(r=l?Xt(l,e):null,n=t.getAttribute("formmethod")||a.getAttribute("method")||Wa,s=yc(t.getAttribute("formenctype"))||yc(a.getAttribute("enctype"))||Ua,i=new FormData(a,t),!u2()){let{name:d,type:h,value:u}=t;if(h==="image"){let f=d?`${d}.`:"";i.append(`${f}x`,"0"),i.append(`${f}y`,"0")}else d&&i.append(d,u)}}else{if(Wl(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Wa,r=null,s=Ua,o=t}return i&&s==="text/plain"&&(o=i,i=void 0),{action:r,method:n.toLowerCase(),encType:s,formData:i,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Vh(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function m2(t,e,n){let r=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return r.pathname==="/"?r.pathname=`_root.${n}`:e&&Xt(r.pathname,e)==="/"?r.pathname=`${e.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function g2(t,e){if(t.id in e)return e[t.id];try{let n=await import(t.module);return e[t.id]=n,n}catch(n){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function x2(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function b2(t,e,n){let r=await Promise.all(t.map(async s=>{let i=e.routes[s.route.id];if(i){let o=await g2(i,n);return o.links?o.links():[]}return[]}));return k2(r.flat(1).filter(x2).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function jf(t,e,n,r,s,i){let o=(l,d)=>n[d]?l.route.id!==n[d].route.id:!0,a=(l,d)=>n[d].pathname!==l.pathname||n[d].route.path?.endsWith("*")&&n[d].params["*"]!==l.params["*"];return i==="assets"?e.filter((l,d)=>o(l,d)||a(l,d)):i==="data"?e.filter((l,d)=>{let h=r.routes[l.route.id];if(!h||!h.hasLoader)return!1;if(o(l,d)||a(l,d))return!0;if(l.route.shouldRevalidate){let u=l.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(t,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof u=="boolean")return u}return!0}):[]}function y2(t,e,{includeHydrateFallback:n}={}){return v2(t.map(r=>{let s=e.routes[r.route.id];if(!s)return[];let i=[s.module];return s.clientActionModule&&(i=i.concat(s.clientActionModule)),s.clientLoaderModule&&(i=i.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(i=i.concat(s.hydrateFallbackModule)),s.imports&&(i=i.concat(s.imports)),i}).flat(1))}function v2(t){return[...new Set(t)]}function w2(t){let e={},n=Object.keys(t).sort();for(let r of n)e[r]=t[r];return e}function k2(t,e){let n=new Set;return new Set(e),t.reduce((r,s)=>{let i=JSON.stringify(w2(s));return n.has(i)||(n.add(i),r.push({key:i,link:s})),r},[])}function M0(){let t=m.useContext(_r);return Vh(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function S2(){let t=m.useContext(Ro);return Vh(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var Hh=m.createContext(void 0);Hh.displayName="FrameworkContext";function A0(){let t=m.useContext(Hh);return Vh(t,"You must render this element inside a <HydratedRouter> element"),t}function C2(t,e){let n=m.useContext(Hh),[r,s]=m.useState(!1),[i,o]=m.useState(!1),{onFocus:a,onBlur:l,onMouseEnter:d,onMouseLeave:h,onTouchStart:u}=e,f=m.useRef(null);m.useEffect(()=>{if(t==="render"&&o(!0),t==="viewport"){let x=y=>{y.forEach(w=>{o(w.isIntersecting)})},b=new IntersectionObserver(x,{threshold:.5});return f.current&&b.observe(f.current),()=>{b.disconnect()}}},[t]),m.useEffect(()=>{if(r){let x=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(x)}}},[r]);let p=()=>{s(!0)},g=()=>{s(!1),o(!1)};return n?t!=="intent"?[i,f,{}]:[i,f,{onFocus:Js(a,p),onBlur:Js(l,g),onMouseEnter:Js(d,p),onMouseLeave:Js(h,g),onTouchStart:Js(u,p)}]:[!1,f,{}]}function Js(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function j2({page:t,...e}){let{router:n}=M0(),r=m.useMemo(()=>er(n.routes,t,n.basename),[n.routes,t,n.basename]);return r?m.createElement(P2,{page:t,matches:r,...e}):null}function N2(t){let{manifest:e,routeModules:n}=A0(),[r,s]=m.useState([]);return m.useEffect(()=>{let i=!1;return b2(t,e,n).then(o=>{i||s(o)}),()=>{i=!0}},[t,e,n]),r}function P2({page:t,matches:e,...n}){let r=un(),{manifest:s,routeModules:i}=A0(),{basename:o}=M0(),{loaderData:a,matches:l}=S2(),d=m.useMemo(()=>jf(t,e,l,s,r,"data"),[t,e,l,s,r]),h=m.useMemo(()=>jf(t,e,l,s,r,"assets"),[t,e,l,s,r]),u=m.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let g=new Set,x=!1;if(e.forEach(y=>{let w=s.routes[y.route.id];!w||!w.hasLoader||(!d.some(C=>C.route.id===y.route.id)&&y.route.id in a&&i[y.route.id]?.shouldRevalidate||w.hasClientLoader?x=!0:g.add(y.route.id))}),g.size===0)return[];let b=m2(t,o,"data");return x&&g.size>0&&b.searchParams.set("_routes",e.filter(y=>g.has(y.route.id)).map(y=>y.route.id).join(",")),[b.pathname+b.search]},[o,a,r,s,d,e,t,i]),f=m.useMemo(()=>y2(h,s),[h,s]),p=N2(h);return m.createElement(m.Fragment,null,u.map(g=>m.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...n})),f.map(g=>m.createElement("link",{key:g,rel:"modulepreload",href:g,...n})),p.map(({key:g,link:x})=>m.createElement("link",{key:g,nonce:n.nonce,...x})))}function O2(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var M2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{M2&&(window.__reactRouterVersion="7.11.0")}catch{}function A2(t,e){return tw({basename:e?.basename,getContext:e?.getContext,future:e?.future,history:xv({window:e?.window}),hydrationData:D2(),routes:t,mapRouteProperties:Qw,hydrationRouteProperties:Xw,dataStrategy:e?.dataStrategy,patchRoutesOnNavigation:e?.patchRoutesOnNavigation,window:e?.window,unstable_instrumentations:e?.unstable_instrumentations}).initialize()}function D2(){let t=window?.__staticRouterHydrationData;return t&&t.errors&&(t={...t,errors:T2(t.errors)}),t}function T2(t){if(!t)return null;let e=Object.entries(t),n={};for(let[r,s]of e)if(s&&s.__type==="RouteErrorResponse")n[r]=new Eo(s.status,s.statusText,s.data,s.internal===!0);else if(s&&s.__type==="Error"){if(s.__subType){let i=window[s.__subType];if(typeof i=="function")try{let o=new i(s.message);o.stack="",n[r]=o}catch{}}if(n[r]==null){let i=new Error(s.message);i.stack="",n[r]=i}}else n[r]=s;return n}var D0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,T0=m.forwardRef(function({onClick:e,discover:n="render",prefetch:r="none",relative:s,reloadDocument:i,replace:o,state:a,target:l,to:d,preventScrollReset:h,viewTransition:u,unstable_defaultShouldRevalidate:f,...p},g){let{basename:x,unstable_useTransitions:b}=m.useContext(Ft),y=typeof d=="string"&&D0.test(d),w=c0(d,x);d=w.to;let C=Tw(d,{relative:s}),[S,k,N]=C2(r,p),v=I2(d,{replace:o,state:a,target:l,preventScrollReset:h,relative:s,viewTransition:u,unstable_defaultShouldRevalidate:f,unstable_useTransitions:b});function P(E){e&&e(E),E.defaultPrevented||v(E)}let O=m.createElement("a",{...p,...N,href:w.absoluteURL||C,onClick:w.isExternal||i?e:P,ref:O2(g,k),target:l,"data-discover":!y&&n==="render"?"true":void 0});return S&&!y?m.createElement(m.Fragment,null,O,m.createElement(j2,{page:C})):O});T0.displayName="Link";var E2=m.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:r="",end:s=!1,style:i,to:o,viewTransition:a,children:l,...d},h){let u=Io(o,{relative:d.relative}),f=un(),p=m.useContext(Ro),{navigator:g,basename:x}=m.useContext(Ft),b=p!=null&&H2(u)&&a===!0,y=g.encodeLocation?g.encodeLocation(u).pathname:u.pathname,w=f.pathname,C=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;n||(w=w.toLowerCase(),C=C?C.toLowerCase():null,y=y.toLowerCase()),C&&x&&(C=Xt(C,x)||C);const S=y!=="/"&&y.endsWith("/")?y.length-1:y.length;let k=w===y||!s&&w.startsWith(y)&&w.charAt(S)==="/",N=C!=null&&(C===y||!s&&C.startsWith(y)&&C.charAt(y.length)==="/"),v={isActive:k,isPending:N,isTransitioning:b},P=k?e:void 0,O;typeof r=="function"?O=r(v):O=[r,k?"active":null,N?"pending":null,b?"transitioning":null].filter(Boolean).join(" ");let E=typeof i=="function"?i(v):i;return m.createElement(T0,{...d,"aria-current":P,className:O,ref:h,style:E,to:o,viewTransition:a},typeof l=="function"?l(v):l)});E2.displayName="NavLink";var L2=m.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:r,replace:s,state:i,method:o=Wa,action:a,onSubmit:l,relative:d,preventScrollReset:h,viewTransition:u,unstable_defaultShouldRevalidate:f,...p},g)=>{let{unstable_useTransitions:x}=m.useContext(Ft),b=z2(),y=V2(a,{relative:d}),w=o.toLowerCase()==="get"?"get":"post",C=typeof a=="string"&&D0.test(a),S=k=>{if(l&&l(k),k.defaultPrevented)return;k.preventDefault();let N=k.nativeEvent.submitter,v=N?.getAttribute("formmethod")||o,P=()=>b(N||k.currentTarget,{fetcherKey:e,method:v,navigate:n,replace:s,state:i,relative:d,preventScrollReset:h,viewTransition:u,unstable_defaultShouldRevalidate:f});x&&n!==!1?m.startTransition(()=>P()):P()};return m.createElement("form",{ref:g,method:w,action:y,onSubmit:r?l:S,...p,"data-discover":!C&&t==="render"?"true":void 0})});L2.displayName="Form";function R2(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function E0(t){let e=m.useContext(_r);return ge(e,R2(t)),e}function I2(t,{target:e,replace:n,state:r,preventScrollReset:s,relative:i,viewTransition:o,unstable_defaultShouldRevalidate:a,unstable_useTransitions:l}={}){let d=tn(),h=un(),u=Io(t,{relative:i});return m.useCallback(f=>{if(d2(f,e)){f.preventDefault();let p=n!==void 0?n:En(h)===En(u),g=()=>d(t,{replace:p,state:r,preventScrollReset:s,relative:i,viewTransition:o,unstable_defaultShouldRevalidate:a});l?m.startTransition(()=>g()):g()}},[h,d,u,n,r,e,t,s,i,o,a,l])}function $2(t){$e(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 e=m.useRef(Dd(t)),n=m.useRef(!1),r=un(),s=m.useMemo(()=>h2(r.search,n.current?null:e.current),[r.search]),i=tn(),o=m.useCallback((a,l)=>{const d=Dd(typeof a=="function"?a(new URLSearchParams(s)):a);n.current=!0,i("?"+d,l)},[i,s]);return[s,o]}var B2=0,F2=()=>`__${String(++B2)}__`;function z2(){let{router:t}=E0("useSubmit"),{basename:e}=m.useContext(Ft),n=Uw(),r=t.fetch,s=t.navigate;return m.useCallback(async(i,o={})=>{let{action:a,method:l,encType:d,formData:h,body:u}=p2(i,e);if(o.navigate===!1){let f=o.fetcherKey||F2();await r(f,n,o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:h,body:u,formMethod:o.method||l,formEncType:o.encType||d,flushSync:o.flushSync})}else await s(o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:h,body:u,formMethod:o.method||l,formEncType:o.encType||d,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[r,s,e,n])}function V2(t,{relative:e}={}){let{basename:n}=m.useContext(Ft),r=m.useContext(en);ge(r,"useFormAction must be used inside a RouteContext");let[s]=r.matches.slice(-1),i={...Io(t||".",{relative:e})},o=un();if(t==null){i.search=o.search;let a=new URLSearchParams(i.search),l=a.getAll("index");if(l.some(h=>h==="")){a.delete("index"),l.filter(u=>u).forEach(u=>a.append("index",u));let h=a.toString();i.search=h?`?${h}`:""}}return(!t||t===".")&&s.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:Dn([n,i.pathname])),En(i)}function H2(t,{relative:e}={}){let n=m.useContext(Ih);ge(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=E0("useViewTransitionState"),s=Io(t,{relative:e});if(!n.isTransitioning)return!1;let i=Xt(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Xt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return rl(s.pathname,o)!=null||rl(s.pathname,i)!=null}function _2(t){return m.createElement(e2,{flushSync:Tr.flushSync,...t})}const W2={en:{loading:"Loading...",error:"Error",selectProject:"Select a project to view dashboard",controlCenter:"Control Center",settings:"Settings",sync:"Sync",offline:"Offline",switchToLight:"Switch to light mode",switchToDark:"Switch to dark mode",settingsSection:"Settings",overviewSection:"Overview",entitiesSection:"Entities",toolsSection:"Tools",configEditor:"Config Editor",projects:"Projects",addProject:"Add Project",global:"Global",skills:"Skills",skillsNav:"Skills",health:"Health",collapse:"Collapse",expand:"Expand",installing:"Installing...",manage:"Manage",uninstall:"Uninstall",installGlobally:"Install Globally",installGloballyDesc:"Available to all projects instead of current project only",selectAtLeastOneAgent:"Please select at least one agent",installationFailed:"Installation failed",allSkills:"All Skills",refresh:"Refresh",browseAndManageSkills:"Browse and manage skills for your agents",detected:"Detected",notDetected:"Not detected",sessions:"sessions",noSessions:"No sessions",terminal:"Terminal",terminalSub:"Open bash at path",editor:"Editor",editorSub:"Open in VS Code",useGlobalFallback:"Use global fallback",openAtPath:"Open at project path",openAppOnly:"Open app only",actionOptionsLoadFailed:"Could not load editor/terminal options",launch:"Launch",launchSub:"Start Claude Code",config:"Config",configSub:"Manage project settings",recentSessions:"Recent Sessions",viewAllHistory:"View All History",showLess:"Show Less",actionFailed:"Action failed",loadingSessions:"Loading sessions...",noSessionsFound:"No sessions found",configuration:"Claude Settings",activeKit:"Active Kit",aiModel:"Model",hooks:"Hooks",active:"active",mcpServers:"MCP Servers",connected:"connected",editProjectConfig:"Edit Project Config",globalSettings:"(Global)",globalSkills:"Global Skills",loadingSkills:"Loading skills...",noDescription:"No description",browseSkillsMarketplace:"Browse Skills Marketplace",backToDashboard:"Back to Dashboard",educationalConfigEditor:"Educational Config Editor",discard:"Discard",saveChanges:"Save Changes",mergedView:"Merged View",localConfig:"Local (.ck.json)",globalConfig:"Global",syntaxValid:"Syntax Valid",configurationHelp:"Configuration Help",field:"Field",type:"Type",default:"Default",description:"Description",validValues:"Valid Values",systemEffect:"System Effect",exampleUsage:"Example Usage",knowledgeBase:"Knowledge Base",clickToSeeHelp:"Click on any configuration field to see detailed documentation and usage examples.",extractedFrom:"Extracted from ClaudeKit v2.x Specification",resetToDefault:"Reset",saving:"Saving...",saved:"Saved",confirmReset:"Reset to Default?",confirmResetMessage:"All changes will be lost and replaced with default values.",confirm:"Confirm",saveFailed:"Save failed",configTab:"Config",systemTab:"System",formTab:"Form",jsonTab:"JSON",readOnly:"Read-only",installedKit:"Installed Kit",kitVersion:"Kit Version",installedOn:"Installed On",noKitInstalled:"No kit installed",components:"Components",agents:"Agents",commands:"Commands",workflows:"Workflows",kitSkills:"Skills",fileOwnership:"File Ownership",ownershipCk:"kit-managed",ownershipUser:"user-owned",ownershipModified:"modified",componentInventory:"Component Inventory",installedHooks:"Installed Hooks",installedMcpServers:"MCP Servers",lastChecked:"Last update check",staleIndicator:"Stale",skippedVersion:"Skipped",filesModifiedFromDefaults:"files modified from kit defaults",cliCard:"ClaudeKit CLI",checkForUpdates:"Check for Updates",checking:"Checking...",upToDate:"Up to date",updateAvailable:"Update available",updateNow:"Update Now",updating:"Updating...",updateSuccess:"Update Complete!",updateFailed:"Update Failed",closeModal:"Close",showDetails:"Show Details",hideDetails:"Hide Details",environment:"Environment",claudeConfigPath:"Claude config",nodeVersion:"Node",bunVersion:"Bun",osVersion:"OS",envShell:"Shell",envHomeDir:"Home",envCpuCores:"CPU Cores",envTotalMemory:"Memory",cliPackageManager:"Package Manager",cliInstallLocation:"Install Location",cliGitVersion:"Git",cliGhVersion:"GitHub CLI",channelStable:"Stable",channelBeta:"Beta",betaBadge:"Beta",latestVersion:"Latest",selectVersion:"Select version",loadingVersions:"Loading versions...",prereleaseLabel:"Pre",currentVersionLabel:"Current",checkAll:"Check All",checkingAll:"Checking...",updateAll:"Update All",updatesAvailable:"{count} updates available",allUpToDate:"All up to date",systemControlTower:"System Control Tower",systemOverviewTitle:"Update & Runtime Overview",systemOverviewDesc:"Track CLI and kit health, then run upgrades from one place.",installedComponentsHeading:"Installed Components",updateReadiness:"Update Readiness",checkedComponents:"Checked",activeChannel:"Channel",readyToScan:"Ready to scan",noTrackedFiles:"No tracked files detected",kitsLabel:"Kits",componentFilterAll:"All",componentFilterUpdates:"Updates",componentFilterUpdatesCount:"Updates ({count})",componentFilterUpToDate:"Up to date",componentFilterUpToDateCount:"Up to date ({count})",componentFilterCli:"CLI",componentFilterKits:"Kits",noComponentsMatchFilter:"No components match the current filter.",runCheckAllForFilter:"Run Check All to populate this filter.",noUpdatesFound:"No updates found. Checked components are up to date.",noUpToDateYet:"No components are up to date yet.",configWorkspaceHint:"Edit configuration or manage system updates from one workspace.",settingsJsonHeading:"Claude Settings JSON",settingsJsonMissing:"No settings file found at ~/.claude/settings.json.",settingsJsonLoadFailed:"Failed to load ~/.claude/settings.json.",settingsBackupSaved:"Backup saved",hookDiagnosticsTitle:"Hook Diagnostics",hookDiagnosticsDesc:"Inspect recent hook activity and failures without opening JSONL files manually.",hookDiagnosticsPathPending:"Resolving log path...",hookDiagnosticsScopeGlobal:"Global hooks",hookDiagnosticsEntries:"Entries",hookDiagnosticsCrashes:"Crashes",hookDiagnosticsWarnings:"Warnings",hookDiagnosticsBlocks:"Blocks",hookDiagnosticsLastEvent:"Last event",hookDiagnosticsLoading:"Loading hook diagnostics...",hookDiagnosticsLoadFailed:"Failed to load hook diagnostics",hookDiagnosticsMissing:"No hook log file found for this scope yet.",hookDiagnosticsEmpty:"Hook log is present but contains no readable entries.",hookDiagnosticsParseErrorsNotice:"Skipped {count} malformed log line(s) while loading diagnostics.",hookDiagnosticsTruncatedNotice:"Showing a bounded recent window to keep diagnostics responsive on large logs.",hookDiagnosticsToolLabel:"tool",hookDiagnosticsTargetLabel:"target",hookDiagnosticsUnknown:"Unknown",hookDiagnostics:"Hook Diagnostics",hookEvent:"Event",hookExecutions:"Executions",hookAvgLatency:"Avg Latency",hookFailureRate:"Failure Rate",hookLastRun:"Last Run",hookLatencyWarning:"Latency > 500ms",activityMetrics:"Activity",activityTotalSessions:"Total Sessions",activityMostActive:"Most Active Projects",activityPeriod24h:"24h",activityPeriod7d:"7d",activityPeriod30d:"30d",activityNoData:"No activity data",addProjectTitle:"Add Project",addProjectDescription:"Add a new ClaudeKit project to the control center",projectPath:"Project Path",pathPlaceholder:"/path/to/project",alias:"Alias",aliasOptional:"(optional)",aliasPlaceholder:"my-project",aliasDescription:"Custom display name for the project",pathRequired:"Path is required",failedToAdd:"Failed to add project",cancel:"Cancel",adding:"Adding...",somethingWentWrong:"Something went wrong",reloadApp:"Reload App",serverNotRunning:"Server Not Running",startServerMessage:"The Config UI requires the backend server to be running.",runThisCommand:"Run this command",tryAgain:"Try Again",projectConfig:"Project Config",inheritedFromGlobal:"Inherited from Global",localOverride:"Local Override",viewGlobalConfig:"This field inherits from global config. View",onboardingTitle:"Welcome to ClaudeKit",onboardingSubtitle:"Choose your kit and get started in minutes",kitEngineerName:"ClaudeKit Engineer",kitEngineerTagline:"AI-powered coding with skills, hooks, and multi-agent workflows",kitMarketingName:"ClaudeKit Marketing",kitMarketingTagline:"Content automation: campaigns, social media, analytics",featureAgents:"AI Agents",featureAgentsDesc:"Specialized agents for different tasks",featureHooks:"Lifecycle Hooks",featureHooksDesc:"Customize Claude's behavior at key moments",featureSkills:"Skills Library",featureSkillsDesc:"Pre-built capabilities you can activate",featureMultiAgent:"Multi-Agent Workflows",featureMultiAgentDesc:"Coordinate multiple agents for complex tasks",featureContent:"Content Generation",featureContentDesc:"Automated content creation and optimization",featureSocial:"Social Media Tools",featureSocialDesc:"Scheduling, analytics, and engagement automation",stepChooseKit:"Choose Kit",stepConfigure:"Configure",stepInstall:"Install",back:"Back",next:"Next",install:"Install",installSuccess:"Installation Complete!",installSuccessDesc:"{kit} is ready to use",getStarted:"Get Started",goToDashboard:"Go to Dashboard",kitConfig:"Kit Config",kitConfigSubtitle:"Configure ClaudeKit Engineer settings",scopeGlobal:"Global",scopeProject:"Project",sectionGeneral:"General",sectionPaths:"Paths",sectionPrivacy:"Privacy & Trust",sectionProject:"Project Detection",sectionIntegrations:"Integrations",sectionHooks:"Hooks",sectionAdvanced:"Advanced",fieldCodingLevel:"Coding Level",fieldCodingLevelDesc:"Your coding experience level (-1=auto, 0=beginner, 1=intermediate, 2=advanced, 3=expert, 4=tech-lead, 5=god-mode)",fieldStatusline:"Statusline Mode",fieldStatuslineDesc:"How much info to show in the status line",fieldStatuslineColors:"Statusline Colors",fieldStatuslineColorsDesc:"Enable ANSI color output in the statusline",fieldStatuslineQuota:"Statusline Quota Display",fieldStatuslineQuotaDesc:"Show the 5h / wk quota chips in the statusline",fieldThinkingLanguage:"Thinking Language",fieldThinkingLanguageDesc:"Language for Claude's internal reasoning (null=English)",fieldResponseLanguage:"Response Language",fieldResponseLanguageDesc:"Language for Claude's responses (null=match user)",fieldDocsPath:"Docs Directory",fieldDocsPathDesc:"Path to documentation directory",fieldPlansPath:"Plans Directory",fieldPlansPathDesc:"Path to plans directory",fieldPrivacyBlock:"Privacy Block",fieldPrivacyBlockDesc:"Block access to sensitive files (.env, credentials)",fieldTrustEnabled:"Trust Mode",fieldTrustEnabledDesc:"Enable auto-approval for tool calls",fieldTrustPassphrase:"Trust Passphrase",fieldTrustPassphraseDesc:"Passphrase to enable trust mode",fieldProjectType:"Project Type",fieldProjectTypeDesc:"Override auto-detected project type",fieldPackageManager:"Package Manager",fieldPackageManagerDesc:"Override auto-detected package manager",fieldFramework:"Framework",fieldFrameworkDesc:"Override auto-detected framework",fieldGeminiModel:"Gemini Model",fieldGeminiModelDesc:"Gemini model for CLI commands; legacy gemini-3.0-* ids auto-map",geminiModel25Flash:"Gemini 2.5 Flash — All tiers",geminiModel25Pro:"Gemini 2.5 Pro — May hit capacity limits",geminiModel3FlashPreview:"Gemini 3 Flash Preview — Pro/Ultra only",geminiModel3ProPreview:"Gemini 3 Pro Preview — Pro/Ultra only",fieldResearchUseGemini:"Use Gemini for Research",fieldResearchUseGeminiDesc:"Use Gemini CLI instead of WebSearch",fieldDocsMaxLoc:"Max Lines per Doc",fieldDocsMaxLocDesc:"Maximum lines of code per documentation file",fieldPlanNamingFormat:"Plan Naming Format",fieldPlanNamingFormatDesc:"Format for plan directory names",fieldPlanDateFormat:"Plan Date Format",fieldPlanDateFormatDesc:"Date format for plan names (moment.js)",fieldPlanValidationMode:"Validation Mode",fieldPlanValidationModeDesc:"How to validate plans before implementation",fieldPlanMinQuestions:"Min Questions",fieldPlanMinQuestionsDesc:"Minimum validation questions",fieldPlanMaxQuestions:"Max Questions",fieldPlanMaxQuestionsDesc:"Maximum validation questions",fieldAssertions:"Assertions",fieldAssertionsDesc:"Code assertions and rules to enforce",fieldHookSessionInit:"Session Init",fieldHookSessionInitDesc:"Project detection and environment setup",fieldHookSubagentInit:"Subagent Init",fieldHookSubagentInitDesc:"Inject context to subagents",fieldHookDescriptiveName:"Descriptive Name",fieldHookDescriptiveNameDesc:"Enforce kebab-case descriptive file naming for scripts",fieldHookDevRulesReminder:"Dev Rules Reminder",fieldHookDevRulesReminderDesc:"Inject development rules context",fieldHookUsageContextAwareness:"Usage Prompt Awareness",fieldHookUsageContextAwarenessDesc:"Inject usage-limit awareness into prompts",fieldHookContextTracking:"Context Tracking",fieldHookContextTrackingDesc:"Context window tracking (% used, token counts)",fieldHookScoutBlock:"Scout Block",fieldHookScoutBlockDesc:"Block heavy directories from exploration",fieldHookPrivacyBlock:"Privacy Block Hook",fieldHookPrivacyBlockDesc:"Block sensitive files from reading",fieldHookPostEditSimplify:"Post-Edit Simplify",fieldHookPostEditSimplifyDesc:"Simplify reminder after edits",sectionUpdatePipeline:"Update Pipeline",fieldAutoInitAfterUpdate:"Auto Init After Update",fieldAutoInitAfterUpdateDesc:"Automatically run ck init after ck update when kit has new version",fieldAutoMigrateAfterUpdate:"Auto Migrate After Update",fieldAutoMigrateAfterUpdateDesc:"Automatically run ck migrate after ck update (independent of init)",fieldMigrateProviders:"Migrate Providers",fieldMigrateProvidersDesc:"Which providers to auto-migrate. Use 'auto' to scan filesystem or a comma-separated list.",skillsPageTitle:"Skills Management",skillsPageDesc:"Install ClaudeKit skills to your coding agents",availableSkills:"Available Skills",installedSkills:"Installed Skills",noSkillsFound:"No skills found",installSkill:"Install",uninstallSkill:"Uninstall",manageSkill:"Manage",syncRegistry:"Sync",installSkillTitle:"Install Skill",selectAgents:"Select target agents",installLocation:"Installation location",globalInstall:"Global",projectInstall:"Project",confirmInstall:"Install to selected agents",installingSkill:"Installing...",skillInstallSuccess:"Skill installed successfully",skillInstallFailed:"Installation failed",agentClaudeCode:"Claude Code",agentCursor:"Cursor",agentCodex:"Codex",agentOpencode:"OpenCode",agentGoose:"Goose",agentGeminiCli:"Gemini CLI",agentAntigravity:"Antigravity",agentGithubCopilot:"GitHub Copilot",agentAmp:"Amp",agentKilo:"Kilo",agentRoo:"Roo",agentWindsurf:"Windsurf",agentCline:"Cline",agentOpenhands:"OpenHands",installed:"Installed",notInstalled:"Not installed",allAgents:"All Agents",filterByAgent:"Filter by agent",skillsTitle:"Skills",skillsSubtitle:"Browse, install, and manage skills for your coding agents",availableCount:"Available",installedCount:"Installed",agentsCount:"Agents",searchSkills:"Search skills...",searchShortcut:"/",sortAZ:"A-Z",sortCategory:"Category",sortInstalledFirst:"Installed first",listView:"List view",gridView:"Grid view",categoryAll:"All",categoryAI:"AI",categoryUIUX:"UI/UX",categoryBackend:"Backend",categorySecurity:"Security",categoryDevOps:"DevOps",categoryDatabase:"Database",categoryDevelopment:"Development",categoryResearch:"Research",categoryGeneral:"General",categoryCore:"Core",categoryDocumentation:"Documentation",categoryTooling:"Tooling",categoryMedia:"Media",categoryFrameworks:"Frameworks",skillsCountLabel:"{count} skills",installToAll:"Install to All Detected",scopeLabel:"Installation Scope",agentInstalled:"Installed",agentNotInstalled:"Not installed",skillSource:"Source location",skillSourceBadge:"Source",detailPanelClose:"Close",versionLabel:"v{version}",installAllToAllAgents:"Install All to All Agents",bulkInstallFailed:"Bulk install failed",noAgentsDetected:"No agents detected",kitBadgeEngineer:"Engineer",kitBadgeMarketing:"Marketing",customizedBadge:"Customized",installedVersionLabel:"Installed Version",installedAtLabel:"Installed At",sourceTimestampLabel:"Source Date",kitLabel:"Kit",skillMetadata:"Skill Info",migrate:"Migrate",migrateTitle:"Migrate",migrateSubtitle:"Migrate your Claude Code stack to other providers",migrateDetectedProviders:"Detected",migrateSelectedProviders:"Selected",migrateDiscovering:"Discovering migration sources...",migrateRefresh:"Refresh Discovery",migrateRun:"Run Migration",migrateRunning:"Migrating...",migrateSourceSummary:"Source Summary",migratePresetCodex:"Codex",migratePresetAntigravity:"Antigravity",migratePresetCore:"Codex + Antigravity + Droid",migratePresetDetected:"All Detected",migrateScope:"Scope",migrateScopeProject:"Project",migrateScopeGlobal:"Global",migrateTypes:"Portable Types",migrateTypeAgents:"Subagents",migrateTypeCommands:"Commands",migrateTypeSkills:"Skills",migrateTypeConfig:"Config",migrateTypeRules:"Rules",migrateTypeHooks:"Hooks",migrateSearchProviders:"Search providers...",migrateSelectVisible:"Select Visible",migrateClearSelection:"Clear Selection",migrateProvidersHeading:"Target Providers",migrateProvidersCountSuffix:"providers",migrateNoProvidersMatch:"No providers match current filters.",migrateSelectButton:"Select",migrateSelectedButton:"Selected",migrateSelectProviderAction:"Select Provider",migrateUnselectProvider:"Unselect Provider",migrateCapabilitiesLabel:"types",migrateCapabilitiesSection:"Capability Matrix",migrateSupported:"Supported",migrateUnsupportedShort:"Unsupported",migrateIncludedEnabled:"Enabled",migrateIncludedDisabled:"Disabled",migrateLatestTarget:"Latest Target",migrateNoResultForProvider:"No migration result for this provider yet.",migrateActionSummaryTitle:"Ready to Migrate",migrateGlobalOnlyCommandsShort:"Commands global-only",migrateNoProviders:"No providers available.",migrateUnsupported:"Will be skipped (unsupported)",migrateGlobalForced:"Codex commands are global-only. Scope will be forced to global.",migrateResults:"Migration Results",migrateInstalled:"Installed",migrateSkipped:"Skipped",migrateFailed:"Failed",migrateProvider:"Provider",migrateStatus:"Status",migratePath:"Path",migrateError:"Error",migrateStatusInstalled:"Installed",migrateStatusSkipped:"Skipped",migrateStatusFailed:"Failed",migrateNoResults:"No migration results yet.",migrateDetectFailed:"Failed to discover migration data",migrateExecuteFailed:"Migration execution failed",migrateSelectProvider:"Select at least one provider",migrateNoTypesEnabled:"Enable at least one portable type",migrateDetectedTag:"Detected",migrateNotDetectedTag:"Not detected",migrateFilterRecommended:"Recommended",migrateActionInstall:"Install",migrateActionUpdate:"Update",migrateActionSkip:"Skip",migrateActionConflict:"Conflict",migrateActionDelete:"Delete",migrateUnchanged:"unchanged",migrateConflictSectionTitle:"Conflicts",migrateConflictUseCK:"Use CK",migrateConflictKeepMine:"Keep Mine",migrateConflictSmartMerge:"Smart Merge",migrateConflictShowDiff:"Show Diff",migrateConflictHideDiff:"Hide Diff",migrateConflictResolved:"Resolved",migrateConflictManual:"Manual",migrateConflictOverwriteAll:"Overwrite All",migrateConflictKeepAll:"Keep All",migrateSummaryTitle:"Migration Complete",migrateSummaryNewMigration:"New Migration",migrateType:"Type",migrateItem:"Item",migrateReconciling:"Analyzing changes...",migrateReviewPlan:"Review Plan",migrateExecutePlan:"Execute Migration",migrateExecuting:"Executing migration...",migrateResolveConflicts:"Resolve all conflicts before executing",migrateSummarySubtitle:"items migrated",migrateSummarySearchPlaceholder:"Search items...",migrateSummaryFilterAll:"All",migrateSummaryCollapseAll:"Collapse all",migrateSummaryExpandAll:"Expand all",migrateSummaryNoResults:"No items match your search",migrateSummaryProviders:"Providers",migrateTypeUnknown:"Other",kanbanTitle:"Plan Kanban",kanbanNoFile:"No plan file specified. Use ?file= parameter.",kanbanNoPhases:"No phases detected in this plan",kanbanError400:"Invalid request — missing file parameter",kanbanError403:"Access denied — file is outside the project directory",kanbanError404:"Plan file not found",kanbanComplete:"complete",kanbanStatus_pending:"Pending","kanbanStatus_in-progress":"In Progress",kanbanStatus_completed:"Completed",kanbanPhases:"phases",kanbanProgress:"Progress",kanbanLoadError:"Failed to load plan data",developmentFeature:"Development",betaFeature:"Beta",experimentalFeature:"Experimental",sectionModelTaxonomy:"Model Taxonomy",taxonomyDescription:"Customize model mappings for portable migration to other coding agents.",taxonomyTierHeavy:"Heavy (opus)",taxonomyTierBalanced:"Balanced (sonnet)",taxonomyTierLight:"Light (haiku)",taxonomyModel:"Model",taxonomyEffort:"Effort",taxonomyResetProvider:"Reset",taxonomyTier:"Tier",statuslineBuilder:"Status Line Builder",statuslineBuilderDescription:"Visually design your Claude Code status-line using drag-and-drop",statuslineSections:"Sections",statuslinePreview:"Preview",statuslineTheme:"Color Theme",statuslineSettings:"General Settings",statuslineResetDefaults:"Reset to Defaults",statuslineSave:"Save",statuslineBaseMode:"Base Mode",statuslineBreakpoint:"Responsive Breakpoint",statuslineMaxAgents:"Max Agent Rows",statuslineTodoTruncation:"Todo Truncation",statuslineEnable:"Enable",statuslineDisable:"Disable",statuslineDragHint:"Drag to reorder, toggle to enable/disable sections",statuslinePresetDefault:"Default",statuslinePresetMonochrome:"Monochrome",statuslinePresetSolarized:"Solarized",statuslinePresetNord:"Nord",statuslinePresetDracula:"Dracula",statuslinePresetCatppuccin:"Catppuccin",statuslinePresetGruvbox:"Gruvbox",statuslinePresetTokyoNight:"Tokyo Night",statuslinePresetRosePine:"Rosé Pine",statuslinePresetOneDark:"One Dark",statuslinePresetAyu:"Ayu",statuslinePresetKanagawa:"Kanagawa",statuslinePresetStealth:"Stealth",statuslinePresetHacker:"Hacker",statuslineSaved:"Saved successfully",statuslineSaveError:"Save failed",statusline:"Status Line",statuslineCollapseSettings:"Collapse settings",statuslineExpandSettings:"Expand settings",statuslineIconOverride:"Icon override",statuslineLabelOverride:"Label override",statuslineMaxWidth:"Max width (chars)",statuslineIconPlaceholder:"e.g. 🤖",statuslineMaxWidthPlaceholder:"auto",statuslineCustomColors:"Custom colors",statuslineColorContextGroup:"Context Window",statuslineColorQuotaGroup:"Usage Quota",statuslineColorGeneralGroup:"General",statuslineColorSectionGroup:"Section Colors",statuslineColorContextLow:"Low (<50%)",statuslineColorContextMid:"Mid (50-75%)",statuslineColorContextHigh:"High (>75%)",statuslineColorAccent:"Accent",statuslineColorMuted:"Muted",statuslineColorSeparator:"Separator",statuslineModeFullDesc:"All sections visible",statuslineModeCompactDesc:"Condensed display",statuslineModeMinimalDesc:"Essential info only",statuslineModeNoneDesc:"Disabled",statuslinePreviewTitle:"Claude Code — statusline preview",statuslinePreviewEmptyLine:"(empty line)",statuslinePreviewNoLines:"(no lines configured)",statuslineSectionModelLabel:"Model",statuslineSectionContextLabel:"Context Window",statuslineSectionQuotaLabel:"Usage Quota",statuslineSectionDirectoryLabel:"Directory",statuslineSectionGitLabel:"Git Status",statuslineSectionCostLabel:"Cost",statuslineSectionChangesLabel:"Changes",statuslineSectionAgentsLabel:"Agents",statuslineSectionTodosLabel:"Tasks",statuslineSectionModelDesc:"AI model name and provider",statuslineSectionContextDesc:"Context window usage bar",statuslineSectionQuotaDesc:"5-hour and weekly usage quota",statuslineSectionDirectoryDesc:"Current working directory",statuslineSectionGitDesc:"Git branch, staged/unstaged changes",statuslineSectionCostDesc:"Session cost estimate",statuslineSectionChangesDesc:"Lines added and removed",statuslineSectionAgentsDesc:"Recent agent activity",statuslineSectionTodosDesc:"Current task progress",statuslineSectionsVisible:"sections visible",statuslineLoadErrorSaveDisabled:"Could not load saved layout. Saving is disabled to prevent data loss.",statuslineAddLine:"Add Line",statuslineRemoveLine:"Remove",statuslineHiddenSections:"Hidden Sections",statuslineDragToLine:"Drag sections to a line to show them",statuslineQuotaLow:"Quota Low",statuslineQuotaHigh:"Quota High",statuslineLine:"Line",sessionsTitle:"Sessions",sessionDetail:"Session Detail",sessionMessages:"messages",sessionToolCalls:"tool calls",sessionDuration:"Duration",noSessionsData:"No sessions found",sessionReadOnly:"Read-only view",sessionLastActive:"Last active",sessionProjectSessions:"Project Sessions",sessionBack:"Back",sessionLoading:"Loading...",sessionError:"Failed to load",sessionCount:"sessions",sessionToolInput:"Input",sessionToolResult:"Result",sessionToolsUsed:"Tools Used",sessionSystemContext:"System Context",sessionExpandAll:"Expand all",sessionCollapseAll:"Collapse all",sessionNoContent:"No text content",sessionUser:"User",sessionAssistant:"Assistant",sessionThinking:"Thinking...",sessionSearchPlaceholder:"Search in conversation...",sessionSearchResults:"results",sessionNoResults:"No matches",sessionGroupMessages:"messages",palettePlaceholder:"Search agents, commands, skills...",paletteNoResults:"No results found",paletteAgents:"Agents",paletteCommands:"Commands",paletteSkills:"Skills",paletteProjects:"Projects",paletteNavigation:"Navigation",skillsBrowser:"Skills",skillsCount:"{count} skills",skillDetail:"Skill Detail",searchSkillsBrowserPlaceholder:"Search skills...",noSkillsBrowserFound:"No skills found",backToSkillsBrowser:"Back to Skills",skillTriggers:"Triggers",skillLocal:"Local",skillGithub:"GitHub",systemNavLabel:"System",dashboardTitle:"Dashboard",dashboardAgents:"Agents",dashboardCommands:"Commands",dashboardSkills:"Skills",dashboardMcpServers:"MCP Servers",configured:"Configured",available:"Available",modelDistribution:"Model Distribution",recentAgents:"Recent Agents",suggestionsTitle:"Suggestions",acrossAgents:"across {count} agents",noAgentsConfigured:"No agents configured in ~/.claude/agents/",mcpTitle:"MCP Servers",mcpServerName:"Server",mcpCommand:"Command",mcpArgs:"Arguments",mcpSource:"Source",mcpStatus:"Status",mcpConfigured:"Configured",mcpNoServers:"No MCP servers configured",mcpSourceSettings:"settings.json",mcpSourceMcpJson:".mcp.json",mcpSourceProject:"Project",mcpToolCount:"Tools",agentsBrowser:"Agents",agentsBrowserCount:"{count} agents",filterAll:"All",agentDetail:"Agent Detail",agentInstructions:"Instructions",agentFrontmatter:"Configuration",searchAgentsPlaceholder:"Search agents...",noAgentsFound:"No agents found",backToAgents:"Back to Agents",commandsBrowser:"Commands",commandsCount:"{count} commands",commandDetail:"Command Detail",searchCommandsPlaceholder:"Search commands...",noCommandsFound:"No commands found",backToCommands:"Back to Commands",rootCommands:"Root",selectToView:"Select an item to view details",indexingFrom:"Indexing from"},vi:{loading:"Đang tải...",error:"Lỗi",selectProject:"Chọn dự án để xem bảng điều khiển",controlCenter:"Trung tâm điều khiển",settings:"Cài đặt",sync:"Đồng bộ",offline:"Ngoại tuyến",switchToLight:"Chuyển sang chế độ sáng",switchToDark:"Chuyển sang chế độ tối",settingsSection:"Cài đặt",overviewSection:"Tổng quan",entitiesSection:"Thực thể",toolsSection:"Công cụ",configEditor:"Trình chỉnh sửa cấu hình",projects:"Dự án",addProject:"Thêm dự án",global:"Toàn cục",skills:"Kỹ năng",skillsNav:"Kỹ năng",health:"Sức khỏe",collapse:"Thu gọn",expand:"Mở rộng",installing:"Đang cài đặt...",manage:"Quản lý",uninstall:"Gỡ cài đặt",installGlobally:"Cài đặt toàn cục",installGloballyDesc:"Khả dụng cho tất cả dự án thay vì chỉ dự án hiện tại",selectAtLeastOneAgent:"Vui lòng chọn ít nhất một agent",installationFailed:"Cài đặt thất bại",allSkills:"Tất cả kỹ năng",refresh:"Làm mới",browseAndManageSkills:"Duyệt và quản lý kỹ năng cho agents của bạn",detected:"Đã phát hiện",notDetected:"Chưa phát hiện",sessions:"phiên",noSessions:"Không có phiên",terminal:"Terminal",terminalSub:"Mở bash tại đường dẫn",editor:"Trình soạn thảo",editorSub:"Mở trong VS Code",useGlobalFallback:"Dùng fallback global",openAtPath:"Mở tại đường dẫn dự án",openAppOnly:"Chỉ mở ứng dụng",actionOptionsLoadFailed:"Không thể tải tùy chọn editor/terminal",launch:"Khởi chạy",launchSub:"Bắt đầu Claude Code",config:"Cấu hình",configSub:"Quản lý cài đặt dự án",recentSessions:"Phiên gần đây",viewAllHistory:"Xem tất cả lịch sử",showLess:"Thu gọn",actionFailed:"Thao tác thất bại",loadingSessions:"Đang tải phiên...",noSessionsFound:"Không tìm thấy phiên nào",configuration:"Cài đặt Claude",activeKit:"Kit hoạt động",aiModel:"Mô hình",hooks:"Hooks",active:"hoạt động",mcpServers:"Máy chủ MCP",connected:"kết nối",editProjectConfig:"Chỉnh sửa cấu hình dự án",globalSettings:"(Toàn cục)",globalSkills:"Kỹ năng toàn cục",loadingSkills:"Đang tải kỹ năng...",noDescription:"Không có mô tả",browseSkillsMarketplace:"Duyệt Skills Marketplace",backToDashboard:"Quay lại bảng điều khiển",educationalConfigEditor:"Trình chỉnh sửa cấu hình hướng dẫn",discard:"Hủy bỏ",saveChanges:"Lưu thay đổi",mergedView:"Chế độ gộp",localConfig:"Cục bộ (.ck.json)",globalConfig:"Toàn cục",syntaxValid:"Cú pháp hợp lệ",configurationHelp:"Hướng dẫn cấu hình",field:"Trường",type:"Kiểu",default:"Mặc định",description:"Mô tả",validValues:"Giá trị hợp lệ",systemEffect:"Hiệu ứng hệ thống",exampleUsage:"Ví dụ sử dụng",knowledgeBase:"Cơ sở kiến thức",clickToSeeHelp:"Nhấp vào bất kỳ trường cấu hình nào để xem tài liệu chi tiết và ví dụ sử dụng.",extractedFrom:"Trích xuất từ ClaudeKit v2.x Specification",resetToDefault:"Đặt lại",saving:"Đang lưu...",saved:"Đã lưu",confirmReset:"Đặt lại về mặc định?",confirmResetMessage:"Tất cả thay đổi sẽ bị mất và được thay thế bằng giá trị mặc định.",confirm:"Xác nhận",saveFailed:"Lưu thất bại",configTab:"Cấu hình",systemTab:"Hệ thống",formTab:"Biểu mẫu",jsonTab:"JSON",readOnly:"Chỉ đọc",installedKit:"Kit đã cài",kitVersion:"Phiên bản Kit",installedOn:"Cài đặt vào",noKitInstalled:"Chưa cài kit",components:"Thành phần",agents:"Agents",commands:"Commands",workflows:"Workflows",kitSkills:"Skills",fileOwnership:"Quyền sở hữu tệp",ownershipCk:"do kit quản lý",ownershipUser:"do người dùng",ownershipModified:"đã chỉnh sửa",componentInventory:"Thành phần đã cài",installedHooks:"Hooks đã cài",installedMcpServers:"MCP Servers",lastChecked:"Kiểm tra cập nhật",staleIndicator:"Cũ",skippedVersion:"Đã bỏ qua",filesModifiedFromDefaults:"tệp đã sửa so với mặc định",cliCard:"ClaudeKit CLI",checkForUpdates:"Kiểm tra cập nhật",checking:"Đang kiểm tra...",upToDate:"Đã cập nhật",updateAvailable:"Có bản cập nhật",updateNow:"Cập nhật ngay",updating:"Đang cập nhật...",updateSuccess:"Cập nhật hoàn tất!",updateFailed:"Cập nhật thất bại",closeModal:"Đóng",showDetails:"Xem chi tiết",hideDetails:"Ẩn chi tiết",environment:"Môi trường",claudeConfigPath:"Cấu hình Claude",nodeVersion:"Node",bunVersion:"Bun",osVersion:"Hệ điều hành",envShell:"Shell",envHomeDir:"Thư mục gốc",envCpuCores:"Nhân CPU",envTotalMemory:"Bộ nhớ",cliPackageManager:"Trình quản lý gói",cliInstallLocation:"Vị trí cài đặt",cliGitVersion:"Git",cliGhVersion:"GitHub CLI",channelStable:"Ổn định",channelBeta:"Beta",betaBadge:"Beta",latestVersion:"Mới nhất",selectVersion:"Chọn phiên bản",loadingVersions:"Đang tải...",prereleaseLabel:"Thử nghiệm",currentVersionLabel:"Hiện tại",checkAll:"Kiểm tra tất cả",checkingAll:"Đang kiểm tra...",updateAll:"Cập nhật tất cả",updatesAvailable:"{count} bản cập nhật",allUpToDate:"Tất cả đã cập nhật",systemControlTower:"Trung tâm hệ thống",systemOverviewTitle:"Tổng quan cập nhật & môi trường",systemOverviewDesc:"Theo dõi CLI và kit, rồi nâng cấp từ một nơi.",installedComponentsHeading:"Thành phần đã cài",updateReadiness:"Mức sẵn sàng cập nhật",checkedComponents:"Đã kiểm tra",activeChannel:"Kênh",readyToScan:"Sẵn sàng kiểm tra",noTrackedFiles:"Không phát hiện tệp theo dõi",kitsLabel:"Kit",componentFilterAll:"Tất cả",componentFilterUpdates:"Bản cập nhật",componentFilterUpdatesCount:"Bản cập nhật ({count})",componentFilterUpToDate:"Đã cập nhật",componentFilterUpToDateCount:"Đã cập nhật ({count})",componentFilterCli:"CLI",componentFilterKits:"Kit",noComponentsMatchFilter:"Không có thành phần phù hợp bộ lọc hiện tại.",runCheckAllForFilter:"Hãy chạy Kiểm tra tất cả để nạp dữ liệu cho bộ lọc này.",noUpdatesFound:"Không có bản cập nhật. Các thành phần đã kiểm tra đều mới nhất.",noUpToDateYet:"Chưa có thành phần nào ở trạng thái đã cập nhật.",configWorkspaceHint:"Chỉnh sửa cấu hình hoặc quản lý cập nhật hệ thống trong một màn hình.",settingsJsonHeading:"JSON Cài đặt Claude",settingsJsonMissing:"Không tìm thấy tệp ~/.claude/settings.json.",settingsJsonLoadFailed:"Không thể tải ~/.claude/settings.json.",settingsBackupSaved:"Đã lưu bản sao lưu",hookDiagnosticsTitle:"Chẩn đoán Hook",hookDiagnosticsDesc:"Xem hoạt động hook gần đây và lỗi mà không cần mở tệp JSONL thủ công.",hookDiagnosticsPathPending:"Đang xác định đường dẫn log...",hookDiagnosticsScopeGlobal:"Hook toàn cục",hookDiagnosticsEntries:"Bản ghi",hookDiagnosticsCrashes:"Sự cố",hookDiagnosticsWarnings:"Cảnh báo",hookDiagnosticsBlocks:"Chặn",hookDiagnosticsLastEvent:"Sự kiện cuối",hookDiagnosticsLoading:"Đang tải chẩn đoán hook...",hookDiagnosticsLoadFailed:"Không thể tải chẩn đoán hook",hookDiagnosticsMissing:"Chưa tìm thấy tệp log hook cho phạm vi này.",hookDiagnosticsEmpty:"Tệp log hook có tồn tại nhưng không có bản ghi đọc được.",hookDiagnosticsParseErrorsNotice:"Đã bỏ qua {count} dòng log bị lỗi khi tải chẩn đoán.",hookDiagnosticsTruncatedNotice:"Đang hiển thị cửa sổ bản ghi gần đây để giữ giao diện phản hồi tốt với log lớn.",hookDiagnosticsToolLabel:"công cụ",hookDiagnosticsTargetLabel:"mục tiêu",hookDiagnosticsUnknown:"Không rõ",hookDiagnostics:"Chẩn đoán Hook",hookEvent:"Sự kiện",hookExecutions:"Lần chạy",hookAvgLatency:"Trung bình",hookFailureRate:"Tỉ lệ lỗi",hookLastRun:"Lần cuối",hookLatencyWarning:"Độ trễ > 500ms",activityMetrics:"Hoạt động",activityTotalSessions:"Tổng phiên",activityMostActive:"Dự án hoạt động nhiều nhất",activityPeriod24h:"24h",activityPeriod7d:"7 ngày",activityPeriod30d:"30 ngày",activityNoData:"Không có dữ liệu",addProjectTitle:"Thêm dự án",addProjectDescription:"Thêm dự án ClaudeKit mới vào trung tâm điều khiển",projectPath:"Đường dẫn dự án",pathPlaceholder:"/đường/dẫn/dự/án",alias:"Bí danh",aliasOptional:"(tùy chọn)",aliasPlaceholder:"dự-án-của-tôi",aliasDescription:"Tên hiển thị tùy chỉnh cho dự án",pathRequired:"Đường dẫn bắt buộc",failedToAdd:"Không thể thêm dự án",cancel:"Hủy",adding:"Đang thêm...",somethingWentWrong:"Đã xảy ra lỗi",reloadApp:"Tải lại ứng dụng",serverNotRunning:"Máy chủ không chạy",startServerMessage:"Config UI yêu cầu máy chủ backend đang chạy.",runThisCommand:"Chạy lệnh này",tryAgain:"Thử lại",projectConfig:"Cấu hình dự án",inheritedFromGlobal:"Kế thừa từ toàn cục",localOverride:"Ghi đè cục bộ",viewGlobalConfig:"Trường này kế thừa từ cấu hình toàn cục. Xem",onboardingTitle:"Chào mừng đến ClaudeKit",onboardingSubtitle:"Chọn kit của bạn và bắt đầu trong vài phút",kitEngineerName:"ClaudeKit Engineer",kitEngineerTagline:"Lập trình AI với skills, hooks và multi-agent",kitMarketingName:"ClaudeKit Marketing",kitMarketingTagline:"Tự động hóa nội dung: chiến dịch, mạng xã hội, phân tích",featureAgents:"AI Agents",featureAgentsDesc:"Các agent chuyên biệt cho từng tác vụ",featureHooks:"Lifecycle Hooks",featureHooksDesc:"Tùy chỉnh hành vi của Claude tại các thời điểm quan trọng",featureSkills:"Thư viện Skills",featureSkillsDesc:"Các khả năng có sẵn bạn có thể kích hoạt",featureMultiAgent:"Multi-Agent Workflows",featureMultiAgentDesc:"Phối hợp nhiều agent cho các tác vụ phức tạp",featureContent:"Tạo nội dung",featureContentDesc:"Tự động tạo và tối ưu nội dung",featureSocial:"Công cụ mạng xã hội",featureSocialDesc:"Lên lịch, phân tích và tự động tương tác",stepChooseKit:"Chọn Kit",stepConfigure:"Cấu hình",stepInstall:"Cài đặt",back:"Quay lại",next:"Tiếp theo",install:"Cài đặt",installSuccess:"Cài đặt hoàn tất!",installSuccessDesc:"{kit} đã sẵn sàng sử dụng",getStarted:"Bắt đầu",goToDashboard:"Đi đến Dashboard",kitConfig:"Cấu hình Kit",kitConfigSubtitle:"Cấu hình ClaudeKit Engineer",scopeGlobal:"Toàn cục",scopeProject:"Dự án",sectionGeneral:"Cài đặt chung",sectionPaths:"Đường dẫn",sectionPrivacy:"Bảo mật & Tin cậy",sectionProject:"Phát hiện dự án",sectionIntegrations:"Tích hợp",sectionHooks:"Hooks",sectionAdvanced:"Nâng cao",fieldCodingLevel:"Cấp độ lập trình",fieldCodingLevelDesc:"Cấp độ kinh nghiệm (-1=tự động, 0=mới bắt đầu, 1=trung cấp, 2=nâng cao, 3=chuyên gia, 4=tech-lead, 5=thần)",fieldStatusline:"Chế độ thanh trạng thái",fieldStatuslineDesc:"Lượng thông tin hiển thị trên thanh trạng thái",fieldStatuslineColors:"Màu thanh trạng thái",fieldStatuslineColorsDesc:"Bật màu ANSI trong thanh trạng thái",fieldStatuslineQuota:"Hiển thị Quota Statusline",fieldStatuslineQuotaDesc:"Hiển thị các nhãn quota 5h / wk trong statusline",fieldThinkingLanguage:"Ngôn ngữ suy nghĩ",fieldThinkingLanguageDesc:"Ngôn ngữ cho suy luận nội bộ của Claude (null=Tiếng Anh)",fieldResponseLanguage:"Ngôn ngữ phản hồi",fieldResponseLanguageDesc:"Ngôn ngữ cho phản hồi của Claude (null=theo người dùng)",fieldDocsPath:"Thư mục tài liệu",fieldDocsPathDesc:"Đường dẫn đến thư mục tài liệu",fieldPlansPath:"Thư mục kế hoạch",fieldPlansPathDesc:"Đường dẫn đến thư mục kế hoạch",fieldPrivacyBlock:"Chặn quyền riêng tư",fieldPrivacyBlockDesc:"Chặn truy cập file nhạy cảm (.env, credentials)",fieldTrustEnabled:"Chế độ tin cậy",fieldTrustEnabledDesc:"Tự động phê duyệt các tool calls",fieldTrustPassphrase:"Mật khẩu tin cậy",fieldTrustPassphraseDesc:"Mật khẩu để bật chế độ tin cậy",fieldProjectType:"Loại dự án",fieldProjectTypeDesc:"Ghi đè loại dự án tự động phát hiện",fieldPackageManager:"Trình quản lý gói",fieldPackageManagerDesc:"Ghi đè trình quản lý gói tự động phát hiện",fieldFramework:"Framework",fieldFrameworkDesc:"Ghi đè framework tự động phát hiện",fieldGeminiModel:"Mô hình Gemini",fieldGeminiModelDesc:"Mô hình Gemini cho các lệnh CLI; id gemini-3.0-* cũ sẽ tự động ánh xạ",geminiModel25Flash:"Gemini 2.5 Flash — Mọi tài khoản",geminiModel25Pro:"Gemini 2.5 Pro — Có thể bị giới hạn dung lượng",geminiModel3FlashPreview:"Gemini 3 Flash Preview — Chỉ Pro/Ultra",geminiModel3ProPreview:"Gemini 3 Pro Preview — Chỉ Pro/Ultra",fieldResearchUseGemini:"Dùng Gemini cho nghiên cứu",fieldResearchUseGeminiDesc:"Dùng Gemini CLI thay vì WebSearch",fieldDocsMaxLoc:"Số dòng tối đa/tài liệu",fieldDocsMaxLocDesc:"Số dòng code tối đa cho mỗi file tài liệu",fieldPlanNamingFormat:"Định dạng tên kế hoạch",fieldPlanNamingFormatDesc:"Định dạng cho tên thư mục kế hoạch",fieldPlanDateFormat:"Định dạng ngày kế hoạch",fieldPlanDateFormatDesc:"Định dạng ngày cho tên kế hoạch (moment.js)",fieldPlanValidationMode:"Chế độ xác thực",fieldPlanValidationModeDesc:"Cách xác thực kế hoạch trước khi triển khai",fieldPlanMinQuestions:"Số câu hỏi tối thiểu",fieldPlanMinQuestionsDesc:"Số câu hỏi xác thực tối thiểu",fieldPlanMaxQuestions:"Số câu hỏi tối đa",fieldPlanMaxQuestionsDesc:"Số câu hỏi xác thực tối đa",fieldAssertions:"Assertions",fieldAssertionsDesc:"Các assertions và quy tắc cần thực thi",fieldHookSessionInit:"Khởi tạo phiên",fieldHookSessionInitDesc:"Phát hiện dự án và thiết lập môi trường",fieldHookSubagentInit:"Khởi tạo subagent",fieldHookSubagentInitDesc:"Inject context vào subagents",fieldHookDescriptiveName:"Tên mô tả",fieldHookDescriptiveNameDesc:"Bắt buộc đặt tên file dạng kebab-case mô tả cho scripts",fieldHookDevRulesReminder:"Nhắc nhở quy tắc dev",fieldHookDevRulesReminderDesc:"Inject context quy tắc phát triển",fieldHookUsageContextAwareness:"Nhận thức sử dụng cho prompt",fieldHookUsageContextAwarenessDesc:"Inject nhận thức giới hạn sử dụng vào prompt",fieldHookContextTracking:"Theo dõi ngữ cảnh",fieldHookContextTrackingDesc:"Theo dõi cửa sổ ngữ cảnh (% đã dùng, số token)",fieldHookScoutBlock:"Chặn Scout",fieldHookScoutBlockDesc:"Chặn thư mục nặng khỏi việc khám phá",fieldHookPrivacyBlock:"Hook chặn quyền riêng tư",fieldHookPrivacyBlockDesc:"Chặn đọc file nhạy cảm",fieldHookPostEditSimplify:"Đơn giản sau chỉnh sửa",fieldHookPostEditSimplifyDesc:"Nhắc đơn giản sau khi chỉnh sửa",sectionUpdatePipeline:"Pipeline Cập nhật",fieldAutoInitAfterUpdate:"Tự động Init sau Update",fieldAutoInitAfterUpdateDesc:"Tự động chạy ck init sau ck update khi kit có phiên bản mới",fieldAutoMigrateAfterUpdate:"Tự động Migrate sau Update",fieldAutoMigrateAfterUpdateDesc:"Tự động chạy ck migrate sau ck update (độc lập với init)",fieldMigrateProviders:"Provider Migrate",fieldMigrateProvidersDesc:"Provider nào tự động migrate. Dùng 'auto' để quét hệ thống hoặc danh sách phân cách bằng dấu phẩy.",skillsPageTitle:"Quản lý Kỹ năng",skillsPageDesc:"Cài đặt kỹ năng ClaudeKit cho các agent lập trình",availableSkills:"Kỹ năng có sẵn",installedSkills:"Kỹ năng đã cài",noSkillsFound:"Không tìm thấy kỹ năng",installSkill:"Cài đặt",uninstallSkill:"Gỡ cài đặt",manageSkill:"Quản lý",syncRegistry:"Đồng bộ",installSkillTitle:"Cài đặt Kỹ năng",selectAgents:"Chọn agent đích",installLocation:"Vị trí cài đặt",globalInstall:"Toàn cục",projectInstall:"Dự án",confirmInstall:"Cài đặt cho các agent đã chọn",installingSkill:"Đang cài đặt...",skillInstallSuccess:"Cài đặt kỹ năng thành công",skillInstallFailed:"Cài đặt thất bại",agentClaudeCode:"Claude Code",agentCursor:"Cursor",agentCodex:"Codex",agentOpencode:"OpenCode",agentGoose:"Goose",agentGeminiCli:"Gemini CLI",agentAntigravity:"Antigravity",agentGithubCopilot:"GitHub Copilot",agentAmp:"Amp",agentKilo:"Kilo",agentRoo:"Roo",agentWindsurf:"Windsurf",agentCline:"Cline",agentOpenhands:"OpenHands",installed:"Đã cài",notInstalled:"Chưa cài",allAgents:"Tất cả Agent",filterByAgent:"Lọc theo agent",skillsTitle:"Kỹ năng",skillsSubtitle:"Duyệt, cài đặt và quản lý kỹ năng cho coding agents",availableCount:"Có sẵn",installedCount:"Đã cài",agentsCount:"Agents",searchSkills:"Tìm kiếm kỹ năng...",searchShortcut:"/",sortAZ:"A-Z",sortCategory:"Danh mục",sortInstalledFirst:"Đã cài trước",listView:"Dạng danh sách",gridView:"Dạng lưới",categoryAll:"Tất cả",categoryAI:"AI",categoryUIUX:"UI/UX",categoryBackend:"Backend",categorySecurity:"Bảo mật",categoryDevOps:"DevOps",categoryDatabase:"Cơ sở dữ liệu",categoryDevelopment:"Phát triển",categoryResearch:"Nghiên cứu",categoryGeneral:"Tổng quát",categoryCore:"Cốt lõi",categoryDocumentation:"Tài liệu",categoryTooling:"Công cụ",categoryMedia:"Phương tiện",categoryFrameworks:"Framework",skillsCountLabel:"{count} kỹ năng",installToAll:"Cài cho tất cả đã phát hiện",scopeLabel:"Phạm vi cài đặt",agentInstalled:"Đã cài",agentNotInstalled:"Chưa cài",skillSource:"Vị trí nguồn",skillSourceBadge:"Nguồn",detailPanelClose:"Đóng",versionLabel:"v{version}",installAllToAllAgents:"Cài tất cả cho tất cả Agent",bulkInstallFailed:"Cài hàng loạt thất bại",noAgentsDetected:"Không phát hiện agent nào",kitBadgeEngineer:"Engineer",kitBadgeMarketing:"Marketing",customizedBadge:"Đã tùy chỉnh",installedVersionLabel:"Phiên bản cài đặt",installedAtLabel:"Cài đặt lúc",sourceTimestampLabel:"Ngày nguồn",kitLabel:"Kit",skillMetadata:"Thông tin Skill",migrate:"Di trú",migrateTitle:"Di trú",migrateSubtitle:"Chuyển toàn bộ stack Claude Code sang provider khác",migrateDetectedProviders:"Đã phát hiện",migrateSelectedProviders:"Đã chọn",migrateDiscovering:"Đang quét nguồn di trú...",migrateRefresh:"Làm mới quét",migrateRun:"Chạy di trú",migrateRunning:"Đang di trú...",migrateSourceSummary:"Tổng quan nguồn",migratePresetCodex:"Codex",migratePresetAntigravity:"Antigravity",migratePresetCore:"Codex + Antigravity + Droid",migratePresetDetected:"Tất cả đã phát hiện",migrateScope:"Phạm vi",migrateScopeProject:"Dự án",migrateScopeGlobal:"Toàn cục",migrateTypes:"Loại di trú",migrateTypeAgents:"Subagents",migrateTypeCommands:"Commands",migrateTypeSkills:"Skills",migrateTypeConfig:"Config",migrateTypeRules:"Rules",migrateTypeHooks:"Hooks",migrateSearchProviders:"Tìm provider...",migrateSelectVisible:"Chọn phần đang hiện",migrateClearSelection:"Bỏ chọn tất cả",migrateProvidersHeading:"Provider đích",migrateProvidersCountSuffix:"provider",migrateNoProvidersMatch:"Không có provider khớp bộ lọc hiện tại.",migrateSelectButton:"Chọn",migrateSelectedButton:"Đã chọn",migrateSelectProviderAction:"Chọn provider",migrateUnselectProvider:"Bỏ chọn provider",migrateCapabilitiesLabel:"loại",migrateCapabilitiesSection:"Ma trận khả năng",migrateSupported:"Hỗ trợ",migrateUnsupportedShort:"Không hỗ trợ",migrateIncludedEnabled:"Đang bật",migrateIncludedDisabled:"Đang tắt",migrateLatestTarget:"Đích gần nhất",migrateNoResultForProvider:"Chưa có kết quả di trú cho provider này.",migrateActionSummaryTitle:"Sẵn sàng di trú",migrateGlobalOnlyCommandsShort:"Commands chỉ global",migrateNoProviders:"Không có provider khả dụng.",migrateUnsupported:"Sẽ bỏ qua (không hỗ trợ)",migrateGlobalForced:"Lệnh Codex chỉ hỗ trợ global. Phạm vi sẽ tự chuyển global.",migrateResults:"Kết quả di trú",migrateInstalled:"Đã cài",migrateSkipped:"Đã bỏ qua",migrateFailed:"Lỗi",migrateProvider:"Provider",migrateStatus:"Trạng thái",migratePath:"Đường dẫn",migrateError:"Lỗi",migrateStatusInstalled:"Đã cài",migrateStatusSkipped:"Đã bỏ qua",migrateStatusFailed:"Lỗi",migrateNoResults:"Chưa có kết quả di trú.",migrateDetectFailed:"Không thể quét dữ liệu di trú",migrateExecuteFailed:"Chạy di trú thất bại",migrateSelectProvider:"Vui lòng chọn ít nhất một provider",migrateNoTypesEnabled:"Bật ít nhất một loại di trú",migrateDetectedTag:"Đã phát hiện",migrateNotDetectedTag:"Chưa phát hiện",migrateFilterRecommended:"Đề xuất",migrateActionInstall:"Cài",migrateActionUpdate:"Cập nhật",migrateActionSkip:"Bỏ qua",migrateActionConflict:"Xung đột",migrateActionDelete:"Xóa",migrateUnchanged:"chưa thay đổi",migrateConflictSectionTitle:"Xung đột",migrateConflictUseCK:"Dùng CK",migrateConflictKeepMine:"Giữ của tôi",migrateConflictSmartMerge:"Merge thông minh",migrateConflictShowDiff:"Hiện diff",migrateConflictHideDiff:"Ẩn diff",migrateConflictResolved:"Đã giải quyết",migrateConflictManual:"Thủ công",migrateConflictOverwriteAll:"Ghi đè tất cả",migrateConflictKeepAll:"Giữ tất cả",migrateSummaryTitle:"Di trú hoàn tất",migrateSummaryNewMigration:"Di trú mới",migrateType:"Loại",migrateItem:"Mục",migrateReconciling:"Đang phân tích thay đổi...",migrateReviewPlan:"Xem kế hoạch",migrateExecutePlan:"Thực hiện di trú",migrateExecuting:"Đang thực hiện di trú...",migrateResolveConflicts:"Giải quyết xung đột trước khi thực hiện",migrateSummarySubtitle:"mục đã di trú",migrateSummarySearchPlaceholder:"Tìm kiếm...",migrateSummaryFilterAll:"Tất cả",migrateSummaryCollapseAll:"Thu gọn",migrateSummaryExpandAll:"Mở rộng",migrateSummaryNoResults:"Không tìm thấy mục nào",migrateSummaryProviders:"Provider",migrateTypeUnknown:"Khác",kanbanTitle:"Bảng Kanban Kế hoạch",kanbanNoFile:"Chưa chọn file kế hoạch. Dùng tham số ?file=.",kanbanNoPhases:"Không phát hiện giai đoạn nào trong kế hoạch này",kanbanError400:"Yêu cầu không hợp lệ — thiếu tham số file",kanbanError403:"Truy cập bị từ chối — file nằm ngoài thư mục dự án",kanbanError404:"Không tìm thấy file kế hoạch",kanbanComplete:"hoàn thành",kanbanStatus_pending:"Chờ xử lý","kanbanStatus_in-progress":"Đang thực hiện",kanbanStatus_completed:"Hoàn thành",kanbanPhases:"giai đoạn",kanbanProgress:"Tiến độ",kanbanLoadError:"Không thể tải dữ liệu kế hoạch",developmentFeature:"Đang phát triển",betaFeature:"Beta",experimentalFeature:"Thử nghiệm",sectionModelTaxonomy:"Phân loại mô hình",taxonomyDescription:"Tuỳ chỉnh ánh xạ mô hình cho migration portable sang coding agent khác.",taxonomyTierHeavy:"Nặng (opus)",taxonomyTierBalanced:"Cân bằng (sonnet)",taxonomyTierLight:"Nhẹ (haiku)",taxonomyModel:"Mô hình",taxonomyEffort:"Mức nỗ lực",taxonomyResetProvider:"Đặt lại",taxonomyTier:"Cấp độ",statuslineBuilder:"Trình tạo dòng trạng thái",statuslineBuilderDescription:"Thiết kế bố cục dòng trạng thái bằng kéo và thả",statuslineSections:"Các mục",statuslinePreview:"Xem trước",statuslineTheme:"Giao diện màu sắc",statuslineSettings:"Cài đặt chung",statuslineResetDefaults:"Đặt lại mặc định",statuslineSave:"Lưu",statuslineBaseMode:"Chế độ cơ bản",statuslineBreakpoint:"Điểm ngắt responsive",statuslineMaxAgents:"Số agent tối đa",statuslineTodoTruncation:"Cắt ngắn task",statuslineEnable:"Bật",statuslineDisable:"Tắt",statuslineDragHint:"Kéo để thay đổi thứ tự, bật/tắt từng mục",statuslinePresetDefault:"Mặc định",statuslinePresetMonochrome:"Đơn sắc",statuslinePresetSolarized:"Solarized",statuslinePresetNord:"Nord",statuslinePresetDracula:"Dracula",statuslinePresetCatppuccin:"Catppuccin",statuslinePresetGruvbox:"Gruvbox",statuslinePresetTokyoNight:"Tokyo Night",statuslinePresetRosePine:"Rosé Pine",statuslinePresetOneDark:"One Dark",statuslinePresetAyu:"Ayu",statuslinePresetKanagawa:"Kanagawa",statuslinePresetStealth:"Ẩn mình",statuslinePresetHacker:"Hacker",statuslineSaved:"Đã lưu thành công",statuslineSaveError:"Lưu thất bại",statusline:"Dòng trạng thái",statuslineCollapseSettings:"Thu gọn cài đặt",statuslineExpandSettings:"Mở rộng cài đặt",statuslineIconOverride:"Ghi đè biểu tượng",statuslineLabelOverride:"Ghi đè nhãn",statuslineMaxWidth:"Chiều rộng tối đa (ký tự)",statuslineIconPlaceholder:"vd. 🤖",statuslineMaxWidthPlaceholder:"tự động",statuslineCustomColors:"Màu tùy chỉnh",statuslineColorContextGroup:"Cửa sổ ngữ cảnh",statuslineColorQuotaGroup:"Hạn mức sử dụng",statuslineColorGeneralGroup:"Chung",statuslineColorSectionGroup:"Màu từng mục",statuslineColorContextLow:"Thấp (<50%)",statuslineColorContextMid:"Trung (50-75%)",statuslineColorContextHigh:"Cao (>75%)",statuslineColorAccent:"Nhấn mạnh",statuslineColorMuted:"Giảm nhạt",statuslineColorSeparator:"Dấu phân cách",statuslineModeFullDesc:"Hiển thị tất cả các mục",statuslineModeCompactDesc:"Hiển thị thu gọn",statuslineModeMinimalDesc:"Chỉ thông tin cần thiết",statuslineModeNoneDesc:"Đã tắt",statuslinePreviewTitle:"Claude Code — xem trước dòng trạng thái",statuslinePreviewEmptyLine:"(dòng trống)",statuslinePreviewNoLines:"(chưa cấu hình dòng nào)",statuslineSectionModelLabel:"Mô hình",statuslineSectionContextLabel:"Cửa sổ ngữ cảnh",statuslineSectionQuotaLabel:"Hạn mức sử dụng",statuslineSectionDirectoryLabel:"Thư mục",statuslineSectionGitLabel:"Trạng thái Git",statuslineSectionCostLabel:"Chi phí",statuslineSectionChangesLabel:"Thay đổi",statuslineSectionAgentsLabel:"Agents",statuslineSectionTodosLabel:"Nhiệm vụ",statuslineSectionModelDesc:"Tên mô hình AI và nhà cung cấp",statuslineSectionContextDesc:"Thanh sử dụng cửa sổ ngữ cảnh",statuslineSectionQuotaDesc:"Hạn mức sử dụng 5 giờ và hàng tuần",statuslineSectionDirectoryDesc:"Thư mục làm việc hiện tại",statuslineSectionGitDesc:"Nhánh Git, thay đổi đã/chưa staged",statuslineSectionCostDesc:"Ước tính chi phí phiên",statuslineSectionChangesDesc:"Dòng thêm và xóa",statuslineSectionAgentsDesc:"Hoạt động agent gần đây",statuslineSectionTodosDesc:"Tiến độ tác vụ hiện tại",statuslineSectionsVisible:"mục hiển thị",statuslineLoadErrorSaveDisabled:"Không thể tải bố cục đã lưu. Tính năng lưu đã bị tắt để tránh mất dữ liệu.",statuslineAddLine:"Thêm dòng",statuslineRemoveLine:"Xóa",statuslineHiddenSections:"Mục ẩn",statuslineDragToLine:"Kéo mục vào dòng để hiển thị",statuslineQuotaLow:"Hạn mức thấp",statuslineQuotaHigh:"Hạn mức cao",statuslineLine:"Dòng",sessionsTitle:"Phiên làm việc",sessionDetail:"Chi tiết phiên",sessionMessages:"tin nhắn",sessionToolCalls:"lệnh gọi",sessionDuration:"Thời lượng",noSessionsData:"Không tìm thấy phiên",sessionReadOnly:"Chế độ chỉ xem",sessionLastActive:"Hoạt động lần cuối",sessionProjectSessions:"Phiên dự án",sessionBack:"Quay lại",sessionLoading:"Đang tải...",sessionError:"Tải thất bại",sessionCount:"phiên",sessionToolInput:"Đầu vào",sessionToolResult:"Kết quả",sessionToolsUsed:"Công cụ đã dùng",sessionSystemContext:"Ngữ cảnh hệ thống",sessionExpandAll:"Mở rộng tất cả",sessionCollapseAll:"Thu gọn tất cả",sessionNoContent:"Không có nội dung",sessionUser:"Người dùng",sessionAssistant:"Trợ lý",sessionThinking:"Đang suy nghĩ...",sessionSearchPlaceholder:"Tìm trong hội thoại...",sessionSearchResults:"kết quả",sessionNoResults:"Không tìm thấy",sessionGroupMessages:"tin nhắn",palettePlaceholder:"Tìm agents, lệnh, skills...",paletteNoResults:"Không tìm thấy kết quả",paletteAgents:"Agents",paletteCommands:"Lệnh",paletteSkills:"Skills",paletteProjects:"Dự án",paletteNavigation:"Điều hướng",skillsBrowser:"Skills",skillsCount:"{count} skills",skillDetail:"Chi tiết Skill",searchSkillsBrowserPlaceholder:"Tìm skills...",noSkillsBrowserFound:"Không tìm thấy skill",backToSkillsBrowser:"Quay lại Skills",skillTriggers:"Kích hoạt",skillLocal:"Cục bộ",skillGithub:"GitHub",systemNavLabel:"Hệ thống",dashboardTitle:"Bảng điều khiển",dashboardAgents:"Agents",dashboardCommands:"Lệnh",dashboardSkills:"Skills",dashboardMcpServers:"MCP Servers",configured:"Đã cấu hình",available:"Có sẵn",modelDistribution:"Phân bổ Model",recentAgents:"Agents gần đây",suggestionsTitle:"Gợi ý",acrossAgents:"trên {count} agents",noAgentsConfigured:"Chưa có agents trong ~/.claude/agents/",mcpTitle:"MCP Servers",mcpServerName:"Server",mcpCommand:"Lệnh",mcpArgs:"Tham số",mcpSource:"Nguồn",mcpStatus:"Trạng thái",mcpConfigured:"Đã cấu hình",mcpNoServers:"Chưa cấu hình MCP server",mcpSourceSettings:"settings.json",mcpSourceMcpJson:".mcp.json",mcpSourceProject:"Dự án",mcpToolCount:"Công cụ",agentsBrowser:"Agents",agentsBrowserCount:"{count} agents",filterAll:"Tất cả",agentDetail:"Chi tiết Agent",agentInstructions:"Hướng dẫn",agentFrontmatter:"Cấu hình",searchAgentsPlaceholder:"Tìm agents...",noAgentsFound:"Không tìm thấy agent",backToAgents:"Quay lại Agents",commandsBrowser:"Lệnh",commandsCount:"{count} lệnh",commandDetail:"Chi tiết lệnh",searchCommandsPlaceholder:"Tìm lệnh...",noCommandsFound:"Không tìm thấy lệnh",backToCommands:"Quay lại Lệnh",rootCommands:"Gốc",selectToView:"Chọn mục để xem chi tiết",indexingFrom:"Lấy từ"}},_h=m.createContext(null),L0="ck-dashboard-lang";function U2(){const t=localStorage.getItem(L0);return t==="en"||t==="vi"?t:navigator.language.startsWith("vi")?"vi":"en"}function K2({children:t}){const[e,n]=m.useState(U2),r=m.useCallback(o=>{localStorage.setItem(L0,o),n(o)},[]),s=m.useCallback(o=>W2[e][o],[e]),i=m.useMemo(()=>({lang:e,setLang:r,t:s}),[e,r,s]);return c.jsx(_h.Provider,{value:i,children:t})}function X(){const t=m.useContext(_h);if(!t)throw new Error("useI18n must be used within I18nProvider");return t}class G2 extends m.Component{constructor(){super(...arguments);Yu(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){console.error("App error:",n,r.componentStack)}render(){if(this.state.hasError){const n=this.state.error?.name==="ServerUnavailableError";return c.jsx(_h.Consumer,{children:r=>c.jsx("div",{className:"flex h-screen items-center justify-center bg-dash-bg",children:c.jsx("div",{className:"text-center space-y-4 max-w-md px-6",children:n?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"w-16 h-16 mx-auto rounded-full bg-orange-500/10 border border-orange-500/30 flex items-center justify-center text-3xl",children:"🔌"}),c.jsx("h1",{className:"text-2xl font-bold text-orange-500",children:r?.t("serverNotRunning")??"Server Not Running"}),c.jsx("p",{className:"text-dash-text-secondary",children:r?.t("startServerMessage")??"The Config UI requires the backend server to be running."}),c.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-lg p-4",children:[c.jsx("p",{className:"text-xs text-dash-text-muted uppercase tracking-widest mb-2 font-bold",children:r?.t("runThisCommand")??"Run this command"}),c.jsx("code",{className:"block text-sm text-dash-accent font-mono bg-dash-bg px-3 py-2 rounded border border-dash-border",children:"ck config"})]}),c.jsx("button",{onClick:()=>window.location.reload(),className:"px-6 py-2 bg-dash-accent text-dash-bg rounded-lg font-bold hover:bg-dash-accent-hover transition-colors",children:r?.t("tryAgain")??"Try Again"})]}):c.jsxs(c.Fragment,{children:[c.jsx("h1",{className:"text-2xl font-bold text-red-500",children:r?.t("somethingWentWrong")??"Something went wrong"}),c.jsx("p",{className:"text-dash-text-muted",children:this.state.error?.message}),c.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-dash-accent text-white rounded-md hover:opacity-90",children:r?.t("reloadApp")??"Reload App"})]})})})})}return this.props.children}}const Jt=({direction:t="horizontal",isDragging:e=!1,onMouseDown:n})=>{const r=t==="horizontal";return c.jsx("div",{onMouseDown:n,className:`
|
|
23
|
+
group flex items-center justify-center shrink-0
|
|
24
|
+
${r?"w-2 cursor-col-resize":"h-2 cursor-row-resize"}
|
|
25
|
+
${e?"bg-dash-accent/20":"hover:bg-dash-surface-hover/50"}
|
|
26
|
+
transition-colors
|
|
27
|
+
`,children:c.jsx("div",{className:`
|
|
28
|
+
rounded-full transition-all
|
|
29
|
+
${r?"w-0.5 h-8":"h-0.5 w-8"}
|
|
30
|
+
${e?"bg-dash-accent":"bg-dash-border group-hover:bg-dash-text-muted"}
|
|
31
|
+
`})})},q2=[{type:"navigation",name:"Dashboard",description:"Project overview",route:"/"},{type:"navigation",name:"Config Editor",description:"Edit Claude configuration",route:"/config/global"},{type:"navigation",name:"Skills",description:"Browse and manage skills",route:"/skills"},{type:"navigation",name:"Migrate",description:"Migrate stack to other providers",route:"/migrate"},{type:"navigation",name:"Status Line",description:"Customize Claude Code statusline",route:"/statusline"},{type:"navigation",name:"System",description:"System updates and environment info",route:"/system"}];function Y2(t,e){if(!e.trim())return!0;const n=`${t.name} ${t.description}`.toLowerCase();return e.toLowerCase().trim().split(/\s+/).every(r=>n.includes(r))}function R0(t){const e=[];for(const n of t)n.children?e.push(...R0(n.children)):e.push({type:"command",name:n.name,description:n.description??"",route:`/commands?selected=${encodeURIComponent(n.path)}`});return e}function J2({projects:t}){const[e,n]=m.useState([]),[r,s]=m.useState(!0);m.useEffect(()=>{let l=!1;async function d(){const h=[],[u,f,p]=await Promise.allSettled([fetch("/api/agents/browser"),fetch("/api/commands"),fetch("/api/skills/browse")]);if(u.status==="fulfilled"&&u.value.ok)try{const g=await u.value.json();for(const x of g.agents??[])h.push({type:"agent",name:x.name||x.slug,description:x.description??"",route:`/agents?selected=${encodeURIComponent(x.slug)}`})}catch{}if(f.status==="fulfilled"&&f.value.ok)try{const g=await f.value.json();h.push(...R0(g.tree??[]))}catch{}if(p.status==="fulfilled"&&p.value.ok)try{const g=await p.value.json();for(const x of g.skills??[])h.push({type:"skill",name:x.name,description:x.description??"",route:`/skills?selected=${encodeURIComponent(x.name)}`})}catch{}l||(n(h),s(!1))}return d(),()=>{l=!0}},[]);const i=m.useMemo(()=>t.filter(l=>!l.path.endsWith("/.claude")&&l.path!=="~/.claude").map(l=>({type:"project",name:l.name||l.path.split("/").pop()||l.path,description:l.path,route:`/project/${l.id}`})),[t]),o=m.useMemo(()=>[...q2,...i,...e],[i,e]);return{search:m.useMemo(()=>l=>{const h=l.trim()?o.filter(f=>Y2(f,l)):o,u={project:[],navigation:[],agent:[],command:[],skill:[]};for(const f of h){const p=u[f.type];p.length<5&&p.push(f)}return u},[o]),loading:r}}const Nf=["navigation","project","agent","command","skill"],Q2={navigation:"bg-dash-accent/20 text-dash-accent",project:"bg-dash-text-muted/20 text-dash-text-muted",agent:"bg-[#e85d4a]/20 text-[#e85d4a]",command:"bg-blue-500/20 text-blue-400",skill:"bg-green-500/20 text-green-400"};function Pf({text:t,query:e}){if(!e.trim())return c.jsx("span",{children:t});const n=e.trim().toLowerCase().split(/\s+/).filter(Boolean).sort((i,o)=>o.length-i.length),r=[];let s=t;for(;s.length>0;){let i=-1,o=0,a="";for(const l of n){const d=s.toLowerCase().indexOf(l);d!==-1&&(i===-1||d<i||d===i&&l.length>o)&&(i=d,o=l.length,a=l)}if(i===-1||!a){r.push({text:s,match:!1});break}i>0&&r.push({text:s.slice(0,i),match:!1}),r.push({text:s.slice(i,i+o),match:!0}),s=s.slice(i+o)}return c.jsx("span",{children:r.map((i,o)=>i.match?c.jsx("mark",{className:"bg-dash-accent/30 text-dash-text rounded-sm px-0.5",children:i.text},`m${o}`):c.jsx("span",{children:i.text},`s${o}`))})}const X2=({open:t,projects:e,onClose:n})=>{const{t:r}=X(),s=tn(),i=m.useRef(null),o=m.useRef(null),[a,l]=m.useState(""),[d,h]=m.useState(0),{search:u,loading:f}=J2({projects:e}),p=u(a),g=Nf.flatMap(S=>p[S]??[]);m.useEffect(()=>{t&&(l(""),h(0),setTimeout(()=>i.current?.focus(),0))},[t]),m.useEffect(()=>{o.current?.querySelector(`[data-idx="${d}"]`)?.scrollIntoView({block:"nearest"})},[d]);const x=m.useCallback(S=>{s(S.route),n()},[s,n]),b=m.useCallback(S=>{if(S.key==="Escape"){n();return}if(S.key==="ArrowDown"){S.preventDefault(),h(k=>Math.min(k+1,g.length-1));return}if(S.key==="ArrowUp"){S.preventDefault(),h(k=>Math.max(k-1,0));return}if(S.key==="Enter"){S.preventDefault();const k=g[d];k&&x(k)}},[g,d,n,x]),y=S=>{l(S.target.value),h(0)};if(!t)return null;let w=0;const C=S=>{switch(S){case"navigation":return r("paletteNavigation");case"project":return r("paletteProjects");case"agent":return r("paletteAgents");case"command":return r("paletteCommands");case"skill":return r("paletteSkills")}};return c.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[12vh]",style:{background:"rgba(0,0,0,0.5)",backdropFilter:"blur(4px)"},"aria-label":"Search",onClick:n,onKeyDown:S=>S.key==="Escape"&&n(),children:c.jsxs("div",{className:"w-full max-w-[600px] mx-4 bg-dash-surface border border-dash-border rounded-xl shadow-2xl overflow-hidden",onClick:S=>S.stopPropagation(),onKeyDown:S=>S.stopPropagation(),children:[c.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-dash-border",children:[c.jsx("svg",{className:"w-4 h-4 text-dash-text-muted shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),c.jsx("input",{ref:i,type:"text",className:"flex-1 bg-transparent text-dash-text placeholder:text-dash-text-muted text-base outline-none",placeholder:r("palettePlaceholder"),value:a,onChange:y,onKeyDown:b,autoComplete:"off",spellCheck:!1}),c.jsx("kbd",{className:"hidden sm:block text-[10px] text-dash-text-muted bg-dash-surface border border-dash-border rounded px-1.5 py-0.5",children:"esc"})]}),c.jsxs("div",{ref:o,className:"max-h-[420px] overflow-y-auto py-2",children:[f&&c.jsx("div",{className:"px-4 py-6 text-center text-dash-text-muted text-sm",children:r("loading")}),!f&&g.length===0&&c.jsx("div",{className:"px-4 py-6 text-center text-dash-text-muted text-sm",children:r("paletteNoResults")}),!f&&Nf.map(S=>{const k=p[S];if(!k||k.length===0)return null;const N=C(S);return c.jsxs("div",{children:[c.jsx("div",{className:"px-4 py-1.5 text-[10px] font-semibold uppercase tracking-widest text-dash-text-muted",children:N}),k.map(v=>{const P=w++,O=P===d;return c.jsxs("button",{type:"button","data-idx":P,className:`w-full flex items-center gap-3 px-4 py-2.5 text-left cursor-pointer transition-colors ${O?"bg-dash-accent/10 text-dash-text":"text-dash-text hover:bg-dash-surface"}`,onClick:()=>x(v),onMouseEnter:()=>h(P),children:[c.jsx("span",{className:`shrink-0 text-[10px] font-medium px-1.5 py-0.5 rounded ${Q2[S]}`,children:N}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"text-sm font-medium truncate",children:c.jsx(Pf,{text:v.name,query:a})}),v.description&&c.jsx("div",{className:"text-xs text-dash-text-muted truncate mt-0.5",children:c.jsx(Pf,{text:v.description,query:a})})]}),O&&c.jsx("kbd",{className:"shrink-0 text-[10px] text-dash-text-muted bg-dash-surface border border-dash-border rounded px-1.5 py-0.5",children:"↵"})]},`${S}-${v.route}`)})]},S)})]}),g.length>0&&c.jsxs("div",{className:"px-4 py-2 border-t border-dash-border flex gap-4 text-[10px] text-dash-text-muted",children:[c.jsx("span",{children:"↑↓ navigate"}),c.jsx("span",{children:"↵ select"}),c.jsx("span",{children:"esc close"})]})]})})};function Z2(){const[t,e]=m.useState(null),[n,r]=m.useState(!0),[s,i]=m.useState(null);return m.useEffect(()=>{let o=!1;async function a(){r(!0),i(null);try{const l=await fetch("/api/dashboard/stats");if(!l.ok)throw new Error(`Dashboard stats fetch failed: ${l.status}`);const d=await l.json();if(o)return;e({agents:d.agents??0,commands:d.commands??0,skills:d.skills??0,mcpServers:d.mcpServers??0})}catch(l){if(o)return;i(l instanceof Error?l.message:"Failed to load counts")}finally{o||r(!1)}}return a(),()=>{o=!0}},[]),{counts:t,loading:n,error:s}}var nr=(t=>(t.HEALTHY="healthy",t.WARNING="warning",t.ERROR="error",t.LOADING="loading",t.UNKNOWN="unknown",t))(nr||{}),jn=(t=>(t.ENGINEER="engineer",t.MARKETING="marketing",t.ARCHITECT="architect",t.RESEARCHER="researcher",t.DEVOP="devops",t))(jn||{});const ek=({isOpen:t,onClose:e,onAdd:n})=>{const{t:r}=X(),[s,i]=m.useState(""),[o,a]=m.useState(""),[l,d]=m.useState(!1),[h,u]=m.useState(null);m.useEffect(()=>{t||(i(""),a(""),u(null),d(!1))},[t]),m.useEffect(()=>{if(!t)return;const p=g=>{g.key==="Escape"&&e()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t]),m.useEffect(()=>{if(!t)return;const p=document.activeElement;return document.querySelector("#project-path")?.focus(),()=>{p?.focus()}},[t]);const f=async p=>{if(p.preventDefault(),!s.trim()){u(r("pathRequired"));return}try{d(!0),u(null);const g={path:s.trim(),...o.trim()&&{alias:o.trim()}};await n(g),e()}catch(g){u(g instanceof Error?g.message:r("failedToAdd"))}finally{d(!1)}};return t?c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:e,children:c.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-lg shadow-xl max-w-md w-full mx-4",onClick:p=>p.stopPropagation(),children:[c.jsxs("div",{className:"px-6 py-4 border-b border-dash-border",children:[c.jsx("h2",{className:"text-lg font-bold text-dash-text",children:r("addProjectTitle")}),c.jsx("p",{className:"text-sm text-dash-text-muted mt-1",children:r("addProjectDescription")})]}),c.jsxs("form",{onSubmit:f,className:"p-6 space-y-4",children:[c.jsxs("div",{children:[c.jsxs("label",{htmlFor:"project-path",className:"block text-sm font-medium text-dash-text mb-2",children:[r("projectPath")," ",c.jsx("span",{className:"text-red-500",children:"*"})]}),c.jsx("input",{id:"project-path",type:"text",value:s,onChange:p=>i(p.target.value),placeholder:r("pathPlaceholder"),disabled:l,className:"w-full px-3 py-2 bg-dash-bg border border-dash-border rounded-md text-dash-text placeholder-dash-text-muted focus:outline-none focus:ring-2 focus:ring-dash-accent focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed"})]}),c.jsxs("div",{children:[c.jsxs("label",{htmlFor:"project-alias",className:"block text-sm font-medium text-dash-text mb-2",children:[r("alias")," ",r("aliasOptional")]}),c.jsx("input",{id:"project-alias",type:"text",value:o,onChange:p=>a(p.target.value),placeholder:r("aliasPlaceholder"),disabled:l,className:"w-full px-3 py-2 bg-dash-bg border border-dash-border rounded-md text-dash-text placeholder-dash-text-muted focus:outline-none focus:ring-2 focus:ring-dash-accent focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed"}),c.jsx("p",{className:"text-xs text-dash-text-muted mt-1",children:r("aliasDescription")})]}),h&&c.jsx("div",{className:"px-3 py-2 bg-red-500/10 border border-red-500/20 rounded-md",children:c.jsx("p",{className:"text-sm text-red-500",children:h})}),c.jsxs("div",{className:"flex gap-3 pt-2",children:[c.jsx("button",{type:"button",onClick:e,disabled:l,className:"flex-1 px-4 py-2 border border-dash-border rounded-md text-dash-text-secondary hover:bg-dash-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:r("cancel")}),c.jsx("button",{type:"submit",disabled:l||!s.trim(),className:"flex-1 px-4 py-2 bg-dash-accent text-white rounded-md hover:bg-dash-accent/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:r(l?"adding":"addProject")})]})]})]})}):null},tk=({vertical:t=!1})=>{const{lang:e,setLang:n}=X();return c.jsxs("div",{className:`flex ${t?"flex-col":""} items-center rounded-lg border border-dash-border overflow-hidden`,children:[c.jsx("button",{onClick:()=>n("en"),className:`px-2 py-1 text-xs font-medium transition-colors ${e==="en"?"bg-dash-accent text-dash-bg":"text-dash-text-muted hover:bg-dash-surface-hover"}`,title:"English",children:"EN"}),c.jsx("button",{onClick:()=>n("vi"),className:`px-2 py-1 text-xs font-medium transition-colors ${e==="vi"?"bg-dash-accent text-dash-bg":"text-dash-text-muted hover:bg-dash-surface-hover"}`,title:"Tiếng Việt",children:"VI"})]})},nk=({projects:t,currentProjectId:e,isCollapsed:n,width:r,isConnected:s,theme:i,onSwitchProject:o,onToggle:a,onAddProject:l,onToggleTheme:d})=>{const{t:h}=X(),u=tn(),f=un(),[p,g]=m.useState(!1),{counts:x}=Z2(),b=f.pathname==="/"||f.pathname==="/dashboard",y=b,w=f.pathname==="/config/global",C=f.pathname==="/migrate",S=f.pathname==="/statusline",k=f.pathname==="/mcp",N=f.pathname==="/agents",v=f.pathname==="/commands",P=f.pathname==="/skills",O=[...t].filter($=>!$.path.endsWith("/.claude")&&$.path!=="~/.claude").sort(($,F)=>$.pinned&&!F.pinned?-1:!$.pinned&&F.pinned?1:$.name.localeCompare(F.name)),E=r?{width:`${r}px`}:void 0,M=r?"":n?"w-14":"w-72",D=r?r>=160:!n;return c.jsxs("aside",{style:E,className:`${M} bg-dash-surface border-r border-dash-border flex flex-col transition-all duration-300 ease-in-out z-20 h-full overflow-hidden`,children:[c.jsxs("div",{className:`flex items-center ${D?"p-6 gap-3":"p-2 justify-center"}`,children:[c.jsx("img",{src:"/images/logo-transparent-32.png",alt:"ClaudeKit",className:"w-8 h-8 shrink-0"}),D&&c.jsxs("div",{className:"overflow-hidden",children:[c.jsx("h1",{className:"text-sm font-bold truncate tracking-tight text-dash-text",children:"ClaudeKit"}),c.jsx("p",{className:"text-[10px] text-dash-text-muted font-medium uppercase tracking-wider",children:h("controlCenter")})]})]}),c.jsxs("div",{className:`${D?"px-4":"px-2"} py-2 space-y-1`,children:[D&&c.jsx("p",{className:"px-2 pb-2 text-[10px] font-bold text-dash-text-muted uppercase tracking-widest",children:h("overviewSection")}),c.jsx(qn,{icon:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"})}),label:h("systemNavLabel"),isCollapsed:!D,active:b,onClick:()=>u("/")})]}),c.jsxs("div",{className:`${D?"px-4":"px-2"} py-2 space-y-1 border-t border-dash-border`,children:[D&&c.jsx("p",{className:"px-2 pb-2 pt-2 text-[10px] font-bold text-dash-text-muted uppercase tracking-widest",children:h("entitiesSection")}),c.jsx(qn,{icon:c.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z"})}),label:h("agentsBrowser"),isCollapsed:!D,active:N,onClick:()=>u("/agents"),badge:D&&x?String(x.agents):void 0}),c.jsx(qn,{icon:c.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),label:h("commandsBrowser"),isCollapsed:!D,active:v,onClick:()=>u("/commands"),badge:D&&x?String(x.commands):void 0}),c.jsx(qn,{icon:c.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})}),label:h("skillsNav"),isCollapsed:!D,active:P,onClick:()=>u("/skills"),badge:D&&x?String(x.skills):void 0}),c.jsx(qn,{icon:c.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 12h14M12 5l7 7-7 7"})}),label:h("mcpTitle"),isCollapsed:!D,active:k,onClick:()=>u("/mcp"),badge:D&&x?String(x.mcpServers):void 0})]}),c.jsxs("div",{className:`${D?"px-4":"px-2"} py-2 space-y-1 border-t border-dash-border`,children:[D&&c.jsx("p",{className:"px-2 pb-2 pt-2 text-[10px] font-bold text-dash-text-muted uppercase tracking-widest",children:h("toolsSection")}),c.jsx(qn,{icon:c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),label:h("configEditor"),isCollapsed:!D,active:w,onClick:()=>u("/config/global")}),c.jsx(qn,{icon:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 10V7m0 10a2 2 0 002 2h2a2 2 0 002-2V7a2 2 0 00-2-2h-2a2 2 0 00-2 2"})}),label:h("statusline"),isCollapsed:!D,active:S,onClick:()=>u("/statusline")}),c.jsx(qn,{icon:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 4a2 2 0 114 0v1a1 1 0 001 1h3a1 1 0 011 1v3a1 1 0 01-1 1h-1a2 2 0 100 4h1a1 1 0 011 1v3a1 1 0 01-1 1h-3a1 1 0 01-1-1v-1a2 2 0 10-4 0v1a1 1 0 01-1 1H7a1 1 0 01-1-1v-3a1 1 0 00-1-1H4a2 2 0 110-4h1a1 1 0 001-1V7a1 1 0 011-1h3a1 1 0 001-1V4z"})}),label:h("migrate"),isCollapsed:!D,active:C,onClick:()=>u("/migrate")})]}),c.jsxs("div",{className:`flex-1 overflow-y-auto overflow-x-hidden ${D?"px-4":"px-2"} py-2 space-y-1 border-t border-dash-border`,children:[D&&c.jsx("p",{className:"px-2 pb-2 pt-2 text-[10px] font-bold text-dash-text-muted uppercase tracking-widest",children:h("projects")}),O.map($=>{const F=f.pathname.endsWith("/config"),z=e===$.id&&!w&&!F&&!C&&!S&&!k&&!N&&!v&&!P&&!y;return c.jsxs("button",{onClick:()=>o($.id),className:`w-full group relative flex items-center ${D?"gap-2.5 px-2 py-1.5":"justify-center p-2"} rounded-md transition-colors ${z?"bg-dash-accent-subtle text-dash-accent border border-dash-accent/10":"text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text border border-transparent"}`,children:[c.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${$.health===nr.HEALTHY?"bg-dash-accent":$.health===nr.WARNING?"bg-orange-400":"bg-red-500"} ${z?"animate-pulse":""}`}),D&&c.jsxs(c.Fragment,{children:[$.pinned&&c.jsx("span",{className:"text-xs",children:"📌"}),c.jsx("span",{className:"text-sm font-medium truncate",children:$.name})]}),!D&&c.jsxs("div",{className:"absolute left-14 px-2 py-1 bg-dash-text text-dash-bg text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none border border-dash-border z-50",children:[$.pinned&&"📌 ",$.name]})]},$.id)}),c.jsxs("button",{onClick:()=>g(!0),className:`w-full flex items-center ${D?"gap-3 p-2.5":"justify-center p-2"} rounded-md text-dash-text-muted hover:bg-dash-surface-hover hover:text-dash-text-secondary transition-colors mt-4`,children:[c.jsx("div",{className:`${D?"w-5 h-5":""} flex items-center justify-center`,children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}),D&&c.jsx("span",{className:"text-sm font-medium",children:h("addProject")})]})]}),c.jsx(ek,{isOpen:p,onClose:()=>g(!1),onAdd:l}),c.jsx("div",{className:"border-t border-dash-border",children:c.jsxs("div",{className:`py-3 flex items-center ${D?"px-3 justify-between":"justify-center flex-col gap-2"}`,children:[c.jsxs("div",{className:"flex items-center gap-2",title:h(s?"sync":"offline"),children:[c.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${s?"bg-dash-accent shadow-[0_0_8px_var(--dash-accent-glow)]":"bg-red-500"}`}),D&&c.jsx("span",{className:"text-[10px] font-bold text-dash-text-muted uppercase tracking-widest",children:h(s?"sync":"offline")})]}),c.jsxs("div",{className:`flex items-center gap-1 ${D?"":"flex-col"}`,children:[c.jsx(tk,{vertical:!D}),c.jsx("button",{onClick:d,className:"w-8 h-8 rounded-lg flex items-center justify-center text-dash-text-muted hover:bg-dash-surface-hover hover:text-dash-text transition-colors",title:h(i==="dark"?"switchToLight":"switchToDark"),children:i==="dark"?c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364-6.364l-.707.707M6.343 17.657l-.707.707M17.657 17.657l-.707-.707M6.343 6.343l-.707-.707M12 5a7 7 0 100 14 7 7 0 000-14z"})}):c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})})}),c.jsx("button",{onClick:a,className:"w-8 h-8 rounded-lg flex items-center justify-center text-dash-text-muted hover:bg-dash-surface-hover hover:text-dash-text transition-colors",title:h(n?"expand":"collapse"),children:n?c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M5 5l7 7-7 7"})}):c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 19l-7-7 7-7m8 14l-7-7 7-7"})})})]})]})})]})},qn=({icon:t,label:e,badge:n,isCollapsed:r,active:s,onClick:i,disabled:o})=>c.jsxs("button",{onClick:i,disabled:o,className:`w-full group relative flex items-center ${r?"justify-center p-2":"gap-3 p-2"} rounded-md transition-colors ${o?"opacity-50 cursor-not-allowed":s?"bg-dash-surface-hover text-dash-text":"text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text"}`,children:[c.jsx("div",{className:`${r?"":"w-5 h-5"} flex items-center justify-center`,children:t}),!r&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-sm font-medium flex-1 text-left",children:e}),n&&c.jsx("span",{className:"ml-auto text-[10px] font-mono text-dash-text-disabled bg-dash-surface px-1.5 py-0.5 rounded",children:n})]}),r&&c.jsx("div",{className:"absolute left-14 px-2 py-1 bg-dash-text text-dash-bg text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none border border-dash-border z-50",children:e})]}),kt="/api";class vc extends Error{constructor(){super("Backend server is not running. Start it with: ck config"),this.name="ServerUnavailableError"}}async function nn(){try{if(!(await fetch(`${kt}/health`,{method:"GET"})).ok)throw new vc}catch(t){throw t instanceof vc?t:new vc}}function Wh(t){return{id:t.id,name:t.name,path:t.path,health:t.health,kitType:t.kitType||"engineer",model:t.model,activeHooks:t.activeHooks,mcpServers:t.mcpServers,skills:t.skills,pinned:t.pinned,tags:t.tags,addedAt:t.addedAt,lastOpened:t.lastOpened,preferences:t.preferences}}async function I0(){await nn();const t=await fetch(`${kt}/projects`);if(!t.ok)throw new Error("Failed to fetch projects");return(await t.json()).map(Wh)}async function rk(){await nn();const t=await fetch(`${kt}/skills`);if(!t.ok)throw new Error("Failed to fetch skills");return t.json()}async function sk(t,e){try{await nn();const n=e!==void 0?`?limit=${e}`:"",r=await fetch(`${kt}/sessions/${encodeURIComponent(t)}${n}`);return r.ok?r.json():[]}catch{return[]}}async function ik(t,e){await nn();const n=new URLSearchParams;t&&n.set("projectId",t);const r=await fetch(`${kt}/actions/options?${n.toString()}`,{signal:e});if(!r.ok)throw new Error("Failed to fetch action options");return r.json()}async function ok(t,e,n,r){await nn();const s=await fetch(`${kt}/actions/open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:t,path:e,appId:n,projectId:r})});if(!s.ok){const i=await s.json().catch(()=>({error:"Action failed"}));throw new Error(i.error||"Action failed")}}async function ak(){await nn();try{const r=await fetch(`${kt}/settings/raw`);if(r.ok)return r.json()}catch{}const t=await fetch(`${kt}/settings`);if(!t.ok)throw new Error("Failed to fetch settings file");const e=await t.json(),n=e.settings&&typeof e.settings=="object"?e.settings:{model:e.model,permissions:e.permissions,hookCount:e.hookCount,mcpServerCount:e.mcpServerCount};return{path:e.settingsPath??"~/.claude/settings.json",exists:e.settingsExists??!0,settings:n}}async function lk(t){await nn();const e=await fetch(`${kt}/settings/raw`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:t})});if(!e.ok){const n=await e.json().catch(()=>({error:"Failed to save settings file"}));throw new Error(n.error||"Failed to save settings file")}return e.json()}async function ck(t){await nn();const e=await fetch(`${kt}/projects`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!e.ok){const r=await e.text();throw new Error(r||"Failed to add project")}const n=await e.json();return Wh(n)}async function dk(t){await nn();const e=await fetch(`${kt}/projects/${encodeURIComponent(t)}`,{method:"DELETE"});if(!e.ok){const n=await e.text();throw new Error(n||"Failed to remove project")}}async function $0(t,e){await nn();const n=await fetch(`${kt}/projects/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok){const s=await n.text();throw new Error(s||"Failed to update project")}const r=await n.json();return Wh(r)}async function hk(){const t=await fetch(`${kt}/metadata/global`);return t.ok?t.json():(console.error("Failed to fetch global metadata"),{})}async function uk(){await nn();const t=await fetch(`${kt}/migrate/providers`);if(!t.ok)throw new Error("Failed to fetch migration providers");return t.json()}async function Of(){await nn();const t=await fetch(`${kt}/migrate/discovery`);if(!t.ok)throw new Error("Failed to discover migration items");return t.json()}function fk(){const[t,e]=m.useState([]),[n,r]=m.useState(!0),[s,i]=m.useState(null),o=m.useCallback(async()=>{try{r(!0),i(null);const a=await rk();e(a)}catch(a){i(a instanceof Error?a.message:"Failed to load skills")}finally{r(!1)}},[]);return m.useEffect(()=>{o()},[o]),{skills:t,loading:n,error:s,reload:o}}function pk(t){const[e,n]=m.useState([]),[r,s]=m.useState(!1),[i,o]=m.useState(null),a=m.useCallback(async()=>{if(!t){n([]);return}try{s(!0),o(null);const l=await sk(t,999);n(l)}catch(l){o(l instanceof Error?l.message:"Failed to load sessions")}finally{s(!1)}},[t]);return m.useEffect(()=>{a()},[a]),{sessions:e,loading:r,error:i,reload:a}}function mk(){const[t,e]=m.useState([]),[n,r]=m.useState(!0),[s,i]=m.useState(null),o=m.useCallback(async()=>{try{r(!0),i(null);const h=await I0();e(h)}catch(h){i(h instanceof Error?h.message:"Failed to load projects")}finally{r(!1)}},[]),a=m.useCallback(async h=>{const u=await ck(h);return await o(),u},[o]),l=m.useCallback(async h=>{await dk(h),await o()},[o]),d=m.useCallback(async(h,u)=>{const f=await $0(h,u);return await o(),f},[o]);return m.useEffect(()=>{o()},[o]),{projects:t,loading:n,error:s,reload:o,addProject:a,removeProject:l,updateProject:d}}function gk(){return typeof window<"u"&&"__TAURI_INTERNALS__"in window}function xk(t,e,n=50,r=0){const[s,i]=m.useState(null),[o,a]=m.useState(!1),[l,d]=m.useState(null),h=m.useCallback(async()=>{if(!t||!e){i(null);return}try{a(!0),d(null);const u=new URLSearchParams({limit:String(n),offset:String(r)}),f=await fetch(`/api/sessions/${encodeURIComponent(t)}/${encodeURIComponent(e)}?${u.toString()}`);if(!f.ok)throw new Error(`HTTP ${f.status}`);const p=await f.json();i(p)}catch(u){d(u instanceof Error?u.message:"Failed to load")}finally{a(!1)}},[t,e,n,r]);return m.useEffect(()=>{h()},[h]),{data:s,loading:o,error:l,reload:h}}const bk="modulepreload",yk=function(t){return"/"+t},Mf={},Af=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=o?.nonce||o?.getAttribute("nonce");s=Promise.allSettled(n.map(l=>{if(l=yk(l),l in Mf)return;Mf[l]=!0;const d=l.endsWith(".css"),h=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${h}`))return;const u=document.createElement("link");if(u.rel=d?"stylesheet":bk,d||(u.as="script"),u.crossOrigin="",u.href=l,a&&u.setAttribute("nonce",a),document.head.appendChild(u),d)return new Promise((f,p)=>{u.addEventListener("load",f),u.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return e().catch(i)})};function vk(){const[t,e]=m.useState(!1);return m.useEffect(()=>{if(!gk())return;let n=!1,r;return Promise.all([Af(()=>import("./event-BR0sBAas.js"),__vite__mapDeps([0,1])),Af(()=>import("./index-Bnd1bUG3.js"),__vite__mapDeps([2,1]))]).then(([{listen:s},{check:i}])=>{n||s("check-updates",async()=>{try{(await i())?.available&&e(!0)}catch{}}).then(o=>{if(n){o();return}r=o})}),()=>{n=!0,r?.()}},[]),{updateAvailable:t}}function Ms({storageKey:t,defaultSize:e,minSize:n,maxSize:r,direction:s="horizontal",invert:i=!1}){const[o,a]=m.useState(()=>{if(typeof window>"u")return e;const p=localStorage.getItem(t);if(p){const g=Number.parseInt(p,10);if(!Number.isNaN(g)&&g>=n&&g<=r)return g}return e}),[l,d]=m.useState(!1);m.useEffect(()=>{localStorage.setItem(t,String(o))},[o,t]);const h=m.useCallback(p=>{p.preventDefault(),d(!0);const g=s==="horizontal"?p.clientX:p.clientY,x=o,b=w=>{const S=((s==="horizontal"?w.clientX:w.clientY)-g)*(i?-1:1),k=Math.max(n,Math.min(r,x+S));a(k)},y=()=>{d(!1),document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",y),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",b),document.addEventListener("mouseup",y),document.body.style.cursor=s==="horizontal"?"col-resize":"row-resize",document.body.style.userSelect="none"},[o,n,r,s,i]),u=m.useCallback(()=>{a(e)},[e]),f=m.useCallback(p=>{a(Math.max(n,Math.min(r,p)))},[n,r]);return{size:o,isDragging:l,startDrag:h,setSize:f,reset:u}}const wk=()=>{const{t}=X(),e=tn(),n=un(),{projectId:r}=Bh();vk();const[s,i]=m.useState(null);m.useEffect(()=>{r&&i(r)},[r]);const[o,a]=m.useState(()=>typeof window<"u"&&localStorage.getItem("claudekit-theme")||"dark"),[l]=m.useState(!0),[d,h]=m.useState(!1);m.useEffect(()=>{const O=E=>{(E.metaKey||E.ctrlKey)&&E.key==="k"&&(E.preventDefault(),h(M=>!M))};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[]);const{size:u,isDragging:f,startDrag:p,setSize:g}=Ms({storageKey:"claudekit-sidebar-width",defaultSize:288,minSize:56,maxSize:400}),x=u<=56,{projects:b,loading:y,error:w,addProject:C}=mk(),S=async O=>{await C(O)};m.useEffect(()=>{const O=n.pathname.startsWith("/project/");b.length===0||r||!O||e(`/project/${b[0].id}`,{replace:!0})},[b,r,e,n.pathname]),m.useEffect(()=>{const O=window.document.documentElement;o==="dark"?(O.classList.add("dark"),O.setAttribute("data-theme","dark")):(O.classList.remove("dark"),O.setAttribute("data-theme","light")),localStorage.setItem("claudekit-theme",o)},[o]);const k=()=>a(O=>O==="light"?"dark":"light"),N=m.useMemo(()=>b.find(O=>O.id===s)||null,[b,s]),v=O=>{e(`/project/${O}`)},P=()=>{g(x?288:56)};return y?c.jsx("div",{className:"flex h-screen w-full bg-dash-bg text-dash-text items-center justify-center",children:c.jsx("div",{className:"animate-pulse text-dash-text-muted",children:t("loading")})}):w?c.jsx("div",{className:"flex h-screen w-full bg-dash-bg text-dash-text items-center justify-center",children:c.jsxs("div",{className:"text-red-500",children:[t("error"),": ",w]})}):c.jsxs("div",{className:"flex h-screen w-full bg-dash-bg text-dash-text overflow-hidden font-sans transition-colors duration-300",children:[c.jsx(X2,{open:d,projects:b,onClose:()=>h(!1)}),c.jsx(nk,{projects:b,currentProjectId:s,isCollapsed:x,width:u,isConnected:l,theme:o,onSwitchProject:v,onToggle:P,onAddProject:S,onToggleTheme:k}),c.jsx(Jt,{direction:"horizontal",isDragging:f,onMouseDown:p}),c.jsx("div",{className:"flex-1 flex flex-col min-w-0 h-full relative",children:c.jsx("main",{className:"flex-1 flex flex-col overflow-hidden p-4 md:p-6",children:c.jsx(s2,{context:{project:N,isConnected:l,theme:o,onToggleTheme:k}})})})]})};function Cr(t,e){const n=/(\*\*(.+?)\*\*|\*(.+?)\*|_(.+?)_|`([^`]+)`|\[([^\]]+)\]\(([^)]+)\))/g,r=[];let s=0,i=0;for(const o of t.matchAll(n)){o.index!==void 0&&o.index>s&&r.push(t.slice(s,o.index));const a=`${e}-inline-${i++}`;o[0].startsWith("**")?r.push(c.jsx("strong",{children:o[2]},a)):o[0].startsWith("`")?r.push(c.jsx("code",{className:"bg-[var(--dash-surface)] border border-[var(--dash-border)] px-1.5 py-0.5 rounded text-sm font-mono text-[var(--dash-accent)]",children:o[5]},a)):o[0].startsWith("[")?r.push(c.jsx("a",{href:o[7],target:"_blank",rel:"noopener noreferrer",className:"text-[var(--dash-accent)] hover:underline",children:o[6]},a)):r.push(c.jsx("em",{children:o[3]??o[4]},a)),o.index!==void 0&&(s=o.index+o[0].length)}return s<t.length&&r.push(t.slice(s)),r.length===1?r[0]:c.jsx(c.Fragment,{children:r})}const As=({content:t,className:e=""})=>{const n=t.split(`
|
|
32
|
+
`),r=[];let s=0,i=0;function o(){return i+=1,`md-${i}`}if(n[0]?.trim()==="---"){for(s=1;s<n.length&&n[s]?.trim()!=="---";)s++;s++}for(;s<n.length;){const a=n[s];if(a.startsWith("```")){const l=a.slice(3).trim(),d=[];for(s++;s<n.length&&!n[s].startsWith("```");)d.push(n[s]),s++;const h=o();r.push(c.jsxs("div",{className:"my-3",children:[l&&c.jsx("div",{className:"text-[10px] font-mono text-[var(--dash-text-muted)] bg-[var(--dash-surface)] border border-b-0 border-[var(--dash-border)] rounded-t px-3 py-1",children:l}),c.jsx("pre",{className:["overflow-x-auto p-4 text-xs font-mono text-[var(--dash-text)]","bg-[var(--dash-surface)] border border-[var(--dash-border)]",l?"rounded-b":"rounded"].join(" "),children:c.jsx("code",{children:d.join(`
|
|
33
|
+
`)})})]},h)),s++;continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(a.trim())){r.push(c.jsx("hr",{className:"border-[var(--dash-border)] my-4"},o())),s++;continue}if(a.startsWith("### ")){r.push(c.jsx("h3",{className:"text-sm font-semibold text-[var(--dash-text)] mt-4 mb-1",children:Cr(a.slice(4),`h3-${i}`)},o())),s++;continue}if(a.startsWith("## ")){r.push(c.jsx("h2",{className:"text-base font-semibold text-[var(--dash-text)] mt-5 mb-2 pb-1 border-b border-[var(--dash-border)]",children:Cr(a.slice(3),`h2-${i}`)},o())),s++;continue}if(a.startsWith("# ")){r.push(c.jsx("h1",{className:"text-xl font-bold text-[var(--dash-text)] mt-4 mb-2 first:mt-0",children:Cr(a.slice(2),`h1-${i}`)},o())),s++;continue}if(a.startsWith("> ")){const l=[];for(;s<n.length&&n[s].startsWith("> ");)l.push(n[s].slice(2)),s++;const d=o();r.push(c.jsx("blockquote",{className:"border-l-2 border-[var(--dash-accent)] pl-4 italic text-[var(--dash-text-muted)] my-2",children:l.map((h,u)=>c.jsx("p",{className:"text-sm leading-relaxed",children:Cr(h,`${d}-q${u}`)},`${d}-q${u}`))},d));continue}if(/^\s*[-*+] /.test(a)){const l=[];for(;s<n.length&&/^\s*[-*+] /.test(n[s]);)l.push(n[s].replace(/^\s*[-*+] /,"")),s++;const d=o();r.push(c.jsx("ul",{className:"list-disc pl-6 space-y-1 my-2",children:l.map((h,u)=>c.jsx("li",{className:"text-sm text-[var(--dash-text)] leading-relaxed",children:Cr(h,`${d}-li${u}`)},`${d}-li${u}`))},d));continue}if(/^\d+\. /.test(a)){const l=[];for(;s<n.length&&/^\d+\. /.test(n[s]);)l.push(n[s].replace(/^\d+\. /,"")),s++;const d=o();r.push(c.jsx("ol",{className:"list-decimal pl-6 space-y-1 my-2",children:l.map((h,u)=>c.jsx("li",{className:"text-sm text-[var(--dash-text)] leading-relaxed",children:Cr(h,`${d}-ol${u}`)},`${d}-ol${u}`))},d));continue}if(a.trim()===""){r.push(c.jsx("div",{className:"h-2"},o())),s++;continue}r.push(c.jsx("p",{className:"text-sm text-[var(--dash-text)] leading-relaxed my-1",children:Cr(a,`p-${i}`)},o())),s++}return c.jsx("div",{className:`markdown-content ${e}`.trim(),children:r})};function kk(){const[t,e]=m.useState([]),[n,r]=m.useState(!0),[s,i]=m.useState(null),o=m.useCallback(async()=>{try{r(!0),i(null);const a=await fetch("/api/agents/browser");if(!a.ok)throw new Error(`Request failed: ${a.status}`);const l=await a.json();e(l.agents)}catch(a){i(a instanceof Error?a.message:"Failed to load agents")}finally{r(!1)}},[]);return m.useEffect(()=>{o()},[o]),{agents:t,loading:n,error:s,reload:o}}function Sk(t){const[e,n]=m.useState(null),[r,s]=m.useState(!1),[i,o]=m.useState(null),a=m.useCallback(async()=>{if(t)try{s(!0),o(null);const l=await fetch(`/api/agents/browser/${encodeURIComponent(t)}`);if(l.status===404)throw new Error("Agent not found");if(!l.ok)throw new Error(`Request failed: ${l.status}`);const d=await l.json();n(d)}catch(l){o(l instanceof Error?l.message:"Failed to load agent")}finally{s(!1)}},[t]);return m.useEffect(()=>{a()},[a]),{agent:e,loading:r,error:i}}function Ck(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3.5 h-3.5 shrink-0 text-dash-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 3.104v5.714a2.25 2.25 0 01-.659 1.591L5 14.5M9.75 3.104c-.251.023-.501.05-.75.082m.75-.082a24.301 24.301 0 014.5 0m0 0v5.714a2.25 2.25 0 001.357 2.059l1.045.467A4.5 4.5 0 0121 15.75v.75m-4.5-6.75a.75.75 0 00-.75.75v3a.75.75 0 001.5 0v-3a.75.75 0 00-.75-.75z"})})}function B0(t){if(!t)return"unset";const e=t.toLowerCase();return e.includes("opus")?"opus":e.includes("sonnet")?"sonnet":e.includes("haiku")?"haiku":"unset"}function jk(t){if(!t)return"unset";const e=B0(t);return e!=="unset"?e:t.length>16?`${t.slice(0,14)}…`:t}const Nk=({label:t,active:e,onClick:n})=>c.jsx("button",{type:"button",onClick:n,className:["px-2.5 py-0.5 rounded-full text-xs font-medium border transition-colors",e?"bg-dash-accent-subtle text-dash-accent border-dash-accent/30":"bg-transparent text-dash-text-muted border-dash-border hover:border-dash-accent/40 hover:text-dash-text"].join(" "),children:t});function Pk({agent:t,selected:e,onClick:n}){return c.jsxs("button",{type:"button",onClick:n,className:["w-full flex items-start gap-2 px-3 py-2 rounded-md transition-colors text-left group",e?"bg-dash-accent/10 border border-dash-accent/30":"hover:bg-dash-surface-hover border border-transparent"].join(" "),children:[c.jsx(Ck,{}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[c.jsx("span",{className:"text-sm font-semibold text-dash-accent font-mono",children:t.name}),t.model&&c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-medium shrink-0",children:jk(t.model)})]}),t.description&&c.jsx("p",{className:"text-xs text-dash-text-muted mt-0.5 truncate",children:t.description})]})]})}function Ok({label:t,count:e}){return c.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[c.jsx("span",{className:"text-xs font-bold text-dash-text-muted uppercase tracking-wider flex-1",children:t}),c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold",children:e})]})}const Mk=new Set(["name","description","color"]),Ak=({frontmatter:t})=>{const e=Object.entries(t).filter(([n,r])=>!Mk.has(n)&&r!==void 0&&r!==null&&r!=="");return e.length===0?null:c.jsx("div",{className:"rounded-lg border border-dash-border overflow-hidden text-sm",children:c.jsx("table",{className:"w-full",children:c.jsx("tbody",{children:e.map(([n,r])=>c.jsxs("tr",{className:"border-b border-dash-border last:border-0",children:[c.jsx("td",{className:"px-3 py-2 font-mono text-xs text-dash-text-muted bg-dash-surface w-32 shrink-0 align-top",children:n}),c.jsx("td",{className:"px-3 py-2 text-xs text-dash-text break-all",children:typeof r=="object"?JSON.stringify(r):String(r)})]},n))})})})},Dk=({slug:t})=>{const{t:e}=X(),{agent:n,loading:r,error:s}=Sk(t);return r?c.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-dash-text-muted",children:e("loading")}):s?c.jsx("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm",children:s}):n?c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("h2",{className:"text-base font-semibold text-dash-text font-mono truncate flex-1",children:n.name}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:e("sessionReadOnly")})]}),n.description&&c.jsx("div",{className:"rounded-lg border border-dash-border bg-dash-surface px-4 py-3",children:c.jsx("p",{className:"text-sm text-dash-text-muted",children:n.description})}),c.jsx("div",{className:"flex items-center gap-2 text-xs text-dash-text-muted",children:c.jsxs("span",{className:"font-mono px-2 py-0.5 rounded bg-dash-surface border border-dash-border text-dash-accent",children:[n.dirLabel,"/",t,".md"]})}),c.jsx(Ak,{frontmatter:n.frontmatter}),n.body&&c.jsx("div",{className:"rounded-lg border border-dash-border bg-dash-surface p-5 overflow-x-auto",children:c.jsx(As,{content:n.body})})]}):null},Tk=({message:t})=>c.jsx("div",{className:"flex items-center justify-center h-full text-sm text-dash-text-muted",children:t}),Ek=()=>{const{t}=X(),{agents:e,loading:n,error:r}=kk(),[s,i]=m.useState(""),[o,a]=m.useState("all"),[l,d]=m.useState(null),{size:h,isDragging:u,startDrag:f}=Ms({storageKey:"ck-agents-panel-width",defaultSize:380,minSize:260,maxSize:650}),p=m.useMemo(()=>{let b=e;if(s.trim()){const y=s.toLowerCase();b=b.filter(w=>w.name.toLowerCase().includes(y)||w.description.toLowerCase().includes(y))}return o!=="all"&&(b=b.filter(y=>B0(y.model)===o)),b},[e,s,o]),g=m.useMemo(()=>{const b=new Map;for(const y of p){const w=b.get(y.dirLabel)??[];w.push(y),b.set(y.dirLabel,w)}return b},[p]),x=[{key:"all",label:t("filterAll")},{key:"opus",label:"Opus"},{key:"sonnet",label:"Sonnet"},{key:"haiku",label:"Haiku"},{key:"unset",label:"Unset"}];return c.jsxs("div",{className:"flex h-full overflow-hidden",children:[c.jsxs("div",{style:{width:`${h}px`},className:"shrink-0 flex flex-col overflow-hidden border-r border-dash-border",children:[c.jsxs("div",{className:"shrink-0 px-4 pt-4 pb-3 border-b border-dash-border",children:[c.jsxs("div",{className:"flex items-start justify-between mb-3",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-base font-bold text-dash-text",children:t("agentsBrowser")}),!n&&!r&&c.jsx("p",{className:"text-xs text-dash-text-muted mt-0.5",children:t("agentsBrowserCount").replace("{count}",String(e.length))}),c.jsx("p",{className:"text-[11px] text-dash-text-muted font-mono mt-0.5",children:"~/.claude/agents/"})]}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:t("sessionReadOnly")})]}),c.jsxs("div",{className:"relative mb-2",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-dash-text-muted pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),c.jsx("input",{type:"text",value:s,onChange:b=>i(b.target.value),placeholder:t("searchAgentsPlaceholder"),className:"w-full pl-9 pr-4 py-2 text-sm bg-dash-surface border border-dash-border rounded-lg text-dash-text placeholder:text-dash-text-muted focus:outline-none focus:border-dash-accent/50 transition-colors"}),s&&c.jsx("button",{type:"button",onClick:()=>i(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-dash-text-muted hover:text-dash-text transition-colors",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),c.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:x.map(({key:b,label:y})=>c.jsx(Nk,{label:y,active:o===b,onClick:()=>a(b)},b))})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-2 py-2",children:[n&&c.jsx("div",{className:"flex flex-1 items-center justify-center text-dash-text-muted text-sm p-8",children:t("loading")}),!n&&r&&c.jsx("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm m-2",children:r}),!n&&!r&&g.size===0&&c.jsx("div",{className:"flex items-center justify-center p-8 text-dash-text-muted text-sm",children:t("noAgentsFound")}),!n&&!r&&g.size>0&&c.jsx("div",{className:"flex flex-col gap-2 pb-4",children:Array.from(g.entries()).map(([b,y])=>c.jsxs("div",{children:[g.size>1&&c.jsx(Ok,{label:b,count:y.length}),c.jsx("div",{className:"space-y-0.5",children:y.map(w=>c.jsx(Pk,{agent:w,selected:l===w.slug,onClick:()=>d(w.slug)},`${w.dirLabel}/${w.slug}`))})]},b))})]})]}),c.jsx(Jt,{onMouseDown:f,isDragging:u,direction:"horizontal"}),c.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:l?c.jsx(Dk,{slug:l}):c.jsx(Tk,{message:t("selectToView")})})]})};function Lk(){const[t,e]=m.useState([]),[n,r]=m.useState(!0),[s,i]=m.useState(null),o=m.useCallback(async()=>{try{r(!0),i(null);const a=await fetch("/api/commands");if(!a.ok)throw new Error(`HTTP ${a.status}`);const l=await a.json();e(l.tree)}catch(a){i(a instanceof Error?a.message:"Failed to load")}finally{r(!1)}},[]);return m.useEffect(()=>{o()},[o]),{tree:t,loading:n,error:s,reload:o}}function Rk(t){const[e,n]=m.useState(null),[r,s]=m.useState(!1),[i,o]=m.useState(null),a=m.useCallback(async()=>{if(!t){n(null);return}try{s(!0),o(null);const l=t.replace(/\//g,"--"),d=await fetch(`/api/commands/detail/${encodeURIComponent(l)}`);if(!d.ok)throw new Error(`HTTP ${d.status}`);const h=await d.json();n(h)}catch(l){o(l instanceof Error?l.message:"Failed to load")}finally{s(!1)}},[t]);return m.useEffect(()=>{a()},[a]),{detail:e,loading:r,error:i,reload:a}}function F0(t){const e=[];for(const n of t)n.children?e.push(...F0(n.children)):e.push(n);return e}function z0(t){return F0(t).length}function Ik(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7a2 2 0 012-2h4l2 2h8a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2V7z"})})}function V0({open:t}){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:`w-3 h-3 shrink-0 transition-transform ${t?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}function $k(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3.5 h-3.5 shrink-0 text-dash-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3"})})}function H0(t,e){if(!e)return!0;const n=e.toLowerCase();return t.name.toLowerCase().includes(n)||t.description?.toLowerCase().includes(n)?!0:t.children?t.children.some(r=>H0(r,n)):!1}function _0(t,e){return e?t.filter(n=>H0(n,e)).map(n=>n.children?{...n,children:_0(n.children,e)}:n):t}function W0({node:t,selected:e,onSelect:n}){return c.jsxs("button",{type:"button",onClick:()=>n(t.path),className:["w-full flex items-start gap-2 px-3 py-2 rounded-md transition-colors text-left group",e?"bg-dash-accent/10 border border-dash-accent/30":"hover:bg-dash-surface-hover border border-transparent"].join(" "),children:[c.jsx($k,{}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("span",{className:"text-sm font-semibold text-dash-accent font-mono",children:["/",t.name]}),t.description&&c.jsx("p",{className:"text-xs text-dash-text-muted mt-0.5 truncate",children:t.description})]})]})}function U0({node:t,depth:e,forceOpen:n,selectedPath:r,onSelect:s}){const[i,o]=m.useState(!0),a=n||i,l=z0(t.children??[]);return c.jsxs("div",{className:e>0?"ml-3 border-l border-dash-border pl-2":"",children:[c.jsxs("button",{type:"button",onClick:()=>o(d=>!d),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-dash-surface-hover transition-colors text-left",children:[c.jsx(V0,{open:a}),c.jsx(Ik,{}),c.jsx("span",{className:"text-xs font-bold text-dash-text-muted uppercase tracking-wider flex-1",children:t.name}),c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold",children:l})]}),a&&c.jsx("div",{className:"mt-0.5 space-y-0.5",children:(t.children??[]).map(d=>d.children?c.jsx(U0,{node:d,depth:e+1,forceOpen:n,selectedPath:r,onSelect:s},d.path):c.jsx(W0,{node:d,selected:r===d.path,onSelect:s},d.path))})]})}function Bk({nodes:t,forceOpen:e,selectedPath:n,onSelect:r,label:s}){const[i,o]=m.useState(!0),a=e||i;return t.length===0?null:c.jsxs("div",{children:[c.jsxs("button",{type:"button",onClick:()=>o(l=>!l),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-dash-surface-hover transition-colors text-left",children:[c.jsx(V0,{open:a}),c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4 shrink-0 text-dash-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"})}),c.jsx("span",{className:"text-xs font-bold text-dash-text-muted uppercase tracking-wider flex-1",children:s}),c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold",children:t.length})]}),a&&c.jsx("div",{className:"mt-0.5 space-y-0.5",children:t.map(l=>c.jsx(W0,{node:l,selected:n===l.path,onSelect:r},l.path))})]})}const Fk=({commandPath:t})=>{const{t:e}=X(),{detail:n,loading:r,error:s}=Rk(t);return r?c.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-dash-text-muted",children:e("sessionLoading")}):s?c.jsxs("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm",children:[e("sessionError"),": ",s]}):n?c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsxs("h2",{className:"text-base font-semibold text-dash-text font-mono truncate flex-1",children:["/",n.name]}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:e("sessionReadOnly")})]}),n.description&&c.jsx("div",{className:"rounded-lg border border-dash-border bg-dash-surface px-4 py-3",children:c.jsx("p",{className:"text-sm text-dash-text-muted",children:n.description})}),c.jsx("div",{className:"flex items-center gap-2 text-xs text-dash-text-muted",children:c.jsxs("span",{className:"font-mono px-2 py-0.5 rounded bg-dash-surface border border-dash-border text-dash-accent",children:["~/.claude/commands/",n.path]})}),c.jsx("div",{className:"rounded-lg border border-dash-border bg-dash-surface p-5 overflow-x-auto",children:c.jsx(As,{content:n.content})})]}):null},zk=({message:t})=>c.jsx("div",{className:"flex items-center justify-center h-full text-sm text-dash-text-muted",children:t}),Vk=()=>{const{t}=X(),{tree:e,loading:n,error:r}=Lk(),[s,i]=m.useState(""),[o,a]=m.useState(null),{size:l,isDragging:d,startDrag:h}=Ms({storageKey:"ck-commands-panel-width",defaultSize:380,minSize:260,maxSize:650}),u=m.useMemo(()=>_0(e,s),[e,s]),f=u.filter(b=>!b.children),p=u.filter(b=>b.children),g=m.useMemo(()=>z0(e),[e]),x=s.trim().length>0;return c.jsxs("div",{className:"flex h-full overflow-hidden",children:[c.jsxs("div",{style:{width:`${l}px`},className:"shrink-0 flex flex-col overflow-hidden border-r border-dash-border",children:[c.jsxs("div",{className:"shrink-0 px-4 pt-4 pb-3 border-b border-dash-border",children:[c.jsxs("div",{className:"flex items-start justify-between mb-3",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-base font-bold text-dash-text",children:t("commandsBrowser")}),!n&&!r&&c.jsx("p",{className:"text-xs text-dash-text-muted mt-0.5",children:t("commandsCount").replace("{count}",String(g))}),c.jsx("p",{className:"text-[11px] text-dash-text-muted font-mono mt-0.5",children:"~/.claude/commands/"})]}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:t("sessionReadOnly")})]}),c.jsxs("div",{className:"relative",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-dash-text-muted pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),c.jsx("input",{type:"text",value:s,onChange:b=>i(b.target.value),placeholder:t("searchCommandsPlaceholder"),className:"w-full pl-9 pr-4 py-2 text-sm bg-dash-surface border border-dash-border rounded-lg text-dash-text placeholder:text-dash-text-muted focus:outline-none focus:border-dash-accent/50 transition-colors"}),s&&c.jsx("button",{type:"button",onClick:()=>i(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-dash-text-muted hover:text-dash-text transition-colors",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-2 py-2",children:[n&&c.jsx("div",{className:"flex flex-1 items-center justify-center text-dash-text-muted text-sm p-8",children:t("sessionLoading")}),!n&&r&&c.jsxs("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm m-2",children:[t("sessionError"),": ",r]}),!n&&!r&&u.length===0&&c.jsx("div",{className:"flex items-center justify-center p-8 text-dash-text-muted text-sm",children:t("noCommandsFound")}),!n&&!r&&u.length>0&&c.jsxs("div",{className:"flex flex-col gap-2 pb-4",children:[c.jsx(Bk,{nodes:f,forceOpen:x,selectedPath:o,onSelect:a,label:t("rootCommands")}),p.map(b=>c.jsx(U0,{node:b,depth:0,forceOpen:x,selectedPath:o,onSelect:a},b.path))]})]})]}),c.jsx(Jt,{onMouseDown:h,isDragging:d,direction:"horizontal"}),c.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:o?c.jsx(Fk,{commandPath:o}):c.jsx(zk,{message:t("selectToView")})})]})},K0=({title:t,filePath:e,onBack:n,onSave:r,onReset:s,saveStatus:i,syntaxError:o,showResetConfirm:a,setShowResetConfirm:l,badge:d,showActions:h=!0,showFilePath:u=!0})=>{const{t:f}=X();return c.jsxs("div",{className:"flex items-center justify-between mb-3 shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("button",{onClick:n,className:"px-2 py-1 rounded-lg bg-dash-surface hover:bg-dash-surface-hover border border-dash-border text-sm text-dash-text-secondary hover:text-dash-text flex items-center group transition-all font-medium shadow-sm",title:f("backToDashboard"),children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4 group-hover:-translate-x-0.5 transition-transform",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),c.jsx("h1",{className:"text-xl font-bold tracking-tight text-dash-text",children:t}),d,u&&c.jsx("span",{className:"text-xs text-dash-text-muted mono",children:e})]}),h&&c.jsxs("div",{className:"flex items-center gap-2 relative",children:[a?c.jsxs("div",{className:"flex items-center gap-2 bg-red-500/10 border border-red-500/30 rounded-lg px-2 py-1 animate-in fade-in duration-200",children:[c.jsx("span",{className:"text-xs text-red-500 font-medium",children:f("confirmReset")}),c.jsx("button",{onClick:s,className:"px-2 py-0.5 rounded bg-red-500 text-white text-xs font-bold hover:bg-red-600 transition-colors",children:f("confirm")}),c.jsx("button",{onClick:()=>l(!1),className:"px-2 py-0.5 rounded bg-dash-surface text-dash-text-secondary text-xs font-bold hover:bg-dash-surface-hover transition-colors border border-dash-border",children:f("cancel")})]}):c.jsx("button",{onClick:()=>l(!0),className:"px-3 py-1.5 rounded-lg bg-dash-surface text-xs font-bold text-dash-text-secondary hover:bg-dash-surface-hover transition-colors border border-dash-border",children:f("resetToDefault")}),c.jsx("button",{onClick:r,disabled:!!o||i==="saving",className:`px-3 py-1.5 rounded-lg text-xs font-bold transition-all tracking-widest uppercase ${o?"bg-dash-surface text-dash-text-muted cursor-not-allowed border border-dash-border":i==="saved"?"bg-green-500 text-white shadow-lg shadow-green-500/20":i==="error"?"bg-red-500 text-white":"bg-dash-accent text-dash-bg hover:bg-dash-accent-hover shadow-lg shadow-dash-accent/20"}`,children:f(i==="saving"?"saving":i==="saved"?"saved":i==="error"?"saveFailed":"saveChanges")})]})]})},G0={plan:{path:"plan",type:"object",default:"{}",description:"Configuration for plan management including naming conventions, resolution strategies, and validation workflows.",descriptionVi:"Cấu hình quản lý kế hoạch bao gồm quy ước đặt tên, chiến lược giải quyết và quy trình xác thực.",effect:"Controls how plans are created (namingFormat), located (resolution), and reviewed (validation) during development.",effectVi:"Điều khiển cách tạo kế hoạch (namingFormat), định vị (resolution) và xem xét (validation) trong quá trình phát triển."},"plan.resolution":{path:"plan.resolution",type:"object",default:"{}",description:"Settings for resolving which plan is currently active. Uses cascading resolution: session state (explicit) → branch name matching (suggested).",descriptionVi:"Cài đặt để xác định kế hoạch đang hoạt động. Sử dụng giải quyết theo tầng: trạng thái phiên (rõ ràng) → khớp tên nhánh (gợi ý).",effect:"'session' = ACTIVE (explicitly set via set-active-plan). 'branch' = SUGGESTED (hint from git branch name). 'mostRecent' was removed to avoid stale plan pollution.",effectVi:"'session' = ĐANG HOẠT ĐỘNG (đặt rõ ràng qua set-active-plan). 'branch' = GỢI Ý (từ tên nhánh git). 'mostRecent' đã bị xóa để tránh ô nhiễm kế hoạch cũ."},"plan.validation":{path:"plan.validation",type:"object",default:"{}",description:"Settings for the plan validation interview that reviews assumptions, risks, and architecture decisions.",descriptionVi:"Cài đặt cho phỏng vấn xác thực kế hoạch để xem xét giả định, rủi ro và quyết định kiến trúc.",effect:"Runs validation interview based on mode: 'prompt' (ask first), 'auto' (run automatically), 'strict' (enforce validation), 'none' (skip). Questions focus on configured areas.",effectVi:"Chạy phỏng vấn xác thực dựa trên chế độ: 'prompt' (hỏi trước), 'auto' (tự chạy), 'strict' (bắt buộc xác thực), 'none' (bỏ qua). Câu hỏi tập trung vào các lĩnh vực đã cấu hình."},paths:{path:"paths",type:"object",default:"{}",description:"Custom paths for project directories. Supports relative paths (from project root) or absolute paths for consolidated setups.",descriptionVi:"Đường dẫn tùy chỉnh cho các thư mục dự án. Hỗ trợ đường dẫn tương đối (từ thư mục gốc) hoặc tuyệt đối cho thiết lập tập trung.",effect:"Relative paths are resolved from project root. Absolute paths allow consolidated plans across repos.",effectVi:"Đường dẫn tương đối được giải quyết từ thư mục gốc dự án. Đường dẫn tuyệt đối cho phép kế hoạch tập trung giữa các repo."},locale:{path:"locale",type:"object",default:"{}",description:"Language settings separating internal AI reasoning from user-facing output for optimal precision.",descriptionVi:"Cài đặt ngôn ngữ tách suy luận AI nội bộ khỏi đầu ra cho người dùng để có độ chính xác tối ưu.",effect:"thinkingLanguage: for reasoning/logic (recommended: 'en'). responseLanguage: for user output (e.g., 'vi' for Vietnamese responses).",effectVi:"thinkingLanguage: cho suy luận/logic (khuyến nghị: 'en'). responseLanguage: cho đầu ra người dùng (vd: 'vi' cho phản hồi tiếng Việt)."},trust:{path:"trust",type:"object",default:"{}",description:"Trusted execution mode for bypassing certain security confirmations in controlled environments.",descriptionVi:"Chế độ thực thi tin cậy để bỏ qua một số xác nhận bảo mật trong môi trường được kiểm soát.",effect:"When trust.enabled=true, security prompts may be skipped. passphrase is used for context injection testing.",effectVi:"Khi trust.enabled=true, các lời nhắc bảo mật có thể bị bỏ qua. passphrase dùng để kiểm tra tiêm ngữ cảnh."},project:{path:"project",type:"object",default:"{}",description:"Override automatic project detection. Set to 'auto' for automatic detection or specify exact values.",descriptionVi:"Ghi đè phát hiện dự án tự động. Đặt 'auto' để tự động phát hiện hoặc chỉ định giá trị cụ thể.",effect:"type: single-repo/monorepo/library. packageManager: npm/yarn/pnpm/bun. framework: next/nuxt/astro/etc.",effectVi:"type: single-repo/monorepo/library. packageManager: npm/yarn/pnpm/bun. framework: next/nuxt/astro/v.v."},codingLevel:{path:"codingLevel",type:"number",default:"-1",validValues:["-1","0","1","2","3","4","5"],description:"Controls the communication style and depth of explanations based on user's coding experience level.",descriptionVi:"Điều khiển phong cách giao tiếp và độ sâu giải thích dựa trên trình độ lập trình của người dùng.",effect:"Loads corresponding output style and injects it into the session context. Changes how Claude explains code and structures responses.",effectVi:"Tải phong cách đầu ra tương ứng và đưa vào ngữ cảnh phiên. Thay đổi cách Claude giải thích code và cấu trúc phản hồi.",example:`{
|
|
34
|
+
"codingLevel": 1
|
|
35
|
+
}`},privacyBlock:{path:"privacyBlock",type:"boolean",default:"true",description:"Enables or disables the privacy protection hook that blocks access to sensitive files and domains.",descriptionVi:"Bật hoặc tắt hook bảo vệ quyền riêng tư, chặn truy cập vào các tệp và domain nhạy cảm.",effect:"When true, blocks reading files like .env, passwords, credentials, SSH keys, and API tokens.",effectVi:"Khi bật, chặn đọc các tệp như .env, mật khẩu, thông tin xác thực, SSH keys và API tokens.",example:`{
|
|
36
|
+
"privacyBlock": false
|
|
37
|
+
}`},"plan.namingFormat":{path:"plan.namingFormat",type:"string",default:'"{date}-{issue}-{slug}"',description:"Template for naming plan directories. Uses placeholder tokens that get replaced at runtime.",descriptionVi:"Mẫu đặt tên thư mục kế hoạch. Sử dụng các token placeholder được thay thế khi chạy.",effect:"{date} is replaced with formatted date, {issue} is extracted from branch, {slug} is for agent substitution.",effectVi:"{date} được thay bằng ngày đã định dạng, {issue} trích xuất từ branch, {slug} cho agent thay thế.",example:`{
|
|
38
|
+
"plan": {
|
|
39
|
+
"namingFormat": "{date}-{slug}"
|
|
40
|
+
}
|
|
41
|
+
}`},"plan.dateFormat":{path:"plan.dateFormat",type:"string",default:'"YYMMDD-HHmm"',description:"Date format string for {date} token in naming pattern.",descriptionVi:"Chuỗi định dạng ngày cho token {date} trong mẫu đặt tên.",example:`{
|
|
42
|
+
"plan": {
|
|
43
|
+
"dateFormat": "YYMMDD"
|
|
44
|
+
}
|
|
45
|
+
}`},"plan.issuePrefix":{path:"plan.issuePrefix",type:"string | null",default:"null",description:"Prefix to prepend to extracted issue numbers in plan naming (e.g., 'GH-', 'JIRA-').",descriptionVi:"Tiền tố thêm vào số issue trích xuất trong đặt tên kế hoạch (vd: 'GH-', 'JIRA-').",example:`{
|
|
46
|
+
"plan": {
|
|
47
|
+
"issuePrefix": "GH-"
|
|
48
|
+
}
|
|
49
|
+
}`},"plan.reportsDir":{path:"plan.reportsDir",type:"string",default:'"reports"',description:"Subdirectory name within plan directory for storing reports.",descriptionVi:"Tên thư mục con trong thư mục kế hoạch để lưu trữ báo cáo.",example:`{
|
|
50
|
+
"plan": {
|
|
51
|
+
"reportsDir": "reports"
|
|
52
|
+
}
|
|
53
|
+
}`},"plan.resolution.order":{path:"plan.resolution.order",type:"string[]",default:'["session", "branch"]',validValues:["session","branch","directory"],description:"Order of resolution methods to try when finding the active plan.",descriptionVi:"Thứ tự các phương thức giải quyết để tìm kế hoạch đang hoạt động.",example:`{
|
|
54
|
+
"plan": {
|
|
55
|
+
"resolution": {
|
|
56
|
+
"order": ["session", "branch"]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}`},"plan.resolution.branchPattern":{path:"plan.resolution.branchPattern",type:"string (regex)",default:'"(?:feat|fix|chore|refactor|docs)/(?:[^/]+/)?(.+)"',description:"Regex pattern for extracting plan slug from git branch name. Capture group 1 is used as the slug.",descriptionVi:"Mẫu regex để trích xuất slug kế hoạch từ tên nhánh git. Nhóm bắt 1 được dùng làm slug.",example:`{
|
|
60
|
+
"plan": {
|
|
61
|
+
"resolution": {
|
|
62
|
+
"branchPattern": "(?:feat|fix)/(.+)"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}`},"plan.validation.mode":{path:"plan.validation.mode",type:"string",default:'"prompt"',validValues:["prompt","auto","strict","none"],description:"Controls when plan validation interview runs.",descriptionVi:"Điều khiển thời điểm chạy phỏng vấn xác thực kế hoạch.",example:`{
|
|
66
|
+
"plan": {
|
|
67
|
+
"validation": {
|
|
68
|
+
"mode": "auto"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}`},"plan.validation.minQuestions":{path:"plan.validation.minQuestions",type:"number",default:"3",description:"Minimum number of validation questions to ask during plan review.",descriptionVi:"Số câu hỏi xác thực tối thiểu trong quá trình xem xét kế hoạch.",example:`{
|
|
72
|
+
"plan": {
|
|
73
|
+
"validation": {
|
|
74
|
+
"minQuestions": 5
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}`},"plan.validation.maxQuestions":{path:"plan.validation.maxQuestions",type:"number",default:"8",description:"Maximum number of validation questions to ask during plan review.",descriptionVi:"Số câu hỏi xác thực tối đa trong quá trình xem xét kế hoạch.",example:`{
|
|
78
|
+
"plan": {
|
|
79
|
+
"validation": {
|
|
80
|
+
"maxQuestions": 10
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}`},"plan.validation.focusAreas":{path:"plan.validation.focusAreas",type:"string[]",default:'["assumptions", "risks", "tradeoffs", "architecture"]',description:"Categories of questions to focus on during validation interview.",descriptionVi:"Các danh mục câu hỏi tập trung trong phỏng vấn xác thực.",example:`{
|
|
84
|
+
"plan": {
|
|
85
|
+
"validation": {
|
|
86
|
+
"focusAreas": ["security", "performance"]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}`},"paths.docs":{path:"paths.docs",type:"string",default:'"docs"',description:"Path to documentation directory (relative to project root or absolute).",descriptionVi:"Đường dẫn thư mục tài liệu (tương đối với thư mục gốc hoặc tuyệt đối).",example:`{
|
|
90
|
+
"paths": {
|
|
91
|
+
"docs": "docs"
|
|
92
|
+
}
|
|
93
|
+
}`},"paths.plans":{path:"paths.plans",type:"string",default:'"plans"',description:"Path to plans directory (relative to project root or absolute).",descriptionVi:"Đường dẫn thư mục kế hoạch (tương đối với thư mục gốc hoặc tuyệt đối).",example:`{
|
|
94
|
+
"paths": {
|
|
95
|
+
"plans": "plans"
|
|
96
|
+
}
|
|
97
|
+
}`},"locale.thinkingLanguage":{path:"locale.thinkingLanguage",type:"string | null",default:"null",description:"Language for internal reasoning and logic. Recommended: 'en' for precision.",descriptionVi:"Ngôn ngữ suy luận nội bộ và logic. Khuyến nghị: 'en' để chính xác.",example:`{
|
|
98
|
+
"locale": {
|
|
99
|
+
"thinkingLanguage": "en"
|
|
100
|
+
}
|
|
101
|
+
}`},"locale.responseLanguage":{path:"locale.responseLanguage",type:"string | null",default:"null",description:"Language for user-facing output (responses, explanations, comments).",descriptionVi:"Ngôn ngữ cho đầu ra người dùng (phản hồi, giải thích, nhận xét).",example:`{
|
|
102
|
+
"locale": {
|
|
103
|
+
"responseLanguage": "fr"
|
|
104
|
+
}
|
|
105
|
+
}`},"trust.enabled":{path:"trust.enabled",type:"boolean",default:"false",description:"Enables trusted execution mode. When enabled, bypasses certain security prompts.",descriptionVi:"Bật chế độ thực thi tin cậy. Khi bật, bỏ qua một số lời nhắc bảo mật.",example:`{
|
|
106
|
+
"trust": {
|
|
107
|
+
"enabled": true
|
|
108
|
+
}
|
|
109
|
+
}`},"trust.passphrase":{path:"trust.passphrase",type:"string | null",default:"null",description:"Secret passphrase for testing context injection and trust verification.",descriptionVi:"Cụm mật khẩu bí mật để kiểm tra tiêm ngữ cảnh và xác minh tin cậy.",example:`{
|
|
110
|
+
"trust": {
|
|
111
|
+
"passphrase": "super-secret-key"
|
|
112
|
+
}
|
|
113
|
+
}`},"project.type":{path:"project.type",type:"string",default:'"auto"',validValues:["auto","library","application","monorepo","cli","api","web","mobile"],description:"Override automatic project type detection.",descriptionVi:"Ghi đè phát hiện loại dự án tự động.",example:`{
|
|
114
|
+
"project": {
|
|
115
|
+
"type": "monorepo"
|
|
116
|
+
}
|
|
117
|
+
}`},"project.packageManager":{path:"project.packageManager",type:"string",default:'"auto"',validValues:["auto","npm","yarn","pnpm","bun"],description:"Override automatic package manager detection.",descriptionVi:"Ghi đè phát hiện trình quản lý gói tự động.",example:`{
|
|
118
|
+
"project": {
|
|
119
|
+
"packageManager": "pnpm"
|
|
120
|
+
}
|
|
121
|
+
}`},"project.framework":{path:"project.framework",type:"string",default:'"auto"',validValues:["auto","react","vue","angular","svelte","nextjs","nuxt","express","nestjs","fastify","none"],description:"Override automatic framework detection.",descriptionVi:"Ghi đè phát hiện framework tự động.",example:`{
|
|
122
|
+
"project": {
|
|
123
|
+
"framework": "nextjs"
|
|
124
|
+
}
|
|
125
|
+
}`},docs:{path:"docs",type:"object",default:"{}",description:"Configuration for documentation management including file size limits and splitting behavior.",descriptionVi:"Cấu hình quản lý tài liệu bao gồm giới hạn kích thước tệp và hành vi chia nhỏ.",effect:"Controls how documentation files are processed and split when they exceed size limits.",effectVi:"Điều khiển cách các tệp tài liệu được xử lý và chia nhỏ khi vượt quá giới hạn kích thước."},"docs.maxLoc":{path:"docs.maxLoc",type:"number",default:"800",description:"Maximum lines of code per documentation file before automatic splitting is triggered.",descriptionVi:"Số dòng code tối đa mỗi tệp tài liệu trước khi tự động chia nhỏ được kích hoạt.",effect:"When a documentation file exceeds this line count, the system will suggest or automatically split it into smaller files for better readability and maintenance.",effectVi:"Khi tệp tài liệu vượt quá số dòng này, hệ thống sẽ đề xuất hoặc tự động chia nhỏ thành các tệp nhỏ hơn để dễ đọc và bảo trì hơn.",example:`{
|
|
126
|
+
"docs": {
|
|
127
|
+
"maxLoc": 1000
|
|
128
|
+
}
|
|
129
|
+
}`},gemini:{path:"gemini",type:"object",default:"{}",description:"Configuration for Google Gemini API integration used for CLI commands and research tasks.",descriptionVi:"Cấu hình tích hợp Google Gemini API dùng cho lệnh CLI và tác vụ nghiên cứu.",effect:"Controls which Gemini model is used for research, web search, and other AI-powered CLI operations.",effectVi:"Điều khiển model Gemini nào được dùng cho nghiên cứu, tìm kiếm web và các thao tác CLI hỗ trợ AI khác."},"gemini.model":{path:"gemini.model",type:"string",default:'"gemini-3-flash-preview"',validValues:["gemini-2.5-flash","gemini-2.5-pro","gemini-3-pro-preview","gemini-3-flash-preview"],description:"Gemini model used for CLI commands and research operations. Pick a known model or type any valid model ID. Legacy gemini-3.0-* ids are auto-mapped on load.",descriptionVi:"Model Gemini dùng cho lệnh CLI và thao tác nghiên cứu. Chọn model có sẵn hoặc nhập ID model bất kỳ. Các id gemini-3.0-* cũ sẽ được tự động ánh xạ khi tải.",effect:"Determines which Gemini model handles research, web search, and other auxiliary tasks. Flash models are faster but less capable than Pro models.",effectVi:"Xác định model Gemini nào xử lý nghiên cứu, tìm kiếm web và các tác vụ phụ trợ khác. Model Flash nhanh hơn nhưng kém khả năng hơn model Pro.",example:`{
|
|
130
|
+
"gemini": {
|
|
131
|
+
"model": "gemini-2.5-pro"
|
|
132
|
+
}
|
|
133
|
+
}`},skills:{path:"skills",type:"object",default:"{}",description:"Configuration for skills system including research behavior and custom skill settings.",descriptionVi:"Cấu hình hệ thống kỹ năng bao gồm hành vi nghiên cứu và cài đặt kỹ năng tùy chỉnh.",effect:"Controls how skills are executed, particularly research operations and their AI provider choices.",effectVi:"Điều khiển cách các kỹ năng được thực thi, đặc biệt là thao tác nghiên cứu và lựa chọn nhà cung cấp AI."},"skills.research":{path:"skills.research",type:"object",default:"{}",description:"Configuration specific to the research skill behavior and AI provider selection.",descriptionVi:"Cấu hình riêng cho hành vi kỹ năng nghiên cứu và lựa chọn nhà cung cấp AI.",effect:"Determines whether research operations use Gemini CLI or Claude's built-in WebSearch tool.",effectVi:"Xác định liệu thao tác nghiên cứu có dùng Gemini CLI hay công cụ WebSearch tích hợp của Claude."},"skills.research.useGemini":{path:"skills.research.useGemini",type:"boolean",default:"true",description:"When enabled, uses Gemini CLI for research operations instead of Claude's WebSearch tool.",descriptionVi:"Khi bật, dùng Gemini CLI cho thao tác nghiên cứu thay vì công cụ WebSearch của Claude.",effect:"Gemini CLI offers faster search results and lower token costs for research, but requires Gemini API setup. WebSearch is built-in but more expensive.",effectVi:"Gemini CLI cung cấp kết quả tìm kiếm nhanh hơn và chi phí token thấp hơn cho nghiên cứu, nhưng cần thiết lập Gemini API. WebSearch tích hợp sẵn nhưng đắt hơn.",example:`{
|
|
134
|
+
"skills": {
|
|
135
|
+
"research": {
|
|
136
|
+
"useGemini": false
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}`},hooks:{path:"hooks",type:"object",default:"{}",description:"Configuration for lifecycle hooks that inject context, enforce rules, and enhance safety throughout the development workflow.",descriptionVi:"Cấu hình các hook vòng đời tiêm ngữ cảnh, thực thi quy tắc và tăng cường an toàn trong suốt quy trình phát triển.",effect:"Controls which hooks are active. Each hook fires at specific points in the workflow to inject context or enforce guardrails.",effectVi:"Điều khiển hook nào đang hoạt động. Mỗi hook kích hoạt tại các điểm cụ thể trong quy trình để tiêm ngữ cảnh hoặc thực thi bảo vệ."},"hooks.session-init":{path:"hooks.session-init",type:"boolean",default:"true",description:"Runs project detection and environment setup at the start of every Claude Code session.",descriptionVi:"Chạy phát hiện dự án và thiết lập môi trường khi bắt đầu mỗi phiên Claude Code.",effect:"When enabled, automatically detects project type, framework, package manager, and injects relevant context into the session.",effectVi:"Khi bật, tự động phát hiện loại dự án, framework, trình quản lý gói và tiêm ngữ cảnh liên quan vào phiên.",example:`{
|
|
140
|
+
"hooks": {
|
|
141
|
+
"session-init": false
|
|
142
|
+
}
|
|
143
|
+
}`},"hooks.subagent-init":{path:"hooks.subagent-init",type:"boolean",default:"true",description:"Injects context (paths, plans, reports) into spawned subagents to ensure consistency.",descriptionVi:"Tiêm ngữ cảnh (đường dẫn, kế hoạch, báo cáo) vào các subagent được tạo để đảm bảo nhất quán.",effect:"Ensures subagents inherit work context, know where to save reports, and follow the same plan structure as the parent agent.",effectVi:"Đảm bảo subagent kế thừa ngữ cảnh làm việc, biết nơi lưu báo cáo và tuân theo cùng cấu trúc kế hoạch với agent cha.",example:`{
|
|
144
|
+
"hooks": {
|
|
145
|
+
"subagent-init": false
|
|
146
|
+
}
|
|
147
|
+
}`},"hooks.descriptive-name":{path:"hooks.descriptive-name",type:"boolean",default:"true",description:"Injects descriptive naming context so agents generate meaningful, self-documenting file and variable names.",descriptionVi:"Tiêm ngữ cảnh đặt tên mô tả để agent tạo tên tệp và biến có ý nghĩa, tự tài liệu hóa.",effect:"When enabled, reminds the agent to use long, descriptive kebab-case names for files and clear variable naming conventions.",effectVi:"Khi bật, nhắc nhở agent sử dụng tên kebab-case dài, mô tả cho tệp và quy ước đặt tên biến rõ ràng.",example:`{
|
|
148
|
+
"hooks": {
|
|
149
|
+
"descriptive-name": false
|
|
150
|
+
}
|
|
151
|
+
}`},"hooks.dev-rules-reminder":{path:"hooks.dev-rules-reminder",type:"boolean",default:"true",description:"Injects development rules context before tool execution to maintain coding standards.",descriptionVi:"Tiêm ngữ cảnh quy tắc phát triển trước khi thực thi công cụ để duy trì chuẩn code.",effect:"Reminds the agent of coding standards, file naming conventions, and project-specific rules before file operations.",effectVi:"Nhắc nhở agent về chuẩn code, quy ước đặt tên tệp và quy tắc riêng của dự án trước thao tác tệp.",example:`{
|
|
152
|
+
"hooks": {
|
|
153
|
+
"dev-rules-reminder": false
|
|
154
|
+
}
|
|
155
|
+
}`},"hooks.usage-context-awareness":{path:"hooks.usage-context-awareness",type:"boolean",default:"true",description:"Injects usage-limit awareness into prompt context so the agent can react before overruns.",descriptionVi:"Tiêm nhận biết giới hạn sử dụng vào ngữ cảnh prompt để agent phản ứng trước khi vượt quá.",effect:"When enabled, reminder context can warn the agent to stay concise or split work when usage windows are tight.",effectVi:"Khi bật, ngữ cảnh nhắc nhở có thể cảnh báo agent nên ngắn gọn hơn hoặc chia nhỏ công việc khi cửa sổ sử dụng trở nên chặt.",example:`{
|
|
156
|
+
"hooks": {
|
|
157
|
+
"usage-context-awareness": false
|
|
158
|
+
}
|
|
159
|
+
}`},"hooks.context-tracking":{path:"hooks.context-tracking",type:"boolean",default:"true",description:"Tracks context window usage and injects awareness data so agents can optimize token consumption.",descriptionVi:"Theo dõi sử dụng cửa sổ ngữ cảnh và tiêm dữ liệu nhận biết để agent tối ưu hóa tiêu thụ token.",effect:"When enabled, monitors context percentage and remaining capacity, warning the agent when approaching limits to prevent truncation.",effectVi:"Khi bật, giám sát phần trăm ngữ cảnh và dung lượng còn lại, cảnh báo agent khi tiến gần giới hạn để ngăn cắt xén.",example:`{
|
|
160
|
+
"hooks": {
|
|
161
|
+
"context-tracking": false
|
|
162
|
+
}
|
|
163
|
+
}`},"hooks.scout-block":{path:"hooks.scout-block",type:"boolean",default:"true",description:"Blocks heavy directories (node_modules, .git, dist) from exploration to save tokens.",descriptionVi:"Chặn các thư mục nặng (node_modules, .git, dist) khỏi khám phá để tiết kiệm token.",effect:"Prevents the agent from reading irrelevant or large directories that waste tokens and context window space.",effectVi:"Ngăn agent đọc các thư mục không liên quan hoặc lớn lãng phí token và không gian cửa sổ ngữ cảnh.",example:`{
|
|
164
|
+
"hooks": {
|
|
165
|
+
"scout-block": false
|
|
166
|
+
}
|
|
167
|
+
}`},"hooks.privacy-block":{path:"hooks.privacy-block",type:"boolean",default:"true",description:"Blocks reading sensitive files (.env, credentials, secrets) to protect user privacy.",descriptionVi:"Chặn đọc các tệp nhạy cảm (.env, thông tin xác thực, bí mật) để bảo vệ quyền riêng tư người dùng.",effect:"When enabled, prompts user for permission before accessing files that may contain API keys, passwords, or other secrets.",effectVi:"Khi bật, nhắc người dùng cho phép trước khi truy cập tệp có thể chứa API keys, mật khẩu hoặc bí mật khác.",example:`{
|
|
168
|
+
"hooks": {
|
|
169
|
+
"privacy-block": false
|
|
170
|
+
}
|
|
171
|
+
}`},"hooks.post-edit-simplify-reminder":{path:"hooks.post-edit-simplify-reminder",type:"boolean",default:"true",description:"Reminds the agent to simplify code after file edits to maintain readability and prevent bloat.",descriptionVi:"Nhắc nhở agent đơn giản hóa code sau khi chỉnh sửa tệp để duy trì khả năng đọc và ngăn phình to.",effect:"After editing files, suggests reviewing for unnecessary complexity, redundant code, or opportunities to refactor.",effectVi:"Sau khi chỉnh sửa tệp, đề xuất xem xét độ phức tạp không cần thiết, code dư thừa hoặc cơ hội refactor.",example:`{
|
|
172
|
+
"hooks": {
|
|
173
|
+
"post-edit-simplify-reminder": false
|
|
174
|
+
}
|
|
175
|
+
}`},"updatePipeline.autoInitAfterUpdate":{path:"updatePipeline.autoInitAfterUpdate",type:"boolean",default:"false",description:"Automatically runs `ck init` after `ck update` when the installed kit content has a newer version.",descriptionVi:"Tự động chạy `ck init` sau `ck update` khi nội dung kit đã cài có phiên bản mới hơn.",effect:"Power users can reduce the update flow to one command. This setting is read from global config for update runs.",effectVi:"Người dùng nâng cao có thể rút gọn quy trình cập nhật còn một lệnh. Thiết lập này được đọc từ global config trong lúc update.",example:`{
|
|
176
|
+
"updatePipeline": {
|
|
177
|
+
"autoInitAfterUpdate": true,
|
|
178
|
+
"autoMigrateAfterUpdate": true,
|
|
179
|
+
"migrateProviders": ["codex"]
|
|
180
|
+
}
|
|
181
|
+
}`},"updatePipeline.autoMigrateAfterUpdate":{path:"updatePipeline.autoMigrateAfterUpdate",type:"boolean",default:"false",description:"Automatically runs `ck migrate` as an independent step after `ck update` for detected or configured providers.",descriptionVi:"Tự động chạy `ck migrate` như bước độc lập sau `ck update` cho các provider được phát hiện hoặc đã cấu hình.",effect:"Runs independently of kit init — even if kit is already at latest, providers can still be synced.",effectVi:"Chạy độc lập với kit init — ngay cả khi kit đã ở phiên bản mới nhất, provider vẫn có thể được đồng bộ.",example:`{
|
|
182
|
+
"updatePipeline": {
|
|
183
|
+
"autoInitAfterUpdate": true,
|
|
184
|
+
"autoMigrateAfterUpdate": true,
|
|
185
|
+
"migrateProviders": ["codex"]
|
|
186
|
+
}
|
|
187
|
+
}`},"updatePipeline.migrateProviders":{path:"updatePipeline.migrateProviders",type:'"auto" | string[]',default:'"auto"',validValues:["auto"],description:'Choose which providers are auto-migrated. Use `auto` to scan the filesystem, enter a comma-separated list such as `codex, cursor`, or paste a JSON array like `["codex"]` and the form will normalize it.',descriptionVi:'Chọn provider nào sẽ được auto-migrate. Dùng `auto` để quét hệ thống tệp, nhập danh sách phân tách bằng dấu phẩy như `codex, cursor`, hoặc dán JSON array như `["codex"]` và form sẽ tự chuẩn hóa.',effect:"`auto` targets every detected provider. A specific list limits the auto-migrate step to those providers only.",effectVi:"`auto` nhắm đến mọi provider được phát hiện. Danh sách cụ thể sẽ giới hạn bước auto-migrate chỉ còn các provider đó.",example:`{
|
|
188
|
+
"updatePipeline": {
|
|
189
|
+
"autoInitAfterUpdate": true,
|
|
190
|
+
"autoMigrateAfterUpdate": true,
|
|
191
|
+
"migrateProviders": ["codex"]
|
|
192
|
+
}
|
|
193
|
+
}`},statusline:{path:"statusline",type:"string",default:'"full"',validValues:["full","compact","minimal","none"],description:"Controls how much information is displayed in the Claude Code status line during operations.",descriptionVi:"Điều khiển lượng thông tin hiển thị trong dòng trạng thái Claude Code trong khi thao tác.",effect:"'full' shows all details (tokens, model, cost). 'compact' shows summary. 'minimal' shows only critical info. 'none' hides status line.",effectVi:"'full' hiển thị tất cả chi tiết (token, model, chi phí). 'compact' hiển thị tóm tắt. 'minimal' chỉ hiển thị thông tin quan trọng. 'none' ẩn dòng trạng thái.",example:`{
|
|
194
|
+
"statusline": "compact"
|
|
195
|
+
}`},statuslineColors:{path:"statuslineColors",type:"boolean",default:"true",description:"Controls whether the statusline uses ANSI color codes. When false, renders plain text. NO_COLOR/FORCE_COLOR env vars are also respected.",descriptionVi:"Kiểm soát việc thanh trạng thái sử dụng mã màu ANSI. Khi tắt, hiển thị văn bản thuần. Biến môi trường NO_COLOR/FORCE_COLOR cũng được hỗ trợ.",effect:"When enabled, statusline elements are colorized (model=cyan, dir=yellow, branch=magenta, context=threshold). When disabled, all output is plain text.",effectVi:"Khi bật, các phần tử thanh trạng thái được tô màu (model=xanh lam, thư mục=vàng, nhánh=tím, ngữ cảnh=theo ngưỡng). Khi tắt, tất cả đầu ra là văn bản thuần.",example:`{
|
|
196
|
+
"statuslineColors": false
|
|
197
|
+
}`},statuslineQuota:{path:"statuslineQuota",type:"boolean",default:"true",description:"Controls whether the cosmetic 5h / wk quota chips are shown in the statusline.",descriptionVi:"Kiểm soát việc các nhãn quota 5h / wk mang tính thẩm mỹ có được hiển thị trong thanh trạng thái hay không.",effect:"When enabled, the statusline shows cached 5h and weekly quota percentages. When disabled, the rest of the statusline stays intact and only the quota chips are hidden.",effectVi:"Khi bật, thanh trạng thái hiển thị phần trăm quota 5h và hàng tuần từ cache. Khi tắt, phần còn lại của thanh trạng thái vẫn giữ nguyên và chỉ ẩn các nhãn quota.",example:`{
|
|
198
|
+
"statuslineQuota": false
|
|
199
|
+
}`},assertions:{path:"assertions",type:"string[]",default:"[]",description:"List of user-defined assertions that are injected at the start of every session.",descriptionVi:"Danh sách các khẳng định do người dùng định nghĩa, được tiêm vào đầu mỗi phiên.",example:`{
|
|
200
|
+
"assertions": ["Use strict mode", "No console.logs"]
|
|
201
|
+
}`}};function Hk(t,e,n){const r={...t},s=e.split(".");let i=r;for(let o=0;o<s.length-1;o++){const a=s[o];!(a in i)||typeof i[a]!="object"||i[a]===null?i[a]={}:i[a]={...i[a]},i=i[a]}return i[s[s.length-1]]=n,r}function Td(t,e){const n=e.split(".");let r=t;for(const s of n){if(r==null||typeof r!="object")return;r=r[s]}return r}function q0(t,e){const n=e.split(".");let r=t;for(const s of n){if(!r.properties)return{};const i=r.properties;if(!i[s])return{};r=i[s]}return r}function _k(t){if(Array.isArray(t.oneOf)){const e=t.oneOf.map(n=>{if(!n||typeof n!="object")return null;const r=n;return r.const!==void 0?JSON.stringify(r.const):r.type==="array"&&r.items?"string[]":Array.isArray(r.type)?r.type.join(" | "):typeof r.type=="string"?r.type:null}).filter(n=>!!n);return e.length>0?e.join(" | "):"unknown"}return Array.isArray(t.type)?t.type.join(" | "):typeof t.type=="string"?t.type:"unknown"}function Wk(t,e){if(!t)return null;const n=G0[t];if(n)return n;if(!e)return null;const r=q0(e,t);if(Object.keys(r).length===0)return null;const s=Array.isArray(r.enum)?r.enum.map(i=>String(i)):Array.isArray(r.oneOf)?r.oneOf.map(i=>{if(!i||typeof i!="object")return null;const o=i;return o.const!==void 0?String(o.const):null}).filter(i=>!!i):void 0;return{path:t,type:_k(r),default:r.default!==void 0?JSON.stringify(r.default):"n/a",validValues:s&&s.length>0?s:void 0,description:typeof r.description=="string"?r.description:"Schema-derived help is available for this field.",descriptionVi:typeof r.description=="string"?r.description:"Trường này đang hiển thị mô tả được suy ra từ schema."}}function Uk(t,e){return t??e??null}function Qs(t){return t==="auto"?"auto":Array.isArray(t)?t.join(", "):typeof t=="string"?t:""}function Kk(t){const e=t.trim();return(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e).trim().toLowerCase()}function Gk(t){const e=t.trim();if(!e)return[];try{const n=JSON.parse(e);if(typeof n=="string"||Array.isArray(n))return n}catch{}return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1).split(",").map(n=>n.trim()).filter(Boolean):e}function Y0(t){const e=Gk(t),n=(Array.isArray(e)?e:String(e).split(",")).map(Kk).filter(Boolean).filter((r,s,i)=>i.indexOf(r)===s);return n.length===0||n.length===1&&n[0]==="auto"?"auto":n.filter(r=>r!=="auto")}function qk(t){return t.trim()===""?null:Y0(t)}const Yk=({value:t,onChange:e,onFocus:n,disabled:r})=>c.jsx("input",{type:"text",value:t??"",onChange:s=>e(s.target.value||null),onFocus:n,disabled:r,className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
|
|
202
|
+
text-dash-text placeholder-dash-text-muted
|
|
203
|
+
focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
|
|
204
|
+
disabled:opacity-50 disabled:cursor-not-allowed
|
|
205
|
+
transition-colors`,placeholder:"Enter value..."}),Jk=({value:t,onChange:e,onFocus:n,schema:r,disabled:s})=>c.jsx("input",{type:"number",value:t!=null?String(t):"",onChange:i=>{const o=i.target.value;if(o==="")e(null);else{const a=r.type==="integer"?Number.parseInt(o,10):Number.parseFloat(o);Number.isNaN(a)||e(a)}},onFocus:n,min:r.minimum,max:r.maximum,disabled:s,className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
|
|
206
|
+
text-dash-text placeholder-dash-text-muted
|
|
207
|
+
focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
|
|
208
|
+
disabled:opacity-50 disabled:cursor-not-allowed
|
|
209
|
+
transition-colors`}),Qk=({value:t,onChange:e,onFocus:n,disabled:r})=>{const s=t===!0;return c.jsx("button",{type:"button",role:"switch","aria-checked":s,onClick:()=>e(!s),onFocus:n,disabled:r,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors
|
|
210
|
+
focus:outline-none focus:ring-2 focus:ring-dash-accent/50
|
|
211
|
+
disabled:opacity-50 disabled:cursor-not-allowed
|
|
212
|
+
${s?"bg-dash-accent":"bg-dash-border"}`,children:c.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-sm transition-transform
|
|
213
|
+
${s?"translate-x-6":"translate-x-1"}`})})},Xk=({value:t,onChange:e,onFocus:n,schema:r,disabled:s,enumLabels:i,editable:o})=>{const a=r.enum||[],l=`enum-list-${a.join("-").slice(0,32)}`;if(o){const d=u=>i?.[String(u)]??String(u),h=t!=null?d(t):"";return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",list:l,value:h,onChange:u=>{const f=u.target.value,p=a.find(g=>d(g)===f);e(p!=null?String(p):f===""?null:f)},onFocus:n,disabled:s,placeholder:"Select or type a model...",className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
|
|
214
|
+
text-dash-text
|
|
215
|
+
focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
|
|
216
|
+
disabled:opacity-50 disabled:cursor-not-allowed
|
|
217
|
+
transition-colors`}),c.jsx("datalist",{id:l,children:a.map(u=>{const f=d(u);return c.jsx("option",{value:f},String(u))})})]})}return c.jsxs("select",{value:t!=null?String(t):"",onChange:d=>{const h=d.target.value;h===""?e(null):a.includes(Number(h))?e(Number(h)):e(h)},onFocus:n,disabled:s,className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
|
|
218
|
+
text-dash-text
|
|
219
|
+
focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
|
|
220
|
+
disabled:opacity-50 disabled:cursor-not-allowed
|
|
221
|
+
transition-colors appearance-none cursor-pointer`,children:[c.jsx("option",{value:"",children:"-- Select --"}),a.map(d=>c.jsx("option",{value:String(d),children:i?.[String(d)]??String(d)},String(d)))]})},Zk=({value:t,onChange:e,onFocus:n,disabled:r})=>{const[s,i]=m.useState(()=>Qs(t)),[o,a]=m.useState(!1);return m.useEffect(()=>{o||i(Qs(t))},[o,t]),c.jsx("input",{type:"text",value:o?s:Qs(t),onChange:l=>{const d=l.target.value;i(d);const h=qk(d);h!==null&&e(h)},onFocus:()=>{a(!0),i(Qs(t)),n?.()},onBlur:l=>{const d=l.target.value,h=Y0(d);a(!1),i(Qs(h)),e(h)},disabled:r,className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
|
|
222
|
+
text-dash-text placeholder-dash-text-muted
|
|
223
|
+
focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
|
|
224
|
+
disabled:opacity-50 disabled:cursor-not-allowed
|
|
225
|
+
transition-colors`,placeholder:"auto or codex, cursor"})},eS=({value:t,onChange:e,onFocus:n,disabled:r})=>{const s=Array.isArray(t)?t:[],[i,o]=m.useState(""),a=()=>{i.trim()&&(e([...s,i.trim()]),o(""))},l=d=>{const h=s.filter((u,f)=>f!==d);e(h.length>0?h:[])};return c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.map((d,h)=>c.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-dash-bg border border-dash-border rounded text-xs text-dash-text",children:[String(d),!r&&c.jsx("button",{type:"button",onClick:()=>l(h),className:"text-dash-text-muted hover:text-red-500 transition-colors",children:c.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},h))}),!r&&c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{type:"text",value:i,onChange:d=>o(d.target.value),onFocus:n,onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),a())},placeholder:"Add item...",className:`flex-1 px-2 py-1 text-xs bg-dash-bg border border-dash-border rounded
|
|
226
|
+
text-dash-text placeholder-dash-text-muted
|
|
227
|
+
focus:outline-none focus:ring-1 focus:ring-dash-accent/50`}),c.jsx("button",{type:"button",onClick:a,className:"px-2 py-1 text-xs bg-dash-accent text-white rounded hover:bg-dash-accent-hover transition-colors",children:"+"})]})]})},tS=({value:t,onChange:e,onFocus:n,disabled:r})=>{const[s,i]=m.useState(!1);return c.jsxs("div",{className:"relative",children:[c.jsx("input",{type:s?"text":"password",value:t??"",onChange:o=>e(o.target.value||null),onFocus:n,disabled:r,className:`w-full px-3 py-2 pr-10 text-sm bg-dash-bg border border-dash-border rounded-lg
|
|
228
|
+
text-dash-text placeholder-dash-text-muted
|
|
229
|
+
focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
|
|
230
|
+
disabled:opacity-50 disabled:cursor-not-allowed
|
|
231
|
+
transition-colors`,placeholder:"Enter passphrase..."}),c.jsx("button",{type:"button",onClick:()=>i(!s),className:"absolute right-2 top-1/2 -translate-y-1/2 text-dash-text-muted hover:text-dash-text transition-colors",children:s?c.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"})}):c.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})})]})},nS={default:"bg-gray-500/10 text-gray-500 dark:bg-gray-400/10 dark:text-gray-400",project:"bg-orange-500/10 text-orange-600 dark:text-orange-400",global:"bg-blue-500/10 text-blue-600 dark:text-blue-400"},rS=({source:t})=>{const{t:e}=X(),n=()=>{switch(t){case"default":return e("default");case"project":return e("scopeProject");case"global":return e("scopeGlobal")}};return c.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded font-bold uppercase tracking-wider ${nS[t]}`,children:n()})};function sS(t,e){if(e.includes("passphrase")||e.includes("password"))return"password";if(Array.isArray(t.oneOf)&&t.oneOf.some(r=>r.const==="auto")&&t.oneOf.some(r=>r.type==="array"&&r.items?.type==="string"))return"string-array-union";if(t.enum&&t.enum.length>0)return"enum";switch(Array.isArray(t.type)?t.type.find(r=>r!=="null")||"string":t.type||"string"){case"boolean":return"boolean";case"integer":case"number":return"number";case"array":return"array";case"object":return"object";default:return"string"}}const iS=({fieldPath:t,label:e,description:n,schema:r,value:s,source:i,onChange:o,onFocus:a,disabled:l,enumLabels:d,editable:h})=>{const u=sS(r,t),f=()=>{const p={value:s,onChange:o,onFocus:a,schema:r,disabled:l};switch(u){case"boolean":return c.jsx(Qk,{...p});case"number":return c.jsx(Jk,{...p});case"enum":return c.jsx(Xk,{...p,enumLabels:d,editable:h});case"string-array-union":return c.jsx(Zk,{...p});case"array":return c.jsx(eS,{...p});case"password":return c.jsx(tS,{...p});case"object":return null;default:return c.jsx(Yk,{...p})}};return u==="object"?null:c.jsx("div",{className:"py-3 border-b border-dash-border/50 last:border-b-0",children:c.jsxs("div",{className:"flex items-start justify-between gap-4",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[c.jsx("span",{className:"text-sm font-medium text-dash-text",children:e}),c.jsx(rS,{source:i})]}),n&&c.jsx("p",{className:"text-xs text-dash-text-muted mb-2 leading-relaxed",children:n}),c.jsx("p",{className:"text-[10px] text-dash-text-muted/50 font-mono mb-2",children:t})]}),c.jsx("div",{className:u==="boolean"?"shrink-0":"w-1/2 max-w-xs",children:f()})]})})},oS=({id:t,title:e,defaultCollapsed:n=!1,children:r})=>{const[s,i]=m.useState(n);return c.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-lg overflow-hidden",children:[c.jsxs("button",{type:"button",onClick:()=>i(!s),className:"w-full flex items-center justify-between px-4 py-3 bg-dash-surface-hover/30 hover:bg-dash-surface-hover/50 transition-colors","aria-expanded":!s,"aria-controls":`section-${t}`,children:[c.jsx("h3",{className:"text-sm font-bold text-dash-text uppercase tracking-wider",children:e}),c.jsx("svg",{className:`w-4 h-4 text-dash-text-muted transition-transform duration-200 ${s?"":"rotate-180"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),c.jsx("div",{id:`section-${t}`,className:`transition-all duration-200 ease-in-out ${s?"max-h-0 overflow-hidden":"max-h-[2000px]"}`,children:c.jsx("div",{className:"px-4 py-2",children:r})})]})},aS=({schema:t,value:e,sources:n,sections:r,onChange:s,onFieldFocus:i,disabled:o})=>c.jsx("div",{className:"space-y-4",children:r.map((a,l)=>c.jsx(oS,{id:a.id,title:a.title,defaultCollapsed:a.defaultCollapsed??l>1,children:a.fields.map(d=>{const h=q0(t,d.path),u=Td(e,d.path),f=n[d.path]||"default";return c.jsx(iS,{fieldPath:d.path,label:d.label,description:d.description||h.description,schema:h,value:u,source:f,onChange:p=>s(d.path,p),onFocus:()=>i?.(d.path),disabled:o,enumLabels:d.enumLabels,editable:d.editable},d.path)})},a.id))}),J0=({width:t,isLoading:e,schema:n,config:r,sources:s,sections:i,onChange:o,onFieldFocus:a,onNaturalHeightChange:l})=>{const{t:d}=X(),h=m.useRef(null),u=m.useRef(null),f=m.useRef(null),p=m.useRef(null);return m.useEffect(()=>{if(!l)return;const g=()=>{const b=u.current?.getBoundingClientRect().height??0,y=f.current;if(!y){l(Math.ceil(b));return}const w=window.getComputedStyle(y),C=Number.parseFloat(w.paddingTop||"0"),S=Number.parseFloat(w.paddingBottom||"0"),k=p.current?.getBoundingClientRect().height??0;l(Math.ceil(b+C+S+k))};if(g(),typeof ResizeObserver>"u")return;const x=new ResizeObserver(()=>{g()});return h.current&&x.observe(h.current),u.current&&x.observe(u.current),f.current&&x.observe(f.current),p.current&&x.observe(p.current),()=>x.disconnect()},[l]),c.jsxs("div",{ref:h,"data-form-panel":!0,style:{width:`${t}%`},className:"bg-dash-surface border border-dash-border rounded-xl overflow-hidden flex flex-col shadow-sm min-w-0 h-full",children:[c.jsx("div",{ref:u,"data-form-panel-header":!0,className:"p-3 border-b border-dash-border bg-dash-surface-hover/50 shrink-0",children:c.jsx("h3",{className:"text-xs font-bold text-dash-text-secondary uppercase tracking-widest",children:d("formTab")})}),c.jsx("div",{ref:f,"data-form-panel-scroll":!0,className:"flex-1 overflow-auto p-4",children:c.jsx("div",{ref:p,"data-form-panel-content":!0,children:e?c.jsx("div",{className:"h-full flex items-center justify-center",children:c.jsx("div",{className:"animate-pulse text-dash-text-muted text-sm",children:d("loading")})}):n?c.jsx(aS,{schema:n,value:r,sources:s,sections:i,onChange:o,onFieldFocus:a}):null})})]})},Q0=1024;let lS=0,wc=class{constructor(e,n){this.from=e,this.to=n}};class xe{constructor(e={}){this.id=lS++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Dt.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}xe.closedBy=new xe({deserialize:t=>t.split(" ")});xe.openedBy=new xe({deserialize:t=>t.split(" ")});xe.group=new xe({deserialize:t=>t.split(" ")});xe.isolate=new xe({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});xe.contextHash=new xe({perNode:!0});xe.lookAhead=new xe({perNode:!0});xe.mounted=new xe({perNode:!0});class fi{constructor(e,n,r,s=!1){this.tree=e,this.overlay=n,this.parser=r,this.bracketed=s}static get(e){return e&&e.props&&e.props[xe.mounted.id]}}const cS=Object.create(null);class Dt{constructor(e,n,r,s=0){this.name=e,this.props=n,this.id=r,this.flags=s}static define(e){let n=e.props&&e.props.length?Object.create(null):cS,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new Dt(e.name||"",n,e.id,r);if(e.props){for(let i of e.props)if(Array.isArray(i)||(i=i(s)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(xe.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let s of r.split(" "))n[s]=e[r];return r=>{for(let s=r.prop(xe.group),i=-1;i<(s?s.length:0);i++){let o=n[i<0?r.name:s[i]];if(o)return o}}}}Dt.none=new Dt("",Object.create(null),0,8);class Uh{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let s=null;for(let i of e){let o=i(r);if(o){s||(s=Object.assign({},r.props));let a=o[1],l=o[0];l.combine&&l.id in s&&(a=l.combine(s[l.id],a)),s[l.id]=a}}n.push(s?new Dt(r.name,s,r.id,r.flags):r)}return new Uh(n)}}const fa=new WeakMap,Df=new WeakMap;var Fe;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(Fe||(Fe={}));class Ve{constructor(e,n,r,s,i){if(this.type=e,this.children=n,this.positions=r,this.length=s,this.props=null,i&&i.length){this.props=Object.create(null);for(let[o,a]of i)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=fi.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let s=r.toString();s&&(n&&(n+=","),n+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new Ld(this.topNode,e)}cursorAt(e,n=0,r=0){let s=fa.get(this)||this.topNode,i=new Ld(s);return i.moveTo(e,n),fa.set(this,i._tree),i}get topNode(){return new Qt(this,0,0,null)}resolve(e,n=0){let r=Pi(fa.get(this)||this.topNode,e,n,!1);return fa.set(this,r),r}resolveInner(e,n=0){let r=Pi(Df.get(this)||this.topNode,e,n,!0);return Df.set(this,r),r}resolveStack(e,n=0){return uS(this,e,n)}iterate(e){let{enter:n,leave:r,from:s=0,to:i=this.length}=e,o=e.mode||0,a=(o&Fe.IncludeAnonymous)>0;for(let l=this.cursor(o|Fe.IncludeAnonymous);;){let d=!1;if(l.from<=i&&l.to>=s&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;d=!0}for(;d&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;d=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:qh(Dt.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new Ve(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new Ve(Dt.none,n,r,s)))}static build(e){return fS(e)}}Ve.empty=new Ve(Dt.none,[],[],0);class Kh{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Kh(this.buffer,this.index)}}class cr{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return Dt.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],s=this.set.types[n],i=s.name;if(/\W/.test(i)&&!s.isError&&(i=JSON.stringify(i)),e+=4,r==e)return i;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return i+"("+o.join(",")+")"}findChild(e,n,r,s,i){let{buffer:o}=this,a=-1;for(let l=e;l!=n&&!(X0(i,s,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,n,r){let s=this.buffer,i=new Uint16Array(n-e),o=0;for(let a=e,l=0;a<n;){i[l++]=s[a++],i[l++]=s[a++]-r;let d=i[l++]=s[a++]-r;i[l++]=s[a++]-e,o=Math.max(o,d)}return new cr(i,o,this.set)}}function X0(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function Pi(t,e,n,r){for(var s;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let o=!r&&t instanceof Qt&&t.index<0?null:t.parent;if(!o)return t;t=o}let i=r?0:Fe.IgnoreOverlays;if(r)for(let o=t,a=o.parent;a;o=a,a=o.parent)o instanceof Qt&&o.index<0&&((s=a.enter(e,n,i))===null||s===void 0?void 0:s.from)!=o.from&&(t=a);for(;;){let o=t.enter(e,n,i);if(!o)return t;t=o}}class Z0{cursor(e=0){return new Ld(this,e)}getChild(e,n=null,r=null){let s=Tf(this,e,n,r);return s.length?s[0]:null}getChildren(e,n=null,r=null){return Tf(this,e,n,r)}resolve(e,n=0){return Pi(this,e,n,!1)}resolveInner(e,n=0){return Pi(this,e,n,!0)}matchContext(e){return Ed(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let s=n.lastChild;if(!s||s.to!=n.to)break;s.type.isError&&s.from==s.to?(r=n,n=s.prevSibling):n=s}return r}get node(){return this}get next(){return this.parent}}class Qt extends Z0{constructor(e,n,r,s){super(),this._tree=e,this.from=n,this.index=r,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,s,i=0){var o;for(let a=this;;){for(let{children:l,positions:d}=a._tree,h=n>0?l.length:-1;e!=h;e+=n){let u=l[e],f=d[e]+a.from;if(!(!(i&Fe.EnterBracketed&&u instanceof Ve&&((o=fi.get(u))===null||o===void 0?void 0:o.overlay)===null&&(f>=r||f+u.length<=r))&&!X0(s,r,f,f+u.length))){if(u instanceof cr){if(i&Fe.ExcludeBuffers)continue;let p=u.findChild(0,u.buffer.length,n,r-f,s);if(p>-1)return new ir(new dS(a,u,e,f),null,p)}else if(i&Fe.IncludeAnonymous||!u.type.isAnonymous||Gh(u)){let p;if(!(i&Fe.IgnoreMounts)&&(p=fi.get(u))&&!p.overlay)return new Qt(p.tree,f,e,a);let g=new Qt(u,f,e,a);return i&Fe.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(n<0?u.children.length-1:0,n,r,s,i)}}}if(i&Fe.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+n:e=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,n,r=0){let s;if(!(r&Fe.IgnoreOverlays)&&(s=fi.get(this._tree))&&s.overlay){let i=e-this.from,o=r&Fe.EnterBracketed&&s.bracketed;for(let{from:a,to:l}of s.overlay)if((n>0||o?a<=i:a<i)&&(n<0||o?l>=i:l>i))return new Qt(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Tf(t,e,n,r){let s=t.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let o=!1;!o;)if(o=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(e)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function Ed(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class dS{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class ir extends Z0{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.context.start,r);return i<0?null:new ir(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,n,r=0){if(r&Fe.ExcludeBuffers)return null;let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return i<0?null:new ir(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new ir(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new ir(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let o=r.buffer[this.index+1];e.push(r.slice(s,i,o)),n.push(0)}return new Ve(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ex(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;i<t.length;i++){let o=t[i];(o.from>n.from||o.to<n.to)&&(n=o,e=i)}let r=n instanceof Qt&&n.index<0?null:n.parent,s=t.slice();return r?s[e]=r:s.splice(e,1),new hS(s,n)}class hS{constructor(e,n){this.heads=e,this.node=n}get next(){return ex(this.heads)}}function uS(t,e,n){let r=t.resolveInner(e,n),s=null;for(let i=r instanceof Qt?r:r.context.parent;i;i=i.parent)if(i.index<0){let o=i.parent;(s||(s=[r])).push(o.resolve(e,n)),i=o}else{let o=fi.get(i.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Qt(o.tree,o.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(Pi(a,e,n,!1))}}return s?ex(s):r}class Ld{get name(){return this.type.name}constructor(e,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~Fe.EnterBracketed,e instanceof Qt)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:s}=this.buffer;return this.type=n||s.set.types[s.buffer[e]],this.from=r+s.buffer[e+1],this.to=r+s.buffer[e+2],!0}yield(e){return e?e instanceof Qt?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:s}=this.buffer,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.buffer.start,r);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Fe.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Fe.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Fe.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:s}=this;if(s){if(e>0){if(this.index<s.buffer.buffer.length)return!1}else for(let i=0;i<this.index;i++)if(s.buffer.buffer[i+3]<this.index)return!1;({index:n,parent:r}=s)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let i=n+e,o=e<0?-1:r._tree.children.length;i!=o;i+=e){let a=r._tree.children[i];if(this.mode&Fe.IncludeAnonymous||a instanceof cr||!a.type.isAnonymous||Gh(a))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let s=this.index,i=this.stack.length;i>=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;n=o,r=i+1;break e}s=this.stack[--i]}for(let s=r;s<this.stack.length;s++)n=new ir(this.buffer,n,this.stack[s]);return this.bufferNode=new ir(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let s=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(s=!0)}for(;;){if(s&&n&&n(this),s=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,s=!0}}}matchContext(e){if(!this.buffer)return Ed(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let s=e.length-1,i=this.stack.length-1;s>=0;i--){if(i<0)return Ed(this._tree,e,s);let o=r[n.buffer[this.stack[i]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function Gh(t){return t.children.some(e=>e instanceof cr||!e.type.isAnonymous||Gh(e))}function fS(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=Q0,reused:i=[],minRepeatType:o=r.types.length}=t,a=Array.isArray(n)?new Kh(n,n.length):n,l=r.types,d=0,h=0;function u(k,N,v,P,O,E){let{id:M,start:D,end:$,size:F}=a,z=h,G=d;if(F<0)if(a.next(),F==-1){let fe=i[M];v.push(fe),P.push(D-k);return}else if(F==-3){d=M;return}else if(F==-4){h=M;return}else throw new RangeError(`Unrecognized record size: ${F}`);let le=l[M],Z,Q,ce=D-k;if($-D<=s&&(Q=b(a.pos-N,O))){let fe=new Uint16Array(Q.size-Q.skip),W=a.pos-Q.size,oe=fe.length;for(;a.pos>W;)oe=y(Q.start,fe,oe);Z=new cr(fe,$-Q.start,r),ce=Q.start-k}else{let fe=a.pos-F;a.next();let W=[],oe=[],ue=M>=o?M:-1,be=0,Pe=$;for(;a.pos>fe;)ue>=0&&a.id==ue&&a.size>=0?(a.end<=Pe-s&&(g(W,oe,D,be,a.end,Pe,ue,z,G),be=W.length,Pe=a.end),a.next()):E>2500?f(D,fe,W,oe):u(D,fe,W,oe,ue,E+1);if(ue>=0&&be>0&&be<W.length&&g(W,oe,D,be,D,Pe,ue,z,G),W.reverse(),oe.reverse(),ue>-1&&be>0){let Qe=p(le,G);Z=qh(le,W,oe,0,W.length,0,$-D,Qe,Qe)}else Z=x(le,W,oe,$-D,z-$,G)}v.push(Z),P.push(ce)}function f(k,N,v,P){let O=[],E=0,M=-1;for(;a.pos>N;){let{id:D,start:$,end:F,size:z}=a;if(z>4)a.next();else{if(M>-1&&$<M)break;M<0&&(M=F-s),O.push(D,$,F),E++,a.next()}}if(E){let D=new Uint16Array(E*4),$=O[O.length-2];for(let F=O.length-3,z=0;F>=0;F-=3)D[z++]=O[F],D[z++]=O[F+1]-$,D[z++]=O[F+2]-$,D[z++]=z;v.push(new cr(D,O[2]-$,r)),P.push($-k)}}function p(k,N){return(v,P,O)=>{let E=0,M=v.length-1,D,$;if(M>=0&&(D=v[M])instanceof Ve){if(!M&&D.type==k&&D.length==O)return D;($=D.prop(xe.lookAhead))&&(E=P[M]+D.length+$)}return x(k,v,P,O,E,N)}}function g(k,N,v,P,O,E,M,D,$){let F=[],z=[];for(;k.length>P;)F.push(k.pop()),z.push(N.pop()+v-O);k.push(x(r.types[M],F,z,E-O,D-E,$)),N.push(O-v)}function x(k,N,v,P,O,E,M){if(E){let D=[xe.contextHash,E];M=M?[D].concat(M):[D]}if(O>25){let D=[xe.lookAhead,O];M=M?[D].concat(M):[D]}return new Ve(k,N,v,P,M)}function b(k,N){let v=a.fork(),P=0,O=0,E=0,M=v.end-s,D={size:0,start:0,skip:0};e:for(let $=v.pos-k;v.pos>$;){let F=v.size;if(v.id==N&&F>=0){D.size=P,D.start=O,D.skip=E,E+=4,P+=4,v.next();continue}let z=v.pos-F;if(F<0||z<$||v.start<M)break;let G=v.id>=o?4:0,le=v.start;for(v.next();v.pos>z;){if(v.size<0)if(v.size==-3||v.size==-4)G+=4;else break e;else v.id>=o&&(G+=4);v.next()}O=le,P+=F,E+=G}return(N<0||P==k)&&(D.size=P,D.start=O,D.skip=E),D.size>4?D:void 0}function y(k,N,v){let{id:P,start:O,end:E,size:M}=a;if(a.next(),M>=0&&P<o){let D=v;if(M>4){let $=a.pos-(M-4);for(;a.pos>$;)v=y(k,N,v)}N[--v]=D,N[--v]=E-k,N[--v]=O-k,N[--v]=P}else M==-3?d=P:M==-4&&(h=P);return v}let w=[],C=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,w,C,-1,0);let S=(e=t.length)!==null&&e!==void 0?e:w.length?C[0]+w[0].length:0;return new Ve(l[t.topID],w.reverse(),C.reverse(),S)}const Ef=new WeakMap;function Ka(t,e){if(!t.isAnonymous||e instanceof cr||e.type!=t)return 1;let n=Ef.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Ve)){n=1;break}n+=Ka(t,r)}Ef.set(e,n)}return n}function qh(t,e,n,r,s,i,o,a,l){let d=0;for(let g=r;g<s;g++)d+=Ka(t,e[g]);let h=Math.ceil(d*1.5/8),u=[],f=[];function p(g,x,b,y,w){for(let C=b;C<y;){let S=C,k=x[C],N=Ka(t,g[C]);for(C++;C<y;C++){let v=Ka(t,g[C]);if(N+v>=h)break;N+=v}if(C==S+1){if(N>h){let v=g[S];p(v.children,v.positions,0,v.children.length,x[S]+w);continue}u.push(g[S])}else{let v=x[C-1]+g[C-1].length-k;u.push(qh(t,g,x,S,C,k,v,null,l))}f.push(k+w-i)}}return p(e,n,r,s,0),(a||l)(u,f,o)}class $r{constructor(e,n,r,s,i=!1,o=!1){this.from=e,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let s=[new $r(0,e.length,e,0,!1,r)];for(let i of n)i.to>e.length&&s.push(i);return s}static applyChanges(e,n,r=128){if(!n.length)return e;let s=[],i=1,o=e.length?e[0]:null;for(let a=0,l=0,d=0;;a++){let h=a<n.length?n[a]:null,u=h?h.fromA:1e9;if(u-l>=r)for(;o&&o.from<u;){let f=o;if(l>=f.from||u<=f.to||d){let p=Math.max(f.from,l)-d,g=Math.min(f.to,u)-d;f=p>=g?null:new $r(p,g,f.tree,f.offset+d,a>0,!!h)}if(f&&s.push(f),o.to>u)break;o=i<e.length?e[i++]:null}if(!h)break;l=h.toA,d=h.toA-h.toB}return s}}class tx{startParse(e,n,r){return typeof e=="string"&&(e=new pS(e)),r=r?r.length?r.map(s=>new wc(s.from,s.to)):[new wc(0,0)]:[new wc(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let s=this.startParse(e,n,r);for(;;){let i=s.advance();if(i)return i}}}class pS{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new xe({perNode:!0});var Lf={};class sl{constructor(e,n,r,s,i,o,a,l,d,h=0,u){this.p=e,this.stack=n,this.state=r,this.reducePos=s,this.pos=i,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=d,this.lookAhead=h,this.parent=u}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let s=e.parser.context;return new sl(e,[],n,r,r,0,[],0,s?new Rf(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,s=e&65535,{parser:i}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=i.dynamicPrecedence(s);if(a&&(this.score+=a),r==0){this.pushState(i.getGoto(this.state,s,!0),this.reducePos),s<i.minRepeatTerm&&this.storeNode(s,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(s,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),d=l?this.stack[l-2]:this.p.ranges[0].from,h=this.reducePos-d;h>=2e3&&!(!((n=this.p.parser.nodeSet.types[s])===null||n===void 0)&&n.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSize<h&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=d,this.p.lastBigReductionSize=h));let u=l?this.stack[l-1]:0,f=this.bufferBase+this.buffer.length-u;if(s<i.minRepeatTerm||e&131072){let p=i.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(s,d,p,f+4,!0)}if(e&262144)this.state=this.stack[l];else{let p=this.stack[l-3];this.state=i.getGoto(p,s,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(s,d)}storeNode(e,n,r,s=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,a=this.buffer.length;if(a==0&&o.parent&&(a=o.bufferBase-o.parent.bufferBase,o=o.parent),a>0&&o.buffer[a-4]==0&&o.buffer[a-1]>-1){if(n==r)return;if(o.buffer[a-2]>=n){o.buffer[a-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,s);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let a=!1;for(let l=o;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,s>4&&(s-=4)}this.buffer[o]=e,this.buffer[o+1]=n,this.buffer[o+2]=r,this.buffer[o+3]=s}}shift(e,n,r,s){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=s,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,s,4);else{let i=e,{parser:o}=this.p;(s>this.pos||n<=o.maxNode)&&(this.pos=s,o.stateFlag(i,1)||(this.reducePos=s)),this.pushState(i,r),this.shiftContext(n,r),n<=o.maxNode&&this.buffer.push(n,r,s,4)}}apply(e,n,r,s){e&65536?this.reduce(e):this.shift(e,n,r,s)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(n,s),this.buffer.push(r,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),s=e.bufferBase+n;for(;e&&s==e.bufferBase;)e=e.parent;return new sl(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new mS(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if(!(r&65536))return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let s=[];for(let i=0,o;i<n.length;i+=2)(o=n[i+1])!=this.state&&this.p.parser.hasAction(o,e)&&s.push(n[i],o);if(this.stack.length<120)for(let i=0;s.length<8&&i<n.length;i+=2){let o=n[i+1];s.some((a,l)=>l&1&&a==o)||s.push(n[i],o)}n=s}let r=[];for(let s=0;s<n.length&&r.length<4;s+=2){let i=n[s+1];if(i==this.state)continue;let o=this.split();o.pushState(i,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(n[s],this.pos),o.reducePos=this.pos,o.score-=200,r.push(o)}return r}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if(!(n&65536))return!1;if(!e.validAction(this.state,n)){let r=n>>19,s=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],s,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(s,i)=>{if(!n.includes(s))return n.push(s),e.allActions(s,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-i;if(a>1){let l=o&65535,d=this.stack.length-a*3;if(d>=0&&e.getGoto(this.stack[d],l,!1)>=0)return a<<19|65536|l}}else{let a=r(o,i+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new Rf(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Rf{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class mS{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=s}}class il{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new il(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new il(this.stack,this.pos,this.index)}}function pa(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,s=0;r<t.length;){let i=0;for(;;){let o=t.charCodeAt(r++),a=!1;if(o==126){i=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),i+=l,a)break;i*=46}n?n[s++]=i:n=new e(i)}return n}class Ga{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const If=new Ga;class gS{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=If,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,s=this.rangeIndex,i=this.pos+e;for(;i<r.from;){if(!s)return null;let o=this.ranges[--s];i-=r.from-o.to,r=o}for(;n<0?i>r.to:i>=r.to;){if(s==this.ranges.length-1)return null;let o=this.ranges[++s];i+=o.from-r.to,r=o}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,s;if(n>=0&&n<this.chunk.length)r=this.pos+e,s=this.chunk.charCodeAt(n);else{let i=this.resolveOffset(e,1);if(i==null)return-1;if(r=i,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)s=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),s=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),s}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=If,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let s of this.ranges){if(s.from>=n)break;s.to>e&&(r+=this.input.read(Math.max(s.from,e),Math.min(s.to,n)))}return r}}class hs{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;xS(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}hs.prototype.contextual=hs.prototype.fallback=hs.prototype.extend=!1;hs.prototype.fallback=hs.prototype.extend=!1;function xS(t,e,n,r,s,i){let o=0,a=1<<r,{dialect:l}=n.p.parser;e:for(;a&t[o];){let d=t[o+1];for(let p=o+3;p<d;p+=2)if((t[p+1]&a)>0){let g=t[p];if(l.allows(g)&&(e.token.value==-1||e.token.value==g||bS(g,e.token.value,s,i))){e.acceptToken(g);break}}let h=e.next,u=0,f=t[o+2];if(e.next<0&&f>u&&t[d+f*3-3]==65535){o=t[d+f*3-1];continue e}for(;u<f;){let p=u+f>>1,g=d+p+(p<<1),x=t[g],b=t[g+1]||65536;if(h<x)f=p;else if(h>=b)u=p+1;else{o=t[g+2],e.advance();continue e}}break}}function $f(t,e,n){for(let r=e,s;(s=t[r])!=65535;r++)if(s==n)return r-e;return-1}function bS(t,e,n,r){let s=$f(n,r,e);return s<0||$f(n,r,t)<s}const Et=typeof process<"u"&&Lf&&/\bparse\b/.test(Lf.LOG);let kc=null;function Bf(t,e,n){let r=t.cursor(Fe.IncludeAnonymous);for(r.moveTo(e);;)if(!(n<0?r.childBefore(e):r.childAfter(e)))for(;;){if((n<0?r.to<e:r.from>e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class yS{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Bf(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Bf(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],s=this.index[n];if(s==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=r.children[s],o=this.start[n]+r.positions[s];if(o>e)return this.nextStart=o,null;if(i instanceof Ve){if(o==e){if(o<this.safeFrom)return null;let a=o+i.length;if(a<=this.safeTo){let l=i.prop(xe.lookAhead);if(!l||a+l<this.fragment.to)return i}}this.index[n]++,o+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+i.length}}}class vS{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Ga)}getActions(e){let n=0,r=null,{parser:s}=e.p,{tokenizers:i}=s,o=s.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let d=0;d<i.length;d++){if(!(1<<d&o))continue;let h=i[d],u=this.tokens[d];if(!(r&&!h.fallback)&&((h.contextual||u.start!=e.pos||u.mask!=o||u.context!=a)&&(this.updateCachedToken(u,h,e),u.mask=o,u.context=a),u.lookAhead>u.end+25&&(l=Math.max(u.lookAhead,l)),u.value!=0)){let f=n;if(u.extended>-1&&(n=this.addActions(e,u.extended,u.end,n)),n=this.addActions(e,u.value,u.end,n),!h.extend&&(r=u,n>f))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new Ga,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new Ga,{pos:r,p:s}=e;return n.start=r,n.end=Math.min(r+1,s.stream.end),n.value=r==s.stream.end?s.parser.eofTerm:0,n}updateCachedToken(e,n,r){let s=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(s,e),r),e.value>-1){let{parser:i}=r.p;for(let o=0;o<i.specialized.length;o++)if(i.specialized[o]==e.value){let a=i.specializers[o](this.stream.read(e.start,e.end),r);if(a>=0&&r.p.parser.dialect.allows(a>>1)){a&1?e.extended=a>>1:e.value=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,n,r,s){for(let i=0;i<s;i+=3)if(this.actions[i]==e)return s;return this.actions[s++]=e,this.actions[s++]=n,this.actions[s++]=r,s}addActions(e,n,r,s){let{state:i}=e,{parser:o}=e.p,{data:a}=o;for(let l=0;l<2;l++)for(let d=o.stateSlot(i,l?2:1);;d+=3){if(a[d]==65535)if(a[d+1]==1)d=zn(a,d+2);else{s==0&&a[d+1]==2&&(s=this.putAction(zn(a,d+2),n,r,s));break}a[d]==n&&(s=this.putAction(zn(a,d+1),n,r,s))}return s}}class wS{constructor(e,n,r,s){this.parser=e,this.input=n,this.ranges=s,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new gS(n,s),this.tokens=new vS(e,this.stream),this.topTerm=e.top[1];let{from:i}=s[0];this.stacks=[sl.start(this,e.top[0],i)],this.fragments=r.length&&this.stream.end-i>e.bufferLength*4?new yS(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],s,i;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let a=e[o];for(;;){if(this.tokens.mainToken=null,a.pos>n)r.push(a);else{if(this.advanceStack(a,r,e))continue;{s||(s=[],i=[]),s.push(a);let l=this.tokens.getMainToken(a);i.push(l.value,l.end)}}break}}if(!r.length){let o=s&&SS(s);if(o)return Et&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Et&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&s){let o=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,i,r);if(o)return Et&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((a,l)=>l.score-a.score);r.length>o;)r.pop();r.some(a=>a.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let o=0;o<r.length-1;o++){let a=r[o];for(let l=o+1;l<r.length;l++){let d=r[l];if(a.sameState(d)||a.buffer.length>500&&d.buffer.length>500)if((a.score-d.score||a.buffer.length-d.buffer.length)>0)r.splice(l--,1);else{r.splice(o--,1);continue e}}}r.length>12&&(r.sort((o,a)=>a.score-o.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let o=1;o<r.length;o++)r[o].pos<this.minStackPos&&(this.minStackPos=r[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,n,r){let s=e.pos,{parser:i}=this,o=Et?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.curContext&&e.curContext.tracker.strict,h=d?e.curContext.hash:0;for(let u=this.fragments.nodeAt(s);u;){let f=this.parser.nodeSet.types[u.type.id]==u.type?i.getGoto(e.state,u.type.id):-1;if(f>-1&&u.length&&(!d||(u.prop(xe.contextHash)||0)==h))return e.useNode(u,f),Et&&console.log(o+this.stackID(e)+` (via reuse of ${i.getName(u.type.id)})`),!0;if(!(u instanceof Ve)||u.children.length==0||u.positions[0]>0)break;let p=u.children[0];if(p instanceof Ve&&u.positions[0]==0)u=p;else break}}let a=i.stateSlot(e.state,4);if(a>0)return e.reduce(a),Et&&console.log(o+this.stackID(e)+` (via always-reduce ${i.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let d=0;d<l.length;){let h=l[d++],u=l[d++],f=l[d++],p=d==l.length||!r,g=p?e:e.split(),x=this.tokens.mainToken;if(g.apply(h,u,x?x.start:g.pos,f),Et&&console.log(o+this.stackID(g)+` (via ${h&65536?`reduce of ${i.getName(h&65535)}`:"shift"} for ${i.getName(u)} @ ${s}${g==e?"":", split"})`),p)return!0;g.pos>s?n.push(g):r.push(g)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return Ff(e,n),!0}}runRecovery(e,n,r){let s=null,i=!1;for(let o=0;o<e.length;o++){let a=e[o],l=n[o<<1],d=n[(o<<1)+1],h=Et?this.stackID(a)+" -> ":"";if(a.deadEnd&&(i||(i=!0,a.restart(),Et&&console.log(h+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let u=a.split(),f=h;for(let p=0;p<10&&u.forceReduce()&&(Et&&console.log(f+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,r));p++)Et&&(f=this.stackID(u)+" -> ");for(let p of a.recoverByInsert(l))Et&&console.log(h+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,r);this.stream.end>a.pos?(d==a.pos&&(d++,l=0),a.recoverByDelete(l,d),Et&&console.log(h+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),Ff(a,r)):(!s||s.score<a.score)&&(s=a)}return s}stackToTree(e){return e.close(),Ve.build({buffer:il.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let n=(kc||(kc=new WeakMap)).get(e);return n||kc.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function Ff(t,e){for(let n=0;n<e.length;n++){let r=e[n];if(r.pos==t.pos&&r.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class kS{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}class ol extends tx{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let a=0;a<e.repeatNodeCount;a++)n.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),s=[];for(let a=0;a<n.length;a++)s.push([]);function i(a,l,d){s[a].push([l,l.deserialize(String(d))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=xe[l]);for(let d=1;d<a.length;){let h=a[d++];if(h>=0)i(h,l,a[d++]);else{let u=a[d+-h];for(let f=-h;f>0;f--)i(a[d++],l,u);d++}}}this.nodeSet=new Uh(n.map((a,l)=>Dt.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:s[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Q0;let o=pa(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(zf),this.states=pa(e.states,Uint32Array),this.data=pa(e.stateData),this.goto=pa(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new hs(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let s=new wS(this,e,n,r);for(let i of this.wrappers)s=i(s,e,n,r);return s}getGoto(e,n,r=!1){let s=this.goto;if(n>=s[0])return-1;for(let i=s[n+1];;){let o=s[i++],a=o&1,l=s[i++];if(a&&r)return l;for(let d=i+(o>>1);i<d;i++)if(s[i]==e)return l;if(a)return-1}}hasAction(e,n){let r=this.data;for(let s=0;s<2;s++)for(let i=this.stateSlot(e,s?2:1),o;;i+=3){if((o=r[i])==65535)if(r[i+1]==1)o=r[i=zn(r,i+2)];else{if(r[i+1]==2)return zn(r,i+2);break}if(o==n||o==0)return zn(r,i+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),s=r?n(r):void 0;for(let i=this.stateSlot(e,1);s==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=zn(this.data,i+2);else break;s=n(zn(this.data,i+1))}return s}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=zn(this.data,r+2);else break;if(!(this.data[r+2]&1)){let s=this.data[r+1];n.some((i,o)=>o&1&&i==s)||n.push(this.data[r],s)}}return n}configure(e){let n=Object.assign(Object.create(ol.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let s=e.tokenizers.find(i=>i.from==r);return s?s.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,s)=>{let i=e.specializers.find(a=>a.from==r.external);if(!i)return r;let o=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[s]=zf(o),o})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let i of e.split(" ")){let o=n.indexOf(i);o>=0&&(r[o]=!0)}let s=null;for(let i=0;i<n.length;i++)if(!r[i])for(let o=this.dialects[n[i]],a;(a=this.data[o++])!=65535;)(s||(s=new Uint8Array(this.maxTerm+1)))[a]=1;return new kS(e,r,s)}static deserialize(e){return new ol(e)}}function zn(t,e){return t[e]|t[e+1]<<16}function SS(t){let e=null;for(let n of t){let r=n.p.stoppedAt;(n.pos==n.p.stream.end||r!=null&&n.pos>r)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function zf(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}let CS=0;class Kt{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=CS++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof Kt&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let s=new Kt(r,[],null,[]);if(s.set.push(s),n)for(let i of n.set)s.set.push(i);return s}static defineModifier(e){let n=new al(e);return r=>r.modified.indexOf(n)>-1?r:al.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let jS=0;class al{constructor(e){this.name=e,this.instances=[],this.id=jS++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&NS(n,a.modified));if(r)return r;let s=[],i=new Kt(e.name,s,e,n);for(let a of n)a.instances.push(i);let o=PS(n);for(let a of e.set)if(!a.modified.length)for(let l of o)s.push(al.get(a,l));return i}}function NS(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function PS(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,s=e.length;r<s;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function nx(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],o=2,a=s;for(let u=0;;){if(a=="..."&&u>0&&u+3==s.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+s);if(i.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),u+=f[0].length,u==s.length)break;let p=s[u++];if(u==s.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+s);a=s.slice(u)}let l=i.length-1,d=i[l];if(!d)throw new RangeError("Invalid path: "+s);let h=new Oi(r,o,l>0?i.slice(0,l):null);e[d]=h.sort(e[d])}}return rx.add(e)}const rx=new xe({combine(t,e){let n,r,s;for(;t||e;){if(!t||e&&t.depth>=e.depth?(s=e,e=e.next):(s=t,t=t.next),n&&n.mode==s.mode&&!s.context&&!n.context)continue;let i=new Oi(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class Oi{constructor(e,n,r,s){this.tags=e,this.mode=n,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Oi.empty=new Oi([],2,null);function sx(t,e){let n=Object.create(null);for(let i of t)if(!Array.isArray(i.tag))n[i.tag.id]=i.class;else for(let o of i.tag)n[o.id]=i.class;let{scope:r,all:s=null}=e||{};return{style:i=>{let o=s;for(let a of i)for(let l of a.set){let d=n[l.id];if(d){o=o?o+" "+d:d;break}}return o},scope:r}}function OS(t,e){let n=null;for(let r of t){let s=r.style(e);s&&(n=n?n+" "+s:s)}return n}function MS(t,e,n,r=0,s=t.length){let i=new AS(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,s,"",i.highlighters),i.flush(s)}class AS{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,s,i){let{type:o,from:a,to:l}=e;if(a>=r||l<=n)return;o.isTop&&(i=this.highlighters.filter(p=>!p.scope||p.scope(o)));let d=s,h=DS(e)||Oi.empty,u=OS(i,h.tags);if(u&&(d&&(d+=" "),d+=u,h.mode==1&&(s+=(s?" ":"")+u)),this.startSpan(Math.max(n,a),d),h.opaque)return;let f=e.tree&&e.tree.prop(xe.mounted);if(f&&f.overlay){let p=e.node.enter(f.overlay[0].from+a,1),g=this.highlighters.filter(b=>!b.scope||b.scope(f.tree.type)),x=e.firstChild();for(let b=0,y=a;;b++){let w=b<f.overlay.length?f.overlay[b]:null,C=w?w.from+a:l,S=Math.max(n,y),k=Math.min(r,C);if(S<k&&x)for(;e.from<k&&(this.highlightRange(e,S,k,s,i),this.startSpan(Math.min(k,e.to),d),!(e.to>=C||!e.nextSibling())););if(!w||C>r)break;y=w.to+a,y>n&&(this.highlightRange(p.cursor(),Math.max(n,w.from+a),Math.min(r,y),"",g),this.startSpan(Math.min(r,y),d))}x&&e.parent()}else if(e.firstChild()){f&&(s="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,s,i),this.startSpan(Math.min(r,e.to),d)}while(e.nextSibling());e.parent()}}}function DS(t){let e=t.type.prop(rx);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const H=Kt.define,ma=H(),Jn=H(),Vf=H(Jn),Hf=H(Jn),Qn=H(),ga=H(Qn),Sc=H(Qn),Cn=H(),jr=H(Cn),wn=H(),kn=H(),Rd=H(),Xs=H(Rd),xa=H(),L={comment:ma,lineComment:H(ma),blockComment:H(ma),docComment:H(ma),name:Jn,variableName:H(Jn),typeName:Vf,tagName:H(Vf),propertyName:Hf,attributeName:H(Hf),className:H(Jn),labelName:H(Jn),namespace:H(Jn),macroName:H(Jn),literal:Qn,string:ga,docString:H(ga),character:H(ga),attributeValue:H(ga),number:Sc,integer:H(Sc),float:H(Sc),bool:H(Qn),regexp:H(Qn),escape:H(Qn),color:H(Qn),url:H(Qn),keyword:wn,self:H(wn),null:H(wn),atom:H(wn),unit:H(wn),modifier:H(wn),operatorKeyword:H(wn),controlKeyword:H(wn),definitionKeyword:H(wn),moduleKeyword:H(wn),operator:kn,derefOperator:H(kn),arithmeticOperator:H(kn),logicOperator:H(kn),bitwiseOperator:H(kn),compareOperator:H(kn),updateOperator:H(kn),definitionOperator:H(kn),typeOperator:H(kn),controlOperator:H(kn),punctuation:Rd,separator:H(Rd),bracket:Xs,angleBracket:H(Xs),squareBracket:H(Xs),paren:H(Xs),brace:H(Xs),content:Cn,heading:jr,heading1:H(jr),heading2:H(jr),heading3:H(jr),heading4:H(jr),heading5:H(jr),heading6:H(jr),contentSeparator:H(Cn),list:H(Cn),quote:H(Cn),emphasis:H(Cn),strong:H(Cn),link:H(Cn),monospace:H(Cn),strikethrough:H(Cn),inserted:H(),deleted:H(),changed:H(),invalid:H(),meta:xa,documentMeta:H(xa),annotation:H(xa),processingInstruction:H(xa),definition:Kt.defineModifier("definition"),constant:Kt.defineModifier("constant"),function:Kt.defineModifier("function"),standard:Kt.defineModifier("standard"),local:Kt.defineModifier("local"),special:Kt.defineModifier("special")};for(let t in L){let e=L[t];e instanceof Kt&&(e.name=t)}sx([{tag:L.link,class:"tok-link"},{tag:L.heading,class:"tok-heading"},{tag:L.emphasis,class:"tok-emphasis"},{tag:L.strong,class:"tok-strong"},{tag:L.keyword,class:"tok-keyword"},{tag:L.atom,class:"tok-atom"},{tag:L.bool,class:"tok-bool"},{tag:L.url,class:"tok-url"},{tag:L.labelName,class:"tok-labelName"},{tag:L.inserted,class:"tok-inserted"},{tag:L.deleted,class:"tok-deleted"},{tag:L.literal,class:"tok-literal"},{tag:L.string,class:"tok-string"},{tag:L.number,class:"tok-number"},{tag:[L.regexp,L.escape,L.special(L.string)],class:"tok-string2"},{tag:L.variableName,class:"tok-variableName"},{tag:L.local(L.variableName),class:"tok-variableName tok-local"},{tag:L.definition(L.variableName),class:"tok-variableName tok-definition"},{tag:L.special(L.variableName),class:"tok-variableName2"},{tag:L.definition(L.propertyName),class:"tok-propertyName tok-definition"},{tag:L.typeName,class:"tok-typeName"},{tag:L.namespace,class:"tok-namespace"},{tag:L.className,class:"tok-className"},{tag:L.macroName,class:"tok-macroName"},{tag:L.propertyName,class:"tok-propertyName"},{tag:L.operator,class:"tok-operator"},{tag:L.comment,class:"tok-comment"},{tag:L.meta,class:"tok-meta"},{tag:L.invalid,class:"tok-invalid"},{tag:L.punctuation,class:"tok-punctuation"}]);const TS=nx({String:L.string,Number:L.number,"True False":L.bool,PropertyName:L.propertyName,Null:L.null,", :":L.separator,"[ ]":L.squareBracket,"{ }":L.brace}),ES=ol.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[TS],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});let Id=[],ix=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?ix:Id).push(n=n+t[e])})();function LS(t){if(t<768)return!1;for(let e=0,n=Id.length;;){let r=e+n>>1;if(t<Id[r])n=r;else if(t>=ix[r])e=r+1;else return!0;if(e==n)return!1}}function _f(t){return t>=127462&&t<=127487}const Wf=8205;function RS(t,e,n=!0,r=!0){return(n?ox:IS)(t,e,r)}function ox(t,e,n){if(e==t.length)return e;e&&ax(t.charCodeAt(e))&&lx(t.charCodeAt(e-1))&&e--;let r=Cc(t,e);for(e+=Uf(r);e<t.length;){let s=Cc(t,e);if(r==Wf||s==Wf||n&&LS(s))e+=Uf(s),r=s;else if(_f(s)){let i=0,o=e-2;for(;o>=0&&_f(Cc(t,o));)i++,o-=2;if(i%2==0)break;e+=2}else break}return e}function IS(t,e,n){for(;e>0;){let r=ox(t,e-2,n);if(r<e)return r;e--}return 0}function Cc(t,e){let n=t.charCodeAt(e);if(!lx(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return ax(r)?(n-55296<<10)+(r-56320)+65536:n}function ax(t){return t>=56320&&t<57344}function lx(t){return t>=55296&&t<56320}function Uf(t){return t<65536?1:2}class Ne{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=vs(this,e,n);let s=[];return this.decompose(0,e,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(n,this.length,s,1),Nn.from(s,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=vs(this,e,n);let r=[];return this.decompose(e,n,r,0),Nn.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),s=new pi(this),i=new pi(e);for(let o=n,a=n;;){if(s.next(o),i.next(o),o=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(a+=s.value.length,s.done||a>=r)return!0}}iter(e=1){return new pi(this,e)}iterRange(e,n=this.length){return new cx(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let s=this.line(e).from;r=this.iterRange(s,Math.max(s,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new dx(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Ne.empty:e.length<=32?new ze(e):Nn.from(ze.split(e,[]))}}class ze extends Ne{constructor(e,n=$S(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,s){for(let i=0;;i++){let o=this.text[i],a=s+o.length;if((n?r:a)>=e)return new BS(s,a,r,o);s=a+1,r++}}decompose(e,n,r,s){let i=e<=0&&n>=this.length?this:new ze(Kf(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(s&1){let o=r.pop(),a=qa(i.text,o.text.slice(),0,i.length);if(a.length<=32)r.push(new ze(a,o.length+i.length));else{let l=a.length>>1;r.push(new ze(a.slice(0,l)),new ze(a.slice(l)))}}else r.push(i)}replace(e,n,r){if(!(r instanceof ze))return super.replace(e,n,r);[e,n]=vs(this,e,n);let s=qa(this.text,qa(r.text,Kf(this.text,0,e)),n),i=this.length+r.length-(n-e);return s.length<=32?new ze(s,i):Nn.from(ze.split(s,[]),i)}sliceString(e,n=this.length,r=`
|
|
232
|
+
`){[e,n]=vs(this,e,n);let s="";for(let i=0,o=0;i<=n&&o<this.text.length;o++){let a=this.text[o],l=i+a.length;i>e&&o&&(s+=r),e<l&&n>i&&(s+=a.slice(Math.max(0,e-i),n-i)),i=l+1}return s}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],s=-1;for(let i of e)r.push(i),s+=i.length+1,r.length==32&&(n.push(new ze(r,s)),r=[],s=-1);return s>-1&&n.push(new ze(r,s)),n}}class Nn extends Ne{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,s){for(let i=0;;i++){let o=this.children[i],a=s+o.length,l=r+o.lines-1;if((n?l:a)>=e)return o.lineInner(e,n,r,s);s=a+1,r=l+1}}decompose(e,n,r,s){for(let i=0,o=0;o<=n&&i<this.children.length;i++){let a=this.children[i],l=o+a.length;if(e<=l&&n>=o){let d=s&((o<=e?1:0)|(l>=n?2:0));o>=e&&l<=n&&!d?r.push(a):a.decompose(e-o,n-o,r,d)}o=l+1}}replace(e,n,r){if([e,n]=vs(this,e,n),r.lines<this.lines)for(let s=0,i=0;s<this.children.length;s++){let o=this.children[s],a=i+o.length;if(e>=i&&n<=a){let l=o.replace(e-i,n-i,r),d=this.lines-o.lines+l.lines;if(l.lines<d>>4&&l.lines>d>>6){let h=this.children.slice();return h[s]=l,new Nn(h,this.length-(n-e)+r.length)}return super.replace(i,a,l)}i=a+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=`
|
|
233
|
+
`){[e,n]=vs(this,e,n);let s="";for(let i=0,o=0;i<this.children.length&&o<=n;i++){let a=this.children[i],l=o+a.length;o>e&&i&&(s+=r),e<l&&n>o&&(s+=a.sliceString(e-o,n-o,r)),o=l+1}return s}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof Nn))return 0;let r=0,[s,i,o,a]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=n,i+=n){if(s==o||i==a)return r;let l=this.children[s],d=e.children[i];if(l!=d)return r+l.scanIdentical(d,n);r+=l.length+1}}static from(e,n=e.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let p of e)r+=p.lines;if(r<32){let p=[];for(let g of e)g.flatten(p);return new ze(p,n)}let s=Math.max(32,r>>5),i=s<<1,o=s>>1,a=[],l=0,d=-1,h=[];function u(p){let g;if(p.lines>i&&p instanceof Nn)for(let x of p.children)u(x);else p.lines>o&&(l>o||!l)?(f(),a.push(p)):p instanceof ze&&l&&(g=h[h.length-1])instanceof ze&&p.lines+g.lines<=32?(l+=p.lines,d+=p.length+1,h[h.length-1]=new ze(g.text.concat(p.text),g.length+1+p.length)):(l+p.lines>s&&f(),l+=p.lines,d+=p.length+1,h.push(p))}function f(){l!=0&&(a.push(h.length==1?h[0]:Nn.from(h,d)),d=-1,l=h.length=0)}for(let p of e)u(p);return f(),a.length==1?a[0]:new Nn(a,n)}}Ne.empty=new ze([""],0);function $S(t){let e=-1;for(let n of t)e+=n.length+1;return e}function qa(t,e,n=0,r=1e9){for(let s=0,i=0,o=!0;i<t.length&&s<=r;i++){let a=t[i],l=s+a.length;l>=n&&(l>r&&(a=a.slice(0,r-s)),s<n&&(a=a.slice(n-s)),o?(e[e.length-1]+=a,o=!1):e.push(a)),s=l+1}return e}function Kf(t,e,n){return qa(t,[""],e,n)}class pi{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof ze?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],i=this.offsets[r],o=i>>1,a=s instanceof ze?s.text.length:s.children.length;if(o==(n>0?a:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=`
|
|
234
|
+
`,this;e--}else if(s instanceof ze){let l=s.text[o+(n<0?-1:0)];if(this.offsets[r]+=n,l.length>Math.max(0,e))return this.value=e==0?l:n>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=s.children[o+(n<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof ze?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class cx{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new pi(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*n,this.value=s.length<=r?s:n<0?s.slice(s.length-r):s.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class dx{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:s}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Ne.prototype[Symbol.iterator]=function(){return this.iter()},pi.prototype[Symbol.iterator]=cx.prototype[Symbol.iterator]=dx.prototype[Symbol.iterator]=function(){return this});class BS{constructor(e,n,r,s){this.from=e,this.to=n,this.number=r,this.text=s}get length(){return this.to-this.from}}function vs(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function Ye(t,e,n=!0,r=!0){return RS(t,e,n,r)}function FS(t){return t>=56320&&t<57344}function zS(t){return t>=55296&&t<56320}function Nt(t,e){let n=t.charCodeAt(e);if(!zS(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return FS(r)?(n-55296<<10)+(r-56320)+65536:n}function Yh(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Pn(t){return t<65536?1:2}const $d=/\r\n?|\n/;var vt=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(vt||(vt={}));class Tn{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];e+=r<0?this.sections[n]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,r=0,s=0;n<this.sections.length;){let i=this.sections[n++],o=this.sections[n++];o<0?(e(r,s,i),s+=i):s+=o,r+=i}}iterChangedRanges(e,n=!1){Bd(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],s=this.sections[n++];s<0?e.push(r,s):e.push(s,r)}return new Tn(e)}composeDesc(e){return this.empty?e:e.empty?this:hx(this,e)}mapDesc(e,n=!1){return e.empty?this:Fd(this,e,n)}mapPos(e,n=-1,r=vt.Simple){let s=0,i=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],d=s+a;if(l<0){if(d>e)return i+(e-s);i+=a}else{if(r!=vt.Simple&&d>=e&&(r==vt.TrackDel&&s<e&&d>e||r==vt.TrackBefore&&s<e||r==vt.TrackAfter&&d>e))return null;if(d>e||d==e&&n<0&&!a)return e==s||n<0?i:i+l;i+=l}s=d}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return i}touchesRange(e,n=e){for(let r=0,s=0;r<this.sections.length&&s<=n;){let i=this.sections[r++],o=this.sections[r++],a=s+i;if(o>=0&&s<=n&&a>=e)return s<e&&a>n?"cover":!0;s=a}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],s=this.sections[n++];e+=(e?" ":"")+r+(s>=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Tn(e)}static create(e){return new Tn(e)}}class Ge extends Tn{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Bd(this,(n,r,s,i,o)=>e=e.replace(s,s+(r-n),o),!1),e}mapDesc(e,n=!1){return Fd(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let s=0,i=0;s<n.length;s+=2){let o=n[s],a=n[s+1];if(a>=0){n[s]=a,n[s+1]=o;let l=s>>1;for(;r.length<l;)r.push(Ne.empty);r.push(o?e.slice(i,i+o):Ne.empty)}i+=o}return new Ge(n,r)}compose(e){return this.empty?e:e.empty?this:hx(this,e,!0)}map(e,n=!1){return e.empty?this:Fd(this,e,n,!0)}iterChanges(e,n=!1){Bd(this,e,n)}get desc(){return Tn.create(this.sections)}filter(e){let n=[],r=[],s=[],i=new Mi(this);e:for(let o=0,a=0;;){let l=o==e.length?1e9:e[o++];for(;a<l||a==l&&i.len==0;){if(i.done)break e;let h=Math.min(i.len,l-a);ht(s,h,-1);let u=i.ins==-1?-1:i.off==0?i.ins:0;ht(n,h,u),u>0&&or(r,n,i.text),i.forward(h),a+=h}let d=e[o++];for(;a<d;){if(i.done)break e;let h=Math.min(i.len,d-a);ht(n,h,-1),ht(s,h,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(h),a+=h}}return{changes:new Ge(n,r),filtered:Tn.create(s)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],s=this.sections[n+1];s<0?e.push(r):s==0?e.push([r]):e.push([r].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,r){let s=[],i=[],o=0,a=null;function l(h=!1){if(!h&&!s.length)return;o<n&&ht(s,n-o,-1);let u=new Ge(s,i);a=a?a.compose(u.map(a)):u,s=[],i=[],o=0}function d(h){if(Array.isArray(h))for(let u of h)d(u);else if(h instanceof Ge){if(h.length!=n)throw new RangeError(`Mismatched change set length (got ${h.length}, expected ${n})`);l(),a=a?a.compose(h.map(a)):h}else{let{from:u,to:f=u,insert:p}=h;if(u>f||u<0||f>n)throw new RangeError(`Invalid change range ${u} to ${f} (in doc of length ${n})`);let g=p?typeof p=="string"?Ne.of(p.split(r||$d)):p:Ne.empty,x=g.length;if(u==f&&x==0)return;u<o&&l(),u>o&&ht(s,u-o,-1),ht(s,f-u,x),or(i,s,g),o=f}}return d(e),l(!a),a}static empty(e){return new Ge(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let s=0;s<e.length;s++){let i=e[s];if(typeof i=="number")n.push(i,-1);else{if(!Array.isArray(i)||typeof i[0]!="number"||i.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length<s;)r.push(Ne.empty);r[s]=Ne.of(i.slice(1)),n.push(i[0],r[s].length)}}}return new Ge(n,r)}static createSet(e,n){return new Ge(e,n)}}function ht(t,e,n,r=!1){if(e==0&&n<=0)return;let s=t.length-2;s>=0&&n<=0&&n==t[s+1]?t[s]+=e:s>=0&&e==0&&t[s]==0?t[s+1]+=n:r?(t[s]+=e,t[s+1]+=n):t.push(e,n)}function or(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<r;)t.push(Ne.empty);t.push(n)}}function Bd(t,e,n){let r=t.inserted;for(let s=0,i=0,o=0;o<t.sections.length;){let a=t.sections[o++],l=t.sections[o++];if(l<0)s+=a,i+=a;else{let d=s,h=i,u=Ne.empty;for(;d+=a,h+=l,l&&r&&(u=u.append(r[o-2>>1])),!(n||o==t.sections.length||t.sections[o+1]<0);)a=t.sections[o++],l=t.sections[o++];e(s,d,i,h,u),s=d,i=h}}}function Fd(t,e,n,r=!1){let s=[],i=r?[]:null,o=new Mi(t),a=new Mi(e);for(let l=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let d=Math.min(o.len,a.len);ht(s,d,-1),o.forward(d),a.forward(d)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!n))){let d=a.len;for(ht(s,a.ins,-1);d;){let h=Math.min(o.len,d);o.ins>=0&&l<o.i&&o.len<=h&&(ht(s,0,o.ins),i&&or(i,s,o.text),l=o.i),o.forward(h),d-=h}a.next()}else if(o.ins>=0){let d=0,h=o.len;for(;h;)if(a.ins==-1){let u=Math.min(h,a.len);d+=u,h-=u,a.forward(u)}else if(a.ins==0&&a.len<h)h-=a.len,a.next();else break;ht(s,d,l<o.i?o.ins:0),i&&l<o.i&&or(i,s,o.text),l=o.i,o.forward(o.len-h)}else{if(o.done&&a.done)return i?Ge.createSet(s,i):Tn.create(s);throw new Error("Mismatched change set lengths")}}}function hx(t,e,n=!1){let r=[],s=n?[]:null,i=new Mi(t),o=new Mi(e);for(let a=!1;;){if(i.done&&o.done)return s?Ge.createSet(r,s):Tn.create(r);if(i.ins==0)ht(r,i.len,0,a),i.next();else if(o.len==0&&!o.done)ht(r,0,o.ins,a),s&&or(s,r,o.text),o.next();else{if(i.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(i.len2,o.len),d=r.length;if(i.ins==-1){let h=o.ins==-1?-1:o.off?0:o.ins;ht(r,l,h,a),s&&h&&or(s,r,o.text)}else o.ins==-1?(ht(r,i.off?0:i.len,l,a),s&&or(s,r,i.textBit(l))):(ht(r,i.off?0:i.len,o.off?0:o.ins,a),s&&!o.off&&or(s,r,o.text));a=(i.ins>l||o.ins>=0&&o.len>l)&&(a||r.length>d),i.forward2(l),o.forward(l)}}}}class Mi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length?Ne.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?Ne.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Lr{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,s;return this.empty?r=s=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),r==this.from&&s==this.to?this:new Lr(r,s,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return R.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return R.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return R.range(e.anchor,e.head)}static create(e,n,r){return new Lr(e,n,r)}}class R{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:R.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new R([this.main],0)}addRange(e,n=!0){return R.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let r=this.ranges.slice();return r[n]=e,R.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new R(e.ranges.map(n=>Lr.fromJSON(n)),e.main)}static single(e,n=e){return new R([R.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;s<e.length;s++){let i=e[s];if(i.empty?i.from<=r:i.from<r)return R.normalized(e.slice(),n);r=i.to}return new R(e,n)}static cursor(e,n=0,r,s){return Lr.create(e,e,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(s??16777215)<<6)}static range(e,n,r,s){let i=(r??16777215)<<6|(s==null?7:Math.min(6,s));return n<e?Lr.create(n,e,48|i):Lr.create(e,n,(n>e?8:0)|i)}static normalized(e,n=0){let r=e[n];e.sort((s,i)=>s.from-i.from),n=e.indexOf(r);for(let s=1;s<e.length;s++){let i=e[s],o=e[s-1];if(i.empty?i.from<=o.to:i.from<o.to){let a=o.from,l=Math.max(i.to,o.to);s<=n&&n--,e.splice(--s,2,i.anchor>i.head?R.range(l,a):R.range(a,l))}}return new R(e,n)}}function ux(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let Jh=0;class Y{constructor(e,n,r,s,i){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=Jh++,this.default=e([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(e={}){return new Y(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:Qh),!!e.static,e.enables)}of(e){return new Ya([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ya(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ya(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function Qh(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Ya{constructor(e,n,r,s){this.dependencies=e,this.facet=n,this.type=r,this.value=s,this.id=Jh++}dynamicSlot(e){var n;let r=this.value,s=this.facet.compareInput,i=this.id,o=e[i]>>1,a=this.type==2,l=!1,d=!1,h=[];for(let u of this.dependencies)u=="doc"?l=!0:u=="selection"?d=!0:((n=e[u.id])!==null&&n!==void 0?n:1)&1||h.push(e[u.id]);return{create(u){return u.values[o]=r(u),1},update(u,f){if(l&&f.docChanged||d&&(f.docChanged||f.selection)||zd(u,h)){let p=r(u);if(a?!Gf(p,u.values[o],s):!s(p,u.values[o]))return u.values[o]=p,1}return 0},reconfigure:(u,f)=>{let p,g=f.config.address[i];if(g!=null){let x=cl(f,g);if(this.dependencies.every(b=>b instanceof Y?f.facet(b)===u.facet(b):b instanceof ot?f.field(b,!1)==u.field(b,!1):!0)||(a?Gf(p=r(u),x,s):s(p=r(u),x)))return u.values[o]=x,0}else p=r(u);return u.values[o]=p,1}}}}function Gf(t,e,n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!n(t[r],e[r]))return!1;return!0}function zd(t,e){let n=!1;for(let r of e)mi(t,r)&1&&(n=!0);return n}function VS(t,e,n){let r=n.map(l=>t[l.id]),s=n.map(l=>l.type),i=r.filter(l=>!(l&1)),o=t[e.id]>>1;function a(l){let d=[];for(let h=0;h<r.length;h++){let u=cl(l,r[h]);if(s[h]==2)for(let f of u)d.push(f);else d.push(u)}return e.combine(d)}return{create(l){for(let d of r)mi(l,d);return l.values[o]=a(l),1},update(l,d){if(!zd(l,i))return 0;let h=a(l);return e.compare(h,l.values[o])?0:(l.values[o]=h,1)},reconfigure(l,d){let h=zd(l,r),u=d.config.facets[e.id],f=d.facet(e);if(u&&!h&&Qh(n,u))return l.values[o]=f,0;let p=a(l);return e.compare(p,f)?(l.values[o]=f,0):(l.values[o]=p,1)}}}const ba=Y.define({static:!0});class ot{constructor(e,n,r,s,i){this.id=e,this.createF=n,this.updateF=r,this.compareF=s,this.spec=i,this.provides=void 0}static define(e){let n=new ot(Jh++,e.create,e.update,e.compare||((r,s)=>r===s),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(ba).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,s)=>{let i=r.values[n],o=this.updateF(i,s);return this.compareF(i,o)?0:(r.values[n]=o,1)},reconfigure:(r,s)=>{let i=r.facet(ba),o=s.facet(ba),a;return(a=i.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(r.values[n]=a.create(r),1):s.config.address[this.id]!=null?(r.values[n]=s.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,ba.of({field:this,create:e})]}get extension(){return this}}const Or={lowest:4,low:3,default:2,high:1,highest:0};function Zs(t){return e=>new fx(e,t)}const Wr={highest:Zs(Or.highest),high:Zs(Or.high),default:Zs(Or.default),low:Zs(Or.low),lowest:Zs(Or.lowest)};class fx{constructor(e,n){this.inner=e,this.prec=n}}class Ul{of(e){return new Vd(this,e)}reconfigure(e){return Ul.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Vd{constructor(e,n){this.compartment=e,this.inner=n}}class ll{constructor(e,n,r,s,i,o){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=i,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,r){let s=[],i=Object.create(null),o=new Map;for(let f of HS(e,n,o))f instanceof ot?s.push(f):(i[f.facet.id]||(i[f.facet.id]=[])).push(f);let a=Object.create(null),l=[],d=[];for(let f of s)a[f.id]=d.length<<1,d.push(p=>f.slot(p));let h=r?.config.facets;for(let f in i){let p=i[f],g=p[0].facet,x=h&&h[f]||[];if(p.every(b=>b.type==0))if(a[g.id]=l.length<<1|1,Qh(x,p))l.push(r.facet(g));else{let b=g.combine(p.map(y=>y.value));l.push(r&&g.compare(b,r.facet(g))?r.facet(g):b)}else{for(let b of p)b.type==0?(a[b.id]=l.length<<1|1,l.push(b.value)):(a[b.id]=d.length<<1,d.push(y=>b.dynamicSlot(y)));a[g.id]=d.length<<1,d.push(b=>VS(b,g,p))}}let u=d.map(f=>f(a));return new ll(e,o,u,a,l,i)}}function HS(t,e,n){let r=[[],[],[],[],[]],s=new Map;function i(o,a){let l=s.get(o);if(l!=null){if(l<=a)return;let d=r[l].indexOf(o);d>-1&&r[l].splice(d,1),o instanceof Vd&&n.delete(o.compartment)}if(s.set(o,a),Array.isArray(o))for(let d of o)i(d,a);else if(o instanceof Vd){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(o.compartment)||o.inner;n.set(o.compartment,d),i(d,a)}else if(o instanceof fx)i(o.inner,o.prec);else if(o instanceof ot)r[a].push(o),o.provides&&i(o.provides,a);else if(o instanceof Ya)r[a].push(o),o.facet.extensions&&i(o.facet.extensions,Or.default);else{let d=o.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(d,a)}}return i(t,Or.default),r.reduce((o,a)=>o.concat(a))}function mi(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let s=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|s}function cl(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const px=Y.define(),Hd=Y.define({combine:t=>t.some(e=>e),static:!0}),mx=Y.define({combine:t=>t.length?t[0]:void 0,static:!0}),gx=Y.define(),xx=Y.define(),bx=Y.define(),yx=Y.define({combine:t=>t.length?t[0]:!1});class Ln{constructor(e,n){this.type=e,this.value=n}static define(){return new _S}}class _S{of(e){return new Ln(this,e)}}class WS{constructor(e){this.map=e}of(e){return new me(this,e)}}class me{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new me(this.type,n)}is(e){return this.type==e}static define(e={}){return new WS(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let s of e){let i=s.map(n);i&&r.push(i)}return r}}me.reconfigure=me.define();me.appendConfig=me.define();class Je{constructor(e,n,r,s,i,o){this.startState=e,this.changes=n,this.selection=r,this.effects=s,this.annotations=i,this.scrollIntoView=o,this._doc=null,this._state=null,r&&ux(r,n.newLength),i.some(a=>a.type==Je.time)||(this.annotations=i.concat(Je.time.of(Date.now())))}static create(e,n,r,s,i,o){return new Je(e,n,r,s,i,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(Je.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}Je.time=Ln.define();Je.userEvent=Ln.define();Je.addToHistory=Ln.define();Je.remote=Ln.define();function US(t,e){let n=[];for(let r=0,s=0;;){let i,o;if(r<t.length&&(s==e.length||e[s]>=t[r]))i=t[r++],o=t[r++];else if(s<e.length)i=e[s++],o=e[s++];else return n;!n.length||n[n.length-1]<i?n.push(i,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function vx(t,e,n){var r;let s,i,o;return n?(s=e.changes,i=Ge.empty(e.changes.length),o=t.changes.compose(e.changes)):(s=e.changes.map(t.changes),i=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(s)),{changes:o,selection:e.selection?e.selection.map(i):(r=t.selection)===null||r===void 0?void 0:r.map(s),effects:me.mapEffects(t.effects,s).concat(me.mapEffects(e.effects,i)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function _d(t,e,n){let r=e.selection,s=us(e.annotations);return e.userEvent&&(s=s.concat(Je.userEvent.of(e.userEvent))),{changes:e.changes instanceof Ge?e.changes:Ge.of(e.changes||[],n,t.facet(mx)),selection:r&&(r instanceof R?r:R.single(r.anchor,r.head)),effects:us(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function wx(t,e,n){let r=_d(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let i=1;i<e.length;i++){e[i].filter===!1&&(n=!1);let o=!!e[i].sequential;r=vx(r,_d(t,e[i],o?r.changes.newLength:t.doc.length),o)}let s=Je.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return GS(n?KS(s):s)}function KS(t){let e=t.startState,n=!0;for(let s of e.facet(gx)){let i=s(t);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:US(n,i))}if(n!==!0){let s,i;if(n===!1)i=t.changes.invertedDesc,s=Ge.empty(e.doc.length);else{let o=t.changes.filter(n);s=o.changes,i=o.filtered.mapDesc(o.changes).invertedDesc}t=Je.create(e,s,t.selection&&t.selection.map(i),me.mapEffects(t.effects,i),t.annotations,t.scrollIntoView)}let r=e.facet(xx);for(let s=r.length-1;s>=0;s--){let i=r[s](t);i instanceof Je?t=i:Array.isArray(i)&&i.length==1&&i[0]instanceof Je?t=i[0]:t=wx(e,us(i),!1)}return t}function GS(t){let e=t.startState,n=e.facet(bx),r=t;for(let s=n.length-1;s>=0;s--){let i=n[s](t);i&&Object.keys(i).length&&(r=vx(r,_d(e,i,t.changes.newLength),!0))}return r==t?t:Je.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const qS=[];function us(t){return t==null?qS:Array.isArray(t)?t:[t]}var Ie=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Ie||(Ie={}));const YS=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Wd;try{Wd=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function JS(t){if(Wd)return Wd.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||YS.test(n)))return!0}return!1}function QS(t){return e=>{if(!/\S/.test(e))return Ie.Space;if(JS(e))return Ie.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return Ie.Word;return Ie.Other}}class ke{constructor(e,n,r,s,i,o){this.config=e,this.doc=n,this.selection=r,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=i,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)mi(this,a<<1);this.computeSlot=null}field(e,n=!0){let r=this.config.address[e.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return mi(this,r),cl(this,r)}update(...e){return wx(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:s}=n;for(let a of e.effects)a.is(Ul.reconfigure)?(n&&(s=new Map,n.compartments.forEach((l,d)=>s.set(d,l)),n=null),s.set(a.value.compartment,a.value.extension)):a.is(me.reconfigure)?(n=null,r=a.value):a.is(me.appendConfig)&&(n=null,r=us(r).concat(a.value));let i;n?i=e.startState.values.slice():(n=ll.resolve(r,s,this),i=new ke(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,d)=>d.reconfigure(l,this),null).values);let o=e.startState.facet(Hd)?e.newSelection:e.newSelection.asSingle();new ke(n,e.newDoc,o,i,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:R.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),s=this.changes(r.changes),i=[r.range],o=us(r.effects);for(let a=1;a<n.ranges.length;a++){let l=e(n.ranges[a]),d=this.changes(l.changes),h=d.map(s);for(let f=0;f<a;f++)i[f]=i[f].map(h);let u=s.mapDesc(d,!0);i.push(l.range.map(u)),s=s.compose(h),o=me.mapEffects(o,h).concat(me.mapEffects(us(l.effects),u))}return{changes:s,selection:R.create(i,n.mainIndex),effects:o}}changes(e=[]){return e instanceof Ge?e:Ge.of(e,this.doc.length,this.facet(ke.lineSeparator))}toText(e){return Ne.of(e.split(this.facet(ke.lineSeparator)||$d))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(mi(this,n),cl(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let s=e[r];s instanceof ot&&this.config.address[s.id]!=null&&(n[r]=s.spec.toJSON(this.field(e[r]),this))}return n}static fromJSON(e,n={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(r){for(let i in r)if(Object.prototype.hasOwnProperty.call(e,i)){let o=r[i],a=e[i];s.push(o.init(l=>o.spec.fromJSON(a,l)))}}return ke.create({doc:e.doc,selection:R.fromJSON(e.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(e={}){let n=ll.resolve(e.extensions||[],new Map),r=e.doc instanceof Ne?e.doc:Ne.of((e.doc||"").split(n.staticFacet(ke.lineSeparator)||$d)),s=e.selection?e.selection instanceof R?e.selection:R.single(e.selection.anchor,e.selection.head):R.single(0);return ux(s,r.length),n.staticFacet(Hd)||(s=s.asSingle()),new ke(n,r,s,n.dynamicSlots.map(()=>null),(i,o)=>o.create(i),null)}get tabSize(){return this.facet(ke.tabSize)}get lineBreak(){return this.facet(ke.lineSeparator)||`
|
|
235
|
+
`}get readOnly(){return this.facet(yx)}phrase(e,...n){for(let r of this.facet(ke.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let i=+(s||1);return!i||i>n.length?r:n[i-1]})),e}languageDataAt(e,n,r=-1){let s=[];for(let i of this.facet(px))for(let o of i(this,n,r))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){let n=this.languageDataAt("wordChars",e);return QS(n.length?n[0]:"")}wordAt(e){let{text:n,from:r,length:s}=this.doc.lineAt(e),i=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let l=Ye(n,o,!1);if(i(n.slice(l,o))!=Ie.Word)break;o=l}for(;a<s;){let l=Ye(n,a);if(i(n.slice(a,l))!=Ie.Word)break;a=l}return o==a?null:R.range(o+r,a+r)}}ke.allowMultipleSelections=Hd;ke.tabSize=Y.define({combine:t=>t.length?t[0]:4});ke.lineSeparator=mx;ke.readOnly=yx;ke.phrases=Y.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(s=>t[s]==e[s])}});ke.languageData=px;ke.changeFilter=gx;ke.transactionFilter=xx;ke.transactionExtender=bx;Ul.reconfigure=me.define();function Rn(t,e,n={}){let r={};for(let s of t)for(let i of Object.keys(s)){let o=s[i],a=r[i];if(a===void 0)r[i]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](a,o);else throw new Error("Config merge conflict for field "+i)}for(let s in e)r[s]===void 0&&(r[s]=e[s]);return r}class dr{eq(e){return this==e}range(e,n=e){return Ai.create(e,n,this)}}dr.prototype.startSide=dr.prototype.endSide=0;dr.prototype.point=!1;dr.prototype.mapMode=vt.TrackDel;function Xh(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}class Ai{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new Ai(e,n,r)}}function Ud(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Zh{constructor(e,n,r,s){this.from=e,this.to=n,this.value=r,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,s=0){let i=r?this.to:this.from;for(let o=s,a=i.length;;){if(o==a)return o;let l=o+a>>1,d=i[l]-e||(r?this.value[l].endSide:this.value[l].startSide)-n;if(l==o)return d>=0?o:a;d>=0?a=l:o=l+1}}between(e,n,r,s){for(let i=this.findIndex(n,-1e9,!0),o=this.findIndex(r,1e9,!1,i);i<o;i++)if(s(this.from[i]+e,this.to[i]+e,this.value[i])===!1)return!1}map(e,n){let r=[],s=[],i=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let d=this.value[l],h=this.from[l]+e,u=this.to[l]+e,f,p;if(h==u){let g=n.mapPos(h,d.startSide,d.mapMode);if(g==null||(f=p=g,d.startSide!=d.endSide&&(p=n.mapPos(h,d.endSide),p<f)))continue}else if(f=n.mapPos(h,d.startSide),p=n.mapPos(u,d.endSide),f>p||f==p&&d.startSide>0&&d.endSide<=0)continue;(p-f||d.endSide-d.startSide)<0||(o<0&&(o=f),d.point&&(a=Math.max(a,p-f)),r.push(d),s.push(f-o),i.push(p-o))}return{mapped:r.length?new Zh(s,i,r,a):null,pos:o}}}class ye{constructor(e,n,r,s){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=s}static create(e,n,r,s){return new ye(e,n,r,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:s=0,filterTo:i=this.length}=e,o=e.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(Ud)),this.isEmpty)return n.length?ye.of(n):this;let a=new kx(this,null,-1).goto(0),l=0,d=[],h=new _n;for(;a.value||l<n.length;)if(l<n.length&&(a.from-n[l].from||a.startSide-n[l].value.startSide)>=0){let u=n[l++];h.addInner(u.from,u.to,u.value)||d.push(u)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==n.length||this.chunkEnd(a.chunkIndex)<n[l].from)&&(!o||s>this.chunkEnd(a.chunkIndex)||i<this.chunkPos[a.chunkIndex])&&h.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||s>a.to||i<a.from||o(a.from,a.to,a.value))&&(h.addInner(a.from,a.to,a.value)||d.push(Ai.create(a.from,a.to,a.value))),a.next());return h.finishInner(this.nextLayer.isEmpty&&!d.length?ye.empty:this.nextLayer.update({add:d,filter:o,filterFrom:s,filterTo:i}))}map(e){if(e.empty||this.isEmpty)return this;let n=[],r=[],s=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],d=e.touchesRange(a,a+l.length);if(d===!1)s=Math.max(s,l.maxPoint),n.push(l),r.push(e.mapPos(a));else if(d===!0){let{mapped:h,pos:u}=l.map(a,e);h&&(s=Math.max(s,h.maxPoint),n.push(h),r.push(u))}}let i=this.nextLayer.map(e);return n.length==0?i:new ye(r,n,i||ye.empty,s)}between(e,n,r){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let i=this.chunkPos[s],o=this.chunk[s];if(n>=i&&e<=i+o.length&&o.between(i,e-i,n-i,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return Di.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return Di.from(e).goto(n)}static compare(e,n,r,s,i=-1){let o=e.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=i),a=n.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=i),l=qf(o,a,r),d=new ei(o,l,i),h=new ei(a,l,i);r.iterGaps((u,f,p)=>Yf(d,u,h,f,p,s)),r.empty&&r.length==0&&Yf(d,0,h,0,0,s)}static eq(e,n,r=0,s){s==null&&(s=999999999);let i=e.filter(h=>!h.isEmpty&&n.indexOf(h)<0),o=n.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(i.length!=o.length)return!1;if(!i.length)return!0;let a=qf(i,o),l=new ei(i,a,0).goto(r),d=new ei(o,a,0).goto(r);for(;;){if(l.to!=d.to||!Kd(l.active,d.active)||l.point&&(!d.point||!Xh(l.point,d.point)))return!1;if(l.to>s)return!0;l.next(),d.next()}}static spans(e,n,r,s,i=-1){let o=new ei(e,null,i).goto(n),a=n,l=o.openStart;for(;;){let d=Math.min(o.to,r);if(o.point){let h=o.activeForPoint(o.to),u=o.pointFrom<n?h.length+1:o.point.startSide<0?h.length:Math.min(h.length,l);s.point(a,d,o.point,h,u,o.pointRank),l=Math.min(o.openEnd(d),h.length)}else d>a&&(s.span(a,d,o.active,l),l=o.openEnd(d));if(o.to>r)return l+(o.point&&o.to>r?1:0);a=o.to,o.next()}}static of(e,n=!1){let r=new _n;for(let s of e instanceof Ai?[e]:n?XS(e):e)r.add(s.from,s.to,s.value);return r.finish()}static join(e){if(!e.length)return ye.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let s=e[r];s!=ye.empty;s=s.nextLayer)n=new ye(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}ye.empty=new ye([],[],null,-1);function XS(t){if(t.length>1)for(let e=t[0],n=1;n<t.length;n++){let r=t[n];if(Ud(e,r)>0)return t.slice().sort(Ud);e=r}return t}ye.empty.nextLayer=ye.empty;class _n{finishChunk(e){this.chunks.push(new Zh(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new _n)).add(e,n,r)}addInner(e,n,r){let s=e-this.lastTo||r.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(ye.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=ye.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function qf(t,e,n){let r=new Map;for(let i of t)for(let o=0;o<i.chunk.length;o++)i.chunk[o].maxPoint<=0&&r.set(i.chunk[o],i.chunkPos[o]);let s=new Set;for(let i of e)for(let o=0;o<i.chunk.length;o++){let a=r.get(i.chunk[o]);a!=null&&(n?n.mapPos(a):a)==i.chunkPos[o]&&!n?.touchesRange(a,a+i.chunk[o].length)&&s.add(i.chunk[o])}return s}class kx{constructor(e,n,r,s=0){this.layer=e,this.skip=n,this.minPoint=r,this.rank=s}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,n,!1),this}gotoInner(e,n,r){for(;this.chunkIndex<this.layer.chunk.length;){let s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<e||s.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],n,!0);(!r||this.rangeIndex<s)&&this.setRangeIndex(s)}this.next()}forward(e,n){(this.to-e||this.endSide-n)<0&&this.gotoInner(e,n,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],n=this.layer.chunk[this.chunkIndex],r=e+n.from[this.rangeIndex];if(this.from=r,this.to=e+n.to[this.rangeIndex],this.value=n.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Di{constructor(e){this.heap=e}static from(e,n=null,r=-1){let s=[];for(let i=0;i<e.length;i++)for(let o=e[i];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&s.push(new kx(o,n,r,i));return s.length==1?s[0]:new Di(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)jc(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)jc(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),jc(this.heap,0)}}}function jc(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let s=t[r];if(r+1<t.length&&s.compare(t[r+1])>=0&&(s=t[r+1],r++),n.compare(s)<0)break;t[r]=n,t[e]=s,e=r}}class ei{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Di.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){ya(this.active,e),ya(this.activeTo,e),ya(this.activeRank,e),this.minActive=Jf(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:s,rank:i}=this.cursor;for(;n<this.activeRank.length&&(i-this.activeRank[n]||s-this.activeTo[n])>0;)n++;va(this.active,n,r),va(this.activeTo,n,s),va(this.activeRank,n,i),e&&va(e,n,this.cursor.from),this.minActive=Jf(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&ya(r,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=i,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=i.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let s=r.length-1;s>=0&&r[s]<e;s--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let n=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function Yf(t,e,n,r,s,i){t.goto(e),n.goto(r);let o=r+s,a=r,l=r-e,d=!!i.boundChange;for(let h=!1;;){let u=t.to+l-n.to,f=u||t.endSide-n.endSide,p=f<0?t.to+l:n.to,g=Math.min(p,o);if(t.point||n.point?(t.point&&n.point&&Xh(t.point,n.point)&&Kd(t.activeForPoint(t.to),n.activeForPoint(n.to))||i.comparePoint(a,g,t.point,n.point),h=!1):(h&&i.boundChange(a),g>a&&!Kd(t.active,n.active)&&i.compareRange(a,g,t.active,n.active),d&&g<o&&(u||t.openEnd(p)!=n.openEnd(p))&&(h=!0)),p>o)break;a=p,f<=0&&t.next(),f>=0&&n.next()}}function Kd(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n]&&!Xh(t[n],e[n]))return!1;return!0}function ya(t,e){for(let n=e,r=t.length-1;n<r;n++)t[n]=t[n+1];t.pop()}function va(t,e,n){for(let r=t.length-1;r>=e;r--)t[r+1]=t[r];t[e]=n}function Jf(t,e){let n=-1,r=1e9;for(let s=0;s<e.length;s++)(e[s]-r||t[s].endSide-t[n].endSide)<0&&(n=s,r=e[s]);return n}function Ds(t,e,n=t.length){let r=0;for(let s=0;s<n&&s<t.length;)t.charCodeAt(s)==9?(r+=e-r%e,s++):(r++,s=Ye(t,s));return r}function Gd(t,e,n,r){for(let s=0,i=0;;){if(i>=e)return s;if(s==t.length)break;i+=t.charCodeAt(s)==9?n-i%n:1,s=Ye(t,s)}return r===!0?-1:t.length}const qd="ͼ",Qf=typeof Symbol>"u"?"__"+qd:Symbol.for(qd),Yd=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Xf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class hr{constructor(e,n){this.rules=[];let{finish:r}=n||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function i(o,a,l,d){let h=[],u=/^@(\w+)\b/.exec(o[0]),f=u&&u[1]=="keyframes";if(u&&a==null)return l.push(o[0]+";");for(let p in a){let g=a[p];if(/&/.test(p))i(p.split(/,\s*/).map(x=>o.map(b=>x.replace(/&/,b))).reduce((x,b)=>x.concat(b)),g,l);else if(g&&typeof g=="object"){if(!u)throw new RangeError("The value of a property ("+p+") should be a primitive value.");i(s(p),g,h,f)}else g!=null&&h.push(p.replace(/_.*/,"").replace(/[A-Z]/g,x=>"-"+x.toLowerCase())+": "+g+";")}(h.length||f)&&l.push((r&&!u&&!d?o.map(r):o).join(", ")+" {"+h.join(" ")+"}")}for(let o in e)i(s(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
236
|
+
`)}static newName(){let e=Xf[Qf]||1;return Xf[Qf]=e+1,qd+e.toString(36)}static mount(e,n,r){let s=e[Yd],i=r&&r.nonce;s?i&&s.setNonce(i):s=new ZS(e,i),s.mount(Array.isArray(n)?n:[n],e)}}let Zf=new Map;class ZS{constructor(e,n){let r=e.ownerDocument||e,s=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let i=Zf.get(r);if(i)return e[Yd]=i;this.sheet=new s.CSSStyleSheet,Zf.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[Yd]=this}mount(e,n){let r=this.sheet,s=0,i=0;for(let o=0;o<e.length;o++){let a=e[o],l=this.modules.indexOf(a);if(l<i&&l>-1&&(this.modules.splice(l,1),i--,l=-1),l==-1){if(this.modules.splice(i++,0,a),r)for(let d=0;d<a.rules.length;d++)r.insertRule(a.rules[d],s++)}else{for(;i<l;)s+=this.modules[i++].rules.length;s+=a.rules.length,i++}}if(r)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
|
|
237
|
+
`;this.styleTag.textContent=o;let a=n.head||n;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var ur={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Ti={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},eC=typeof navigator<"u"&&/Mac/.test(navigator.platform),tC=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var st=0;st<10;st++)ur[48+st]=ur[96+st]=String(st);for(var st=1;st<=24;st++)ur[st+111]="F"+st;for(var st=65;st<=90;st++)ur[st]=String.fromCharCode(st+32),Ti[st]=String.fromCharCode(st);for(var Nc in ur)Ti.hasOwnProperty(Nc)||(Ti[Nc]=ur[Nc]);function nC(t){var e=eC&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||tC&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Ti:ur)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function De(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var s=n[r];typeof s=="string"?t.setAttribute(r,s):s!=null&&(t[r]=s)}e++}for(;e<arguments.length;e++)Sx(t,arguments[e]);return t}function Sx(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var n=0;n<e.length;n++)Sx(t,e[n]);else throw new RangeError("Unsupported child node: "+e)}let yt=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Jd=typeof document<"u"?document:{documentElement:{style:{}}};const Qd=/Edge\/(\d+)/.exec(yt.userAgent),Cx=/MSIE \d/.test(yt.userAgent),Xd=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(yt.userAgent),Kl=!!(Cx||Xd||Qd),ep=!Kl&&/gecko\/(\d+)/i.test(yt.userAgent),Pc=!Kl&&/Chrome\/(\d+)/.exec(yt.userAgent),rC="webkitFontSmoothing"in Jd.documentElement.style,Zd=!Kl&&/Apple Computer/.test(yt.vendor),tp=Zd&&(/Mobile\/\w+/.test(yt.userAgent)||yt.maxTouchPoints>2);var q={mac:tp||/Mac/.test(yt.platform),windows:/Win/.test(yt.platform),linux:/Linux|X11/.test(yt.platform),ie:Kl,ie_version:Cx?Jd.documentMode||6:Xd?+Xd[1]:Qd?+Qd[1]:0,gecko:ep,gecko_version:ep?+(/Firefox\/(\d+)/.exec(yt.userAgent)||[0,0])[1]:0,chrome:!!Pc,chrome_version:Pc?+Pc[1]:0,ios:tp,android:/Android\b/.test(yt.userAgent),webkit_version:rC?+(/\bAppleWebKit\/(\d+)/.exec(yt.userAgent)||[0,0])[1]:0,safari:Zd,safari_version:Zd?+(/\bVersion\/(\d+(\.\d+)?)/.exec(yt.userAgent)||[0,0])[1]:0,tabSize:Jd.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function eu(t,e){for(let n in t)n=="class"&&e.class?e.class+=" "+t.class:n=="style"&&e.style?e.style+=";"+t.style:e[n]=t[n];return e}const dl=Object.create(null);function tu(t,e,n){if(t==e)return!0;t||(t=dl),e||(e=dl);let r=Object.keys(t),s=Object.keys(e);if(r.length-0!=s.length-0)return!1;for(let i of r)if(i!=n&&(s.indexOf(i)==-1||t[i]!==e[i]))return!1;return!0}function sC(t,e){for(let n=t.attributes.length-1;n>=0;n--){let r=t.attributes[n].name;e[r]==null&&t.removeAttribute(r)}for(let n in e){let r=e[n];n=="style"?t.style.cssText=r:t.getAttribute(n)!=r&&t.setAttribute(n,r)}}function np(t,e,n){let r=!1;if(e)for(let s in e)n&&s in n||(r=!0,s=="style"?t.style.cssText="":t.removeAttribute(s));if(n)for(let s in n)e&&e[s]==n[s]||(r=!0,s=="style"?t.style.cssText=n[s]:t.setAttribute(s,n[s]));return r}function iC(t){let e=Object.create(null);for(let n=0;n<t.attributes.length;n++){let r=t.attributes[n];e[r.name]=r.value}return e}class In{eq(e){return!1}updateDOM(e,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,n,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var it=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(it||(it={}));class ie extends dr{constructor(e,n,r,s){super(),this.startSide=e,this.endSide=n,this.widget=r,this.spec=s}get heightRelevant(){return!1}static mark(e){return new $o(e)}static widget(e){let n=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return n+=r&&!e.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new Fr(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,s;if(e.isBlockGap)r=-5e8,s=4e8;else{let{start:i,end:o}=jx(e,n);r=(i?n?-3e8:-1:5e8)-1,s=(o?n?2e8:1:-6e8)+1}return new Fr(e,r,s,n,e.widget||null,!0)}static line(e){return new Bo(e)}static set(e,n=!1){return ye.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ie.none=ye.empty;class $o extends ie{constructor(e){let{start:n,end:r}=jx(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?eu(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||dl}eq(e){return this==e||e instanceof $o&&this.tagName==e.tagName&&tu(this.attrs,e.attrs)}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}$o.prototype.point=!1;class Bo extends ie{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Bo&&this.spec.class==e.spec.class&&tu(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}Bo.prototype.mapMode=vt.TrackBefore;Bo.prototype.point=!0;class Fr extends ie{constructor(e,n,r,s,i,o){super(n,r,i,e),this.block=s,this.isReplace=o,this.mapMode=s?n<=0?vt.TrackBefore:vt.TrackAfter:vt.TrackDel}get type(){return this.startSide!=this.endSide?it.WidgetRange:this.startSide<=0?it.WidgetBefore:it.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Fr&&oC(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}Fr.prototype.point=!0;function jx(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function oC(t,e){return t==e||!!(t&&e&&t.compare(e))}function fs(t,e,n,r=0){let s=n.length-1;s>=0&&n[s]+r>=t?n[s]=Math.max(n[s],e):n.push(t,e)}class Ei extends dr{constructor(e,n){super(),this.tagName=e,this.attributes=n}eq(e){return e==this||e instanceof Ei&&this.tagName==e.tagName&&tu(this.attributes,e.attributes)}static create(e){return new Ei(e.tagName,e.attributes||dl)}static set(e,n=!1){return ye.of(e,n)}}Ei.prototype.startSide=Ei.prototype.endSide=-1;function Li(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function eh(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Ja(t,e){if(!e.anchorNode)return!1;try{return eh(t,e.anchorNode)}catch{return!1}}function gi(t){return t.nodeType==3?Ii(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function xi(t,e,n,r){return n?rp(t,e,n,r,-1)||rp(t,e,n,r,1):!1}function fr(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function hl(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function rp(t,e,n,r,s){for(;;){if(t==n&&e==r)return!0;if(e==(s<0?0:Wn(t))){if(t.nodeName=="DIV")return!1;let i=t.parentNode;if(!i||i.nodeType!=1)return!1;e=fr(t)+(s<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(s<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=s<0?Wn(t):0}else return!1}}function Wn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Ri(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function aC(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function Nx(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function lC(t,e,n,r,s,i,o,a){let l=t.ownerDocument,d=l.defaultView||window;for(let h=t,u=!1;h&&!u;)if(h.nodeType==1){let f,p=h==l.body,g=1,x=1;if(p)f=aC(d);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(u=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let w=h.getBoundingClientRect();({scaleX:g,scaleY:x}=Nx(h,w)),f={left:w.left,right:w.left+h.clientWidth*g,top:w.top,bottom:w.top+h.clientHeight*x}}let b=0,y=0;if(s=="nearest")e.top<f.top?(y=e.top-(f.top+o),n>0&&e.bottom>f.bottom+y&&(y=e.bottom-f.bottom+o)):e.bottom>f.bottom&&(y=e.bottom-f.bottom+o,n<0&&e.top-y<f.top&&(y=e.top-(f.top+o)));else{let w=e.bottom-e.top,C=f.bottom-f.top;y=(s=="center"&&w<=C?e.top+w/2-C/2:s=="start"||s=="center"&&n<0?e.top-o:e.bottom-C+o)-f.top}if(r=="nearest"?e.left<f.left?(b=e.left-(f.left+i),n>0&&e.right>f.right+b&&(b=e.right-f.right+i)):e.right>f.right&&(b=e.right-f.right+i,n<0&&e.left<f.left+b&&(b=e.left-(f.left+i))):b=(r=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:r=="start"==a?e.left-i:e.right-(f.right-f.left)+i)-f.left,b||y)if(p)d.scrollBy(b,y);else{let w=0,C=0;if(y){let S=h.scrollTop;h.scrollTop+=y/x,C=(h.scrollTop-S)*x}if(b){let S=h.scrollLeft;h.scrollLeft+=b/g,w=(h.scrollLeft-S)*g}e={left:e.left-w,top:e.top-C,right:e.right-w,bottom:e.bottom-C},w&&Math.abs(w-b)<1&&(r="nearest"),C&&Math.abs(C-y)<1&&(s="nearest")}if(p)break;(e.top<f.top||e.bottom>f.bottom||e.left<f.left||e.right>f.right)&&(e={left:Math.max(e.left,f.left),right:Math.min(e.right,f.right),top:Math.max(e.top,f.top),bottom:Math.min(e.bottom,f.bottom)}),h=h.assignedSlot||h.parentNode}else if(h.nodeType==11)h=h.host;else break}function cC(t){let e=t.ownerDocument,n,r;for(let s=t.parentNode;s&&!(s==e.body||n&&r);)if(s.nodeType==1)!r&&s.scrollHeight>s.clientHeight&&(r=s),!n&&s.scrollWidth>s.clientWidth&&(n=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:n,y:r}}class dC{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?Wn(n):0),r,Math.min(e.focusOffset,r?Wn(r):0))}set(e,n,r,s){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let Pr=null;q.safari&&q.safari_version>=26&&(Pr=!1);function Px(t){if(t.setActive)return t.setActive();if(Pr)return t.focus(Pr);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(Pr==null?{get preventScroll(){return Pr={preventScroll:!0},!0}}:void 0),!Pr){Pr=!1;for(let n=0;n<e.length;){let r=e[n++],s=e[n++],i=e[n++];r.scrollTop!=s&&(r.scrollTop=s),r.scrollLeft!=i&&(r.scrollLeft=i)}}}let sp;function Ii(t,e,n=e){let r=sp||(sp=document.createRange());return r.setEnd(t,n),r.setStart(t,e),r}function ps(t,e,n,r){let s={key:e,code:e,keyCode:n,which:n,cancelable:!0};r&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=r);let i=new KeyboardEvent("keydown",s);i.synthetic=!0,t.dispatchEvent(i);let o=new KeyboardEvent("keyup",s);return o.synthetic=!0,t.dispatchEvent(o),i.defaultPrevented||o.defaultPrevented}function hC(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function uC(t,e){let n=e.focusNode,r=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=r)return!1;for(r=Math.min(r,Wn(n));;)if(r){if(n.nodeType!=1)return!1;let s=n.childNodes[r-1];s.contentEditable=="false"?r--:(n=s,r=Wn(n))}else{if(n==t)return!0;r=fr(n),n=n.parentNode}}function Ox(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function Mx(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=Wn(n)}else if(n.parentNode&&!hl(n))r=fr(n),n=n.parentNode;else return null}}function Ax(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r<n.nodeValue.length)return{node:n,offset:r};if(n.nodeType==1&&r<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!hl(n))r=fr(n)+1,n=n.parentNode;else return null}}class an{constructor(e,n,r=!0){this.node=e,this.offset=n,this.precise=r}static before(e,n){return new an(e.parentNode,fr(e),n)}static after(e,n){return new an(e.parentNode,fr(e)+1,n)}}var Ee=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Ee||(Ee={}));const zr=Ee.LTR,nu=Ee.RTL;function Dx(t){let e=[];for(let n=0;n<t.length;n++)e.push(1<<+t[n]);return e}const fC=Dx("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),pC=Dx("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),th=Object.create(null),Sn=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),n=t.charCodeAt(1);th[e]=n,th[n]=-e}function Tx(t){return t<=247?fC[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?pC[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const mC=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Hn{get dir(){return this.level%2?nu:zr}constructor(e,n,r){this.from=e,this.to=n,this.level=r}side(e,n){return this.dir==n==e?this.to:this.from}forward(e,n){return e==(this.dir==n)}static find(e,n,r,s){let i=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=n&&a.to>=n){if(a.level==r)return o;(i<0||(s!=0?s<0?a.from<n:a.to>n:e[i].level>a.level))&&(i=o)}}if(i<0)throw new RangeError("Index out of range");return i}}function Ex(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++){let r=t[n],s=e[n];if(r.from!=s.from||r.to!=s.to||r.direction!=s.direction||!Ex(r.inner,s.inner))return!1}return!0}const Te=[];function gC(t,e,n,r,s){for(let i=0;i<=r.length;i++){let o=i?r[i-1].to:e,a=i<r.length?r[i].from:n,l=i?256:s;for(let d=o,h=l,u=l;d<a;d++){let f=Tx(t.charCodeAt(d));f==512?f=h:f==8&&u==4&&(f=16),Te[d]=f==4?2:f,f&7&&(u=f),h=f}for(let d=o,h=l,u=l;d<a;d++){let f=Te[d];if(f==128)d<a-1&&h==Te[d+1]&&h&24?f=Te[d]=h:Te[d]=256;else if(f==64){let p=d+1;for(;p<a&&Te[p]==64;)p++;let g=d&&h==8||p<n&&Te[p]==8?u==1?1:8:256;for(let x=d;x<p;x++)Te[x]=g;d=p-1}else f==8&&u==1&&(Te[d]=1);h=f,f&7&&(u=f)}}}function xC(t,e,n,r,s){let i=s==1?2:1;for(let o=0,a=0,l=0;o<=r.length;o++){let d=o?r[o-1].to:e,h=o<r.length?r[o].from:n;for(let u=d,f,p,g;u<h;u++)if(p=th[f=t.charCodeAt(u)])if(p<0){for(let x=a-3;x>=0;x-=3)if(Sn[x+1]==-p){let b=Sn[x+2],y=b&2?s:b&4?b&1?i:s:0;y&&(Te[u]=Te[Sn[x]]=y),a=x;break}}else{if(Sn.length==189)break;Sn[a++]=u,Sn[a++]=f,Sn[a++]=l}else if((g=Te[u])==2||g==1){let x=g==s;l=x?0:1;for(let b=a-3;b>=0;b-=3){let y=Sn[b+2];if(y&2)break;if(x)Sn[b+2]|=2;else{if(y&4)break;Sn[b+2]|=4}}}}}function bC(t,e,n,r){for(let s=0,i=r;s<=n.length;s++){let o=s?n[s-1].to:t,a=s<n.length?n[s].from:e;for(let l=o;l<a;){let d=Te[l];if(d==256){let h=l+1;for(;;)if(h==a){if(s==n.length)break;h=n[s++].to,a=s<n.length?n[s].from:e}else if(Te[h]==256)h++;else break;let u=i==1,f=(h<e?Te[h]:r)==1,p=u==f?u?1:2:r;for(let g=h,x=s,b=x?n[x-1].to:t;g>l;)g==b&&(g=n[--x].from,b=x?n[x-1].to:t),Te[--g]=p;l=h}else i=d,l++}}}function nh(t,e,n,r,s,i,o){let a=r%2?2:1;if(r%2==s%2)for(let l=e,d=0;l<n;){let h=!0,u=!1;if(d==i.length||l<i[d].from){let x=Te[l];x!=a&&(h=!1,u=x==16)}let f=!h&&a==1?[]:null,p=h?r:r+1,g=l;e:for(;;)if(d<i.length&&g==i[d].from){if(u)break e;let x=i[d];if(!h)for(let b=x.to,y=d+1;;){if(b==n)break e;if(y<i.length&&i[y].from==b)b=i[y++].to;else{if(Te[b]==a)break e;break}}if(d++,f)f.push(x);else{x.from>l&&o.push(new Hn(l,x.from,p));let b=x.direction==zr!=!(p%2);rh(t,b?r+1:r,s,x.inner,x.from,x.to,o),l=x.to}g=x.to}else{if(g==n||(h?Te[g]!=a:Te[g]==a))break;g++}f?nh(t,l,g,r+1,s,f,o):l<g&&o.push(new Hn(l,g,p)),l=g}else for(let l=n,d=i.length;l>e;){let h=!0,u=!1;if(!d||l>i[d-1].to){let x=Te[l-1];x!=a&&(h=!1,u=x==16)}let f=!h&&a==1?[]:null,p=h?r:r+1,g=l;e:for(;;)if(d&&g==i[d-1].to){if(u)break e;let x=i[--d];if(!h)for(let b=x.from,y=d;;){if(b==e)break e;if(y&&i[y-1].to==b)b=i[--y].from;else{if(Te[b-1]==a)break e;break}}if(f)f.push(x);else{x.to<l&&o.push(new Hn(x.to,l,p));let b=x.direction==zr!=!(p%2);rh(t,b?r+1:r,s,x.inner,x.from,x.to,o),l=x.from}g=x.from}else{if(g==e||(h?Te[g-1]!=a:Te[g-1]==a))break;g--}f?nh(t,g,l,r+1,s,f,o):g<l&&o.push(new Hn(g,l,p)),l=g}}function rh(t,e,n,r,s,i,o){let a=e%2?2:1;gC(t,s,i,r,a),xC(t,s,i,r,a),bC(s,i,r,a),nh(t,s,i,e,n,r,o)}function yC(t,e,n){if(!t)return[new Hn(0,0,e==nu?1:0)];if(e==zr&&!n.length&&!mC.test(t))return Lx(t.length);if(n.length)for(;t.length>Te.length;)Te[Te.length]=256;let r=[],s=e==zr?0:1;return rh(t,s,s,n,0,t.length,r),r}function Lx(t){return[new Hn(0,t,0)]}let Rx="";function vC(t,e,n,r,s){var i;let o=r.head-t.from,a=Hn.find(e,o,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),l=e[a],d=l.side(s,n);if(o==d){let f=a+=s?1:-1;if(f<0||f>=e.length)return null;l=e[a=f],o=l.side(!s,n),d=l.side(s,n)}let h=Ye(t.text,o,l.forward(s,n));(h<l.from||h>l.to)&&(h=d),Rx=t.text.slice(Math.min(o,h),Math.max(o,h));let u=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return u&&h==d&&u.level+(s?0:1)<l.level?R.cursor(u.side(!s,n)+t.from,u.forward(s,n)?1:-1,u.level):R.cursor(h+t.from,l.forward(s,n)?-1:1,l.level)}function wC(t,e,n){for(let r=e;r<n;r++){let s=Tx(t.charCodeAt(r));if(s==1)return zr;if(s==2||s==4)return nu}return zr}const Ix=Y.define(),$x=Y.define(),Bx=Y.define(),Fx=Y.define(),sh=Y.define(),zx=Y.define(),Vx=Y.define(),ru=Y.define(),su=Y.define(),Hx=Y.define({combine:t=>t.some(e=>e)}),_x=Y.define({combine:t=>t.some(e=>e)}),Wx=Y.define();class ms{constructor(e,n="nearest",r="nearest",s=5,i=5,o=!1){this.range=e,this.y=n,this.x=r,this.yMargin=s,this.xMargin=i,this.isSnapshot=o}map(e){return e.empty?this:new ms(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new ms(R.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const wa=me.define({map:(t,e)=>t.map(e)}),Ux=me.define();function Mt(t,e,n){let r=t.facet(Fx);r.length?r[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const Vn=Y.define({combine:t=>t.length?t[0]:!0});let kC=0;const is=Y.define({combine(t){return t.filter((e,n)=>{for(let r=0;r<n;r++)if(t[r].plugin==e.plugin)return!1;return!0})}});class He{constructor(e,n,r,s,i){this.id=e,this.create=n,this.domEventHandlers=r,this.domEventObservers=s,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(is.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(is.of({plugin:this,arg:e}))}static define(e,n){const{eventHandlers:r,eventObservers:s,provide:i,decorations:o}=n||{};return new He(kC++,e,r,s,a=>{let l=[];return o&&l.push($i.of(d=>{let h=d.plugin(a);return h?o(h):ie.none})),i&&l.push(i(a)),l})}static fromClass(e,n){return He.define((r,s)=>new e(r,s),n)}}class Oc{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(Mt(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(n){Mt(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){Mt(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Kx=Y.define(),iu=Y.define(),$i=Y.define(),Gx=Y.define(),qx=Y.define(),Fo=Y.define(),Yx=Y.define();function ip(t,e){let n=t.state.facet(Yx);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(t):i),s=[];return ye.spans(r,e.from,e.to,{point(){},span(i,o,a,l){let d=i-e.from,h=o-e.from,u=s;for(let f=a.length-1;f>=0;f--,l--){let p=a[f].spec.bidiIsolate,g;if(p==null&&(p=wC(e.text,d,h)),l>0&&u.length&&(g=u[u.length-1]).to==d&&g.direction==p)g.to=h,u=g.inner;else{let x={from:d,to:h,direction:p,inner:[]};u.push(x),u=x.inner}}}}),s}const Jx=Y.define();function ou(t){let e=0,n=0,r=0,s=0;for(let i of t.state.facet(Jx)){let o=i(t);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:e,right:n,top:r,bottom:s}}const li=Y.define();class Gt{constructor(e,n,r,s){this.fromA=e,this.toA=n,this.fromB=r,this.toB=s}join(e){return new Gt(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let s=e[n-1];if(!(s.fromA>r.toA)){if(s.toA<r.fromA)break;r=r.join(s),e.splice(n-1,1)}}return e.splice(n,0,r),e}static extendWithRanges(e,n){if(n.length==0)return e;let r=[];for(let s=0,i=0,o=0;;){let a=s<e.length?e[s].fromB:1e9,l=i<n.length?n[i]:1e9,d=Math.min(a,l);if(d==1e9)break;let h=d+o,u=d,f=h;for(;;)if(i<n.length&&n[i]<=u){let p=n[i+1];i+=2,u=Math.max(u,p);for(let g=s;g<e.length&&e[g].fromB<=u;g++)o=e[g].toA-e[g].toB;f=Math.max(f,p+o)}else if(s<e.length&&e[s].fromB<=u){let p=e[s++];u=Math.max(u,p.toB),f=Math.max(f,p.toA),o=p.toA-p.toB}else break;r.push(new Gt(h,f,d,u))}return r}}class ul{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=Ge.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,o,a,l)=>s.push(new Gt(i,o,a,l))),this.changedRanges=s}static create(e,n,r){return new ul(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const SC=[];class Ue{constructor(e,n,r=0){this.dom=e,this.length=n,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return SC}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let n=this.domAttrs;n&&sC(this.dom,n)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,n=this.posAtStart){let r=n;for(let s of this.children){if(s==e)return r;r+=s.length+s.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,n){return null}domPosFor(e,n){let r=fr(this.dom),s=this.length?e>0:n>0;return new an(this.parent.dom,r+(s?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof ql)return e;return null}static get(e){return e.cmTile}}class Gl extends Ue{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let n=this.dom,r=null,s,i=e?.node==n?e:null,o=0;for(let a of this.children){if(a.sync(e),o+=a.length+a.breakAfter,s=r?r.nextSibling:n.firstChild,i&&s!=a.dom&&(i.written=!0),a.dom.parentNode==n)for(;s&&s!=a.dom;)s=op(s);else n.insertBefore(a.dom,s);r=a.dom}for(s=r?r.nextSibling:n.firstChild,i&&s&&(i.written=!0);s;)s=op(s);this.length=o}}function op(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class ql extends Gl{constructor(e,n){super(n),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let n=Ue.get(e);if(n&&this.owns(n))return n;e=e.parentNode}}blockTiles(e){for(let n=[],r=this,s=0,i=0;;)if(s==r.children.length){if(!n.length)return;r=r.parent,r.breakAfter&&i++,s=n.pop()}else{let o=r.children[s++];if(o instanceof ar)n.push(s),r=o,s=0;else{let a=i+o.length,l=e(o,i);if(l!==void 0)return l;i=a+o.breakAfter}}}resolveBlock(e,n){let r,s=-1,i,o=-1;if(this.blockTiles((a,l)=>{let d=l+a.length;if(e>=l&&e<=d){if(a.isWidget()&&n>=-1&&n<=1){if(a.flags&32)return!0;a.flags&16&&(r=void 0)}(l<e||e==d&&(n<-1?a.length:a.covers(1)))&&(!r||!a.isWidget()&&r.isWidget())&&(r=a,s=e-l),(d>e||e==l&&(n>1?a.length:a.covers(-1)))&&(!i||!a.isWidget()&&i.isWidget())&&(i=a,o=e-l)}}),!r&&!i)throw new Error("No tile at position "+e);return r&&n<0||!i?{tile:r,offset:s}:{tile:i,offset:o}}}class ar extends Gl{constructor(e,n){super(e),this.wrapper=n}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,n){let r=new ar(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class ws extends Gl{constructor(e,n){super(e),this.attrs=n}isLine(){return!0}static start(e,n,r){let s=new ws(n||document.createElement("div"),e);return(!n||!r)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(e,n,r){let s=null,i=-1,o=null,a=-1;function l(h,u){for(let f=0,p=0;f<h.children.length&&p<=u;f++){let g=h.children[f],x=p+g.length;x>=u&&(g.isComposite()?l(g,u-p):(!o||o.isHidden&&(n>0||r&&jC(o,g)))&&(x>u||g.flags&32)?(o=g,a=u-p):(p<u||g.flags&16&&!g.isHidden)&&(s=g,i=u-p)),p=x}}l(this,e);let d=(n<0?s:o)||s||o;return d?{tile:d,offset:d==s?i:a}:null}coordsIn(e,n){let r=this.resolveInline(e,n,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),n):CC(this)}domIn(e,n){let r=this.resolveInline(e,n);if(r){let{tile:s,offset:i}=r;if(this.dom.contains(s.dom))return s.isText()?new an(s.dom,Math.min(s.dom.nodeValue.length,i)):s.domPosFor(i,s.flags&16?1:s.flags&32?-1:n);let o=r.tile.parent,a=!1;for(let l of o.children){if(a)return new an(l.dom,0);l==r.tile&&(a=!0)}}return new an(this.dom,0)}}function CC(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=gi(e);return n[n.length-1]||null}function jC(t,e){let n=t.coordsIn(0,1),r=e.coordsIn(0,1);return n&&r&&r.top<n.bottom}class Ot extends Gl{constructor(e,n){super(e),this.mark=n}get domAttrs(){return this.mark.attrs}static of(e,n){let r=new Ot(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class Rr extends Ue{constructor(e,n){super(e,n.length),this.text=n}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,n){let r=this.dom.nodeValue.length;e>r&&(e=r);let s=e,i=e,o=0;e==0&&n<0||e==r&&n>=0?q.chrome||q.gecko||(e?(s--,o=1):i<r&&(i++,o=-1)):n<0?s--:i<r&&i++;let a=Ii(this.dom,s,i).getClientRects();if(!a.length)return null;let l=a[(o?o<0:n>=0)?0:a.length-1];return q.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,d=>d.width)||l),o?Ri(l,o<0):l||null}static of(e,n){let r=new Rr(n||document.createTextNode(e),e);return n||(r.flags|=2),r}}class ks extends Ue{constructor(e,n,r,s){super(e,n,s),this.widget=r}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,n){return this.coordsInWidget(e,n,!1)}coordsInWidget(e,n,r){let s=this.widget.coordsAt(this.dom,e,n);if(s)return s;if(r)return Ri(this.dom.getBoundingClientRect(),this.length?e==0:n<=0);{let i=this.dom.getClientRects(),o=null;if(!i.length)return null;let a=this.flags&16?!0:this.flags&32?!1:e>0;for(let l=a?i.length-1:0;o=i[l],!(e>0?l==0:l==i.length-1||o.top<o.bottom);l+=a?-1:1);return Ri(o,!a)}}get overrideDOMText(){if(!this.length)return Ne.empty;let{root:e}=this;if(!e)return Ne.empty;let n=this.posAtStart;return e.view.state.doc.slice(n,n+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,n,r,s,i){return i||(i=e.toDOM(n),e.editable||(i.contentEditable="false")),new ks(i,r,e,s)}}class fl extends Ue{constructor(e){let n=document.createElement("img");n.className="cm-widgetBuffer",n.setAttribute("aria-hidden","true"),super(n,0,e)}get isHidden(){return!1}get overrideDOMText(){return Ne.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class NC{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,n,r){let{tile:s,index:i,beforeBreak:o,parents:a}=this;for(;e||n>0;)if(s.isComposite())if(o){if(!e)break;r&&r.break(),e--,o=!1}else if(i==s.children.length){if(!e&&!a.length)break;r&&r.leave(s),o=!!s.breakAfter,{tile:s,index:i}=a.pop(),i++}else{let l=s.children[i],d=l.breakAfter;(n>0?l.length<=e:l.length<e)&&(!r||r.skip(l,0,l.length)!==!1||!l.isComposite)?(o=!!d,i++,e-=l.length):(a.push({tile:s,index:i}),s=l,i=0,r&&l.isComposite()&&r.enter(l))}else if(i==s.length)o=!!s.breakAfter,{tile:s,index:i}=a.pop(),i++;else if(e){let l=Math.min(e,s.length-i);r&&r.skip(s,i,i+l),e-=l,i+=l}else break;return this.tile=s,this.index=i,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class PC{constructor(e,n,r,s){this.from=e,this.to=n,this.wrapper=r,this.rank=s}}class OC{constructor(e,n,r){this.cache=e,this.root=n,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,n,r,s){var i;this.flushBuffer();let o=this.ensureMarks(n,r),a=o.lastChild;if(a&&a.isText()&&!(a.flags&8)){this.cache.reused.set(a,2);let l=o.children[o.children.length-1]=new Rr(a.dom,a.text+e);l.parent=o}else o.append(s||Rr.of(e,(i=this.cache.find(Rr))===null||i===void 0?void 0:i.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,n){let r=this.curLine;r.dom!=n.line.dom&&(r.setDOM(this.cache.reused.has(n.line)?Mc(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let s=r;for(let a=n.marks.length-1;a>=0;a--){let l=n.marks[a],d=s.lastChild;if(d instanceof Ot&&d.mark.eq(l.mark))d.dom!=l.dom&&d.setDOM(Mc(l.dom)),s=d;else{if(this.cache.reused.get(l)){let u=Ue.get(l.dom);u&&u.setDOM(Mc(l.dom))}let h=Ot.of(l.mark,l.dom);s.append(h),s=h}this.cache.reused.set(l,2)}let i=Ue.get(e.text);i&&this.cache.reused.set(i,2);let o=new Rr(e.text,e.text.nodeValue);o.flags|=8,s.append(o)}addInlineWidget(e,n,r){let s=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);s||this.flushBuffer();let i=this.ensureMarks(n,r);!s&&!(e.flags&16)&&i.append(this.getBuffer(1)),i.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,n,r){this.flushBuffer(),this.ensureMarks(n,r).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let n=this.afterWidget||this.lastBlock;n.length+=e,this.pos+=e}addLineStart(e,n){var r;e||(e=Qx);let s=ws.start(e,n||((r=this.cache.find(ws))===null||r===void 0?void 0:r.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=s)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,n){var r;let s=this.curLine;for(let i=e.length-1;i>=0;i--){let o=e[i],a;if(n>0&&(a=s.lastChild)&&a instanceof Ot&&a.mark.eq(o))s=a,n--;else{let l=Ot.of(o,(r=this.cache.find(Ot,d=>d.mark.eq(o)))===null||r===void 0?void 0:r.dom);s.append(l),s=l,n=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!ap(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(q.ios&&ap(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Ac,0,32)||new ks(Ac.toDOM(),0,Ac,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let n=new PC(e.from,e.to,e.value,e.rank),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-n.rank||this.wrappers[r-1].to-n.to)<0;)r--;this.wrappers.splice(r,0,n)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let n=this.root;for(let r of this.wrappers){let s=n.lastChild;if(r.from<this.pos&&s instanceof ar&&s.wrapper.eq(r.wrapper))n=s;else{let i=ar.of(r.wrapper,(e=this.cache.find(ar,o=>o.wrapper.eq(r.wrapper)))===null||e===void 0?void 0:e.dom);n.append(i),n=i}}return n}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let n=2|(e<0?16:32),r=this.cache.find(fl,void 0,1);return r&&(r.flags=n),r||new fl(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class MC{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:s,lineBreak:i,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=s;let a=this.textOff=Math.min(e,s.length);return i?null:s.slice(0,a)}let n=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,n);return this.textOff=n,r}}const pl=[ks,ws,Rr,Ot,fl,ar,ql];for(let t=0;t<pl.length;t++)pl[t].bucket=t;class AC{constructor(e){this.view=e,this.buckets=pl.map(()=>[]),this.index=pl.map(()=>0),this.reused=new Map}add(e){let n=e.constructor.bucket,r=this.buckets[n];r.length<6?r.push(e):r[this.index[n]=(this.index[n]+1)%6]=e}find(e,n,r=2){let s=e.bucket,i=this.buckets[s],o=this.index[s];for(let a=i.length-1;a>=0;a--){let l=(a+o)%i.length,d=i[l];if((!n||n(d))&&!this.reused.has(d))return i.splice(l,1),l<o&&this.index[s]--,this.reused.set(d,r),d}return null}findWidget(e,n,r){let s=this.buckets[0];if(s.length)for(let i=0,o=0;;i++){if(i==s.length){if(o)return null;o=1,i=0}let a=s[i];if(!this.reused.has(a)&&(o==0?a.widget.compare(e):a.widget.constructor==e.constructor&&e.updateDOM(a.dom,this.view)))return s.splice(i,1),i<this.index[0]&&this.index[0]--,this.reused.set(a,1),a.length=n,a.flags=a.flags&-498|r,a}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,n=2){if(!this.reused.has(e))return this.reused.set(e,n),e.dom}}class DC{constructor(e,n,r,s,i){this.view=e,this.decorations=s,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new AC(e),this.text=new MC(e.state.doc),this.builder=new OC(this.cache,new ql(e,e.contentDOM),ye.iter(r)),this.cache.reused.set(n,2),this.old=new NC(n),this.reuseWalker={skip:(o,a,l)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,n){let r=n&&this.getCompositionContext(n.text);for(let s=0,i=0,o=0;;){let a=o<e.length?e[o++]:null,l=a?a.fromA:this.old.root.length;if(l>s){let d=l-s;this.preserve(d,!o,!a),s=l,i+=d}if(!a)break;this.forward(a.fromA,a.toA),n&&a.fromA<=n.range.fromA&&a.toA>=n.range.toA?(this.emit(i,n.range.fromB),this.builder.addComposition(n,r),this.text.skip(n.range.toB-n.range.fromB),this.emit(n.range.toB,a.toB)):this.emit(i,a.toB),i=a.toB,s=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,n,r){let s=LC(this.old),i=this.openMarks;this.old.advance(e,r?1:-1,{skip:(o,a,l)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(l-a);else{let d=l>0||a<o.length?ks.of(o.widget,this.view,l-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);d.flags&256?(d.flags&=-2,this.builder.addBlockWidget(d)):(this.builder.ensureLine(null),this.builder.addInlineWidget(d,s,i),i=s.length)}else if(o.isText())this.builder.ensureLine(null),!a&&l==o.length?this.builder.addText(o.text,s,i,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,l),s,i)),i=s.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof fl)this.cache.add(o);else if(o instanceof Ot)this.builder.ensureLine(null),this.builder.addMark(o,s,i),this.cache.reused.set(o,1),i=s.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof Ot&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=i=0):o instanceof Ot&&(s.shift(),i=Math.min(i,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,n){let r=null,s=this.builder,i=0,o=ye.spans(this.decorations,e,n,{point:(a,l,d,h,u,f)=>{if(d instanceof Fr){if(this.disallowBlockEffectsFor[f]){if(d.block)throw new RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(i=h.length,u>h.length)s.continueWidget(l-a);else{let p=d.widget||(d.block?Ss.block:Ss.inline),g=TC(d),x=this.cache.findWidget(p,l-a,g)||ks.of(p,this.view,l-a,g);d.block?(d.startSide>0&&s.addLineStartIfNotCovered(r),s.addBlockWidget(x)):(s.ensureLine(r),s.addInlineWidget(x,h,u))}r=null}else r=EC(r,d);l>a&&this.text.skip(l-a)},span:(a,l,d,h)=>{for(let u=a;u<l;){let f=this.text.next(Math.min(512,l-u));f==null?(s.addLineStartIfNotCovered(r),s.addBreak(),u++):(s.ensureLine(r),s.addText(f,d,h),u+=f.length),r=null}}});s.addLineStartIfNotCovered(r),this.openWidget=o>i,this.openMarks=o}forward(e,n){n-e<=10?this.old.advance(n-e,1,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-e-10,-1),this.old.advance(5,1,this.reuseWalker))}getCompositionContext(e){let n=[],r=null;for(let s=e.parentNode;;s=s.parentNode){let i=Ue.get(s);if(s==this.view.contentDOM)break;i instanceof Ot?n.push(i):i?.isLine()?r=i:s.nodeName=="DIV"&&!r&&s!=this.view.contentDOM?r=new ws(s,Qx):n.push(Ot.of(new $o({tagName:s.nodeName.toLowerCase(),attributes:iC(s)}),s))}return{line:r,marks:n}}}function ap(t,e){let n=r=>{for(let s of r.children)if((e?s.isText():s.length)||n(s))return!0;return!1};return n(t)}function TC(t){let e=t.isReplace?(t.startSide<0?64:0)|(t.endSide>0?128:0):t.startSide>0?32:16;return t.block&&(e|=256),e}const Qx={class:"cm-line"};function EC(t,e){let n=e.spec.attributes,r=e.spec.class;return!n&&!r||(t||(t={class:"cm-line"}),n&&eu(n,t),r&&(t.class+=" "+r)),t}function LC(t){let e=[];for(let n=t.parents.length;n>1;n--){let r=n==t.parents.length?t.tile:t.parents[n].tile;r instanceof Ot&&e.push(r.mark)}return e}function Mc(t){let e=Ue.get(t);return e&&e.setDOM(t.cloneNode()),t}class Ss extends In{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Ss.inline=new Ss("span");Ss.block=new Ss("div");const Ac=new class extends In{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class lp{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=ie.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new ql(e,e.contentDOM),this.updateInner([new Gt(0,0,0,e.state.doc.length)],null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:h,toA:u})=>u<this.minWidthFrom||h>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?s=this.domChanged.newSel.head:!_C(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let i=s>-1?IC(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:h,to:u}=this.hasComposition;r=new Gt(h,u,e.changes.mapPos(h,-1),e.changes.mapPos(u,1)).addToSet(r.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(q.ie||q.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let l=FC(o,this.decorations,e.changes);l.length&&(r=Gt.extendWithRanges(r,l));let d=VC(a,this.blockWrappers,e.changes);return d.length&&(r=Gt.extendWithRanges(r,d)),i&&!r.some(h=>h.fromA<=i.range.fromA&&h.toA>=i.range.toA)&&(r=i.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(n||e.length){let o=this.tile,a=new DC(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=a.run(e,n),ih(o,a.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let i=q.chrome||q.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(i),i&&(i.written||r.selectionRange.focusNode!=i.node||!this.tile.dom.contains(i.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let i of this.tile.children)i.isWidget()&&i.widget instanceof Dc&&s.push(i.dom);r.updateGaps(s)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(Ux)&&(this.editContextFormatting=r.value)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,s=this.view.root.activeElement,i=s==r,o=!i&&!(this.view.state.facet(Vn)||r.tabIndex>-1)&&Ja(r,this.view.observer.selectionRange)&&!(s&&r.contains(s));if(!(i||n||o))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,d,h;if(l.empty?h=d=this.inlineDOMNearPos(l.anchor,l.assoc||1):(h=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),d=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),q.gecko&&l.empty&&!this.hasComposition&&RC(d)){let f=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(f,d.node.childNodes[d.offset]||null)),d=h=new an(f,0),a=!0}let u=this.view.observer.selectionRange;(a||!u.focusNode||(!xi(d.node,d.offset,u.anchorNode,u.anchorOffset)||!xi(h.node,h.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,l))&&(this.view.observer.ignore(()=>{q.android&&q.chrome&&r.contains(u.focusNode)&&HC(u.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let f=Li(this.view.root);if(f)if(l.empty){if(q.gecko){let p=$C(d.node,d.offset);if(p&&p!=3){let g=(p==1?Mx:Ax)(d.node,d.offset);g&&(d=new an(g.node,g.offset))}}f.collapse(d.node,d.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=l.bidiLevel)}else if(f.extend){f.collapse(d.node,d.offset);try{f.extend(h.node,h.offset)}catch{}}else{let p=document.createRange();l.anchor>l.head&&([d,h]=[h,d]),p.setEnd(h.node,h.offset),p.setStart(d.node,d.offset),f.removeAllRanges(),f.addRange(p)}o&&this.view.root.activeElement==r&&(r.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(d,h)),this.impreciseAnchor=d.precise?null:new an(u.anchorNode,u.anchorOffset),this.impreciseHead=h.precise?null:new an(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&xi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=Li(e.root),{anchorNode:s,anchorOffset:i}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let o=this.lineAt(n.head,n.assoc);if(!o)return;let a=o.posAtStart;if(n.head==a||n.head==a+o.length)return;let l=this.coordsAt(n.head,-1),d=this.coordsAt(n.head,1);if(!l||!d||l.bottom>d.top)return;let h=this.domAtPos(n.head+n.assoc,n.assoc);r.collapse(h.node,h.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=n.from&&r.collapse(s,i)}posFromDOM(e,n){let r=this.tile.nearest(e);if(!r)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let s=r.posAtStart;if(r.isComposite()){let i;if(e==r.dom)i=r.dom.childNodes[n];else{let o=Wn(e)==0?0:n==0?-1:1;for(;;){let a=e.parentNode;if(a==r.dom)break;o==0&&a.firstChild!=a.lastChild&&(e==a.firstChild?o=-1:o=1),e=a}o<0?i=e:i=e.nextSibling}if(i==r.dom.firstChild)return s;for(;i&&!Ue.get(i);)i=i.nextSibling;if(!i)return s+r.length;for(let o=0,a=s;;o++){let l=r.children[o];if(l.dom==i)return a;a+=l.length+l.breakAfter}}else return r.isText()?e==r.dom?s+n:s+(n?r.length:0):s}domAtPos(e,n){let{tile:r,offset:s}=this.tile.resolveBlock(e,n);return r.isWidget()?r.domPosFor(e,n):r.domIn(s,n)}inlineDOMNearPos(e,n){let r,s=-1,i=!1,o,a=-1,l=!1;return this.tile.blockTiles((d,h)=>{if(d.isWidget()){if(d.flags&32&&h>=e)return!0;d.flags&16&&(i=!0)}else{let u=h+d.length;if(h<=e&&(r=d,s=e-h,i=u<e),u>=e&&!o&&(o=d,a=e-h,l=h>e),h>e&&o)return!0}}),!r&&!o?this.domAtPos(e,n):(i&&o?r=null:l&&r&&(o=null),r&&n<0||!o?r.domIn(s,n):o.domIn(a,n))}coordsAt(e,n){let{tile:r,offset:s}=this.tile.resolveBlock(e,n);return r.isWidget()?r.widget instanceof Dc?null:r.coordsInWidget(s,n,!0):r.coordsIn(s,n)}lineAt(e,n){let{tile:r}=this.tile.resolveBlock(e,n);return r.isLine()?r:null}coordsForChar(e){let{tile:n,offset:r}=this.tile.resolveBlock(e,1);if(!n.isLine())return null;function s(i,o){if(i.isComposite())for(let a of i.children){if(a.length>=o){let l=s(a,o);if(l)return l}if(o-=a.length,o<0)break}else if(i.isText()&&o<i.length){let a=Ye(i.text,o);if(a==o)return null;let l=Ii(i.dom,o,a).getClientRects();for(let d=0;d<l.length;d++){let h=l[d];if(d==l.length-1||h.top<h.bottom&&h.left<h.right)return h}}return null}return s(n,r)}measureVisibleLineHeights(e){let n=[],{from:r,to:s}=e,i=this.view.contentDOM.clientWidth,o=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==Ee.LTR,d=0,h=(u,f,p)=>{for(let g=0;g<u.children.length&&!(f>s);g++){let x=u.children[g],b=f+x.length,y=x.dom.getBoundingClientRect(),{height:w}=y;if(p&&!g&&(d+=y.top-p.top),x instanceof ar)b>r&&h(x,f,y);else if(f>=r&&(d>0&&n.push(-d),n.push(w+d),d=0,o)){let C=x.dom.lastChild,S=C?gi(C):[];if(S.length){let k=S[S.length-1],N=l?k.right-y.left:y.right-k.left;N>a&&(a=N,this.minWidth=i,this.minWidthFrom=f,this.minWidthTo=b)}}p&&g==u.children.length-1&&(d+=p.bottom-y.bottom),f=b+x.breakAfter}};return h(this.tile,0,null),n}textDirectionAt(e){let{tile:n}=this.tile.resolveBlock(e,1);return getComputedStyle(n.dom).direction=="rtl"?Ee.RTL:Ee.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,l;for(let d of o.children){if(!d.isText()||/[^ -~]/.test(d.text))return;let h=gi(d.dom);if(h.length!=1)return;a+=h[0].width,l=h[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:l}}});if(e)return e;let n=document.createElement("div"),r,s,i;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let o=gi(n.firstChild)[0];r=n.getBoundingClientRect().height,s=o&&o.width?o.width/27:7,i=o&&o.height?o.height:r,n.remove()}),{lineHeight:r,charWidth:s,textHeight:i}}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,s=0;;s++){let i=s==n.viewports.length?null:n.viewports[s],o=i?i.from-1:this.view.state.doc.length;if(o>r){let a=(n.lineBlockAt(o).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(ie.replace({widget:new Dc(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!i)break;r=i.to+1}return ie.set(e)}updateDeco(){let e=1,n=this.view.state.facet($i).map(i=>(this.dynamicDecorationMap[e++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(qx).map((i,o)=>{let a=typeof i=="function";return a&&(r=!0),a?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[e++]=r,n.push(ye.join(s))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(Gx).map(i=>typeof i=="function"?i(this.view):i)}scrollIntoView(e){if(e.isSnapshot){let d=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=d.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let d of this.view.state.facet(Wx))try{if(d(this.view,e.range,e))return!0}catch(h){Mt(this.view.state,h,"scroll handler")}let{range:n}=e,r=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1),s;if(!r)return;!n.empty&&(s=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,s.left),top:Math.min(r.top,s.top),right:Math.max(r.right,s.right),bottom:Math.max(r.bottom,s.bottom)});let i=ou(this.view),o={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;lC(this.view.scrollDOM,o,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,a),-a),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==Ee.LTR)}lineHasWidget(e){let n=r=>r.isWidget()||r.children.some(n);return n(this.tile.resolveBlock(e,1).tile)}destroy(){ih(this.tile)}}function ih(t,e){let n=e?.get(t);if(n!=1){n==null&&t.destroy();for(let r of t.children)ih(r,e)}}function RC(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function Xx(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=Mx(n.focusNode,n.focusOffset),s=Ax(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let a=Ue.get(s.node);if(!a||a.isText()&&a.text!=s.node.nodeValue)i=s;else if(t.docView.lastCompositionAfterCursor){let l=Ue.get(r.node);!l||l.isText()&&l.text!=r.node.nodeValue||(i=s)}}if(t.docView.lastCompositionAfterCursor=i!=r,!i)return null;let o=e-i.offset;return{from:o,to:o+i.node.nodeValue.length,node:i.node}}function IC(t,e,n){let r=Xx(t,n);if(!r)return null;let{node:s,from:i,to:o}=r,a=s.nodeValue;if(/[\n\r]/.test(a)||t.state.doc.sliceString(r.from,r.to)!=a)return null;let l=e.invertedDesc;return{range:new Gt(l.mapPos(i),l.mapPos(o),i,o),text:s}}function $C(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e<t.childNodes.length&&t.childNodes[e].contentEditable=="false"?2:0)}let BC=class{constructor(){this.changes=[]}compareRange(e,n){fs(e,n,this.changes)}comparePoint(e,n){fs(e,n,this.changes)}boundChange(e){fs(e,e,this.changes)}};function FC(t,e,n){let r=new BC;return ye.compare(t,e,n,r),r.changes}class zC{constructor(){this.changes=[]}compareRange(e,n){fs(e,n,this.changes)}comparePoint(){}boundChange(e){fs(e,e,this.changes)}}function VC(t,e,n){let r=new zC;return ye.compare(t,e,n,r),r.changes}function HC(t,e){for(let n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function _C(t,e){let n=!1;return e&&t.iterChangedRanges((r,s)=>{r<e.to&&s>e.from&&(n=!0)}),n}class Dc extends In{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function WC(t,e,n=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),i=e-s.from;if(s.length==0)return R.cursor(e);i==0?n=1:i==s.length&&(n=-1);let o=i,a=i;n<0?o=Ye(s.text,i,!1):a=Ye(s.text,i);let l=r(s.text.slice(o,a));for(;o>0;){let d=Ye(s.text,o,!1);if(r(s.text.slice(d,o))!=l)break;o=d}for(;a<s.length;){let d=Ye(s.text,a);if(r(s.text.slice(a,d))!=l)break;a=d}return R.range(o+s.from,a+s.from)}function UC(t,e,n,r,s){let i=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let a=t.viewState.heightOracle.textHeight,l=Math.floor((s-n.top-(t.defaultLineHeight-a)*.5)/a);i+=l*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(n.from,n.to);return n.from+Gd(o,i,t.state.tabSize)}function oh(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let s;for(let i of r.type){if(i.from>e)break;if(!(i.to<e)){if(i.from<e&&i.to>e)return i;(!s||i.type==it.Text&&(s.type!=i.type||(n<0?i.from<e:i.to>e)))&&(s=i)}}return s||r}return r}function KC(t,e,n,r){let s=oh(t,e.head,e.assoc||-1),i=!r||s.type!=it.Text||!(t.lineWrapping||s.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(i){let o=t.dom.getBoundingClientRect(),a=t.textDirectionAt(s.from),l=t.posAtCoords({x:n==(a==Ee.LTR)?o.right-1:o.left+1,y:(i.top+i.bottom)/2});if(l!=null)return R.cursor(l,n?-1:1)}return R.cursor(n?s.to:s.from,n?-1:1)}function cp(t,e,n,r){let s=t.state.doc.lineAt(e.head),i=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let d=vC(s,i,o,a,n),h=Rx;if(!d){if(s.number==(n?t.state.doc.lines:1))return a;h=`
|
|
238
|
+
`,s=t.state.doc.line(s.number+(n?1:-1)),i=t.bidiSpans(s),d=t.visualLineSide(s,!n)}if(l){if(!l(h))return a}else{if(!r)return d;l=r(h)}a=d}}function GC(t,e,n){let r=t.state.charCategorizer(e),s=r(n);return i=>{let o=r(i);return s==Ie.Space&&(s=o),s==o}}function qC(t,e,n,r){let s=e.head,i=n?1:-1;if(s==(n?t.state.doc.length:0))return R.cursor(s,e.assoc);let o=e.goalColumn,a,l=t.contentDOM.getBoundingClientRect(),d=t.coordsAtPos(s,e.assoc||-1),h=t.documentTop;if(d)o==null&&(o=d.left-l.left),a=i<0?d.top:d.bottom;else{let p=t.viewState.lineBlockAt(s);o==null&&(o=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-p.from))),a=(i<0?p.top:p.bottom)+h}let u=l.left+o,f=r??t.viewState.heightOracle.textHeight>>1;for(let p=0;;p+=10){let g=a+(f+p)*i,x=ah(t,{x:u,y:g},!1,i);return R.cursor(x.pos,x.assoc,void 0,o)}}function bi(t,e,n){for(;;){let r=0;for(let s of t)s.between(e-1,e+1,(i,o,a)=>{if(e>i&&e<o){let l=r||n||(e-i<o-e?-1:1);e=l<0?i:o,r=l}});if(!r)return e}}function Zx(t,e){let n=null;for(let r=0;r<e.ranges.length;r++){let s=e.ranges[r],i=null;if(s.empty){let o=bi(t,s.from,0);o!=s.from&&(i=R.cursor(o,-1))}else{let o=bi(t,s.from,-1),a=bi(t,s.to,1);(o!=s.from||a!=s.to)&&(i=R.range(s.from==s.anchor?o:a,s.from==s.head?o:a))}i&&(n||(n=e.ranges.slice()),n[r]=i)}return n?R.create(n,e.mainIndex):e}function Tc(t,e,n){let r=bi(t.state.facet(Fo).map(s=>s(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:R.cursor(r,r<n.from?1:-1)}class On{constructor(e,n){this.pos=e,this.assoc=n}}function ah(t,e,n,r){let s=t.contentDOM.getBoundingClientRect(),i=s.top+t.viewState.paddingTop,{x:o,y:a}=e,l=a-i,d;for(;;){if(l<0)return new On(0,1);if(l>t.viewState.docHeight)return new On(t.state.doc.length,-1);if(d=t.elementAtHeight(l),r==null)break;if(d.type==it.Text){let f=t.docView.coordsAt(r<0?d.from:d.to,r);if(f&&(r<0?f.top<=l+i:f.bottom>=l+i))break}let u=t.viewState.heightOracle.textHeight/2;l=r>0?d.bottom+u:d.top-u}if(t.viewport.from>=d.to||t.viewport.to<=d.from){if(n)return null;if(d.type==it.Text){let u=UC(t,s,d,o,a);return new On(u,u==d.from?1:-1)}}if(d.type!=it.Text)return l<(d.top+d.bottom)/2?new On(d.from,1):new On(d.to,-1);let h=t.docView.lineAt(d.from,2);return(!h||h.length!=d.length)&&(h=t.docView.lineAt(d.from,-2)),eb(t,h,d.from,o,a)}function eb(t,e,n,r,s){let i=-1,o=null,a=1e9,l=1e9,d=s,h=s,u=(f,p)=>{for(let g=0;g<f.length;g++){let x=f[g];if(x.top==x.bottom)continue;let b=x.left>r?x.left-r:x.right<r?r-x.right:0,y=x.top>s?x.top-s:x.bottom<s?s-x.bottom:0;x.top<=h&&x.bottom>=d&&(d=Math.min(x.top,d),h=Math.max(x.bottom,h),y=0),(i<0||(y-l||b-a)<0)&&(i>=0&&l&&a<b&&o.top<=h-2&&o.bottom>=d+2?l=0:(i=p,a=b,l=y,o=x))}};if(e.isText()){for(let p=0;p<e.length;){let g=Ye(e.text,p);if(u(Ii(e.dom,p,g).getClientRects(),p),!a&&!l)break;p=g}return r>(o.left+o.right)/2==(dp(t,i+n)==Ee.LTR)?new On(n+Ye(e.text,i),-1):new On(n+i,1)}else{if(!e.length)return new On(n,1);for(let x=0;x<e.children.length;x++){let b=e.children[x];if(b.flags&48)continue;let y=(b.dom.nodeType==1?b.dom:Ii(b.dom,0,b.length)).getClientRects();if(u(y,x),!a&&!l)break}let f=e.children[i],p=e.posBefore(f,n);return f.isComposite()||f.isText()?eb(t,f,p,Math.max(o.left,Math.min(o.right,r)),s):r>(o.left+o.right)/2==(dp(t,i+n)==Ee.LTR)?new On(p+f.length,-1):new On(p,1)}}function dp(t,e){let n=t.state.doc.lineAt(e);return t.bidiSpans(n)[Hn.find(t.bidiSpans(n),e-n.from,-1,1)].dir}const ci="";class YC{constructor(e,n){this.points=e,this.view=n,this.text="",this.lineSeparator=n.state.facet(ke.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=ci}readRange(e,n){if(!e)return this;let r=e.parentNode;for(let s=e;;){this.findPointBefore(r,s);let i=this.text.length;this.readNode(s);let o=Ue.get(s),a=s.nextSibling;if(a==n){o?.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=Ue.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:hl(s))||hl(a)&&(s.nodeName!="BR"||o?.isWidget())&&this.text.length>i)&&!QC(a,n)&&this.lineBreak(),s=a}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,o=1,a;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=s.exec(n))&&(i=a.index,o=a[0].length),this.append(n.slice(r,i<0?n.length:i)),i<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=o-1);r=i+o}}readNode(e){let n=Ue.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let s=r.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(JC(e,r.node,r.offset)?n:0))}}function JC(t,e,n){for(;;){if(!e||n<Wn(e))return!1;if(e==t)return!0;n=fr(e)+1,e=e.parentNode}}function QC(t,e){let n;for(;!(t==e||!t);t=t.nextSibling){let r=Ue.get(t);if(!r?.isWidget())return!1;r&&(n||(n=[])).push(r)}if(n)for(let r of n){let s=r.overrideDOMText;if(s?.length)return!1}return!0}class hp{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}}class XC{constructor(e,n,r,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:i,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=tb(e.docView.tile,n,r,0))){let a=i||o?[]:e3(e),l=new YC(a,e);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=t3(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=i&&i.node==a.focusNode&&i.offset==a.focusOffset||!eh(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),d=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!eh(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),h=e.viewport;if((q.ios||q.chrome)&&e.state.selection.main.empty&&l!=d&&(h.from>0||h.to<e.state.doc.length)){let u=Math.min(l,d),f=Math.max(l,d),p=h.from-u,g=h.to-f;(p==0||p==1||u==0)&&(g==0||g==-1||f==e.state.doc.length)&&(l=0,d=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(R.range(d,l)):this.newSel=R.single(d,l)}}}function tb(t,e,n,r){if(t.isComposite()){let s=-1,i=-1,o=-1,a=-1;for(let l=0,d=r,h=r;l<t.children.length;l++){let u=t.children[l],f=d+u.length;if(d<e&&f>n)return tb(u,e,n,d);if(f>=e&&s==-1&&(s=l,i=d),d>n&&u.dom.parentNode==t.dom){o=l,a=h;break}h=f,d=f+u.breakAfter}return{from:i,to:a<0?r+t.length:a,startDOM:(s?t.children[s-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:o<t.children.length&&o>=0?t.children[o].dom:null}}else return t.isText()?{from:r,to:r+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function nb(t,e){let n,{newSel:r}=e,s=t.state.selection.main,i=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,l=s.from,d=null;(i===8||q.android&&e.text.length<a-o)&&(l=s.to,d="end");let h=rb(t.state.doc.sliceString(o,a,ci),e.text,l-o,d);h&&(q.chrome&&i==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==ci+ci&&h.toB--,n={from:o+h.from,to:o+h.toA,insert:Ne.of(e.text.slice(h.from,h.toB).split(ci))})}else r&&(!t.hasFocus&&t.state.facet(Vn)||r.main.eq(s))&&(r=null);if(!n&&!r)return!1;if(!n&&e.typeOver&&!s.empty&&r&&r.main.empty?n={from:s.from,to:s.to,insert:t.state.doc.slice(s.from,s.to)}:(q.mac||q.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=R.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Ne.of([n.insert.toString().replace("."," ")])}):n&&n.from>=s.from&&n.to<=s.to&&(n.from!=s.from||n.to!=s.to)&&s.to-s.from-(n.to-n.from)<=4?n={from:s.from,to:s.to,insert:t.state.doc.slice(s.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,s.to))}:t.state.doc.lineAt(s.from).to<s.to&&t.docView.lineHasWidget(s.to)&&t.inputState.insertingTextAt>Date.now()-50?n={from:s.from,to:s.to,insert:t.state.toText(t.inputState.insertingText)}:q.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==`
|
|
239
|
+
`&&t.lineWrapping&&(r&&(r=R.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:Ne.of([" "])}),n)return au(t,n,r,i);if(r&&!r.main.eq(s)){let o=!1,a="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),a=t.inputState.lastSelectionOrigin,a=="select.pointer"&&(r=Zx(t.state.facet(Fo).map(l=>l(t)),r))),t.dispatch({selection:r,scrollIntoView:o,userEvent:a}),!0}else return!1}function au(t,e,n,r=-1){if(q.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(q.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&t.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&ps(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>s.head)&&ps(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&ps(t.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,a=()=>o||(o=ZC(t,e,n));return t.state.facet(zx).some(l=>l(t,e.from,e.to,i,a))||t.dispatch(a()),!0}function ZC(t,e,n){let r,s=t.state,i=s.selection.main,o=-1;if(e.from==e.to&&e.from<i.from||e.from>i.to){let l=e.from<i.from?-1:1,d=l<0?i.from:i.to,h=bi(s.facet(Fo).map(u=>u(t)),d,l);e.from==h&&(o=h)}if(o>-1)r={changes:e,selection:R.cursor(e.from+e.insert.length,-1)};else if(e.from>=i.from&&e.to<=i.to&&e.to-e.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let l=i.from<e.from?s.sliceDoc(i.from,e.from):"",d=i.to>e.to?s.sliceDoc(e.to,i.to):"";r=s.replaceSelection(t.state.toText(l+e.insert.sliceString(0,void 0,t.state.lineBreak)+d))}else{let l=s.changes(e),d=n&&n.main.to<=l.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=i.to+10&&e.to>=i.to-10){let h=t.state.sliceDoc(e.from,e.to),u,f=n&&Xx(t,n.main.head);if(f){let g=e.insert.length-(e.to-e.from);u={from:f.from,to:f.to-g}}else u=t.state.doc.lineAt(i.head);let p=i.to-e.to;r=s.changeByRange(g=>{if(g.from==i.from&&g.to==i.to)return{changes:l,range:d||g.map(l)};let x=g.to-p,b=x-h.length;if(t.state.sliceDoc(b,x)!=h||x>=u.from&&b<=u.to)return{range:g};let y=s.changes({from:b,to:x,insert:e.insert}),w=g.to-i.to;return{changes:y,range:d?R.range(Math.max(0,d.anchor+w),Math.max(0,d.head+w)):g.map(y)}})}else r={changes:l,selection:d&&s.selection.replaceRange(d)}}let a="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,a+=".compose",t.inputState.compositionFirstChange&&(a+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:a,scrollIntoView:!0})}function rb(t,e,n,r){let s=Math.min(t.length,e.length),i=0;for(;i<s&&t.charCodeAt(i)==e.charCodeAt(i);)i++;if(i==s&&t.length==e.length)return null;let o=t.length,a=e.length;for(;o>0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,i-Math.min(o,a));n-=o+l-i}if(o<i&&t.length<e.length){let l=n<=i&&n>=o?i-n:0;i-=l,a=i+(a-o),o=i}else if(a<i){let l=n<=i&&n>=a?i-n:0;i-=l,o=i+(o-a),a=i}return{from:i,toA:o,toB:a}}function e3(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}=t.observer.selectionRange;return n&&(e.push(new hp(n,r)),(s!=n||i!=r)&&e.push(new hp(s,i))),e}function t3(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?R.single(n+e,r+e):null}class n3{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,q.safari&&e.contentDOM.addEventListener("input",()=>null),q.gecko&&x3(e.contentDOM.ownerDocument)}handleEvent(e){!d3(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let s of r.observers)s(this.view,n);for(let s of r.handlers){if(n.defaultPrevented)break;if(s(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=r3(e),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let o=!n[i].handlers.length,a=r[i];a&&o!=!a.handlers.length&&(s.removeEventListener(i,this.handleEvent),a=null),a||s.addEventListener(i,this.handleEvent,{passive:o})}for(let i in r)i!="scroll"&&!n[i]&&s.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&ib.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),q.android&&q.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return q.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=sb.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||s3.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,ps(this.view.contentDOM,n.key,n.keyCode,n instanceof KeyboardEvent?n:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:q.safari&&!q.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function up(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(s){Mt(n.state,s)}}}function r3(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let s=r.spec,i=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(i)for(let a in i){let l=i[a];l&&n(a).handlers.push(up(r.value,l))}if(o)for(let a in o){let l=o[a];l&&n(a).observers.push(up(r.value,l))}}for(let r in cn)n(r).handlers.push(cn[r]);for(let r in Zt)n(r).observers.push(Zt[r]);return e}const sb=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],s3="dthko",ib=[16,17,18,20,91,92,224,225],ka=6;function Sa(t){return Math.max(0,t)*.7+8}function i3(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class o3{constructor(e,n,r,s){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=cC(e.contentDOM),this.atoms=e.state.facet(Fo).map(o=>o(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(ke.allowMultipleSelections)&&a3(e,n),this.dragging=c3(e,n)&&lb(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&i3(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,s=0,i=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=ou(this.view);e.clientX-l.left<=s+ka?n=-Sa(s-e.clientX):e.clientX+l.right>=o-ka&&(n=Sa(e.clientX-o)),e.clientY-l.top<=i+ka?r=-Sa(i-e.clientY):e.clientY+l.bottom>=a-ka&&(r=Sa(e.clientY-a)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=Zx(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function a3(t,e){let n=t.state.facet(Ix);return n.length?n[0](e):q.mac?e.metaKey:e.ctrlKey}function l3(t,e){let n=t.state.facet($x);return n.length?n[0](e):q.mac?!e.altKey:!e.ctrlKey}function c3(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=Li(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i<s.length;i++){let o=s[i];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function d3(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=Ue.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const cn=Object.create(null),Zt=Object.create(null),ob=q.ie&&q.ie_version<15||q.ios&&q.webkit_version<604;function h3(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),ab(t,n.value)},50)}function Yl(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function ab(t,e){e=Yl(t.state,ru,e);let{state:n}=t,r,s=1,i=n.toText(e),o=i.lines==n.selection.ranges.length;if(lh!=null&&n.selection.ranges.every(l=>l.empty)&&lh==i.toString()){let l=-1;r=n.changeByRange(d=>{let h=n.doc.lineAt(d.from);if(h.from==l)return{range:d};l=h.from;let u=n.toText((o?i.line(s++).text:e)+n.lineBreak);return{changes:{from:h.from,insert:u},range:R.cursor(d.from+u.length)}})}else o?r=n.changeByRange(l=>{let d=i.line(s++);return{changes:{from:l.from,to:l.to,insert:d.text},range:R.cursor(l.from+d.length)}}):r=n.replaceSelection(i);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Zt.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};cn.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Zt.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Zt.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};cn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(Bx))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=f3(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new o3(t,e,n,r)),r&&t.observer.ignore(()=>{Px(t.contentDOM);let i=t.root.activeElement;i&&!i.contains(t.contentDOM)&&i.blur()});let s=t.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function fp(t,e,n,r){if(r==1)return R.cursor(e,n);if(r==2)return WC(t.state,e,n);{let s=t.docView.lineAt(e,n),i=t.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:i.from,a=s?s.posAtEnd:i.to;return a<t.state.doc.length&&a==i.to&&a++,R.range(o,a)}}const u3=q.ie&&q.ie_version<=11;let pp=null,mp=0,gp=0;function lb(t){if(!u3)return t.detail;let e=pp,n=gp;return pp=t,gp=Date.now(),mp=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(mp+1)%3:1}function f3(t,e){let n=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=lb(e),s=t.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,o,a){let l=t.posAndSideAtCoords({x:i.clientX,y:i.clientY},!1),d,h=fp(t,l.pos,l.assoc,r);if(n.pos!=l.pos&&!o){let u=fp(t,n.pos,n.assoc,r),f=Math.min(u.from,h.from),p=Math.max(u.to,h.to);h=f<h.from?R.range(f,p):R.range(p,f)}return o?s.replaceRange(s.main.extend(h.from,h.to)):a&&r==1&&s.ranges.length>1&&(d=p3(s,l.pos))?d:a?s.addRange(h):R.create([h])}}}function p3(t,e){for(let n=0;n<t.ranges.length;n++){let{from:r,to:s}=t.ranges[n];if(r<=e&&s>=e)return R.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}cn.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let s=t.docView.tile.nearest(e.target);if(s&&s.isWidget()){let i=s.posAtStart,o=i+s.length;(i>=n.to||o<=n.from)&&(n=R.range(i,o))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",Yl(t.state,su,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};cn.dragend=t=>(t.inputState.draggedContent=null,!1);function xp(t,e,n,r){if(n=Yl(t.state,ru,n),!n)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=t.inputState,o=r&&i&&l3(t,e)?{from:i.from,to:i.to}:null,a={from:s,insert:n},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}cn.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),s=0,i=()=>{++s==n.length&&xp(t,e,r.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o<n.length;o++){let a=new FileReader;a.onerror=i,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[o]=a.result),i()},a.readAsText(n[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return xp(t,e,r,!0),!0}return!1};cn.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=ob?null:e.clipboardData;return n?(ab(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(h3(t),!1)};function m3(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function g3(t){let e=[],n=[],r=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),n.push(s));if(!e.length){let s=-1;for(let{from:i}of t.selection.ranges){let o=t.doc.lineAt(i);o.number>s&&(e.push(o.text),n.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),s=o.number}r=!0}return{text:Yl(t,su,e.join(t.lineBreak)),ranges:n,linewise:r}}let lh=null;cn.copy=cn.cut=(t,e)=>{let{text:n,ranges:r,linewise:s}=g3(t.state);if(!n&&!s)return!1;lh=s?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=ob?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(m3(t,n),!1)};const cb=Ln.define();function db(t,e){let n=[];for(let r of t.facet(Vx)){let s=r(t,e);s&&n.push(s)}return n.length?t.update({effects:n,annotations:cb.of(!0)}):null}function hb(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=db(t.state,e);n?t.dispatch(n):t.update([])}},10)}Zt.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),hb(t)};Zt.blur=t=>{t.observer.clearSelectionRange(),hb(t)};Zt.compositionstart=Zt.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Zt.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,q.chrome&&q.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Zt.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};cn.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let i=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=e.getTargetRanges();if(i&&o.length){let a=o[0],l=t.posAtDOM(a.startContainer,a.startOffset),d=t.posAtDOM(a.endContainer,a.endOffset);return au(t,{from:l,to:d,insert:t.state.toText(i)},null),!0}}let s;if(q.chrome&&q.android&&(s=sb.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return q.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),q.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Zt.compositionend(t,e),20),!1};const bp=new Set;function x3(t){bp.has(t)||(bp.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const yp=["pre-wrap","normal","pre-line","break-spaces"];let Cs=!1;function vp(){Cs=!1}class b3{constructor(e){this.lineWrapping=e,this.doc=Ne.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return yp.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r<e.length;r++){let s=e[r];s<0?r++:this.heightSamples[Math.floor(s*10)]||(n=!0,this.heightSamples[Math.floor(s*10)]=!0)}return n}refresh(e,n,r,s,i,o){let a=yp.indexOf(e)>-1,l=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,l){this.heightSamples={};for(let d=0;d<o.length;d++){let h=o[d];h<0?d++:this.heightSamples[Math.floor(h*10)]=!0}}return l}}class y3{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class on{constructor(e,n,r,s,i){this.from=e,this.length=n,this.top=r,this.height=s,this._content=i}get type(){return typeof this._content=="number"?it.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Fr?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new on(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var Le=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(Le||(Le={}));const Qa=.001;class wt{constructor(e,n,r=2){this.length=e,this.height=n,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Qa&&(Cs=!0),this.height=e)}replace(e,n,r){return wt.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,s){let i=this,o=r.doc;for(let a=s.length-1;a>=0;a--){let{fromA:l,toA:d,fromB:h,toB:u}=s[a],f=i.lineAt(l,Le.ByPosNoHeight,r.setDoc(n),0,0),p=f.to>=d?f:i.lineAt(d,Le.ByPosNoHeight,r,0,0);for(u+=p.to-d,d=p.to;a>0&&f.from<=s[a-1].toA;)l=s[a-1].fromA,h=s[a-1].fromB,a--,l<f.from&&(f=i.lineAt(l,Le.ByPosNoHeight,r,0,0));h+=f.from-l,l=f.from;let g=lu.build(r.setDoc(o),e,h,u);i=ml(i,i.replace(l,d,g))}return i.updateHeight(r,0)}static empty(){return new It(0,0,0)}static of(e){if(e.length==1)return e[0];let n=0,r=e.length,s=0,i=0;for(;;)if(n==r)if(s>i*2){let a=e[n-1];a.break?e.splice(--n,1,a.left,null,a.right):e.splice(--n,1,a.left,a.right),r+=1+a.break,s-=a.size}else if(i>s*2){let a=e[r];a.break?e.splice(r,1,a.left,null,a.right):e.splice(r,1,a.left,a.right),r+=2+a.break,i-=a.size}else break;else if(s<i){let a=e[n++];a&&(s+=a.size)}else{let a=e[--r];a&&(i+=a.size)}let o=0;return e[n-1]==null?(o=1,n--):e[n]==null&&(o=1,r++),new w3(wt.of(e.slice(0,n)),o,wt.of(e.slice(r)))}}function ml(t,e){return t==e?t:(t.constructor!=e.constructor&&(Cs=!0),e)}wt.prototype.size=1;const v3=ie.replace({});class ub extends wt{constructor(e,n,r){super(e,n),this.deco=r,this.spaceAbove=0}mainBlock(e,n){return new on(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,n,r,s){return this.spaceAbove&&e<r+this.spaceAbove?new on(s,0,r,this.spaceAbove,v3):this.mainBlock(r,s)}lineAt(e,n,r,s,i){let o=this.mainBlock(s,i);return this.spaceAbove?this.blockAt(0,r,s,i).join(o):o}forEachLine(e,n,r,s,i,o){e<=i+this.length&&n>=i&&o(this.lineAt(0,Le.ByPos,r,s,i))}setMeasuredHeight(e){let n=e.heights[e.index++];n<0?(this.spaceAbove=-n,n=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}}class It extends ub{constructor(e,n,r){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,n){return new on(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,n,r){let s=r[0];return r.length==1&&(s instanceof It||s instanceof rt&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof rt?s=new It(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):wt.of(r)}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more?this.setMeasuredHeight(s):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class rt extends wt{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,s=e.doc.lineAt(n+this.length).number,i=s-r+1,o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*i);o=l/i,this.length>i+1&&(a=(this.height-l)/(this.length-i-1))}else o=this.height/i;return{firstLine:r,lastLine:s,perLine:o,perChar:a}}blockAt(e,n,r,s){let{firstLine:i,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(n,s);if(n.lineWrapping){let d=s+(e<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),h=n.doc.lineAt(d),u=a+h.length*l,f=Math.max(r,e-u/2);return new on(h.from,h.length,f,u,0)}else{let d=Math.max(0,Math.min(o-i,Math.floor((e-r)/a))),{from:h,length:u}=n.doc.line(i+d);return new on(h,u,r+a*d,a,0)}}lineAt(e,n,r,s,i){if(n==Le.ByHeight)return this.blockAt(e,r,s,i);if(n==Le.ByPosNoHeight){let{from:p,to:g}=r.doc.lineAt(e);return new on(p,g-p,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(r,i),d=r.doc.lineAt(e),h=a+d.length*l,u=d.number-o,f=s+a*u+l*(d.from-i-u);return new on(d.from,d.length,Math.max(s,Math.min(f,s+this.height-h)),h,0)}forEachLine(e,n,r,s,i,o){e=Math.max(e,i),n=Math.min(n,i+this.length);let{firstLine:a,perLine:l,perChar:d}=this.heightMetrics(r,i);for(let h=e,u=s;h<=n;){let f=r.doc.lineAt(h);if(h==e){let g=f.number-a;u+=l*g+d*(e-i-g)}let p=l+d*f.length;o(new on(f.from,f.length,u,p,0)),u+=p,h=f.to+1}}replace(e,n,r){let s=this.length-n;if(s>0){let i=r[r.length-1];i instanceof rt?r[r.length-1]=new rt(i.length+s):r.push(null,new rt(s-1))}if(e>0){let i=r[0];i instanceof rt?r[0]=new rt(e+i.length):r.unshift(new rt(e-1),null)}return wt.of(r)}decomposeLeft(e,n){n.push(new rt(e-1),null)}decomposeRight(e,n){n.push(null,new rt(this.length-e-1))}updateHeight(e,n=0,r=!1,s){let i=n+this.length;if(s&&s.from<=n+this.length&&s.more){let o=[],a=Math.max(n,s.from),l=-1;for(s.from>n&&o.push(new rt(s.from-n-1).updateHeight(e,n));a<=i&&s.more;){let h=e.doc.lineAt(a).length;o.length&&o.push(null);let u=s.heights[s.index++],f=0;u<0&&(f=-u,u=s.heights[s.index++]),l==-1?l=u:Math.abs(u-l)>=Qa&&(l=-2);let p=new It(h,u,f);p.outdated=!1,o.push(p),a+=h+1}a<=i&&o.push(null,new rt(i-a).updateHeight(e,a));let d=wt.of(o);return(l<0||Math.abs(d.height-this.height)>=Qa||Math.abs(l-this.heightMetrics(e,n).perLine)>=Qa)&&(Cs=!0),ml(this,d)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class w3 extends wt{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,s){let i=r+this.left.height;return e<i?this.left.blockAt(e,n,r,s):this.right.blockAt(e,n,i,s+this.left.length+this.break)}lineAt(e,n,r,s,i){let o=s+this.left.height,a=i+this.left.length+this.break,l=n==Le.ByHeight?e<o:e<a,d=l?this.left.lineAt(e,n,r,s,i):this.right.lineAt(e,n,r,o,a);if(this.break||(l?d.to<a:d.from>a))return d;let h=n==Le.ByPosNoHeight?Le.ByPosNoHeight:Le.ByPos;return l?d.join(this.right.lineAt(a,h,r,o,a)):this.left.lineAt(a,h,r,s,i).join(d)}forEachLine(e,n,r,s,i,o){let a=s+this.left.height,l=i+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,n,r,s,i,o),n>=l&&this.right.forEachLine(e,n,r,a,l,o);else{let d=this.lineAt(l,Le.ByPos,r,s,i);e<d.from&&this.left.forEachLine(e,d.from-1,r,s,i,o),d.to>=e&&d.from<=n&&o(d),n>d.to&&this.right.forEachLine(d.to+1,n,r,a,l,o)}}replace(e,n,r){let s=this.left.length+this.break;if(n<s)return this.balanced(this.left.replace(e,n,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-s,n-s,r));let i=[];e>0&&this.decomposeLeft(e,i);let o=i.length;for(let a of r)i.push(a);if(e>0&&wp(i,o-1),n<this.length){let a=i.length;this.decomposeRight(n,i),wp(i,a)}return wt.of(i)}decomposeLeft(e,n){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(r++,e>=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,n);e<r&&this.left.decomposeRight(e,n),this.break&&e<s&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?wt.of(this.break?[e,null,n]:[e,n]):(this.left=ml(this.left,e),this.right=ml(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,s){let{left:i,right:o}=this,a=n+i.length+this.break,l=null;return s&&s.from<=n+i.length&&s.more?l=i=i.updateHeight(e,n,r,s):i.updateHeight(e,n,r),s&&s.from<=a+o.length&&s.more?l=o=o.updateHeight(e,a,r,s):o.updateHeight(e,a,r),l?this.balanced(i,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function wp(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof rt&&(r=t[e+1])instanceof rt&&t.splice(e-1,3,new rt(n.length+1+r.length))}const k3=5;class lu{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof It?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new It(r-this.pos,-1,0)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e<n||r.heightRelevant){let s=r.widget?r.widget.estimatedHeight:0,i=r.widget?r.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let o=n-e;r.block?this.addBlock(new ub(o,s,r)):(o||i||s>=k3)&&this.addLineDeco(s,i,o)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new It(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,n){let r=new rt(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof It)return e;let n=new It(0,-1,0);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof It)&&!this.isCovered?this.nodes.push(new It(0,-1,0)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let s of this.nodes)s instanceof It&&s.updateHeight(this.oracle,r),r+=s?s.length:1;return this.nodes}static build(e,n,r,s){let i=new lu(r,e);return ye.spans(n,r,s,i,0),i.finish(r)}}function S3(t,e,n){let r=new C3;return ye.compare(t,e,n,r,0),r.changes}class C3{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,r,s){(e<n||r&&r.heightRelevant||s&&s.heightRelevant)&&fs(e,n,this.changes,5)}}function j3(t,e){let n=t.getBoundingClientRect(),r=t.ownerDocument,s=r.defaultView||window,i=Math.max(0,n.left),o=Math.min(s.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(s.innerHeight,n.bottom);for(let d=t.parentNode;d&&d!=r.body;)if(d.nodeType==1){let h=d,u=window.getComputedStyle(h);if((h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&u.overflow!="visible"){let f=h.getBoundingClientRect();i=Math.max(i,f.left),o=Math.min(o,f.right),a=Math.max(a,f.top),l=Math.min(d==t.parentNode?s.innerHeight:l,f.bottom)}d=u.position=="absolute"||u.position=="fixed"?h.offsetParent:h.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:i-n.left,right:Math.max(i,o)-n.left,top:a-(n.top+e),bottom:Math.max(a,l)-(n.top+e)}}function N3(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left<n.innerWidth&&e.right>0&&e.top<n.innerHeight&&e.bottom>0}function P3(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class Ec{constructor(e,n,r,s){this.from=e,this.to=n,this.size=r,this.displaySize=s}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++){let s=e[r],i=n[r];if(s.from!=i.from||s.to!=i.to||s.size!=i.size)return!1}return!0}draw(e,n){return ie.replace({widget:new O3(this.displaySize*(n?e.scaleY:e.scaleX),n)}).range(this.from,this.to)}}class O3 extends In{constructor(e,n){super(),this.size=e,this.vertical=n}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class kp{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Sp,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Ee.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=e.facet(iu).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new b3(n),this.stateDeco=e.facet($i).filter(r=>typeof r!="function"),this.heightMap=wt.empty().applyChanges(this.stateDeco,Ne.empty,this.heightOracle.setDoc(e.doc),[new Gt(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ie.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!e.some(({from:i,to:o})=>s>=i&&s<=o)){let{from:i,to:o}=this.lineBlockAt(s);e.push(new Ca(i,o))}}return this.viewports=e.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Sp:new cu(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(di(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet($i).filter(h=>typeof h!="function");let s=e.changedRanges,i=Gt.extendWithRanges(s,S3(r,this.stateDeco,e?e.changes:Ge.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);vp(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||Cs)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let l=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.head<l.from||n.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,n));let d=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(d||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(_x)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Ee.RTL:Ee.LTR;let o=this.heightOracle.mustRefreshForWrapping(i),a=n.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let d=0,h=0;if(a.width&&a.height){let{scaleX:S,scaleY:k}=Nx(n,a);(S>.005&&Math.abs(this.scaleX-S)>.005||k>.005&&Math.abs(this.scaleY-k)>.005)&&(this.scaleX=S,this.scaleY=k,d|=16,o=l=!0)}let u=(parseInt(r.paddingTop)||0)*this.scaleY,f=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=u||this.paddingBottom!=f)&&(this.paddingTop=u,this.paddingBottom=f,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let p=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=p&&(this.scrollAnchorHeight=-1,this.scrollTop=p),this.scrolledToBottom=Ox(e.scrollDOM);let g=(this.printing?P3:j3)(n,this.paddingTop),x=g.top-this.pixelViewport.top,b=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(l=!0)),!this.inView&&!this.scrollTarget&&!N3(e.dom))return 0;let w=a.width;if((this.contentDOMWidth!=w||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),l){let S=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(S)&&(o=!0),o||s.lineWrapping&&Math.abs(w-this.contentDOMWidth)>s.charWidth){let{lineHeight:k,charWidth:N,textHeight:v}=e.docView.measureTextSize();o=k>0&&s.refresh(i,k,N,v,Math.max(5,w/N),S),o&&(e.docView.minWidth=0,d|=16)}x>0&&b>0?h=Math.max(x,b):x<0&&b<0&&(h=Math.min(x,b)),vp();for(let k of this.viewports){let N=k.from==this.viewport.from?S:e.docView.measureVisibleLineHeights(k);this.heightMap=(o?wt.empty().applyChanges(this.stateDeco,Ne.empty,this.heightOracle,[new Gt(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new y3(k.from,N))}Cs&&(d|=2)}let C=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return C&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),d|=this.updateForViewport()),(d&2||C)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),d}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,i=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new Ca(s.lineAt(o-r*1e3,Le.ByHeight,i,0,0).from,s.lineAt(a+(1-r)*1e3,Le.ByHeight,i,0,0).to);if(n){let{head:d}=n.range;if(d<l.from||d>l.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),u=s.lineAt(d,Le.ByPos,i,0,0),f;n.y=="center"?f=(u.top+u.bottom)/2-h/2:n.y=="start"||n.y=="nearest"&&d<l.from?f=u.top:f=u.bottom-h,l=new Ca(s.lineAt(f-1e3/2,Le.ByHeight,i,0,0).from,s.lineAt(f+h+1e3/2,Le.ByHeight,i,0,0).to)}}return l}mapViewport(e,n){let r=n.mapPos(e.from,-1),s=n.mapPos(e.to,1);return new Ca(this.heightMap.lineAt(r,Le.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,Le.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:n},r=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(e,Le.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,Le.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||s<=o-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||i>=a+Math.max(10,Math.min(r,250)))&&s>o-2*1e3&&i<a+2*1e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let r=[];for(let s of e)n.touchesRange(s.from,s.to)||r.push(new Ec(n.mapPos(s.from),n.mapPos(s.to),s.size,s.displaySize));return r}ensureLineGaps(e,n){let r=this.heightOracle.lineWrapping,s=r?1e4:2e3,i=s>>1,o=s<<1;if(this.defaultTextDirection!=Ee.LTR&&!r)return[];let a=[],l=(h,u,f,p)=>{if(u-h<i)return;let g=this.state.selection.main,x=[g.from];g.empty||x.push(g.to);for(let y of x)if(y>h&&y<u){l(h,y-10,f,p),l(y+10,u,f,p);return}let b=A3(e,y=>y.from>=f.from&&y.to<=f.to&&Math.abs(y.from-h)<i&&Math.abs(y.to-u)<i&&!x.some(w=>y.from<w&&y.to>w));if(!b){if(u<f.to&&n&&r&&n.visibleRanges.some(C=>C.from<=u&&C.to>=u)){let C=n.moveToLineBoundary(R.cursor(u),!1,!0).head;C>h&&(u=C)}let y=this.gapSize(f,h,u,p),w=r||y<2e6?y:2e6;b=new Ec(h,u,y,w)}a.push(b)},d=h=>{if(h.length<o||h.type!=it.Text)return;let u=M3(h.from,h.to,this.stateDeco);if(u.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,p,g;if(r){let x=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,b,y;if(f!=null){let w=Na(u,f),C=((this.visibleBottom-this.visibleTop)/2+x)/h.height;b=w-C,y=w+C}else b=(this.visibleTop-h.top-x)/h.height,y=(this.visibleBottom-h.top+x)/h.height;p=ja(u,b),g=ja(u,y)}else{let x=u.total*this.heightOracle.charWidth,b=s*this.heightOracle.charWidth,y=0;if(x>2e6)for(let N of e)N.from>=h.from&&N.from<h.to&&N.size!=N.displaySize&&N.from*this.heightOracle.charWidth+y<this.pixelViewport.left&&(y=N.size-N.displaySize);let w=this.pixelViewport.left+y,C=this.pixelViewport.right+y,S,k;if(f!=null){let N=Na(u,f),v=((C-w)/2+b)/x;S=N-v,k=N+v}else S=(w-b)/x,k=(C+b)/x;p=ja(u,S),g=ja(u,k)}p>h.from&&l(h.from,p,h,u),g<h.to&&l(g,h.to,h,u)};for(let h of this.viewportLines)Array.isArray(h.type)?h.type.forEach(d):d(h);return a}gapSize(e,n,r,s){let i=Na(s,r)-Na(s,n);return this.heightOracle.lineWrapping?e.height*i:s.total*this.heightOracle.charWidth*i}updateLineGaps(e){Ec.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ie.set(e.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];ye.spans(n,this.viewport.from,this.viewport.to,{span(i,o){r.push({from:i,to:o})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let i=0;i<r.length&&!(s&8);i++){let o=this.visibleRanges[i],a=r[i];(o.from!=a.from||o.to!=a.to)&&(s|=4,e&&e.mapPos(o.from,-1)==a.from&&e.mapPos(o.to,1)==a.to||(s|=8))}return this.visibleRanges=r,s}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||di(this.heightMap.lineAt(e,Le.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||di(this.heightMap.lineAt(this.scaler.fromDOM(e),Le.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return di(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Ca{constructor(e,n){this.from=e,this.to=n}}function M3(t,e,n){let r=[],s=t,i=0;return ye.spans(n,t,e,{span(){},point(o,a){o>s&&(r.push({from:s,to:o}),i+=o-s),s=a}},20),s<e&&(r.push({from:s,to:e}),i+=e-s),{total:i,ranges:r}}function ja({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let s=0;;s++){let{from:i,to:o}=e[s],a=o-i;if(r<=a)return i+r;r-=a}}function Na(t,e){let n=0;for(let{from:r,to:s}of t.ranges){if(e<=s){n+=e-r;break}n+=s-r}return n/t.total}function A3(t,e){for(let n of t)if(e(n))return n}const Sp={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class cu{constructor(e,n,r){let s=0,i=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let d=n.lineAt(a,Le.ByPos,e,0,0).top,h=n.lineAt(l,Le.ByPos,e,0,0).bottom;return s+=h-d,{from:a,to:l,top:d,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let a of this.viewports)a.domTop=o+(a.top-i)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),i=a.bottom}toDOM(e){for(let n=0,r=0,s=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||e<i.top)return s+(e-r)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);r=i.bottom,s=i.domBottom}}fromDOM(e){for(let n=0,r=0,s=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||e<i.domTop)return r+(e-s)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);r=i.bottom,s=i.domBottom}}eq(e){return e instanceof cu?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((n,r)=>n.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function di(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new on(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(s=>di(s,e)):t._content)}const Pa=Y.define({combine:t=>t.join(" ")}),ch=Y.define({combine:t=>t.indexOf(!0)>-1}),dh=hr.newName(),fb=hr.newName(),pb=hr.newName(),mb={"&light":"."+fb,"&dark":"."+pb};function hh(t,e,n){return new hr(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return t;if(!n||!n[s])throw new RangeError(`Unsupported selector: ${s}`);return n[s]}):t+" "+r}})}const D3=hh("."+dh,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},mb),T3={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Lc=q.ie&&q.ie_version<=11;class E3{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new dC,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(q.ie&&q.ie_version<=11||q.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&q.android&&e.constructor.EDIT_CONTEXT!==!1&&!(q.chrome&&q.chrome_version<126)&&(this.editContext=new R3(e),e.state.facet(Vn)&&(e.contentDOM.editContext=this.editContext.editContext)),Lc&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(Vn)?r.root.activeElement!=this.dom:!Ja(this.dom,s))return;let i=s.anchorNode&&r.docView.tile.nearest(s.anchorNode);if(i&&i.isWidget()&&i.widget.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(q.ie&&q.ie_version<=11||q.android&&q.chrome)&&!r.state.selection.main.empty&&s.focusNode&&xi(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=Li(e.root);if(!n)return!1;let r=q.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&L3(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=Ja(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&uC(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),s&&(this.selectionChanged=!0),!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let r=this.dom;r;)if(r.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),n){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=n)r.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,T3),Lc&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Lc&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){var r;if(!this.delayedAndroidKey){let s=()=>{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&ps(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,s=!1;for(let i of e){let o=this.readMutation(i);o&&(o.typeOver&&(s=!0),n==-1?{from:n,to:r}=o:(n=Math.min(o.from,n),r=Math.max(o.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&Ja(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new XC(this.view,e,n,r);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,s=nb(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(e){let n=this.view.docView.tile.nearest(e.target);if(!n||n.isWidget())return null;if(n.markDirty(e.type=="attributes"),e.type=="childList"){let r=Cp(n,e.previousSibling||e.target.previousSibling,-1),s=Cp(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:s?n.posBefore(s):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Vn)!=e.state.facet(Vn)&&(e.view.contentDOM.editContext=e.state.facet(Vn)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Cp(t,e,n){for(;e;){let r=Ue.get(e);if(r&&r.parent==t)return r;let s=e.parentNode;e=s!=t.dom?s:n>0?e.nextSibling:e.previousSibling}return null}function jp(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor,1);return xi(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function L3(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return jp(t,s)}let n=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?jp(t,n):null}class R3{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let s=e.state.selection.main,{anchor:i,head:o}=s,a=this.toEditorPos(r.updateRangeStart),l=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:a,drifted:!1});let d=l-a>r.text.length;a==this.from&&i<this.from?a=i:l==this.to&&i>this.to&&(l=i);let h=rb(e.state.sliceDoc(a,l),r.text,(d?s.from:s.to)-a,d?"end":null);if(!h){let f=R.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));f.main.eq(s)||e.dispatch({selection:f,userEvent:"select"});return}let u={from:h.from+a,to:h.toA+a,insert:Ne.of(r.text.slice(h.from,h.toB).split(`
|
|
240
|
+
`))};if((q.mac||q.android)&&u.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(u={from:a,to:l,insert:Ne.of([r.text.replace("."," ")])}),this.pendingContextChange=u,!e.state.readOnly){let f=this.to-this.from+(u.to-u.from+u.insert.length);au(e,u,R.single(this.toEditorPos(r.selectionStart,f),this.toEditorPos(r.selectionEnd,f)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),u.from<u.to&&!u.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let l=e.coordsForChar(o);i=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||i||new DOMRect,s.push(i)}n.updateCharacterBounds(r.rangeStart,s)},this.handlers.textformatupdate=r=>{let s=[];for(let i of r.getTextFormats()){let o=i.underlineStyle,a=i.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(i.rangeStart),d=this.toEditorPos(i.rangeEnd);if(l<d){let h=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;s.push(ie.mark({attributes:{style:h}}).range(l,d))}}}e.dispatch({effects:Ux.of(ie.set(s))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let s=Li(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((i,o,a,l,d)=>{if(r)return;let h=d.length-(o-i);if(s&&o>=s.to)if(s.from==i&&s.to==o&&s.insert.eq(d)){s=this.pendingContextChange=null,n+=h,this.to+=h;return}else s=null,this.revertPending(e.state);if(i+=n,o+=n,o<=this.from)this.from+=h,this.to+=h;else if(i<this.to){if(i<this.from||o>this.to||this.to-this.from+d.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),d.toString()),this.to+=h}n+=h}),s&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class _{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(s=>s.forEach(i=>r(i,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||hC(e.parent)||document,this.viewState=new kp(e.state||ke.create(e)),e.scrollTo&&e.scrollTo.is(wa)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(is).map(s=>new Oc(s));for(let s of this.plugins)s.update(this);this.observer=new E3(this),this.inputState=new n3(this),this.inputState.ensureHandlers(this.plugins),this.docView=new lp(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let n=e.length==1&&e[0]instanceof Je?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,i=this.state;for(let f of e){if(f.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=f.state}if(this.destroyed){this.viewState.state=i;return}let o=this.hasFocus,a=0,l=null;e.some(f=>f.annotation(cb))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=db(i,o),l||(a=1));let d=this.observer.delayedAndroidKey,h=null;if(d?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(h=null)):this.observer.clear(),i.facet(ke.phrases)!=this.state.facet(ke.phrases))return this.setState(i);s=ul.create(this,i,e),s.flags|=a;let u=this.viewState.scrollTarget;try{this.updateState=2;for(let f of e){if(u&&(u=u.map(f.changes)),f.scrollIntoView){let{main:p}=f.state.selection;u=new ms(p.empty?p:R.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of f.effects)p.is(wa)&&(u=p.value.clip(this.state))}this.viewState.update(s,u),this.bidiCache=gl.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(li)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Pa)!=s.state.facet(Pa)&&(this.viewState.mustMeasureContent=!0),(n||r||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let f of this.state.facet(sh))try{f(s)}catch(p){Mt(this.state,p,"update listener")}(l||h)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),h&&!nb(this,h)&&d.force&&ps(this.contentDOM,d.key,d.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new kp(e),this.plugins=e.facet(is).map(r=>new Oc(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new lp(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(is),r=e.state.facet(is);if(n!=r){let s=[];for(let i of r){let o=n.indexOf(i);if(o<0)s.push(new Oc(i));else{let a=this.plugins[o];a.mustUpdate=e,s.push(a)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){Mt(this.state,r,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,s=r.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(Ox(r))i=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(s);i=p.from,o=p.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let d=[];l&4||([this.measureRequests,d]=[d,this.measureRequests]);let h=d.map(p=>{try{return p.read(this)}catch(g){return Mt(this.state,g),Np}}),u=ul.create(this,this.state,[]),f=!1;u.flags|=l,n?n.flags|=l:n=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),f=this.docView.update(u),f&&this.docViewUpdate());for(let p=0;p<d.length;p++)if(h[p]!=Np)try{let g=d[p];g.write&&g.write(h[p],this)}catch(g){Mt(this.state,g)}if(f&&this.docView.updateSelection(!0),!u.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let g=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-o;if(g>1||g<-1){s=s+g,r.scrollTop=s/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let a of this.state.facet(sh))a(n)}get themeClasses(){return dh+" "+(this.state.facet(ch)?pb:fb)+" "+this.state.facet(Pa)}updateAttrs(){let e=Pp(this,Kx,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Vn)?"true":"false",class:"cm-content",style:`${q.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),Pp(this,iu,n);let r=this.observer.ignore(()=>{let s=np(this.contentDOM,this.contentAttrs,n),i=np(this.dom,this.editorAttrs,e);return s||i});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let s of r.effects)if(s.is(_.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(li);let e=this.state.facet(_.cspNonce);hr.mount(this.root,this.styleModules.concat(D3).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.plugin!=e)&&this.pluginMap.set(e,n=this.plugins.find(r=>r.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return Tc(this,e,cp(this,e,n,r))}moveByGroup(e,n){return Tc(this,e,cp(this,e,n,r=>GC(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),i=r[n?r.length-1:0];return R.cursor(i.side(n,s)+e.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return KC(this,e,n,r)}moveVertically(e,n,r){return Tc(this,e,qC(this,e,n,r))}domAtPos(e,n=1){return this.docView.domAtPos(e,n)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){this.readMeasured();let r=ah(this,e,n);return r&&r.pos}posAndSideAtCoords(e,n=!0){return this.readMeasured(),ah(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(e),i=this.bidiSpans(s),o=i[Hn.find(i,e-s.from,-1,n)];return Ri(r,o.dir==Ee.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Hx)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>I3)return Lx(e.length);let n=this.textDirectionAt(e.from),r;for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||Ex(i.isolates,r=ip(this,e))))return i.order;r||(r=ip(this,e));let s=yC(e.text,n,r);return this.bidiCache.push(new gl(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||q.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Px(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return wa.of(new ms(typeof e=="number"?R.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return wa.of(new ms(R.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return He.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return He.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=hr.newName(),s=[Pa.of(r),li.of(hh(`.${r}`,e))];return n&&n.dark&&s.push(ch.of(!0)),s}static baseTheme(e){return Wr.lowest(li.of(hh("."+dh,e,mb)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&Ue.get(r)||Ue.get(e);return((n=s?.root)===null||n===void 0?void 0:n.view)||null}}_.styleModule=li;_.inputHandler=zx;_.clipboardInputFilter=ru;_.clipboardOutputFilter=su;_.scrollHandler=Wx;_.focusChangeEffect=Vx;_.perLineTextDirection=Hx;_.exceptionSink=Fx;_.updateListener=sh;_.editable=Vn;_.mouseSelectionStyle=Bx;_.dragMovesSelection=$x;_.clickAddsSelectionRange=Ix;_.decorations=$i;_.blockWrappers=Gx;_.outerDecorations=qx;_.atomicRanges=Fo;_.bidiIsolatedRanges=Yx;_.scrollMargins=Jx;_.darkTheme=ch;_.cspNonce=Y.define({combine:t=>t.length?t[0]:""});_.contentAttributes=iu;_.editorAttributes=Kx;_.lineWrapping=_.contentAttributes.of({class:"cm-lineWrapping"});_.announce=me.define();const I3=4096,Np={};class gl{constructor(e,n,r,s,i,o){this.from=e,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=o}static update(e,n){if(n.empty&&!e.some(i=>i.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:Ee.LTR;for(let i=Math.max(0,e.length-10);i<e.length;i++){let o=e[i];o.dir==s&&!n.touchesRange(o.from,o.to)&&r.push(new gl(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function Pp(t,e,n){for(let r=t.state.facet(e),s=r.length-1;s>=0;s--){let i=r[s],o=typeof i=="function"?i(t):i;o&&eu(o,n)}return n}const $3=q.mac?"mac":q.windows?"win":q.linux?"linux":"key";function B3(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,o,a;for(let l=0;l<n.length-1;++l){const d=n[l];if(/^(cmd|meta|m)$/i.test(d))a=!0;else if(/^a(lt)?$/i.test(d))s=!0;else if(/^(c|ctrl|control)$/i.test(d))i=!0;else if(/^s(hift)?$/i.test(d))o=!0;else if(/^mod$/i.test(d))e=="mac"?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+d)}return s&&(r="Alt-"+r),i&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function Oa(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n!==!1&&e.shiftKey&&(t="Shift-"+t),t}const F3=Wr.default(_.domEventHandlers({keydown(t,e){return xb(gb(e.state),t,e,"editor")}})),Jl=Y.define({enables:F3}),Op=new WeakMap;function gb(t){let e=t.facet(Jl),n=Op.get(e);return n||Op.set(e,n=H3(e.reduce((r,s)=>r.concat(s),[]))),n}function z3(t,e,n){return xb(gb(t.state),e,t,n)}let rr=null;const V3=4e3;function H3(t,e=$3){let n=Object.create(null),r=Object.create(null),s=(o,a)=>{let l=r[o];if(l==null)r[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},i=(o,a,l,d,h)=>{var u,f;let p=n[o]||(n[o]=Object.create(null)),g=a.split(/ (?!$)/).map(y=>B3(y,e));for(let y=1;y<g.length;y++){let w=g.slice(0,y).join(" ");s(w,!0),p[w]||(p[w]={preventDefault:!0,stopPropagation:!1,run:[C=>{let S=rr={view:C,prefix:w,scope:o};return setTimeout(()=>{rr==S&&(rr=null)},V3),!0}]})}let x=g.join(" ");s(x,!1);let b=p[x]||(p[x]={preventDefault:!1,stopPropagation:!1,run:((f=(u=p._any)===null||u===void 0?void 0:u.run)===null||f===void 0?void 0:f.slice())||[]});l&&b.run.push(l),d&&(b.preventDefault=!0),h&&(b.stopPropagation=!0)};for(let o of t){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let d of a){let h=n[d]||(n[d]=Object.create(null));h._any||(h._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:u}=o;for(let f in h)h[f].run.push(p=>u(p,uh))}let l=o[e]||o.key;if(l)for(let d of a)i(d,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&i(d,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return n}let uh=null;function xb(t,e,n,r){uh=e;let s=nC(e),i=Nt(s,0),o=Pn(i)==s.length&&s!=" ",a="",l=!1,d=!1,h=!1;rr&&rr.view==n&&rr.scope==r&&(a=rr.prefix+" ",ib.indexOf(e.keyCode)<0&&(d=!0,rr=null));let u=new Set,f=b=>{if(b){for(let y of b.run)if(!u.has(y)&&(u.add(y),y(n)))return b.stopPropagation&&(h=!0),!0;b.preventDefault&&(b.stopPropagation&&(h=!0),d=!0)}return!1},p=t[r],g,x;return p&&(f(p[a+Oa(s,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(q.windows&&e.ctrlKey&&e.altKey)&&!(q.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(g=ur[e.keyCode])&&g!=s?(f(p[a+Oa(g,e,!0)])||e.shiftKey&&(x=Ti[e.keyCode])!=s&&x!=g&&f(p[a+Oa(x,e,!1)]))&&(l=!0):o&&e.shiftKey&&f(p[a+Oa(s,e,!0)])&&(l=!0),!l&&f(p._any)&&(l=!0)),d&&(l=!0),l&&h&&e.stopPropagation(),uh=null,l}class zo{constructor(e,n,r,s,i){this.className=e,this.left=n,this.top=r,this.width=s,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let s=e.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let i=bb(e);return[new zo(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return _3(e,n,r)}}function bb(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Ee.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function Mp(t,e,n,r){let s=t.coordsAtPos(e,n*2);if(!s)return r;let i=t.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,a=t.posAtCoords({x:i.left+1,y:o}),l=t.posAtCoords({x:i.right-1,y:o});return a==null||l==null?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}function _3(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),s=Math.min(n.to,t.viewport.to),i=t.textDirection==Ee.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=bb(t),d=o.querySelector(".cm-line"),h=d&&window.getComputedStyle(d),u=a.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),f=a.right-(h?parseInt(h.paddingRight):0),p=oh(t,r,1),g=oh(t,s,-1),x=p.type==it.Text?p:null,b=g.type==it.Text?g:null;if(x&&(t.lineWrapping||p.widgetLineBreaks)&&(x=Mp(t,r,1,x)),b&&(t.lineWrapping||g.widgetLineBreaks)&&(b=Mp(t,s,-1,b)),x&&b&&x.from==b.from&&x.to==b.to)return w(C(n.from,n.to,x));{let k=x?C(n.from,null,x):S(p,!1),N=b?C(null,n.to,b):S(g,!0),v=[];return(x||p).to<(b||g).from-(x&&b?1:0)||p.widgetLineBreaks>1&&k.bottom+t.defaultLineHeight/2<N.top?v.push(y(u,k.bottom,f,N.top)):k.bottom<N.top&&t.elementAtHeight((k.bottom+N.top)/2).type==it.Text&&(k.bottom=N.top=(k.bottom+N.top)/2),w(k).concat(v).concat(w(N))}function y(k,N,v,P){return new zo(e,k-l.left,N-l.top,v-k,P-N)}function w({top:k,bottom:N,horizontal:v}){let P=[];for(let O=0;O<v.length;O+=2)P.push(y(v[O],k,v[O+1],N));return P}function C(k,N,v){let P=1e9,O=-1e9,E=[];function M(F,z,G,le,Z){let Q=t.coordsAtPos(F,F==v.to?-2:2),ce=t.coordsAtPos(G,G==v.from?2:-2);!Q||!ce||(P=Math.min(Q.top,ce.top,P),O=Math.max(Q.bottom,ce.bottom,O),Z==Ee.LTR?E.push(i&&z?u:Q.left,i&&le?f:ce.right):E.push(!i&&le?u:ce.left,!i&&z?f:Q.right))}let D=k??v.from,$=N??v.to;for(let F of t.visibleRanges)if(F.to>D&&F.from<$)for(let z=Math.max(F.from,D),G=Math.min(F.to,$);;){let le=t.state.doc.lineAt(z);for(let Z of t.bidiSpans(le)){let Q=Z.from+le.from,ce=Z.to+le.from;if(Q>=G)break;ce>z&&M(Math.max(Q,z),k==null&&Q<=D,Math.min(ce,G),N==null&&ce>=$,Z.dir)}if(z=le.to+1,z>=G)break}return E.length==0&&M(D,k==null,$,N==null,t.textDirection),{top:P,bottom:O,horizontal:E}}function S(k,N){let v=a.top+(N?k.top:k.bottom);return{top:v,bottom:v,horizontal:[]}}}function W3(t,e){return t.constructor==e.constructor&&t.eq(e)}class U3{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(Xa)!=e.state.facet(Xa)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(Xa);for(;n<r.length&&r[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:n}=this.view;(e!=this.scaleX||n!=this.scaleY)&&(this.scaleX=e,this.scaleY=n,this.dom.style.transform=`scale(${1/e}, ${1/n})`)}draw(e){if(e.length!=this.drawn.length||e.some((n,r)=>!W3(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let s of e)s.update&&n&&s.constructor&&this.drawn[r].constructor&&s.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(s.draw(),n);for(;n;){let s=n.nextSibling;n.remove(),n=s}this.drawn=e,q.safari&&q.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Xa=Y.define();function yb(t){return[He.define(e=>new U3(e,t)),Xa.of(t)]}const Bi=Y.define({combine(t){return Rn(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function K3(t={}){return[Bi.of(t),G3,q3,Y3,_x.of(!0)]}function vb(t){return t.startState.facet(Bi)!=t.state.facet(Bi)}const G3=yb({above:!0,markers(t){let{state:e}=t,n=e.facet(Bi),r=[];for(let s of e.selection.ranges){let i=s==e.selection.main;if(s.empty||n.drawRangeCursor){let o=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=s.empty?s:R.cursor(s.head,s.head>s.anchor?-1:1);for(let l of zo.forRange(t,o,a))r.push(l)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=vb(t);return n&&Ap(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){Ap(e.state,t)},class:"cm-cursorLayer"});function Ap(t,e){e.style.animationDuration=t.facet(Bi).cursorBlinkRate+"ms"}const q3=yb({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:zo.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||vb(t)},class:"cm-selectionLayer"}),Y3=Wr.highest(_.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),wb=me.define({map(t,e){return t==null?null:e.mapPos(t)}}),hi=ot.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(wb)?r.value:n,t)}}),J3=He.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(hi);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(hi)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(hi),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(hi)!=t&&this.view.dispatch({effects:wb.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Q3(){return[hi,J3]}function Dp(t,e,n,r,s){e.lastIndex=0;for(let i=t.iterRange(n,r),o=n,a;!i.next().done;o+=i.value.length)if(!i.lineBreak)for(;a=e.exec(i.value);)s(o+a.index,a)}function X3(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:s,to:i}of n)s=Math.max(t.state.doc.lineAt(s).from,s-e),i=Math.min(t.state.doc.lineAt(i).to,i+e),r.length&&r[r.length-1].to>=s?r[r.length-1].to=i:r.push({from:s,to:i});return r}class Z3{constructor(e){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:o=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,s)this.addMatch=(a,l,d,h)=>s(h,d,d+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,d,h)=>{let u=r(a,l,d);u&&h(d,d+a[0].length,u)};else if(r)this.addMatch=(a,l,d,h)=>h(d,d+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=o}createDeco(e){let n=new _n,r=n.add.bind(n);for(let{from:s,to:i}of X3(e,this.maxLength))Dp(e.state.doc,this.regexp,s,i,(o,a)=>this.addMatch(a,e,o,r));return n.finish()}updateDeco(e,n){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,o,a,l)=>{l>=e.view.viewport.from&&a<=e.view.viewport.to&&(r=Math.min(a,r),s=Math.max(l,s))}),e.viewportMoved||s-r>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,n.map(e.changes),r,s):n}updateRange(e,n,r,s){for(let i of e.visibleRanges){let o=Math.max(i.from,r),a=Math.min(i.to,s);if(a>=o){let l=e.state.doc.lineAt(o),d=l.to<a?e.state.doc.lineAt(a):l,h=Math.max(i.from,l.from),u=Math.min(i.to,d.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){h=o;break}for(;a<d.to;a++)if(this.boundary.test(d.text[a-d.from])){u=a;break}}let f=[],p,g=(x,b,y)=>f.push(y.range(x,b));if(l==d)for(this.regexp.lastIndex=h-l.from;(p=this.regexp.exec(l.text))&&p.index<u-l.from;)this.addMatch(p,e,p.index+l.from,g);else Dp(e.state.doc,this.regexp,h,u,(x,b)=>this.addMatch(b,e,x,g));n=n.update({filterFrom:h,filterTo:u,filter:(x,b)=>x<h||b>u,add:f})}}return n}}const fh=/x/.unicode!=null?"gu":"g",e4=new RegExp(`[\0-\b
|
|
241
|
+
--\u2028\u2029\uFEFF-]`,fh),t4={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Rc=null;function n4(){var t;if(Rc==null&&typeof document<"u"&&document.body){let e=document.body.style;Rc=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Rc||!1}const Za=Y.define({combine(t){let e=Rn(t,{render:null,specialChars:e4,addSpecialChars:null});return(e.replaceTabs=!n4())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,fh)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,fh)),e}});function r4(t={}){return[Za.of(t),s4()]}let Tp=null;function s4(){return Tp||(Tp=He.fromClass(class{constructor(t){this.view=t,this.decorations=ie.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Za)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new Z3({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:s}=n.state,i=Nt(e[0],0);if(i==9){let o=s.lineAt(r),a=n.state.tabSize,l=Ds(o.text,a,r-o.from);return ie.replace({widget:new l4((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=ie.replace({widget:new a4(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Za);t.startState.facet(Za)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const i4="•";function o4(t){return t>=32?i4:t==10?"":String.fromCharCode(9216+t)}class a4 extends In{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=o4(this.code),r=e.state.phrase("Control character")+" "+(t4[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,r,n);if(s)return s;let i=document.createElement("span");return i.textContent=n,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class l4 extends In{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function c4(){return h4}const d4=ie.line({class:"cm-activeLine"}),h4=He.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let s=t.lineBlockAt(r.head);s.from>e&&(n.push(d4.range(s.from)),e=s.from)}return ie.set(n)}},{decorations:t=>t.decorations});class u4 extends In{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?gi(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),s=Ri(n[0],r.direction!="rtl"),i=parseInt(r.lineHeight);return s.bottom-s.top>i*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+i}:s}ignoreEvent(){return!1}}function f4(t){let e=He.fromClass(class{constructor(n){this.view=n,this.placeholder=t?ie.set([ie.widget({widget:new u4(t),side:1}).range(0)]):ie.none}get decorations(){return this.view.state.doc.length?ie.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,_.contentAttributes.of({"aria-placeholder":t})]:e}const ph=2e3;function p4(t,e,n){let r=Math.min(e.line,n.line),s=Math.max(e.line,n.line),i=[];if(e.off>ph||n.off>ph||e.col<0||n.col<0){let o=Math.min(e.off,n.off),a=Math.max(e.off,n.off);for(let l=r;l<=s;l++){let d=t.doc.line(l);d.length<=a&&i.push(R.range(d.from+o,d.to+a))}}else{let o=Math.min(e.col,n.col),a=Math.max(e.col,n.col);for(let l=r;l<=s;l++){let d=t.doc.line(l),h=Gd(d.text,o,t.tabSize,!0);if(h<0)i.push(R.cursor(d.to));else{let u=Gd(d.text,a,t.tabSize);i.push(R.range(d.from+h,d.from+u))}}}return i}function m4(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function Ep(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),s=n-r.from,i=s>ph?-1:s==r.length?m4(t,e.clientX):Ds(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function g4(t,e){let n=Ep(t,e),r=t.state.selection;return n?{update(s){if(s.docChanged){let i=s.changes.mapPos(s.startState.doc.line(n.line).from),o=s.state.doc.lineAt(i);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},r=r.map(s.changes)}},get(s,i,o){let a=Ep(t,s);if(!a)return r;let l=p4(t.state,n,a);return l.length?o?R.create(l.concat(r.ranges)):R.create(l):r}}:null}function x4(t){let e=n=>n.altKey&&n.button==0;return _.mouseSelectionStyle.of((n,r)=>e(r)?g4(n,r):null)}const b4={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},y4={style:"cursor: crosshair"};function v4(t={}){let[e,n]=b4[t.key||"Alt"],r=He.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||n(s))},keyup(s){(s.keyCode==e||!n(s))&&this.set(!1)},mousemove(s){this.set(n(s))}}});return[r,_.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?y4:null})]}const Ma="-10000px";class kb{constructor(e,n,r,s){this.facet=n,this.createTooltipView=r,this.removeTooltipView=s,this.input=e.state.facet(n),this.tooltips=this.input.filter(o=>o);let i=null;this.tooltipViews=this.tooltips.map(o=>i=r(o,i))}update(e,n){var r;let s=e.state.facet(this.facet),i=s.filter(l=>l);if(s===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],a=n?[]:null;for(let l=0;l<i.length;l++){let d=i[l],h=-1;if(d){for(let u=0;u<this.tooltips.length;u++){let f=this.tooltips[u];f&&f.create==d.create&&(h=u)}if(h<0)o[l]=this.createTooltipView(d,l?o[l-1]:null),a&&(a[l]=!!d.above);else{let u=o[l]=this.tooltipViews[h];a&&(a[l]=n[h]),u.update&&u.update(e)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(r=l.destroy)===null||r===void 0||r.call(l));return n&&(a.forEach((l,d)=>n[d]=l),n.length=a.length),this.input=s,this.tooltips=i,this.tooltipViews=o,!0}}function w4(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Ic=Y.define({combine:t=>{var e,n,r;return{position:q.ios?"absolute":((e=t.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(s=>s.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(s=>s.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||w4}}}),Lp=new WeakMap,du=He.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Ic);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new kb(t,hu,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(Ic);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",n.dom.appendChild(s)}return n.dom.style.position=this.position,n.dom.style.top=Ma,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(q.safari){let o=i.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(t=i.width/this.parent.offsetWidth,e=i.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=ou(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(Ic).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=t,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],d=this.manager.tooltipViews[a],{dom:h}=d,u=t.pos[a],f=t.size[a];if(!u||l.clip!==!1&&(u.bottom<=Math.max(n.top,r.top)||u.top>=Math.min(n.bottom,r.bottom)||u.right<Math.max(n.left,r.left)-.1||u.left>Math.min(n.right,r.right)+.1)){h.style.top=Ma;continue}let p=l.arrow?d.dom.querySelector(".cm-tooltip-arrow"):null,g=p?7:0,x=f.right-f.left,b=(e=Lp.get(d))!==null&&e!==void 0?e:f.bottom-f.top,y=d.offset||S4,w=this.view.textDirection==Ee.LTR,C=f.width>r.right-r.left?w?r.left:r.right-f.width:w?Math.max(r.left,Math.min(u.left-(p?14:0)+y.x,r.right-x)):Math.min(Math.max(r.left,u.left-x+(p?14:0)-y.x),r.right-x),S=this.above[a];!l.strictSide&&(S?u.top-b-g-y.y<r.top:u.bottom+b+g+y.y>r.bottom)&&S==r.bottom-u.bottom>u.top-r.top&&(S=this.above[a]=!S);let k=(S?u.top-r.top:r.bottom-u.bottom)-g;if(k<b&&d.resize!==!1){if(k<this.view.defaultLineHeight){h.style.top=Ma;continue}Lp.set(d,b),h.style.height=(b=k)/i+"px"}else h.style.height&&(h.style.height="");let N=S?u.top-b-g-y.y:u.bottom+g+y.y,v=C+x;if(d.overlap!==!0)for(let P of o)P.left<v&&P.right>C&&P.top<N+b&&P.bottom>N&&(N=S?P.top-b-2-g:P.bottom+g+2);if(this.position=="absolute"?(h.style.top=(N-t.parent.top)/i+"px",Rp(h,(C-t.parent.left)/s)):(h.style.top=N/i+"px",Rp(h,C/s)),p){let P=u.left+(w?y.x:-y.x)-(C+14-7);p.style.left=P/s+"px"}d.overlap!==!0&&o.push({left:C,top:N,right:v,bottom:N+b}),h.classList.toggle("cm-tooltip-above",S),h.classList.toggle("cm-tooltip-below",!S),d.positioned&&d.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Ma}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Rp(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const k4=_.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),S4={x:0,y:0},hu=Y.define({enables:[du,k4]}),xl=Y.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Ql{static create(e){return new Ql(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new kb(e,xl,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let s=r[e];if(s!==void 0){if(n===void 0)n=s;else if(n!==s)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const C4=hu.compute([xl],t=>{let e=t.facet(xl);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:Ql.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class j4{constructor(e,n,r,s,i){this.view=e,this.source=n,this.field=r,this.setHover=s,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:n}=this,r=e.docView.tile.nearest(n.target);if(!r)return;let s,i=1;if(r.isWidget())s=r.posAtStart;else{if(s=e.posAtCoords(n),s==null)return;let a=e.coordsAtPos(s);if(!a||n.y<a.top||n.y>a.bottom||n.x<a.left-e.defaultCharacterWidth||n.x>a.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(s)).find(h=>h.from<=s&&h.to>=s),d=l&&l.dir==Ee.RTL?-1:1;i=n.x<a.left?-d:d}let o=this.source(e,s,i);if(o?.then){let a=this.pending={pos:s};o.then(l=>{this.pending==a&&(this.pending=null,l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])}))},l=>Mt(e.state,l,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(du),n=e?e.manager.tooltips.findIndex(r=>r.create==Ql.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:i}=this;if(s.length&&i&&!N4(i.dom,e)||this.pending){let{pos:o}=s[0]||this.pending,a=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!P4(this.view,o,a,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Aa=4;function N4(t,e){let{left:n,right:r,top:s,bottom:i}=t.getBoundingClientRect(),o;if(o=t.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();s=Math.min(a.top,s),i=Math.max(a.bottom,i)}return e.clientX>=n-Aa&&e.clientX<=r+Aa&&e.clientY>=s-Aa&&e.clientY<=i+Aa}function P4(t,e,n,r,s,i){let o=t.scrollDOM.getBoundingClientRect(),a=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>r||o.right<r||o.top>s||Math.min(o.bottom,a)<s)return!1;let l=t.posAtCoords({x:r,y:s},!1);return l>=e&&l<=n}function O4(t,e={}){let n=me.define(),r=ot.define({create(){return[]},update(s,i){if(s.length&&(e.hideOnChange&&(i.docChanged||i.selection)?s=[]:e.hideOn&&(s=s.filter(o=>!e.hideOn(i,o))),i.docChanged)){let o=[];for(let a of s){let l=i.changes.mapPos(a.pos,-1,vt.TrackDel);if(l!=null){let d=Object.assign(Object.create(null),a);d.pos=l,d.end!=null&&(d.end=i.changes.mapPos(d.end)),o.push(d)}}s=o}for(let o of i.effects)o.is(n)&&(s=o.value),o.is(M4)&&(s=[]);return s},provide:s=>xl.from(s)});return{active:r,extension:[r,He.define(s=>new j4(s,t,r,n,e.hoverTime||300)),C4]}}function Sb(t,e){let n=t.plugin(du);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const M4=me.define(),Ip=Y.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function Fi(t,e){let n=t.plugin(Cb),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const Cb=He.fromClass(class{constructor(t){this.input=t.state.facet(zi),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(Ip);this.top=new Da(t,!0,e.topContainer),this.bottom=new Da(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(Ip);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Da(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Da(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(zi);if(n!=this.input){let r=n.filter(l=>l),s=[],i=[],o=[],a=[];for(let l of r){let d=this.specs.indexOf(l),h;d<0?(h=l(t.view),a.push(h)):(h=this.panels[d],h.update&&h.update(t)),s.push(h),(h.top?i:o).push(h)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>_.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Da{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=$p(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=$p(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function $p(t){let e=t.nextSibling;return t.remove(),e}const zi=Y.define({enables:Cb});class Un extends dr{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Un.prototype.elementClass="";Un.prototype.toDOM=void 0;Un.prototype.mapMode=vt.TrackBefore;Un.prototype.startSide=Un.prototype.endSide=-1;Un.prototype.point=!0;const el=Y.define(),A4=Y.define(),D4={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>ye.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},yi=Y.define();function T4(t){return[jb(),yi.of({...D4,...t})]}const Bp=Y.define({combine:t=>t.some(e=>e)});function jb(t){return[E4]}const E4=He.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(yi).map(e=>new zp(t,e)),this.fixed=!t.state.facet(Bp);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Bp)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=ye.iter(this.view.state.facet(el),this.view.viewport.from),r=[],s=this.gutters.map(i=>new L4(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let o=!0;for(let a of i.type)if(a.type==it.Text&&o){mh(n,r,a.from);for(let l of s)l.line(this.view,a,r);o=!1}else if(a.widget)for(let l of s)l.widget(this.view,a)}else if(i.type==it.Text){mh(n,r,i.from);for(let o of s)o.line(this.view,i,r)}else if(i.widget)for(let o of s)o.widget(this.view,i);for(let i of s)i.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(yi),n=t.state.facet(yi),r=t.docChanged||t.heightChanged||t.viewportChanged||!ye.eq(t.startState.facet(el),t.state.facet(el),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let s of this.gutters)s.update(t)&&(r=!0);else{r=!0;let s=[];for(let i of n){let o=e.indexOf(i);o<0?s.push(new zp(this.view,i)):(this.gutters[o].update(t),s.push(this.gutters[o]))}for(let i of this.gutters)i.dom.remove(),s.indexOf(i)<0&&i.destroy();for(let i of s)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=s}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>_.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,s=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Ee.LTR?{left:r,right:s}:{right:r,left:s}})});function Fp(t){return Array.isArray(t)?t:[t]}function mh(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class L4{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=ye.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:s}=this,i=(n.top-this.height)/e.scaleY,o=n.height/e.scaleY;if(this.i==s.elements.length){let a=new Nb(e,o,i,r);s.elements.push(a),s.dom.appendChild(a.dom)}else s.elements[this.i].update(e,o,i,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];mh(this.cursor,s,n.from),r.length&&(s=s.concat(r));let i=this.gutter.config.lineMarker(e,n,s);i&&s.unshift(i);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,n,s)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),s=r?[r]:null;for(let i of e.state.facet(A4)){let o=i(e,n.widget,n);o&&(s||(s=[])).push(o)}s&&this.addElement(e,n,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class zp{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,s=>{let i=s.target,o;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let l=i.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=s.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);n.domEventHandlers[r](e,a,s)&&s.preventDefault()});this.markers=Fp(n.markers(e)),n.initialSpacer&&(this.spacer=new Nb(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=Fp(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let r=e.view.viewport;return!ye.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class Nb{constructor(e,n,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,s)}update(e,n,r,s){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),R4(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let i=0,o=0;;){let a=o,l=i<n.length?n[i++]:null,d=!1;if(l){let h=l.elementClass;h&&(r+=" "+h);for(let u=o;u<this.markers.length;u++)if(this.markers[u].compare(l)){a=u,d=!0;break}}else a=this.markers.length;for(;o<a;){let h=this.markers[o++];if(h.toDOM){h.destroy(s);let u=s.nextSibling;s.remove(),s=u}}if(!l)break;l.toDOM&&(d?s=s.nextSibling:this.dom.insertBefore(l.toDOM(e),s)),d&&o++}this.dom.className=r,this.markers=n}destroy(){this.setMarkers(null,[])}}function R4(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].compare(e[n]))return!1;return!0}const I4=Y.define(),$4=Y.define(),os=Y.define({combine(t){return Rn(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,n){let r=Object.assign({},e);for(let s in n){let i=r[s],o=n[s];r[s]=i?(a,l,d)=>i(a,l,d)||o(a,l,d):o}return r}})}});class $c extends Un{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Bc(t,e){return t.state.facet(os).formatNumber(e,t.state)}const B4=yi.compute([os],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(I4)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new $c(Bc(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet($4)){let i=s(e,n,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(os)!=e.state.facet(os),initialSpacer(e){return new $c(Bc(e,Vp(e.state.doc.lines)))},updateSpacer(e,n){let r=Bc(n.view,Vp(n.view.state.doc.lines));return r==e.number?e:new $c(r)},domEventHandlers:t.facet(os).domEventHandlers,side:"before"}));function F4(t={}){return[os.of(t),jb(),B4]}function Vp(t){let e=9;for(;e<t;)e=e*10+9;return e}const z4=new class extends Un{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},V4=el.compute(["selection"],t=>{let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.head).from;s>n&&(n=s,e.push(z4.range(s)))}return ye.of(e)});function H4(){return V4}var Fc;const as=new xe;function _4(t){return Y.define({combine:t?e=>e.concat(t):void 0})}const W4=new xe;class ln{constructor(e,n,r=[],s=""){this.data=e,this.name=s,ke.prototype.hasOwnProperty("tree")||Object.defineProperty(ke.prototype,"tree",{get(){return ut(this)}}),this.parser=n,this.extension=[pr.of(this),ke.languageData.of((i,o,a)=>{let l=Hp(i,o,a),d=l.type.prop(as);if(!d)return[];let h=i.facet(d),u=l.type.prop(W4);if(u){let f=l.resolve(o-l.from,a);for(let p of u)if(p.test(f,i)){let g=i.facet(p.facet);return p.type=="replace"?g:g.concat(h)}}return h})].concat(r)}isActiveAt(e,n,r=-1){return Hp(e,n,r).type.prop(as)==this.data}findRegions(e){let n=e.facet(pr);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,o)=>{if(i.prop(as)==this.data){r.push({from:o,to:o+i.length});return}let a=i.prop(xe.mounted);if(a){if(a.tree.prop(as)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+o,to:l.to+o});else r.push({from:o,to:o+i.length});return}else if(a.overlay){let l=r.length;if(s(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;l<i.children.length;l++){let d=i.children[l];d instanceof Ve&&s(d,i.positions[l]+o)}};return s(ut(e),0),r}get allowsNesting(){return!0}}ln.setState=me.define();function Hp(t,e,n){let r=t.facet(pr),s=ut(t).topNode;if(!r||r.allowsNesting)for(let i=s;i;i=i.enter(e,n,Fe.ExcludeBuffers|Fe.EnterBracketed))i.type.isTop&&(s=i);return s}class bl extends ln{constructor(e,n,r){super(e,n,[],r),this.parser=n}static define(e){let n=_4(e.languageData);return new bl(n,e.parser.configure({props:[as.add(r=>r.isTop?n:void 0)]}),e.name)}configure(e,n){return new bl(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function ut(t){let e=t.field(ln.state,!1);return e?e.tree:Ve.empty}class U4{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e<r||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let ti=null;class yl{constructor(e,n,r=[],s,i,o,a,l){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new yl(e,n,[],Ve.empty,0,r,[],null)}startParse(){return this.parser.startParse(new U4(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Ve.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped($r.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=s,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped($r.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=ti;ti=this;try{return e()}finally{ti=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=_p(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:i,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((d,h,u,f)=>l.push({fromA:d,toA:h,fromB:u,toB:f})),r=$r.applyChanges(r,l),s=Ve.empty,i=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let d of this.skipped){let h=e.mapPos(d.from,1),u=e.mapPos(d.to,-1);h<u&&a.push({from:h,to:u})}}}return new yl(this.parser,n,r,s,i,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let n=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:s,to:i}=this.skipped[r];s<e.to&&i>e.from&&(this.fragments=_p(this.fragments,s,i),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends tx{createParse(n,r,s){let i=s[0].from,o=s[s.length-1].to;return{parsedPos:i,advance(){let l=ti;if(l){for(let d of s)l.tempSkipped.push(d);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new Ve(Dt.none,[],[],o-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return ti}}function _p(t,e,n){return $r.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class js{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new js(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=yl.create(e.facet(pr).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new js(r)}}ln.state=ot.define({create:js.init,update(t,e){for(let n of e.effects)if(n.is(ln.setState))return n.value;return e.startState.facet(pr)!=e.state.facet(pr)?js.init(e.state):t.apply(e)}});let Pb=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Pb=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const zc=typeof navigator<"u"&&(!((Fc=navigator.scheduling)===null||Fc===void 0)&&Fc.isInputPending)?()=>navigator.scheduling.isInputPending():null,K4=He.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(ln.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(ln.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=Pb(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:s}}=this.view,i=r.field(ln.state);if(i.tree==i.context.tree&&i.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!zc?Math.max(25,e.timeRemaining()-5):1e9),a=i.context.treeLen<s&&r.doc.length>s+1e3,l=i.context.work(()=>zc&&zc()||Date.now()>o,s+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:ln.setState.of(new js(i.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Mt(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),pr=Y.define({combine(t){return t.length?t[0]:null},enables:t=>[ln.state,K4,_.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class G4{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const q4=Y.define(),Xl=Y.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function vl(t){let e=t.facet(Xl);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Vi(t,e){let n="",r=t.tabSize,s=t.facet(Xl)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let i=0;i<e;i++)n+=s;return n}function uu(t,e){t instanceof ke&&(t=new Zl(t));for(let r of t.state.facet(q4)){let s=r(t,e);if(s!==void 0)return s}let n=ut(t.state);return n.length>=e?Y4(t,n,e):null}class Zl{constructor(e,n={}){this.state=e,this.options=n,this.unit=vl(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==e?{text:"",from:e}:(n<0?s<e:s<=e)?{text:r.text.slice(s-r.from),from:s}:{text:r.text.slice(0,s-r.from),from:r.from}:r}textAfterPos(e,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:s}=this.lineAt(e,n);return r.slice(e-s,Math.min(r.length,e+100-s))}column(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.countColumn(r,e-s),o=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return o>-1&&(i+=o-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return Ds(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.options.overrideIndentation;if(i){let o=i(s);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Ob=new xe;function Y4(t,e,n){let r=e.resolveStack(n),s=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let o=s;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)i.push(o);for(let o=i.length-1;o>=0;o--)r={node:i[o],next:r}}return Mb(r,t,n)}function Mb(t,e,n){for(let r=t;r;r=r.next){let s=Q4(r.node);if(s)return s(fu.create(e,n,r))}return 0}function J4(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function Q4(t){let e=t.type.prop(Ob);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(xe.closedBy))){let s=t.lastChild,i=s&&r.indexOf(s.name)>-1;return o=>t5(o,!0,1,void 0,i&&!J4(o)?s.from:void 0)}return t.parent==null?X4:null}function X4(){return 0}class fu extends Zl{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new fu(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(Z4(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return Mb(this.context.next,this.base,this.pos)}}function Z4(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function e5(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let s=t.options.simulateBreak,i=t.state.doc.lineAt(n.from),o=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let a=n.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let d=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+d}}a=l.to}}function t5(t,e,n,r,s){let i=t.textAfter,o=i.match(/^\s*/)[0].length,a=r&&i.slice(o,o+r.length)==r||s==t.pos+o,l=e5(t);return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*n)}function Wp({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const n5=200;function r5(){return ke.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,s=n.lineAt(r);if(r>s.from+n5)return t;let i=n.sliceString(s.from,r);if(!e.some(d=>d.test(i)))return t;let{state:o}=t,a=-1,l=[];for(let{head:d}of o.selection.ranges){let h=o.doc.lineAt(d);if(h.from==a)continue;a=h.from;let u=uu(o,h.from);if(u==null)continue;let f=/^\s*/.exec(h.text)[0],p=Vi(o,u);f!=p&&l.push({from:h.from,to:h.from+f.length,insert:p})}return l.length?[t,{changes:l,sequential:!0}]:t})}const s5=Y.define(),Ab=new xe;function i5(t){let e=t.firstChild,n=t.lastChild;return e&&e.to<n.from?{from:e.to,to:n.type.isError?t.to:n.from}:null}function o5(t,e,n){let r=ut(t);if(r.length<n)return null;let s=r.resolveStack(n,1),i=null;for(let o=s;o;o=o.next){let a=o.node;if(a.to<=n||a.from>n)continue;if(i&&a.from<e)break;let l=a.type.prop(Ab);if(l&&(a.to<r.length-50||r.length==t.doc.length||!a5(a))){let d=l(a,t);d&&d.from<=n&&d.from>=e&&d.to>n&&(i=d)}}return i}function a5(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function wl(t,e,n){for(let r of t.facet(s5)){let s=r(t,e,n);if(s)return s}return o5(t,e,n)}function Db(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const ec=me.define({map:Db}),Vo=me.define({map:Db});function Tb(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const Vr=ot.define({create(){return ie.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=Up(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(ec)&&!l5(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(Rb),s=r?ie.replace({widget:new m5(r(e.state,n.value))}):Kp;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(Vo)&&(t=t.update({filter:(r,s)=>n.value.from!=r||n.value.to!=s,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=Up(t,e.selection.main.head)),t},provide:t=>_.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,s)=>{n.push(r,s)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n<t.length;){let r=t[n++],s=t[n++];if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid JSON for fold state");e.push(Kp.range(r,s))}return ie.set(e,!0)}});function Up(t,e,n=e){let r=!1;return t.between(e,n,(s,i)=>{s<n&&i>e&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(s,i)=>s>=n||i<=e}):t}function kl(t,e,n){var r;let s=null;return(r=t.field(Vr,!1))===null||r===void 0||r.between(e,n,(i,o)=>{(!s||s.from>i)&&(s={from:i,to:o})}),s}function l5(t,e,n){let r=!1;return t.between(e,e,(s,i)=>{s==e&&i==n&&(r=!0)}),r}function Eb(t,e){return t.field(Vr,!1)?e:e.concat(me.appendConfig.of(Ib()))}const c5=t=>{for(let e of Tb(t)){let n=wl(t.state,e.from,e.to);if(n)return t.dispatch({effects:Eb(t.state,[ec.of(n),Lb(t,n)])}),!0}return!1},d5=t=>{if(!t.state.field(Vr,!1))return!1;let e=[];for(let n of Tb(t)){let r=kl(t.state,n.from,n.to);r&&e.push(Vo.of(r),Lb(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function Lb(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return _.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const h5=t=>{let{state:e}=t,n=[];for(let r=0;r<e.doc.length;){let s=t.lineBlockAt(r),i=wl(e,s.from,s.to);i&&n.push(ec.of(i)),r=(i?t.lineBlockAt(i.to):s).to+1}return n.length&&t.dispatch({effects:Eb(t.state,n)}),!!n.length},u5=t=>{let e=t.state.field(Vr,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,s)=>{n.push(Vo.of({from:r,to:s}))}),t.dispatch({effects:n}),!0},f5=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:c5},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:d5},{key:"Ctrl-Alt-[",run:h5},{key:"Ctrl-Alt-]",run:u5}],p5={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Rb=Y.define({combine(t){return Rn(t,p5)}});function Ib(t){return[Vr,b5]}function $b(t,e){let{state:n}=t,r=n.facet(Rb),s=o=>{let a=t.lineBlockAt(t.posAtDOM(o.target)),l=kl(t.state,a.from,a.to);l&&t.dispatch({effects:Vo.of(l)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,s,e);let i=document.createElement("span");return i.textContent=r.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=s,i}const Kp=ie.replace({widget:new class extends In{toDOM(t){return $b(t,null)}}});class m5 extends In{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return $b(e,this.value)}}const g5={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Vc extends Un{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function x5(t={}){let e={...g5,...t},n=new Vc(e,!0),r=new Vc(e,!1),s=He.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(pr)!=o.state.facet(pr)||o.startState.field(Vr,!1)!=o.state.field(Vr,!1)||ut(o.startState)!=ut(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new _n;for(let l of o.viewportLineBlocks){let d=kl(o.state,l.from,l.to)?r:wl(o.state,l.from,l.to)?n:null;d&&a.add(l.from,l.from,d)}return a.finish()}}),{domEventHandlers:i}=e;return[s,T4({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(s))===null||a===void 0?void 0:a.markers)||ye.empty},initialSpacer(){return new Vc(e,!1)},domEventHandlers:{...i,click:(o,a,l)=>{if(i.click&&i.click(o,a,l))return!0;let d=kl(o.state,a.from,a.to);if(d)return o.dispatch({effects:Vo.of(d)}),!0;let h=wl(o.state,a.from,a.to);return h?(o.dispatch({effects:ec.of(h)}),!0):!1}}}),Ib()]}const b5=_.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Ts{constructor(e,n){this.specs=e;let r;function s(a){let l=hr.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,o=n.scope;this.scope=o instanceof ln?a=>a.prop(as)==o.data:o?a=>a==o:void 0,this.style=sx(e.map(a=>({tag:a.tag,class:a.class||s(Object.assign({},a,{tag:null}))})),{all:i}).style,this.module=r?new hr(r):null,this.themeType=n.themeType}static define(e,n){return new Ts(e,n||{})}}const gh=Y.define(),Bb=Y.define({combine(t){return t.length?[t[0]]:null}});function Hc(t){let e=t.facet(gh);return e.length?e:t.facet(Bb)}function pu(t,e){let n=[v5],r;return t instanceof Ts&&(t.module&&n.push(_.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(Bb.of(t)):r?n.push(gh.computeN([_.darkTheme],s=>s.facet(_.darkTheme)==(r=="dark")?[t]:[])):n.push(gh.of(t)),n}class y5{constructor(e){this.markCache=Object.create(null),this.tree=ut(e.state),this.decorations=this.buildDeco(e,Hc(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=ut(e.state),r=Hc(e.state),s=r!=Hc(e.startState),{viewport:i}=e.view,o=e.changes.mapPos(this.decoratedTo,1);n.length<i.to&&!s&&n.type==this.tree.type&&o>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(n!=this.tree||e.viewportChanged||s)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return ie.none;let r=new _n;for(let{from:s,to:i}of e.visibleRanges)MS(this.tree,n,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=ie.mark({class:l})))},s,i);return r.finish()}}const v5=Wr.high(He.fromClass(y5,{decorations:t=>t.decorations})),w5=Ts.define([{tag:L.meta,color:"#404740"},{tag:L.link,textDecoration:"underline"},{tag:L.heading,textDecoration:"underline",fontWeight:"bold"},{tag:L.emphasis,fontStyle:"italic"},{tag:L.strong,fontWeight:"bold"},{tag:L.strikethrough,textDecoration:"line-through"},{tag:L.keyword,color:"#708"},{tag:[L.atom,L.bool,L.url,L.contentSeparator,L.labelName],color:"#219"},{tag:[L.literal,L.inserted],color:"#164"},{tag:[L.string,L.deleted],color:"#a11"},{tag:[L.regexp,L.escape,L.special(L.string)],color:"#e40"},{tag:L.definition(L.variableName),color:"#00f"},{tag:L.local(L.variableName),color:"#30a"},{tag:[L.typeName,L.namespace],color:"#085"},{tag:L.className,color:"#167"},{tag:[L.special(L.variableName),L.macroName],color:"#256"},{tag:L.definition(L.propertyName),color:"#00c"},{tag:L.comment,color:"#940"},{tag:L.invalid,color:"#f00"}]),k5=_.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Fb=1e4,zb="()[]{}",Vb=Y.define({combine(t){return Rn(t,{afterCursor:!0,brackets:zb,maxScanDistance:Fb,renderMatch:j5})}}),S5=ie.mark({class:"cm-matchingBracket"}),C5=ie.mark({class:"cm-nonmatchingBracket"});function j5(t){let e=[],n=t.matched?S5:C5;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const N5=ot.define({create(){return ie.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(Vb);for(let s of e.state.selection.ranges){if(!s.empty)continue;let i=Mn(e.state,s.head,-1,r)||s.head>0&&Mn(e.state,s.head-1,1,r)||r.afterCursor&&(Mn(e.state,s.head,1,r)||s.head<e.state.doc.length&&Mn(e.state,s.head+1,-1,r));i&&(n=n.concat(r.renderMatch(i,e.state)))}return ie.set(n,!0)},provide:t=>_.decorations.from(t)}),P5=[N5,k5];function O5(t={}){return[Vb.of(t),P5]}const M5=new xe;function xh(t,e,n){let r=t.prop(e<0?xe.openedBy:xe.closedBy);if(r)return r;if(t.name.length==1){let s=n.indexOf(t.name);if(s>-1&&s%2==(e<0?1:0))return[n[s+e]]}return null}function bh(t){let e=t.type.prop(M5);return e?e(t.node):t}function Mn(t,e,n,r={}){let s=r.maxScanDistance||Fb,i=r.brackets||zb,o=ut(t),a=o.resolveInner(e,n);for(let l=a;l;l=l.parent){let d=xh(l.type,n,i);if(d&&l.from<l.to){let h=bh(l);if(h&&(n>0?e>=h.from&&e<h.to:e>h.from&&e<=h.to))return A5(t,e,n,l,h,d,i)}}return D5(t,e,n,o,a.type,s,i)}function A5(t,e,n,r,s,i,o){let a=r.parent,l={from:s.from,to:s.to},d=0,h=a?.cursor();if(h&&(n<0?h.childBefore(r.from):h.childAfter(r.to)))do if(n<0?h.to<=r.from:h.from>=r.to){if(d==0&&i.indexOf(h.type.name)>-1&&h.from<h.to){let u=bh(h);return{start:l,end:u?{from:u.from,to:u.to}:void 0,matched:!0}}else if(xh(h.type,n,o))d++;else if(xh(h.type,-n,o)){if(d==0){let u=bh(h);return{start:l,end:u&&u.from<u.to?{from:u.from,to:u.to}:void 0,matched:!1}}d--}}while(n<0?h.prevSibling():h.nextSibling());return{start:l,matched:!1}}function D5(t,e,n,r,s,i,o){let a=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=n>0)return null;let d={from:n<0?e-1:e,to:n>0?e+1:e},h=t.doc.iterRange(e,n>0?t.doc.length:0),u=0;for(let f=0;!h.next().done&&f<=i;){let p=h.value;n<0&&(f+=p.length);let g=e+f*n;for(let x=n>0?0:p.length-1,b=n>0?p.length:-1;x!=b;x+=n){let y=o.indexOf(p[x]);if(!(y<0||r.resolveInner(g+x,1).type!=s))if(y%2==0==n>0)u++;else{if(u==1)return{start:d,end:{from:g+x,to:g+x+1},matched:y>>1==l>>1};u--}}n>0&&(f+=p.length)}return h.done?{start:d,matched:!1}:null}const T5=Object.create(null),Gp=[Dt.none],qp=[],Yp=Object.create(null),E5=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])E5[t]=L5(T5,e);function _c(t,e){qp.indexOf(t)>-1||(qp.push(t),console.warn(e))}function L5(t,e){let n=[];for(let a of e.split(" ")){let l=[];for(let d of a.split(".")){let h=t[d]||L[d];h?typeof h=="function"?l.length?l=l.map(h):_c(d,`Modifier ${d} used at start of tag`):l.length?_c(d,`Tag ${d} used as modifier`):l=Array.isArray(h)?h:[h]:_c(d,`Unknown highlighting tag ${d}`)}for(let d of l)n.push(d)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(a=>a.id),i=Yp[s];if(i)return i.id;let o=Yp[s]=Dt.define({id:Gp.length,name:r,props:[nx({[r]:n})]});return Gp.push(o),o.id}Ee.RTL,Ee.LTR;const R5=bl.define({name:"json",parser:ES.configure({props:[Ob.add({Object:Wp({except:/^\s*\}/}),Array:Wp({except:/^\s*\]/})}),Ab.add({"Object Array":i5})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function I5(){return new G4(R5)}function yh(){return yh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},yh.apply(null,arguments)}function $5(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}const B5=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=gu(t.state,n.from);return r.line?F5(t):r.block?V5(t):!1};function mu(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=t(e,n);return s?(r(n.update(s)),!0):!1}}const F5=mu(W5,0),z5=mu(Hb,0),V5=mu((t,e)=>Hb(t,e,_5(e)),0);function gu(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const ni=50;function H5(t,{open:e,close:n},r,s){let i=t.sliceDoc(r-ni,r),o=t.sliceDoc(s,s+ni),a=/\s*$/.exec(i)[0].length,l=/^\s*/.exec(o)[0].length,d=i.length-a;if(i.slice(d-e.length,d)==e&&o.slice(l,l+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:s+l,margin:l&&1}};let h,u;s-r<=2*ni?h=u=t.sliceDoc(r,s):(h=t.sliceDoc(r,r+ni),u=t.sliceDoc(s-ni,s));let f=/^\s*/.exec(h)[0].length,p=/\s*$/.exec(u)[0].length,g=u.length-p-n.length;return h.slice(f,f+e.length)==e&&u.slice(g,g+n.length)==n?{open:{pos:r+f+e.length,margin:/\s/.test(h.charAt(f+e.length))?1:0},close:{pos:s-p-n.length,margin:/\s/.test(u.charAt(g-1))?1:0}}:null}function _5(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),s=n.to<=r.to?r:t.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let i=e.length-1;i>=0&&e[i].to>r.from?e[i].to=s.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return e}function Hb(t,e,n=e.selection.ranges){let r=n.map(i=>gu(e,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,o)=>H5(e,r[o],i.from,i.to));if(t!=2&&!s.every(i=>i))return{changes:e.changes(n.map((i,o)=>s[o]?[]:[{from:i.from,insert:r[o].open+" "},{from:i.to,insert:" "+r[o].close}]))};if(t!=1&&s.some(i=>i)){let i=[];for(let o=0,a;o<s.length;o++)if(a=s[o]){let l=r[o],{open:d,close:h}=a;i.push({from:d.pos-l.open.length,to:d.pos+d.margin},{from:h.pos-h.margin,to:h.pos+l.close.length})}return{changes:i}}return null}function W5(t,e,n=e.selection.ranges){let r=[],s=-1;for(let{from:i,to:o}of n){let a=r.length,l=1e9,d=gu(e,i).line;if(d){for(let h=i;h<=o;){let u=e.doc.lineAt(h);if(u.from>s&&(i==o||o>u.from)){s=u.from;let f=/^\s*/.exec(u.text)[0].length,p=f==u.length,g=u.text.slice(f,f+d.length)==d?f:-1;f<u.text.length&&f<l&&(l=f),r.push({line:u,comment:g,token:d,indent:f,empty:p,single:!1})}h=u.to+1}if(l<1e9)for(let h=a;h<r.length;h++)r[h].indent<r[h].line.text.length&&(r[h].indent=l);r.length==a+1&&(r[a].single=!0)}}if(t!=2&&r.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:a,token:l,indent:d,empty:h,single:u}of r)(u||!h)&&i.push({from:a.from+d,insert:l+" "});let o=e.changes(i);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let d=o.from+a,h=d+l.length;o.text[h-o.from]==" "&&h++,i.push({from:d,to:h})}return{changes:i}}return null}const vh=Ln.define(),U5=Ln.define(),K5=Y.define(),_b=Y.define({combine(t){return Rn(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,s)=>e(r,s)||n(r,s)})}}),Wb=ot.define({create(){return An.empty},update(t,e){let n=e.state.facet(_b),r=e.annotation(vh);if(r){let l=At.fromTransaction(e,r.selection),d=r.side,h=d==0?t.undone:t.done;return l?h=Sl(h,h.length,n.minDepth,l):h=Gb(h,e.startState.selection),new An(d==0?r.rest:h,d==0?h:r.rest)}let s=e.annotation(U5);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(Je.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=At.fromTransaction(e),o=e.annotation(Je.time),a=e.annotation(Je.userEvent);return i?t=t.addChanges(i,o,a,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,n.newGroupDelay)),(s=="full"||s=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new An(t.done.map(At.fromJSON),t.undone.map(At.fromJSON))}});function G5(t={}){return[Wb,_b.of(t),_.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?Ub:e.inputType=="historyRedo"?wh:null;return r?(e.preventDefault(),r(n)):!1}})]}function tc(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(Wb,!1);if(!s)return!1;let i=s.pop(t,n,e);return i?(r(i),!0):!1}}const Ub=tc(0,!1),wh=tc(1,!1),q5=tc(0,!0),Y5=tc(1,!0);class At{constructor(e,n,r,s,i){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=i}setSelAfter(e){return new At(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new At(e.changes&&Ge.fromJSON(e.changes),[],e.mapped&&Tn.fromJSON(e.mapped),e.startSelection&&R.fromJSON(e.startSelection),e.selectionsAfter.map(R.fromJSON))}static fromTransaction(e,n){let r=qt;for(let s of e.startState.facet(K5)){let i=s(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new At(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,qt)}static selection(e){return new At(void 0,qt,void 0,void 0,e)}}function Sl(t,e,n,r){let s=e+1>n+20?e-n-1:0,i=t.slice(s,e);return i.push(r),i}function J5(t,e){let n=[],r=!1;return t.iterChangedRanges((s,i)=>n.push(s,i)),e.iterChangedRanges((s,i,o,a)=>{for(let l=0;l<n.length;){let d=n[l++],h=n[l++];a>=d&&o<=h&&(r=!0)}}),r}function Q5(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function Kb(t,e){return t.length?e.length?t.concat(e):t:e}const qt=[],X5=200;function Gb(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-X5));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),Sl(t,t.length-1,1e9,n.setSelAfter(r)))}else return[At.selection([e])]}function Z5(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Wc(t,e){if(!t.length)return t;let n=t.length,r=qt;for(;n;){let s=ej(t[n-1],e,r);if(s.changes&&!s.changes.empty||s.effects.length){let i=t.slice(0,n);return i[n-1]=s,i}else e=s.mapped,n--,r=s.selectionsAfter}return r.length?[At.selection(r)]:qt}function ej(t,e,n){let r=Kb(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):qt,n);if(!t.changes)return At.selection(r);let s=t.changes.map(e),i=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(i):i;return new At(s,me.mapEffects(t.effects,e),o,t.startSelection.map(i),r)}const tj=/^(input\.type|delete)($|\.)/;class An{constructor(e,n,r=0,s=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new An(this.done,this.undone):this}addChanges(e,n,r,s,i){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||tj.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(i,J5(a.changes,e.changes))||r=="input.type.compose")?o=Sl(o,o.length-1,s.minDepth,new At(e.changes.compose(a.changes),Kb(me.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,qt)):o=Sl(o,o.length,s.minDepth,e),new An(o,qt,n,r)}addSelection(e,n,r,s){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:qt;return i.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Q5(i[i.length-1],e)?this:new An(Gb(this.done,e),this.undone,n,r)}addMapping(e){return new An(Wc(this.done,e),Wc(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,r){let s=e==0?this.done:this.undone;if(s.length==0)return null;let i=s[s.length-1],o=i.selectionsAfter[0]||n.selection;if(r&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:vh.of({side:e,rest:Z5(s),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let a=s.length==1?qt:s.slice(0,s.length-1);return i.mapped&&(a=Wc(a,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:vh.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}An.empty=new An(qt,qt);const nj=[{key:"Mod-z",run:Ub,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:wh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:wh,preventDefault:!0},{key:"Mod-u",run:q5,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Y5,preventDefault:!0}];function Es(t,e){return R.create(t.ranges.map(e),t.mainIndex)}function fn(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function pn({state:t,dispatch:e},n){let r=Es(t.selection,n);return r.eq(t.selection,!0)?!1:(e(fn(t,r)),!0)}function nc(t,e){return R.cursor(e?t.to:t.from)}function qb(t,e){return pn(t,n=>n.empty?t.moveByChar(n,e):nc(n,e))}function ft(t){return t.textDirectionAt(t.state.selection.main.head)==Ee.LTR}const Yb=t=>qb(t,!ft(t)),Jb=t=>qb(t,ft(t));function Qb(t,e){return pn(t,n=>n.empty?t.moveByGroup(n,e):nc(n,e))}const rj=t=>Qb(t,!ft(t)),sj=t=>Qb(t,ft(t));function ij(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function rc(t,e,n){let r=ut(t).resolveInner(e.head),s=n?xe.closedBy:xe.openedBy;for(let l=e.head;;){let d=n?r.childAfter(l):r.childBefore(l);if(!d)break;ij(t,d,s)?r=d:l=n?d.to:d.from}let i=r.type.prop(s),o,a;return i&&(o=n?Mn(t,r.from,1):Mn(t,r.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?r.to:r.from,R.cursor(a,n?-1:1)}const oj=t=>pn(t,e=>rc(t.state,e,!ft(t))),aj=t=>pn(t,e=>rc(t.state,e,ft(t)));function Xb(t,e){return pn(t,n=>{if(!n.empty)return nc(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const Zb=t=>Xb(t,!1),ey=t=>Xb(t,!0);function ty(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,s;if(e){for(let i of t.state.facet(_.scrollMargins)){let o=i(t);o?.top&&(n=Math.max(o?.top,n)),o?.bottom&&(r=Math.max(o?.bottom,r))}s=t.scrollDOM.clientHeight-n-r}else s=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,s-5)}}function ny(t,e){let n=ty(t),{state:r}=t,s=Es(r.selection,o=>o.empty?t.moveVertically(o,e,n.height):nc(o,e));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let o=t.coordsAtPos(r.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+n.marginTop,d=a.bottom-n.marginBottom;o&&o.top>l&&o.bottom<d&&(i=_.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-l}))}return t.dispatch(fn(r,s),{effects:i}),!0}const Jp=t=>ny(t,!1),kh=t=>ny(t,!0);function xr(t,e,n){let r=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,n);if(s.head==e.head&&s.head!=(n?r.to:r.from)&&(s=t.moveToLineBoundary(e,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&e.head!=r.from+i&&(s=R.cursor(r.from+i))}return s}const lj=t=>pn(t,e=>xr(t,e,!0)),cj=t=>pn(t,e=>xr(t,e,!1)),dj=t=>pn(t,e=>xr(t,e,!ft(t))),hj=t=>pn(t,e=>xr(t,e,ft(t))),uj=t=>pn(t,e=>R.cursor(t.lineBlockAt(e.head).from,1)),fj=t=>pn(t,e=>R.cursor(t.lineBlockAt(e.head).to,-1));function pj(t,e,n){let r=!1,s=Es(t.selection,i=>{let o=Mn(t,i.head,-1)||Mn(t,i.head,1)||i.head>0&&Mn(t,i.head-1,1)||i.head<t.doc.length&&Mn(t,i.head+1,-1);if(!o||!o.end)return i;r=!0;let a=o.start.from==i.head?o.end.to:o.end.from;return R.cursor(a)});return r?(e(fn(t,s)),!0):!1}const mj=({state:t,dispatch:e})=>pj(t,e);function rn(t,e){let n=Es(t.state.selection,r=>{let s=e(r);return R.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(fn(t.state,n)),!0)}function ry(t,e){return rn(t,n=>t.moveByChar(n,e))}const sy=t=>ry(t,!ft(t)),iy=t=>ry(t,ft(t));function oy(t,e){return rn(t,n=>t.moveByGroup(n,e))}const gj=t=>oy(t,!ft(t)),xj=t=>oy(t,ft(t)),bj=t=>rn(t,e=>rc(t.state,e,!ft(t))),yj=t=>rn(t,e=>rc(t.state,e,ft(t)));function ay(t,e){return rn(t,n=>t.moveVertically(n,e))}const ly=t=>ay(t,!1),cy=t=>ay(t,!0);function dy(t,e){return rn(t,n=>t.moveVertically(n,e,ty(t).height))}const Qp=t=>dy(t,!1),Xp=t=>dy(t,!0),vj=t=>rn(t,e=>xr(t,e,!0)),wj=t=>rn(t,e=>xr(t,e,!1)),kj=t=>rn(t,e=>xr(t,e,!ft(t))),Sj=t=>rn(t,e=>xr(t,e,ft(t))),Cj=t=>rn(t,e=>R.cursor(t.lineBlockAt(e.head).from)),jj=t=>rn(t,e=>R.cursor(t.lineBlockAt(e.head).to)),Zp=({state:t,dispatch:e})=>(e(fn(t,{anchor:0})),!0),em=({state:t,dispatch:e})=>(e(fn(t,{anchor:t.doc.length})),!0),tm=({state:t,dispatch:e})=>(e(fn(t,{anchor:t.selection.main.anchor,head:0})),!0),nm=({state:t,dispatch:e})=>(e(fn(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),Nj=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),Pj=({state:t,dispatch:e})=>{let n=sc(t).map(({from:r,to:s})=>R.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:R.create(n),userEvent:"select"})),!0},Oj=({state:t,dispatch:e})=>{let n=Es(t.selection,r=>{let s=ut(t),i=s.resolveStack(r.from,1);if(r.empty){let o=s.resolveStack(r.from,-1);o.node.from>=i.node.from&&o.node.to<=i.node.to&&(i=o)}for(let o=i;o;o=o.next){let{node:a}=o;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&o.next)return R.range(a.to,a.from)}return r});return n.eq(t.selection)?!1:(e(fn(t,n)),!0)};function hy(t,e){let{state:n}=t,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let o=n.doc.lineAt(i.head);if(e?o.to<t.state.doc.length:o.from>0)for(let a=i;;){let l=t.moveVertically(a,e);if(l.head<o.from||l.head>o.to){s.some(d=>d.head==l.head)||s.push(l);break}else{if(l.head==a.head)break;a=l}}}return s.length==r.ranges.length?!1:(t.dispatch(fn(n,R.create(s,s.length-1))),!0)}const Mj=t=>hy(t,!1),Aj=t=>hy(t,!0),Dj=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=R.create([n.main]):n.main.empty||(r=R.create([R.cursor(n.main.head)])),r?(e(fn(t,r)),!0):!1};function Ho(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(i=>{let{from:o,to:a}=i;if(o==a){let l=e(i);l<o?(n="delete.backward",l=Ta(t,l,!1)):l>o&&(n="delete.forward",l=Ta(t,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=Ta(t,o,!1),a=Ta(t,a,!0);return o==a?{range:i}:{changes:{from:o,to:a},range:R.cursor(o,o<i.head?-1:1)}});return s.changes.empty?!1:(t.dispatch(r.update(s,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?_.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Ta(t,e,n){if(t instanceof _)for(let r of t.state.facet(_.atomicRanges).map(s=>s(t)))r.between(e,e,(s,i)=>{s<e&&i>e&&(e=n?i:s)});return e}const uy=(t,e,n)=>Ho(t,r=>{let s=r.from,{state:i}=t,o=i.doc.lineAt(s),a,l;if(n&&!e&&s>o.from&&s<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,s-o.from))){if(a[a.length-1]==" ")return s-1;let d=Ds(a,i.tabSize),h=d%vl(i)||vl(i);for(let u=0;u<h&&a[a.length-1-u]==" ";u++)s--;l=s}else l=Ye(o.text,s-o.from,e,e)+o.from,l==s&&o.number!=(e?i.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,s-o.from))&&(l=Ye(o.text,l-o.from,!1,!1)+o.from);return l}),Sh=t=>uy(t,!1,!0),fy=t=>uy(t,!0,!1),py=(t,e)=>Ho(t,n=>{let r=n.head,{state:s}=t,i=s.doc.lineAt(r),o=s.charCategorizer(r);for(let a=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let l=Ye(i.text,r-i.from,e)+i.from,d=i.text.slice(Math.min(r,l)-i.from,Math.max(r,l)-i.from),h=o(d);if(a!=null&&h!=a)break;(d!=" "||r!=n.head)&&(a=h),r=l}return r}),my=t=>py(t,!1),Tj=t=>py(t,!0),Ej=t=>Ho(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),Lj=t=>Ho(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),Rj=t=>Ho(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),Ij=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Ne.of(["",""])},range:R.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},$j=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let s=r.from,i=t.doc.lineAt(s),o=s==i.from?s-1:Ye(i.text,s-i.from,!1)+i.from,a=s==i.to?s+1:Ye(i.text,s-i.from,!0)+i.from;return{changes:{from:o,to:a,insert:t.doc.slice(s,a).append(t.doc.slice(o,s))},range:R.cursor(a)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function sc(t){let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.from),i=t.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=t.doc.lineAt(r.to-1)),n>=s.number){let o=e[e.length-1];o.to=i.to,o.ranges.push(r)}else e.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return e}function gy(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let i of sc(t)){if(n?i.to==t.doc.length:i.from==0)continue;let o=t.doc.lineAt(n?i.to+1:i.from-1),a=o.length+1;if(n){r.push({from:i.to,to:o.to},{from:i.from,insert:o.text+t.lineBreak});for(let l of i.ranges)s.push(R.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{r.push({from:o.from,to:i.from},{from:i.to,insert:t.lineBreak+o.text});for(let l of i.ranges)s.push(R.range(l.anchor-a,l.head-a))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:R.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Bj=({state:t,dispatch:e})=>gy(t,e,!1),Fj=({state:t,dispatch:e})=>gy(t,e,!0);function xy(t,e,n){if(t.readOnly)return!1;let r=[];for(let i of sc(t))n?r.push({from:i.from,insert:t.doc.slice(i.from,i.to)+t.lineBreak}):r.push({from:i.to,insert:t.lineBreak+t.doc.slice(i.from,i.to)});let s=t.changes(r);return e(t.update({changes:s,selection:t.selection.map(s,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const zj=({state:t,dispatch:e})=>xy(t,e,!1),Vj=({state:t,dispatch:e})=>xy(t,e,!0),Hj=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(sc(e).map(({from:s,to:i})=>(s>0?s--:i<e.doc.length&&i++,{from:s,to:i}))),r=Es(e.selection,s=>{let i;if(t.lineWrapping){let o=t.lineBlockAt(s.head),a=t.coordsAtPos(s.head,s.assoc||1);a&&(i=o.bottom+t.documentTop-a.bottom+t.defaultLineHeight/2)}return t.moveVertically(s,!0,i)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function _j(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=ut(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e),i;return r&&s&&r.to<=e&&s.from>=e&&(i=r.type.prop(xe.closedBy))&&i.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const rm=by(!1),Wj=by(!0);function by(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:i,to:o}=s,a=e.doc.lineAt(i),l=!t&&i==o&&_j(e,i);t&&(i=o=(o<=a.to?a:e.doc.lineAt(o)).to);let d=new Zl(e,{simulateBreak:i,simulateDoubleBreak:!!l}),h=uu(d,i);for(h==null&&(h=Ds(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:i,to:o}=l:i>a.from&&i<a.from+100&&!/\S/.test(a.text.slice(0,i))&&(i=a.from);let u=["",Vi(e,h)];return l&&u.push(Vi(e,d.lineIndent(a.from,-1))),{changes:{from:i,to:o,insert:Ne.of(u)},range:R.cursor(i+1+u[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function xu(t,e){let n=-1;return t.changeByRange(r=>{let s=[];for(let o=r.from;o<=r.to;){let a=t.doc.lineAt(o);a.number>n&&(r.empty||r.to>a.from)&&(e(a,s,r),n=a.number),o=a.to+1}let i=t.changes(s);return{changes:s,range:R.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const Uj=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Zl(t,{overrideIndentation:i=>{let o=n[i];return o??-1}}),s=xu(t,(i,o,a)=>{let l=uu(r,i.from);if(l==null)return;/\S/.test(i.text)||(l=0);let d=/^\s*/.exec(i.text)[0],h=Vi(t,l);(d!=h||a.from<i.from+d.length)&&(n[i.from]=l,o.push({from:i.from,to:i.from+d.length,insert:h}))});return s.changes.empty||e(t.update(s,{userEvent:"indent"})),!0},yy=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(xu(t,(n,r)=>{r.push({from:n.from,insert:t.facet(Xl)})}),{userEvent:"input.indent"})),!0),vy=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(xu(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=Ds(s,t.tabSize),o=0,a=Vi(t,Math.max(0,i-vl(t)));for(;o<s.length&&o<a.length&&s.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+s.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),Kj=t=>(t.setTabFocusMode(),!0),Gj=[{key:"Ctrl-b",run:Yb,shift:sy,preventDefault:!0},{key:"Ctrl-f",run:Jb,shift:iy},{key:"Ctrl-p",run:Zb,shift:ly},{key:"Ctrl-n",run:ey,shift:cy},{key:"Ctrl-a",run:uj,shift:Cj},{key:"Ctrl-e",run:fj,shift:jj},{key:"Ctrl-d",run:fy},{key:"Ctrl-h",run:Sh},{key:"Ctrl-k",run:Ej},{key:"Ctrl-Alt-h",run:my},{key:"Ctrl-o",run:Ij},{key:"Ctrl-t",run:$j},{key:"Ctrl-v",run:kh}],qj=[{key:"ArrowLeft",run:Yb,shift:sy,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:rj,shift:gj,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:dj,shift:kj,preventDefault:!0},{key:"ArrowRight",run:Jb,shift:iy,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:sj,shift:xj,preventDefault:!0},{mac:"Cmd-ArrowRight",run:hj,shift:Sj,preventDefault:!0},{key:"ArrowUp",run:Zb,shift:ly,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Zp,shift:tm},{mac:"Ctrl-ArrowUp",run:Jp,shift:Qp},{key:"ArrowDown",run:ey,shift:cy,preventDefault:!0},{mac:"Cmd-ArrowDown",run:em,shift:nm},{mac:"Ctrl-ArrowDown",run:kh,shift:Xp},{key:"PageUp",run:Jp,shift:Qp},{key:"PageDown",run:kh,shift:Xp},{key:"Home",run:cj,shift:wj,preventDefault:!0},{key:"Mod-Home",run:Zp,shift:tm},{key:"End",run:lj,shift:vj,preventDefault:!0},{key:"Mod-End",run:em,shift:nm},{key:"Enter",run:rm,shift:rm},{key:"Mod-a",run:Nj},{key:"Backspace",run:Sh,shift:Sh,preventDefault:!0},{key:"Delete",run:fy,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:my,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Tj,preventDefault:!0},{mac:"Mod-Backspace",run:Lj,preventDefault:!0},{mac:"Mod-Delete",run:Rj,preventDefault:!0}].concat(Gj.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),Yj=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:oj,shift:bj},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:aj,shift:yj},{key:"Alt-ArrowUp",run:Bj},{key:"Shift-Alt-ArrowUp",run:zj},{key:"Alt-ArrowDown",run:Fj},{key:"Shift-Alt-ArrowDown",run:Vj},{key:"Mod-Alt-ArrowUp",run:Mj},{key:"Mod-Alt-ArrowDown",run:Aj},{key:"Escape",run:Dj},{key:"Mod-Enter",run:Wj},{key:"Alt-l",mac:"Ctrl-l",run:Pj},{key:"Mod-i",run:Oj,preventDefault:!0},{key:"Mod-[",run:vy},{key:"Mod-]",run:yy},{key:"Mod-Alt-\\",run:Uj},{key:"Shift-Mod-k",run:Hj},{key:"Shift-Mod-\\",run:mj},{key:"Mod-/",run:B5},{key:"Alt-A",run:z5},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Kj}].concat(qj),Jj={key:"Tab",run:yy,shift:vy},sm=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class Ns{constructor(e,n,r=0,s=e.length,i,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,s),this.bufferStart=r,this.normalize=i?a=>i(sm(a)):sm,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Nt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=Yh(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Pn(e);let s=this.normalize(n);if(s.length)for(let i=0,o=r;;i++){let a=s.charCodeAt(i),l=this.match(a,o,this.bufferPos+this.bufferStart);if(i==s.length-1){if(l)return this.value=l,this;break}o==r&&i<n.length&&n.charCodeAt(i)==a&&o++}}}match(e,n,r){let s=null;for(let i=0;i<this.matches.length;i+=2){let o=this.matches[i],a=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?s={from:this.matches[i+1],to:r}:(this.matches[i]++,a=!0)),a||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:n,to:r}:this.matches.push(1,n)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(Ns.prototype[Symbol.iterator]=function(){return this});const wy={from:-1,to:-1,match:/.*/.exec("")},bu="gm"+(/x/.unicode==null?"":"u");class ky{constructor(e,n,r,s=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=wy,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new Sy(e,n,r,s,i);this.re=new RegExp(n,bu+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=e.iter();let o=e.lineAt(s);this.curLineStart=o.from,this.matchPos=Cl(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=Cl(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<s||r>this.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const Uc=new WeakMap;class gs{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let s=Uc.get(e);if(!s||s.from>=r||s.to<=n){let a=new gs(n,e.sliceString(n,r));return Uc.set(e,a),a}if(s.from==n&&s.to==r)return s;let{text:i,from:o}=s;return o>n&&(i=e.sliceString(n,o)+i,o=n),s.to<r&&(i+=e.sliceString(s.to,r)),Uc.set(e,new gs(o,i)),new gs(n,i.slice(n-o,r-o))}}class Sy{constructor(e,n,r,s,i){this.text=e,this.to=i,this.done=!1,this.value=wy,this.matchPos=Cl(e,s),this.re=new RegExp(n,bu+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=gs.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this.matchPos=Cl(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=gs.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(ky.prototype[Symbol.iterator]=Sy.prototype[Symbol.iterator]=function(){return this});function Qj(t){try{return new RegExp(t,bu),!0}catch{return!1}}function Cl(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e<n.to&&(r=n.text.charCodeAt(e-n.from))>=56320&&r<57344;)e++;return e}function Ch(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=De("input",{class:"cm-textfield",name:"line",value:e}),r=De("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),t.dispatch({effects:vi.of(!1)}),t.focus()):i.keyCode==13&&(i.preventDefault(),s())},onsubmit:i=>{i.preventDefault(),s()}},De("label",t.state.phrase("Go to line"),": ",n)," ",De("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),De("button",{name:"close",onclick:()=>{t.dispatch({effects:vi.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]));function s(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!i)return;let{state:o}=t,a=o.doc.lineAt(o.selection.main.head),[,l,d,h,u]=i,f=h?+h.slice(1):0,p=d?+d:a.number;if(d&&u){let b=p/100;l&&(b=b*(l=="-"?-1:1)+a.number/o.doc.lines),p=Math.round(o.doc.lines*b)}else d&&l&&(p=p*(l=="-"?-1:1)+a.number);let g=o.doc.line(Math.max(1,Math.min(o.doc.lines,p))),x=R.cursor(g.from+Math.max(0,Math.min(f,g.length)));t.dispatch({effects:[vi.of(!1),_.scrollIntoView(x.from,{y:"center"})],selection:x}),t.focus()}return{dom:r}}const vi=me.define(),im=ot.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(vi)&&(t=n.value);return t},provide:t=>zi.from(t,e=>e?Ch:null)}),Xj=t=>{let e=Fi(t,Ch);if(!e){let n=[vi.of(!0)];t.state.field(im,!1)==null&&n.push(me.appendConfig.of([im,Zj])),t.dispatch({effects:n}),e=Fi(t,Ch)}return e&&e.dom.querySelector("input").select(),!0},Zj=_.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),eN={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},tN=Y.define({combine(t){return Rn(t,eN,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function nN(t){return[aN,oN]}const rN=ie.mark({class:"cm-selectionMatch"}),sN=ie.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function om(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Ie.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Ie.Word)}function iN(t,e,n,r){return t(e.sliceDoc(n,n+1))==Ie.Word&&t(e.sliceDoc(r-1,r))==Ie.Word}const oN=He.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(tN),{state:n}=t,r=n.selection;if(r.ranges.length>1)return ie.none;let s=r.main,i,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return ie.none;let l=n.wordAt(s.head);if(!l)return ie.none;o=n.charCategorizer(s.head),i=n.sliceDoc(l.from,l.to)}else{let l=s.to-s.from;if(l<e.minSelectionLength||l>200)return ie.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),o=n.charCategorizer(s.head),!(om(o,n,s.from,s.to)&&iN(o,n,s.from,s.to)))return ie.none}else if(i=n.sliceDoc(s.from,s.to),!i)return ie.none}let a=[];for(let l of t.visibleRanges){let d=new Ns(n.doc,i,l.from,l.to);for(;!d.next().done;){let{from:h,to:u}=d.value;if((!o||om(o,n,h,u))&&(s.empty&&h<=s.from&&u>=s.to?a.push(sN.range(h,u)):(h>=s.to||u<=s.from)&&a.push(rN.range(h,u)),a.length>e.maxMatches))return ie.none}}return ie.set(a)}},{decorations:t=>t.decorations}),aN=_.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),lN=({state:t,dispatch:e})=>{let{selection:n}=t,r=R.create(n.ranges.map(s=>t.wordAt(s.head)||R.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function cN(t,e){let{main:n,ranges:r}=t.selection,s=t.wordAt(n.head),i=s&&s.from==n.from&&s.to==n.to;for(let o=!1,a=new Ns(t.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new Ns(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(l=>l.from==a.value.from))continue;if(i){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const dN=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return lN({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=r))return!1;let s=cN(t,r);return s?(e(t.update({selection:t.selection.addRange(R.range(s.from,s.to),!1),effects:_.scrollIntoView(s.to)})),!0):!1},Ls=Y.define({combine(t){return Rn(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new kN(e),scrollToMatch:e=>_.scrollIntoView(e)})}});class Cy{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Qj(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?`
|
|
242
|
+
`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new pN(this):new uN(this)}getCursor(e,n=0,r){let s=e.doc?e:ke.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?rs(this,s,n,r):ns(this,s,n,r)}}class jy{constructor(e){this.spec=e}}function ns(t,e,n,r){return new Ns(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),t.wholeWord?hN(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function hN(t,e){return(n,r,s,i)=>((i>n||i+s.length<r)&&(i=Math.max(0,n-2),s=t.sliceString(i,Math.min(t.length,r+2))),(e(jl(s,n-i))!=Ie.Word||e(Nl(s,n-i))!=Ie.Word)&&(e(Nl(s,r-i))!=Ie.Word||e(jl(s,r-i))!=Ie.Word))}class uN extends jy{constructor(e){super(e)}nextMatch(e,n,r){let s=ns(this.spec,e,r,e.doc.length).nextOverlapping();if(s.done){let i=Math.min(e.doc.length,n+this.spec.unquoted.length);s=ns(this.spec,e,0,i).nextOverlapping()}return s.done||s.value.from==n&&s.value.to==r?null:s.value}prevMatchInRange(e,n,r){for(let s=r;;){let i=Math.max(n,s-1e4-this.spec.unquoted.length),o=ns(this.spec,e,i,s),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(i==n)return null;s-=1e4}}prevMatch(e,n,r){let s=this.prevMatchInRange(e,0,n);return s||(s=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=n||s.to!=r)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let r=ns(this.spec,e,0,e.doc.length),s=[];for(;!r.next().done;){if(s.length>=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=ns(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}function rs(t,e,n,r){return new ky(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?fN(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function jl(t,e){return t.slice(Ye(t,e,!1),e)}function Nl(t,e){return t.slice(e,Ye(t,e))}function fN(t){return(e,n,r)=>!r[0].length||(t(jl(r.input,r.index))!=Ie.Word||t(Nl(r.input,r.index))!=Ie.Word)&&(t(Nl(r.input,r.index+r[0].length))!=Ie.Word||t(jl(r.input,r.index+r[0].length))!=Ie.Word)}class pN extends jy{nextMatch(e,n,r){let s=rs(this.spec,e,r,e.doc.length).next();return s.done&&(s=rs(this.spec,e,0,n).next()),s.done?null:s.value}prevMatchInRange(e,n,r){for(let s=1;;s++){let i=Math.max(n,r-s*1e4),o=rs(this.spec,e,i,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(i==n||a.from>i+10))return a;if(i==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i<e.match.length)return e.match[i]+r.slice(s)}return n})}matchAll(e,n){let r=rs(this.spec,e,0,e.doc.length),s=[];for(;!r.next().done;){if(s.length>=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=rs(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}const Hi=me.define(),yu=me.define(),lr=ot.define({create(t){return new Kc(jh(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Hi)?t=new Kc(n.value.create(),t.panel):n.is(yu)&&(t=new Kc(t.query,n.value?vu:null));return t},provide:t=>zi.from(t,e=>e.panel)});class Kc{constructor(e,n){this.query=e,this.panel=n}}const mN=ie.mark({class:"cm-searchMatch"}),gN=ie.mark({class:"cm-searchMatch cm-searchMatch-selected"}),xN=He.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(lr))}update(t){let e=t.state.field(lr);(e!=t.startState.field(lr)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ie.none;let{view:n}=this,r=new _n;for(let s=0,i=n.visibleRanges,o=i.length;s<o;s++){let{from:a,to:l}=i[s];for(;s<o-1&&l>i[s+1].from-2*250;)l=i[++s].to;t.highlight(n.state,a,l,(d,h)=>{let u=n.state.selection.ranges.some(f=>f.from==d&&f.to==h);r.add(d,h,u?gN:mN)})}return r.finish()}},{decorations:t=>t.decorations});function _o(t){return e=>{let n=e.state.field(lr,!1);return n&&n.query.spec.valid?t(e,n):Oy(e)}}const Pl=_o((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=R.single(r.from,r.to),i=t.state.facet(Ls);return t.dispatch({selection:s,effects:[wu(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),Py(t),!0}),Ol=_o((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=R.single(s.from,s.to),o=t.state.facet(Ls);return t.dispatch({selection:i,effects:[wu(t,s),o.scrollToMatch(i.main,t)],userEvent:"select.search"}),Py(t),!0}),bN=_o((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:R.create(n.map(r=>R.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),yN=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,i=[],o=0;for(let a=new Ns(t.doc,t.sliceDoc(r,s));!a.next().done;){if(i.length>1e3)return!1;a.value.from==r&&(o=i.length),i.push(R.range(a.value.from,a.value.to))}return e(t.update({selection:R.create(i,o),userEvent:"select.search.matches"})),!0},am=_o((t,{query:e})=>{let{state:n}=t,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,r,r);if(!i)return!1;let o=i,a=[],l,d,h=[];o.from==r&&o.to==s&&(d=n.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:d}),o=e.nextMatch(n,o.from,o.to),h.push(_.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let u=t.state.changes(a);return o&&(l=R.single(o.from,o.to).map(u),h.push(wu(t,o)),h.push(n.facet(Ls).scrollToMatch(l.main,t))),t.dispatch({changes:u,selection:l,effects:h,userEvent:"input.replace"}),!0}),vN=_o((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(s=>{let{from:i,to:o}=s;return{from:i,to:o,insert:e.getReplacement(s)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:_.announce.of(r),userEvent:"input.replace.all"}),!0});function vu(t){return t.state.facet(Ls).createPanel(t)}function jh(t,e){var n,r,s,i,o;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let d=t.facet(Ls);return new Cy({search:((n=e?.literal)!==null&&n!==void 0?n:d.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:d.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:d.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:d.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:d.wholeWord})}function Ny(t){let e=Fi(t,vu);return e&&e.dom.querySelector("[main-field]")}function Py(t){let e=Ny(t);e&&e==t.root.activeElement&&e.select()}const Oy=t=>{let e=t.state.field(lr,!1);if(e&&e.panel){let n=Ny(t);if(n&&n!=t.root.activeElement){let r=jh(t.state,e.query.spec);r.valid&&t.dispatch({effects:Hi.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[yu.of(!0),e?Hi.of(jh(t.state,e.query.spec)):me.appendConfig.of(CN)]});return!0},My=t=>{let e=t.state.field(lr,!1);if(!e||!e.panel)return!1;let n=Fi(t,vu);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:yu.of(!1)}),!0},wN=[{key:"Mod-f",run:Oy,scope:"editor search-panel"},{key:"F3",run:Pl,shift:Ol,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Pl,shift:Ol,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:My,scope:"editor search-panel"},{key:"Mod-Shift-l",run:yN},{key:"Mod-Alt-g",run:Xj},{key:"Mod-d",run:dN,preventDefault:!0}];class kN{constructor(e){this.view=e;let n=this.query=e.state.field(lr).query.spec;this.commit=this.commit.bind(this),this.searchField=De("input",{value:n.search,placeholder:Lt(e,"Find"),"aria-label":Lt(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=De("input",{value:n.replace,placeholder:Lt(e,"Replace"),"aria-label":Lt(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=De("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=De("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=De("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,o){return De("button",{class:"cm-button",name:s,onclick:i,type:"button"},o)}this.dom=De("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>Pl(e),[Lt(e,"next")]),r("prev",()=>Ol(e),[Lt(e,"previous")]),r("select",()=>bN(e),[Lt(e,"all")]),De("label",null,[this.caseField,Lt(e,"match case")]),De("label",null,[this.reField,Lt(e,"regexp")]),De("label",null,[this.wordField,Lt(e,"by word")]),...e.state.readOnly?[]:[De("br"),this.replaceField,r("replace",()=>am(e),[Lt(e,"replace")]),r("replaceAll",()=>vN(e),[Lt(e,"replace all")])],De("button",{name:"close",onclick:()=>My(e),"aria-label":Lt(e,"close"),type:"button"},["×"])])}commit(){let e=new Cy({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Hi.of(e)}))}keydown(e){z3(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ol:Pl)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),am(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Hi)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Ls).top}}function Lt(t,e){return t.state.phrase(e)}const Ea=30,La=/[\s\.,:;?!]/;function wu(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),s=t.state.doc.lineAt(n).to,i=Math.max(r.from,e-Ea),o=Math.min(s,n+Ea),a=t.state.sliceDoc(i,o);if(i!=r.from){for(let l=0;l<Ea;l++)if(!La.test(a[l+1])&&La.test(a[l])){a=a.slice(l);break}}if(o!=s){for(let l=a.length-1;l>a.length-Ea;l--)if(!La.test(a[l-1])&&La.test(a[l])){a=a.slice(0,l);break}}return _.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${r.number}.`)}const SN=_.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),CN=[lr,Wr.low(xN),SN];class Ay{constructor(e,n,r,s){this.state=e,this.pos=n,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=ut(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),s=n.text.slice(r-n.from,this.pos-n.from),i=s.search(Dy(e,!1));return i<0?null:{from:r+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function lm(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function jN(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;i<s.length;i++)n[s[i]]=!0}let r=lm(e)+lm(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function NN(t){let e=t.map(s=>typeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:jN(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}class cm{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}}function Br(t){return t.selection.main.from}function Dy(t,e){var n;let{source:r}=t,s=e&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?t:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const Ty=Ln.define();function PN(t,e,n,r){let{main:s}=t.selection,i=n-s.from,o=r-s.from;return{...t.changeByRange(a=>{if(a!=s&&n!=r&&t.sliceDoc(a.from+i,a.from+o)!=t.sliceDoc(n,r))return{range:a};let l=t.toText(e);return{changes:{from:a.from+i,to:r==s.from?a.to:a.from+o,insert:l},range:R.cursor(a.from+i+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const dm=new WeakMap;function ON(t){if(!Array.isArray(t))return t;let e=dm.get(t);return e||dm.set(t,e=NN(t)),e}const Ml=me.define(),_i=me.define();class MN{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let r=Nt(e,n),s=Pn(r);this.chars.push(r);let i=e.slice(n,n+s),o=i.toUpperCase();this.folded.push(Nt(o==i?i.toLowerCase():o,0)),n+=s}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:s,precise:i,byWord:o}=this;if(n.length==1){let w=Nt(e,0),C=Pn(w),S=C==e.length?0:-100;if(w!=n[0])if(w==r[0])S+=-200;else return null;return this.ret(S,[0,C])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,d=0;if(a<0){for(let w=0,C=Math.min(e.length,200);w<C&&d<l;){let S=Nt(e,w);(S==n[d]||S==r[d])&&(s[d++]=w),w+=Pn(S)}if(d<l)return null}let h=0,u=0,f=!1,p=0,g=-1,x=-1,b=/[a-z]/.test(e),y=!0;for(let w=0,C=Math.min(e.length,200),S=0;w<C&&u<l;){let k=Nt(e,w);a<0&&(h<l&&k==n[h]&&(i[h++]=w),p<l&&(k==n[p]||k==r[p]?(p==0&&(g=w),x=w+1,p++):p=0));let N,v=k<255?k>=48&&k<=57||k>=97&&k<=122?2:k>=65&&k<=90?1:0:(N=Yh(k))!=N.toLowerCase()?1:N!=N.toUpperCase()?2:0;(!w||v==1&&b||S==0&&v!=0)&&(n[u]==k||r[u]==k&&(f=!0)?o[u++]=w:o.length&&(y=!1)),S=v,w+=Pn(k)}return u==l&&o[0]==0&&y?this.result(-100+(f?-200:0),o,e):p==l&&g==0?this.ret(-200-e.length+(x==e.length?0:-100),[0,x]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):p==l?this.ret(-900-e.length,[g,x]):u==l?this.result(-100+(f?-200:0)+-700+(y?0:-1100),o,e):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,n,r){let s=[],i=0;for(let o of n){let a=o+(this.astral?Pn(Nt(r,o)):1);i&&s[i-1]==o?s[i-1]=a:(s[i++]=o,s[i++]=a)}return this.ret(e-r.length,s)}}class AN{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.slice(0,this.pattern.length),r=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,n.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const tt=Y.define({combine(t){return Rn(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:DN,filterStrict:!1,compareCompletions:(e,n)=>(e.sortText||e.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>hm(e(r),n(r)),optionClass:(e,n)=>r=>hm(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function hm(t,e){return t?e?t+" "+e:t:e}function DN(t,e,n,r,s,i){let o=t.textDirection==Ee.RTL,a=o,l=!1,d="top",h,u,f=e.left-s.left,p=s.right-e.right,g=r.right-r.left,x=r.bottom-r.top;if(a&&f<Math.min(g,p)?a=!1:!a&&p<Math.min(g,f)&&(a=!0),g<=(a?f:p))h=Math.max(s.top,Math.min(n.top,s.bottom-x))-e.top,u=Math.min(400,a?f:p);else{l=!0,u=Math.min(400,(o?e.right:s.right-e.left)-30);let w=s.bottom-e.bottom;w>=x||w>e.top?h=n.bottom-e.top:(d="bottom",h=e.bottom-n.top)}let b=(e.bottom-e.top)/i.offsetHeight,y=(e.right-e.left)/i.offsetWidth;return{style:`${d}: ${h/b}px; max-width: ${u/y}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function TN(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,s,i){let o=document.createElement("span");o.className="cm-completionLabel";let a=n.displayLabel||n.label,l=0;for(let d=0;d<i.length;){let h=i[d++],u=i[d++];h>l&&o.appendChild(document.createTextNode(a.slice(l,h)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(a.slice(h,u))),f.className="cm-completionMatchedText",l=u}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),e.sort((n,r)=>n.position-r.position).map(n=>n.render)}function Gc(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let s=Math.floor(e/n);return{from:s*n,to:(s+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class EN{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:o}=s.open,a=e.state.facet(tt);this.optionContent=TN(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=Gc(i.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:d}=e.state.field(n).open;for(let h=l.target,u;h&&h!=this.dom;h=h.parentNode)if(h.nodeName=="LI"&&(u=/-(\d+)$/.exec(h.id))&&+u[1]<d.length){this.applyCompletion(e,d[+u[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let d=e.state.field(this.stateField,!1);d&&d.tooltip&&e.state.facet(tt).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:_i.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:i,selected:o,disabled:a}=r.open;(!s.open||s.open.options!=i)&&(this.range=Gc(i.length,o,e.state.facet(tt).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),a!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=Gc(n.options.length,n.selected,this.view.state.facet(tt).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(s);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,s)}).catch(a=>Mt(this.view.state,a,"completion info")):(this.addInfoPane(o,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&RN(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let o=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom<Math.max(i.top,n.top)+10?null:this.view.state.facet(tt).positionInfo(this.view,n,s,r,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,n,r){const s=document.createElement("ul");s.id=n,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",o=>{o.target==s&&o.preventDefault()});let i=null;for(let o=r.from;o<r.to;o++){let{completion:a,match:l}=e[o],{section:d}=a;if(d){let f=typeof d=="string"?d:d.name;if(f!=i&&(o>r.from||r.from==0))if(i=f,typeof d!="string"&&d.header)s.appendChild(d.header(d));else{let p=s.appendChild(document.createElement("completion-section"));p.textContent=f}}const h=s.appendChild(document.createElement("li"));h.id=n+"-"+o,h.setAttribute("role","option");let u=this.optionClass(a);u&&(h.className=u);for(let f of this.optionContent){let p=f(a,this.view.state,this.view,l);p&&h.appendChild(p)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function LN(t,e){return n=>new EN(n,t,e)}function RN(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.top<n.top?t.scrollTop-=(n.top-r.top)/s:r.bottom>n.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function um(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function IN(t,e){let n=[],r=null,s=null,i=h=>{n.push(h);let{section:u}=h.completion;if(u){r||(r=[]);let f=typeof u=="string"?u:u.name;r.some(p=>p.name==f)||r.push(typeof u=="string"?{name:f}:u)}},o=e.facet(tt);for(let h of t)if(h.hasResult()){let u=h.result.getMatch;if(h.result.filter===!1)for(let f of h.result.options)i(new cm(f,h.source,u?u(f):[],1e9-n.length));else{let f=e.sliceDoc(h.from,h.to),p,g=o.filterStrict?new AN(f):new MN(f);for(let x of h.result.options)if(p=g.match(x.label)){let b=x.displayLabel?u?u(x,p.matched):[]:p.matched,y=p.score+(x.boost||0);if(i(new cm(x,h.source,b,y)),typeof x.section=="object"&&x.section.rank==="dynamic"){let{name:w}=x.section;s||(s=Object.create(null)),s[w]=Math.max(y,s[w]||-1e9)}}}}if(r){let h=Object.create(null),u=0,f=(p,g)=>(p.rank==="dynamic"&&g.rank==="dynamic"?s[g.name]-s[p.name]:0)||(typeof p.rank=="number"?p.rank:1e9)-(typeof g.rank=="number"?g.rank:1e9)||(p.name<g.name?-1:1);for(let p of r.sort(f))u-=1e5,h[p.name]=u;for(let p of n){let{section:g}=p.completion;g&&(p.score+=h[typeof g=="string"?g:g.name])}}let a=[],l=null,d=o.compareCompletions;for(let h of n.sort((u,f)=>f.score-u.score||d(u.completion,f.completion))){let u=h.completion;!l||l.label!=u.label||l.detail!=u.detail||l.type!=null&&u.type!=null&&l.type!=u.type||l.apply!=u.apply||l.boost!=u.boost?a.push(h):um(h.completion)>um(l)&&(a[a.length-1]=h),l=h.completion}return a}class ls{constructor(e,n,r,s,i,o){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new ls(this.options,fm(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,o){if(s&&!o&&e.some(d=>d.isPending))return s.setDisabled();let a=IN(e,n);if(!a.length)return s&&e.some(d=>d.isPending)?s.setDisabled():null;let l=n.facet(tt).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let d=s.options[s.selected].completion;for(let h=0;h<a.length;h++)if(a[h].completion==d){l=h;break}}return new ls(a,fm(r,l),{pos:e.reduce((d,h)=>h.hasResult()?Math.min(d,h.from):d,1e8),create:HN,above:i.aboveCursor},s?s.timestamp:Date.now(),l,!1)}map(e){return new ls(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new ls(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Al{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new Al(zN,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(tt),i=(r.override||n.languageDataAt("autocomplete",Br(n)).map(ON)).map(l=>(this.active.find(h=>h.source==l)||new Yt(l,this.active.some(h=>h.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((l,d)=>l==this.active[d])&&(i=this.active);let o=this.open,a=e.effects.some(l=>l.is(ku));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||i.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!$N(i,this.active)||a?o=ls.build(i,n,this.id,o,r,a):o&&o.disabled&&!i.some(l=>l.isPending)&&(o=null),!o&&i.every(l=>!l.isPending)&&i.some(l=>l.hasResult())&&(i=i.map(l=>l.hasResult()?new Yt(l.source,0):l));for(let l of e.effects)l.is(Ly)&&(o=o&&o.setSelected(l.value,this.id));return i==this.active&&o==this.open?this:new Al(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?BN:FN}}function $N(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;r<e.length&&!e[r].hasResult();)r++;let s=n==t.length,i=r==e.length;if(s||i)return s==i;if(t[n++].result!=e[r++].result)return!1}}const BN={"aria-autocomplete":"list"},FN={};function fm(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const zN=[];function Ey(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(Ty);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Yt{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=Ey(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new Yt(s.source,0)),r&4&&s.state==0&&(s=new Yt(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(Ml))s=new Yt(s.source,1,i.value);else if(i.is(_i))s=new Yt(s.source,0);else if(i.is(ku))for(let o of i.value)o.source==s.source&&(s=o);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Br(e.state))}}class xs extends Yt{constructor(e,n,r,s,i,o){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=o}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=Br(e.state);if(a>o||!s||n&2&&(Br(e.startState)==this.from||a<this.limit))return new Yt(this.source,n&4?1:0);let l=e.changes.mapPos(this.limit);return VN(s.validFor,e.state,i,o)?new xs(this.source,this.explicit,l,s,i,o):s.update&&(s=s.update(s,i,o,new Ay(e.state,a,!1)))?new xs(this.source,this.explicit,l,s,s.from,(r=s.to)!==null&&r!==void 0?r:Br(e.state)):new Yt(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new xs(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Yt(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function VN(t,e,n,r){if(!t)return!1;let s=e.sliceDoc(n,r);return typeof t=="function"?t(s,n,r,e):Dy(t,!0).test(s)}const ku=me.define({map(t,e){return t.map(n=>n.map(e))}}),Ly=me.define(),Pt=ot.define({create(){return Al.start()},update(t,e){return t.update(e)},provide:t=>[hu.from(t,e=>e.tooltip),_.contentAttributes.from(t,e=>e.attrs)]});function Su(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(Pt).active.find(s=>s.source==e.source);return r instanceof xs?(typeof n=="string"?t.dispatch({...PN(t.state,n,r.from,r.to),annotations:Ty.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const HN=LN(Pt,Su);function Ra(t,e="option"){return n=>{let r=n.state.field(Pt,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(tt).interactionDelay)return!1;let s=1,i;e=="page"&&(i=Sb(n,r.open.tooltip))&&(s=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,a=r.open.selected>-1?r.open.selected+s*(t?1:-1):t?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),n.dispatch({effects:Ly.of(a)}),!0}}const _N=t=>{let e=t.state.field(Pt,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(tt).interactionDelay?!1:Su(t,e.open.options[e.open.selected])},qc=t=>t.state.field(Pt,!1)?(t.dispatch({effects:Ml.of(!0)}),!0):!1,WN=t=>{let e=t.state.field(Pt,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:_i.of(null)}),!0)};class UN{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const KN=50,GN=1e3,qN=He.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(Pt).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(Pt),n=t.state.facet(tt);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Pt)==e)return;let r=t.transactions.some(i=>{let o=Ey(i,n);return o&8||(i.selection||i.docChanged)&&!(o&3)});for(let i=0;i<this.running.length;i++){let o=this.running[i];if(r||o.context.abortOnDocChange&&t.docChanged||o.updates.length+t.transactions.length>KN&&Date.now()-o.time>GN){for(let a of o.context.abortListeners)try{a()}catch(l){Mt(this.view.state,l)}o.context.abortListeners=null,this.running.splice(i--,1)}else o.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(o=>o.is(Ml)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(o=>o.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(Pt);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(tt).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=Br(e),r=new Ay(e,n,t.explicit,this.view),s=new UN(t,r);this.running.push(s),Promise.resolve(t.source(r)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:_i.of(null)}),Mt(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(tt).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(tt),r=this.view.state.field(Pt);for(let s=0;s<this.running.length;s++){let i=this.running[s];if(i.done===void 0)continue;if(this.running.splice(s--,1),i.done){let a=Br(i.updates.length?i.updates[0].startState:this.view.state),l=Math.min(a,i.done.from+(i.active.explicit?0:1)),d=new xs(i.active.source,i.active.explicit,l,i.done,i.done.from,(t=i.done.to)!==null&&t!==void 0?t:a);for(let h of i.updates)d=d.update(h,n);if(d.hasResult()){e.push(d);continue}}let o=r.active.find(a=>a.source==i.active.source);if(o&&o.isPending)if(i.done==null){let a=new Yt(i.active.source,0);for(let l of i.updates)a=a.update(l,n);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:ku.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Pt,!1);if(e&&e.tooltip&&this.view.state.facet(tt).closeOnBlur){let n=e.open&&Sb(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:_i.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Ml.of(!1)}),20),this.composing=0}}}),YN=typeof navigator=="object"&&/Win/.test(navigator.platform),JN=Wr.highest(_.domEventHandlers({keydown(t,e){let n=e.state.field(Pt,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(YN&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(o=>o.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&Su(e,r),!1}})),QN=_.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Wi={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ir=me.define({map(t,e){let n=e.mapPos(t,-1,vt.TrackAfter);return n??void 0}}),Cu=new class extends dr{};Cu.startSide=1;Cu.endSide=-1;const Ry=ot.define({create(){return ye.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(Ir)&&(t=t.update({add:[Cu.range(n.value,n.value+1)]}));return t}});function XN(){return[eP,Ry]}const Yc="()[]{}<>«»»«[]{}";function Iy(t){for(let e=0;e<Yc.length;e+=2)if(Yc.charCodeAt(e)==t)return Yc.charAt(e+1);return Yh(t<128?t:t+1)}function $y(t,e){return t.languageDataAt("closeBrackets",e)[0]||Wi}const ZN=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),eP=_.inputHandler.of((t,e,n,r)=>{if((ZN?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&Pn(Nt(r,0))==1||e!=s.from||n!=s.to)return!1;let i=rP(t.state,r);return i?(t.dispatch(i),!0):!1}),tP=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=$y(t,t.selection.main.head).brackets||Wi.brackets,s=null,i=t.changeByRange(o=>{if(o.empty){let a=sP(t.doc,o.head);for(let l of r)if(l==a&&ic(t.doc,o.head)==Iy(Nt(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:R.cursor(o.head-l.length)}}return{range:s=o}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},nP=[{key:"Backspace",run:tP}];function rP(t,e){let n=$y(t,t.selection.main.head),r=n.brackets||Wi.brackets;for(let s of r){let i=Iy(Nt(s,0));if(e==s)return i==s?aP(t,s,r.indexOf(s+s+s)>-1,n):iP(t,s,i,n.before||Wi.before);if(e==i&&By(t,t.selection.main.from))return oP(t,s,i)}return null}function By(t,e){let n=!1;return t.field(Ry).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function ic(t,e){let n=t.sliceString(e,e+2);return n.slice(0,Pn(Nt(n,0)))}function sP(t,e){let n=t.sliceString(e-2,e);return Pn(Nt(n,0))==n.length?n:n.slice(1)}function iP(t,e,n,r){let s=null,i=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:n,from:o.to}],effects:Ir.of(o.to+e.length),range:R.range(o.anchor+e.length,o.head+e.length)};let a=ic(t.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+n,from:o.head},effects:Ir.of(o.head+e.length),range:R.cursor(o.head+e.length)}:{range:s=o}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function oP(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&ic(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:R.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function aP(t,e,n,r){let s=r.stringPrefixes||Wi.stringPrefixes,i=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Ir.of(a.to+e.length),range:R.range(a.anchor+e.length,a.head+e.length)};let l=a.head,d=ic(t.doc,l),h;if(d==e){if(pm(t,l))return{changes:{insert:e+e,from:l},effects:Ir.of(l+e.length),range:R.cursor(l+e.length)};if(By(t,l)){let f=n&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+f.length,insert:f},range:R.cursor(l+f.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(h=mm(t,l-2*e.length,s))>-1&&pm(t,h))return{changes:{insert:e+e+e+e,from:l},effects:Ir.of(l+e.length),range:R.cursor(l+e.length)};if(t.charCategorizer(l)(d)!=Ie.Word&&mm(t,l,s)>-1&&!lP(t,l,e,s))return{changes:{insert:e+e,from:l},effects:Ir.of(l+e.length),range:R.cursor(l+e.length)}}return{range:i=a}});return i?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function pm(t,e){let n=ut(t).resolveInner(e+1);return n.parent&&n.from==e}function lP(t,e,n,r){let s=ut(t).resolveInner(e,-1),i=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),l=a.indexOf(n);if(!l||l>-1&&r.indexOf(a.slice(0,l))>-1){let h=s.firstChild;for(;h&&h.from==s.from&&h.to-h.from>n.length+l;){if(t.sliceDoc(h.to-n.length,h.to)==n)return!1;h=h.firstChild}return!0}let d=s.to==e&&s.parent;if(!d)break;s=d}return!1}function mm(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Ie.Word)return e;for(let s of n){let i=e-s.length;if(t.sliceDoc(i,e)==s&&r(t.sliceDoc(i-1,i))!=Ie.Word)return i}return-1}function cP(t={}){return[JN,Pt,tt.of(t),qN,dP,QN]}const Fy=[{key:"Ctrl-Space",run:qc},{mac:"Alt-`",run:qc},{mac:"Alt-i",run:qc},{key:"Escape",run:WN},{key:"ArrowDown",run:Ra(!0)},{key:"ArrowUp",run:Ra(!1)},{key:"PageDown",run:Ra(!0,"page")},{key:"PageUp",run:Ra(!1,"page")},{key:"Enter",run:_N}],dP=Wr.highest(Jl.computeN([tt],t=>t.facet(tt).defaultKeymap?[Fy]:[]));class gm{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class Mr{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let s=r.facet(Ui).markerFilter;s&&(e=s(e,r));let i=e.slice().sort((p,g)=>p.from-g.from||p.to-g.to),o=new _n,a=[],l=0,d=r.doc.iter(),h=0,u=r.doc.length;for(let p=0;;){let g=p==i.length?null:i[p];if(!g&&!a.length)break;let x,b;if(a.length)x=l,b=a.reduce((C,S)=>Math.min(C,S.to),g&&g.from>x?g.from:1e8);else{if(x=g.from,x>u)break;b=g.to,a.push(g),p++}for(;p<i.length;){let C=i[p];if(C.from==x&&(C.to>C.from||C.to==x))a.push(C),p++,b=Math.min(C.to,b);else{b=Math.min(C.from,b);break}}b=Math.min(b,u);let y=!1;if(a.some(C=>C.from==x&&(C.to==b||b==u))&&(y=x==b,!y&&b-x<10)){let C=x-(h+d.value.length);C>0&&(d.next(C),h=x);for(let S=x;;){if(S>=b){y=!0;break}if(!d.lineBreak&&h+d.value.length>S)break;S=h+d.value.length,h+=d.value.length,d.next()}}let w=SP(a);if(y)o.add(x,x,ie.widget({widget:new yP(w),diagnostics:a.slice()}));else{let C=a.reduce((S,k)=>k.markClass?S+" "+k.markClass:S,"");o.add(x,b,ie.mark({class:"cm-lintRange cm-lintRange-"+w+C,diagnostics:a.slice(),inclusiveEnd:a.some(S=>S.to>b)}))}if(l=b,l==u)break;for(let C=0;C<a.length;C++)a[C].to<=l&&a.splice(C--,1)}let f=o.finish();return new Mr(f,n,Ps(f))}}function Ps(t,e=null,n=0){let r=null;return t.between(n,1e9,(s,i,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new gm(s,i,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new gm(r.from,i,r.diagnostic)}}),r}function hP(t,e){let n=e.pos,r=e.end||n,s=t.state.facet(Ui).hideOn(t,n,r);if(s!=null)return s;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(o=>o.is(zy))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function uP(t,e){return t.field(Bt,!1)?e:e.concat(me.appendConfig.of(CP))}const zy=me.define(),ju=me.define(),Vy=me.define(),Bt=ot.define({create(){return new Mr(ie.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,s=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);r=Ps(n,t.selected.diagnostic,i)||Ps(n,null,i)}!n.size&&s&&e.state.facet(Ui).autoPanel&&(s=null),t=new Mr(n,s,r)}for(let n of e.effects)if(n.is(zy)){let r=e.state.facet(Ui).autoPanel?n.value.length?Ki.open:null:t.panel;t=Mr.init(n.value,r,e.state)}else n.is(ju)?t=new Mr(t.diagnostics,n.value?Ki.open:null,t.selected):n.is(Vy)&&(t=new Mr(t.diagnostics,t.panel,n.value));return t},provide:t=>[zi.from(t,e=>e.panel),_.decorations.from(t,e=>e.diagnostics)]}),fP=ie.mark({class:"cm-lintRange cm-lintRange-active"});function pP(t,e,n){let{diagnostics:r}=t.state.field(Bt),s,i=-1,o=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(l,d,{spec:h})=>{if(e>=l&&e<=d&&(l==d||(e>l||n>0)&&(e<d||n<0)))return s=h.diagnostics,i=l,o=d,!1});let a=t.state.facet(Ui).tooltipFilter;return s&&a&&(s=a(s,t.state)),s?{pos:i,end:o,above:t.state.doc.lineAt(i).to<o,create(){return{dom:mP(t,s)}}}:null}function mP(t,e){return De("ul",{class:"cm-tooltip-lint"},e.map(n=>_y(t,n,!1)))}const gP=t=>{let e=t.state.field(Bt,!1);(!e||!e.panel)&&t.dispatch({effects:uP(t.state,[ju.of(!0)])});let n=Fi(t,Ki.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},xm=t=>{let e=t.state.field(Bt,!1);return!e||!e.panel?!1:(t.dispatch({effects:ju.of(!1)}),!0)},xP=t=>{let e=t.state.field(Bt,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},bP=[{key:"Mod-Shift-m",run:gP,preventDefault:!0},{key:"F8",run:xP}],Ui=Y.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...Rn(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:bm,tooltipFilter:bm,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,s,i)=>e(r,s,i)||n(r,s,i):e:n,autoPanel:(e,n)=>e||n})}}});function bm(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function Hy(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;r<n.length;r++){let s=n[r];if(/[a-zA-Z]/.test(s)&&!e.some(i=>i.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function _y(t,e,n){var r;let s=n?Hy(e.actions):[];return De("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},De("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((i,o)=>{let a=!1,l=p=>{if(p.preventDefault(),a)return;a=!0;let g=Ps(t.state.field(Bt).diagnostics,e);g&&i.apply(t,g.from,g.to)},{name:d}=i,h=s[o]?d.indexOf(s[o]):-1,u=h<0?d:[d.slice(0,h),De("u",d.slice(h,h+1)),d.slice(h+1)],f=i.markClass?" "+i.markClass:"";return De("button",{type:"button",class:"cm-diagnosticAction"+f,onclick:l,onmousedown:l,"aria-label":` Action: ${d}${h<0?"":` (access key "${s[o]})"`}.`},u)}),e.source&&De("div",{class:"cm-diagnosticSource"},e.source))}class yP extends In{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return De("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class ym{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=_y(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Ki{constructor(e){this.view=e,this.items=[];let n=s=>{if(s.keyCode==27)xm(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],o=Hy(i.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==s.keyCode){let l=Ps(this.view.state.field(Bt).diagnostics,i);l&&i.actions[a].apply(e,l.from,l.to)}}else return;s.preventDefault()},r=s=>{for(let i=0;i<this.items.length;i++)this.items[i].dom.contains(s.target)&&this.moveSelection(i)};this.list=De("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=De("div",{class:"cm-panel-lint"},this.list,De("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>xm(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Bt).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(Bt),r=0,s=!1,i=null,o=new Set;for(e.between(0,this.view.state.doc.length,(a,l,{spec:d})=>{for(let h of d.diagnostics){if(o.has(h))continue;o.add(h);let u=-1,f;for(let p=r;p<this.items.length;p++)if(this.items[p].diagnostic==h){u=p;break}u<0?(f=new ym(this.view,h),this.items.splice(r,0,f),s=!0):(f=this.items[u],u>r&&(this.items.splice(r,u-r),s=!0)),n&&f.diagnostic==n.diagnostic?f.dom.hasAttribute("aria-selected")||(f.dom.setAttribute("aria-selected","true"),i=f):f.dom.hasAttribute("aria-selected")&&f.dom.removeAttribute("aria-selected"),r++}});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new ym(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let d=l.height/this.list.offsetHeight;a.top<l.top?this.list.scrollTop-=(l.top-a.top)/d:a.bottom>l.bottom&&(this.list.scrollTop+=(a.bottom-l.bottom)/d)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(Bt),r=Ps(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Vy.of(r)})}static open(e){return new Ki(e)}}function vP(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function Ia(t){return vP(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const wP=_.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Ia("#d11")},".cm-lintRange-warning":{backgroundImage:Ia("orange")},".cm-lintRange-info":{backgroundImage:Ia("#999")},".cm-lintRange-hint":{backgroundImage:Ia("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function kP(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function SP(t){let e="hint",n=1;for(let r of t){let s=kP(r.severity);s>n&&(n=s,e=r.severity)}return e}const CP=[Bt,_.decorations.compute([Bt],t=>{let{selected:e,panel:n}=t.field(Bt);return!e||!n||e.from==e.to?ie.none:ie.set([fP.range(e.from,e.to)])}),O4(pP,{hideOn:hP}),wP];var vm=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(nP)),e.defaultKeymap!==!1&&(r=r.concat(Yj)),e.searchKeymap!==!1&&(r=r.concat(wN)),e.historyKeymap!==!1&&(r=r.concat(nj)),e.foldKeymap!==!1&&(r=r.concat(f5)),e.completionKeymap!==!1&&(r=r.concat(Fy)),e.lintKeymap!==!1&&(r=r.concat(bP));var s=[];return e.lineNumbers!==!1&&s.push(F4()),e.highlightActiveLineGutter!==!1&&s.push(H4()),e.highlightSpecialChars!==!1&&s.push(r4()),e.history!==!1&&s.push(G5()),e.foldGutter!==!1&&s.push(x5()),e.drawSelection!==!1&&s.push(K3()),e.dropCursor!==!1&&s.push(Q3()),e.allowMultipleSelections!==!1&&s.push(ke.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(r5()),e.syntaxHighlighting!==!1&&s.push(pu(w5,{fallback:!0})),e.bracketMatching!==!1&&s.push(O5()),e.closeBrackets!==!1&&s.push(XN()),e.autocompletion!==!1&&s.push(cP()),e.rectangularSelection!==!1&&s.push(x4()),n!==!1&&s.push(v4()),e.highlightActiveLine!==!1&&s.push(c4()),e.highlightSelectionMatches!==!1&&s.push(nN()),e.tabSize&&typeof e.tabSize=="number"&&s.push(Xl.of(" ".repeat(e.tabSize))),s.concat([Jl.of(r.flat())]).filter(Boolean)};const jP="#e5c07b",wm="#e06c75",NP="#56b6c2",PP="#ffffff",tl="#abb2bf",Nh="#7d8799",OP="#61afef",MP="#98c379",km="#d19a66",AP="#c678dd",DP="#21252b",Sm="#2c313a",Cm="#282c34",Jc="#353a42",TP="#3E4451",jm="#528bff",EP=_.theme({"&":{color:tl,backgroundColor:Cm},".cm-content":{caretColor:jm},".cm-cursor, .cm-dropCursor":{borderLeftColor:jm},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:TP},".cm-panels":{backgroundColor:DP,color:tl},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Cm,color:Nh,border:"none"},".cm-activeLineGutter":{backgroundColor:Sm},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Jc},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Jc,borderBottomColor:Jc},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Sm,color:tl}}},{dark:!0}),LP=Ts.define([{tag:L.keyword,color:AP},{tag:[L.name,L.deleted,L.character,L.propertyName,L.macroName],color:wm},{tag:[L.function(L.variableName),L.labelName],color:OP},{tag:[L.color,L.constant(L.name),L.standard(L.name)],color:km},{tag:[L.definition(L.name),L.separator],color:tl},{tag:[L.typeName,L.className,L.number,L.changed,L.annotation,L.modifier,L.self,L.namespace],color:jP},{tag:[L.operator,L.operatorKeyword,L.url,L.escape,L.regexp,L.link,L.special(L.string)],color:NP},{tag:[L.meta,L.comment],color:Nh},{tag:L.strong,fontWeight:"bold"},{tag:L.emphasis,fontStyle:"italic"},{tag:L.strikethrough,textDecoration:"line-through"},{tag:L.link,color:Nh,textDecoration:"underline"},{tag:L.heading,fontWeight:"bold",color:wm},{tag:[L.atom,L.bool,L.special(L.variableName)],color:km},{tag:[L.processingInstruction,L.string,L.inserted],color:MP},{tag:L.invalid,color:PP}]),RP=[EP,pu(LP)];var IP=_.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),$P=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:s=!1,theme:i="light",placeholder:o="",basicSetup:a=!0}=e,l=[];switch(n&&l.unshift(Jl.of([Jj])),a&&(typeof a=="boolean"?l.unshift(vm()):l.unshift(vm(a))),o&&l.unshift(f4(o)),i){case"light":l.push(IP);break;case"dark":l.push(RP);break;case"none":break;default:l.push(i);break}return r===!1&&l.push(_.editable.of(!1)),s&&l.push(ke.readOnly.of(!0)),[...l]},BP=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class FP{constructor(e,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class Nm{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var Qc=null,zP=()=>typeof window>"u"?new Nm:(Qc||(Qc=new Nm),Qc),Pm=Ln.define(),VP=200,HP=[];function _P(t){var{value:e,selection:n,onChange:r,onStatistics:s,onCreateEditor:i,onUpdate:o,extensions:a=HP,autoFocus:l,theme:d="light",height:h=null,minHeight:u=null,maxHeight:f=null,width:p=null,minWidth:g=null,maxWidth:x=null,placeholder:b="",editable:y=!0,readOnly:w=!1,indentWithTab:C=!0,basicSetup:S=!0,root:k,initialState:N}=t,[v,P]=m.useState(),[O,E]=m.useState(),[M,D]=m.useState(),$=m.useState(()=>({current:null}))[0],F=m.useState(()=>({current:null}))[0],z=_.theme({"&":{height:h,minHeight:u,maxHeight:f,width:p,minWidth:g,maxWidth:x},"& .cm-scroller":{height:"100% !important"}}),G=_.updateListener.of(Q=>{if(Q.docChanged&&typeof r=="function"&&!Q.transactions.some(W=>W.annotation(Pm))){$.current?$.current.reset():($.current=new FP(()=>{if(F.current){var W=F.current;F.current=null,W()}$.current=null},VP),zP().add($.current));var ce=Q.state.doc,fe=ce.toString();r(fe,Q)}s&&s(BP(Q))}),le=$P({theme:d,editable:y,readOnly:w,placeholder:b,indentWithTab:C,basicSetup:S}),Z=[G,z,...le];return o&&typeof o=="function"&&Z.push(_.updateListener.of(o)),Z=Z.concat(a),m.useLayoutEffect(()=>{if(v&&!M){var Q={doc:e,selection:n,extensions:Z},ce=N?ke.fromJSON(N.json,Q,N.fields):ke.create(Q);if(D(ce),!O){var fe=new _({state:ce,parent:v,root:k});E(fe),i&&i(fe,ce)}}return()=>{O&&(D(void 0),E(void 0))}},[v,M]),m.useEffect(()=>{t.container&&P(t.container)},[t.container]),m.useEffect(()=>()=>{O&&(O.destroy(),E(void 0)),$.current&&($.current.cancel(),$.current=null)},[O]),m.useEffect(()=>{l&&O&&O.focus()},[l,O]),m.useEffect(()=>{O&&O.dispatch({effects:me.reconfigure.of(Z)})},[d,a,h,u,f,p,g,x,b,y,w,C,S,r,o]),m.useEffect(()=>{if(e!==void 0){var Q=O?O.state.doc.toString():"";if(O&&e!==Q){var ce=$.current&&!$.current.isDone,fe=()=>{O&&e!==O.state.doc.toString()&&O.dispatch({changes:{from:0,to:O.state.doc.toString().length,insert:e||""},annotations:[Pm.of(!0)]})};ce?F.current=fe:fe()}}},[e,O]),{state:M,setState:D,view:O,setView:E,container:v,setContainer:P}}var WP=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Wy=m.forwardRef((t,e)=>{var{className:n,value:r="",selection:s,extensions:i=[],onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:d,autoFocus:h,theme:u="light",height:f,minHeight:p,maxHeight:g,width:x,minWidth:b,maxWidth:y,basicSetup:w,placeholder:C,indentWithTab:S,editable:k,readOnly:N,root:v,initialState:P}=t,O=$5(t,WP),E=m.useRef(null),{state:M,view:D,container:$,setContainer:F}=_P({root:v,value:r,autoFocus:h,theme:u,height:f,minHeight:p,maxHeight:g,width:x,minWidth:b,maxWidth:y,basicSetup:w,placeholder:C,indentWithTab:S,editable:k,readOnly:N,selection:s,onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:d,extensions:i,initialState:P});m.useImperativeHandle(e,()=>({editor:E.current,state:M,view:D}),[E,$,M,D]);var z=m.useCallback(le=>{E.current=le,F(le)},[F]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var G=typeof u=="string"?"cm-theme-"+u:"cm-theme";return c.jsx("div",yh({ref:z,className:""+G+(n?" "+n:"")},O))});Wy.displayName="CodeMirror";const UP=()=>{const t=_.theme({"&":{backgroundColor:"var(--dash-surface)",color:"var(--dash-text)",height:"100%"},".cm-editor":{height:"100% !important"},".cm-content":{caretColor:"var(--dash-accent)",fontFamily:"'JetBrains Mono', Menlo, monospace",padding:"1rem"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--dash-accent)"},"& ::selection":{backgroundColor:"var(--dash-accent-selection) !important",color:"inherit !important"},".cm-gutters":{backgroundColor:"var(--dash-surface)",color:"var(--dash-text-muted)",border:"none",borderRight:"1px solid var(--dash-border)",paddingRight:"0.5rem"},".cm-lineNumbers .cm-gutterElement":{padding:"0 0.5rem 0 1rem",minWidth:"3rem"},".cm-activeLineGutter":{backgroundColor:"var(--dash-accent-subtle)",color:"var(--dash-accent)",fontWeight:"600"},".cm-activeLine":{backgroundColor:"color-mix(in srgb, var(--dash-accent) 8%, transparent)"},".cm-matchingBracket":{backgroundColor:"var(--dash-accent-subtle)",outline:"1px solid var(--dash-accent)"},".cm-scroller":{overflow:"auto !important",height:"100%",maxHeight:"100%"}}),e=Ts.define([{tag:L.propertyName,color:"var(--dash-accent)"},{tag:L.string,color:"color-mix(in srgb, var(--dash-accent) 70%, var(--dash-text))"},{tag:L.number,color:"var(--dash-accent-hover)"},{tag:L.bool,color:"var(--dash-accent-hover)"},{tag:L.null,color:"var(--dash-text-muted)"},{tag:L.punctuation,color:"var(--dash-text-secondary)"},{tag:L.brace,color:"var(--dash-text-secondary)"},{tag:L.bracket,color:"var(--dash-text-secondary)"}]);return[t,pu(e)]},KP=({value:t,onChange:e,onCursorLineChange:n,onEditorFocus:r,height:s="100%",readOnly:i=!1,className:o})=>{const a=m.useMemo(()=>[I5(),_.lineWrapping,...UP()],[]),l=m.useMemo(()=>{if(n)return d=>{const h=d.state.selection.main.head,u=d.view.state.doc.lineAt(h).number-1;n(u)}},[n]);return c.jsx("div",{className:`h-full [&_.cm-editor]:h-full [&_.cm-editor]:outline-none [&_.cm-focused]:outline-none ${o??""}`.trim(),children:c.jsx(Wy,{value:t,height:s,extensions:a,onChange:e,onFocus:r,onUpdate:l,theme:"none",readOnly:i,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightActiveLine:!0,foldGutter:!1,dropCursor:!0,drawSelection:!1,allowMultipleSelections:!1,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!1,rectangularSelection:!1,crosshairCursor:!1,highlightSelectionMatches:!0}})})},Nu=({width:t,isLoading:e,jsonText:n,cursorLine:r,syntaxError:s,onChange:i,onEditorFocus:o,onCursorLineChange:a,readOnly:l=!1,headerTitle:d,headerPath:h,headerActions:u})=>{const{t:f}=X(),p=g=>{if(l||!g.target.closest(".cm-editor"))return;const b=g.currentTarget;b.scrollHeight<=b.clientHeight||(b.scrollTop+=g.deltaY)};return c.jsxs("div",{style:{width:`${t}%`},className:"bg-dash-surface border border-dash-border rounded-xl overflow-hidden flex flex-col shadow-sm min-w-0 h-full",children:[c.jsx("div",{className:"p-3 border-b border-dash-border bg-dash-surface-hover/50 shrink-0",children:c.jsxs("div",{className:"flex items-end justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("h3",{className:"text-xs font-bold text-dash-text-secondary uppercase tracking-widest",children:d??f("jsonTab")}),h&&c.jsx("p",{className:"mt-1 mono text-[11px] text-dash-text-muted truncate",children:h})]}),u&&c.jsx("div",{className:"flex items-center gap-2 shrink-0",children:u})]})}),c.jsx("div",{className:"flex-1 min-h-0 overflow-auto",onWheelCapture:p,children:e?c.jsx("div",{className:"h-full flex items-center justify-center",children:c.jsx("div",{className:"animate-pulse text-dash-text-muted text-sm",children:f("loading")})}):l?c.jsx("pre",{className:"h-full overflow-auto p-4 font-mono text-xs leading-4 text-dash-text whitespace-pre m-0",children:n}):c.jsx(KP,{value:n,onChange:i,onEditorFocus:o,onCursorLineChange:a,readOnly:l,className:"[&_.cm-content]:text-xs [&_.cm-content]:leading-4 [&_.cm-gutters]:text-xs [&_.cm-gutters]:leading-4"})}),c.jsxs("div",{className:"px-4 py-2 bg-dash-surface-hover/30 border-t border-dash-border text-[10px] text-dash-text-muted flex justify-between uppercase tracking-widest font-bold",children:[c.jsxs("div",{className:"flex gap-4",children:[c.jsx("span",{children:"UTF-8"}),c.jsx("span",{children:"JSON"}),c.jsxs("span",{children:["L:",r+1]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[l&&c.jsx("span",{children:f("readOnly")}),s?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),c.jsx("span",{className:"text-red-500 normal-case",children:s})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-dash-accent"}),f("syntaxValid")]})]})]})]})},Om=({label:t,value:e})=>c.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 bg-dash-bg border border-dash-border rounded-md",children:[c.jsxs("span",{className:"text-[9px] font-bold text-dash-text-muted uppercase",children:[t,":"]}),c.jsx("span",{className:"text-[10px] mono font-bold text-dash-text-secondary",children:e})]}),Uy=({width:t,fieldDoc:e,activeFieldPath:n,extraContent:r,overrideBadge:s})=>{const{t:i,lang:o}=X(),a=e??(n?G0[n]??{path:n,type:"unknown",default:"n/a",description:"Help is being resolved for this field. Try editing the value or switching to the JSON view for schema-based details.",descriptionVi:"Đang tải trợ giúp cho trường này. Hãy thử chỉnh sửa giá trị hoặc chuyển sang chế độ JSON để xem mô tả suy ra từ schema."}:null);return c.jsxs("div",{style:{width:`${t}%`},className:"bg-dash-surface border border-dash-border rounded-xl flex flex-col shadow-sm overflow-hidden min-w-0",children:[c.jsx("div",{className:"p-3 border-b border-dash-border bg-dash-surface-hover/50 shrink-0",children:c.jsx("h3",{className:"text-xs font-bold text-dash-text-secondary uppercase tracking-widest",children:i("configurationHelp")})}),c.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:a?c.jsxs("div",{className:"space-y-5 animate-in fade-in duration-500",children:[c.jsxs("header",{children:[c.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[c.jsx("span",{className:"text-[10px] bg-dash-accent-subtle text-dash-accent px-1.5 py-0.5 rounded font-mono uppercase font-bold",children:i("field")}),c.jsx("h2",{className:"text-base font-bold text-dash-text mono break-all",children:a.path}),s]}),c.jsxs("div",{className:"flex flex-wrap gap-2 mt-2",children:[c.jsx(Om,{label:i("type"),value:a.type}),c.jsx(Om,{label:i("default"),value:a.default})]})]}),c.jsxs("section",{children:[c.jsx("h4",{className:"text-[10px] font-bold text-dash-text-muted uppercase tracking-widest mb-2",children:i("description")}),c.jsx("p",{className:"text-sm text-dash-text-secondary leading-relaxed italic",children:o==="vi"?a.descriptionVi:a.description})]}),a.validValues&&c.jsxs("section",{children:[c.jsx("h4",{className:"text-[10px] font-bold text-dash-text-muted uppercase tracking-widest mb-2",children:i("validValues")}),c.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.validValues.map(l=>c.jsx("span",{className:"px-2 py-0.5 bg-dash-bg border border-dash-border rounded text-[11px] mono text-dash-text",children:l},l))})]}),a.effect&&c.jsxs("section",{className:"bg-dash-accent-subtle/30 p-3 rounded-lg border border-dash-accent/10",children:[c.jsx("h4",{className:"text-[10px] font-bold text-dash-accent uppercase tracking-widest mb-1",children:i("systemEffect")}),c.jsx("p",{className:"text-[12px] text-dash-text-secondary leading-normal",children:o==="vi"&&a.effectVi?a.effectVi:a.effect})]}),a.example&&c.jsxs("section",{children:[c.jsx("h4",{className:"text-[10px] font-bold text-dash-text-muted uppercase tracking-widest mb-2",children:i("exampleUsage")}),c.jsx("div",{className:"bg-dash-bg p-3 rounded-lg border border-dash-border overflow-hidden",children:c.jsx("pre",{className:"text-[11px] mono text-dash-text-secondary whitespace-pre overflow-x-auto",children:a.example})})]}),r]}):c.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center opacity-40 space-y-4",children:[c.jsx("div",{className:"w-10 h-10 rounded-full bg-dash-bg border border-dash-border flex items-center justify-center text-lg",children:"?"}),c.jsxs("div",{className:"max-w-[180px]",children:[c.jsx("p",{className:"text-sm font-bold text-dash-text mb-1 italic",children:i("knowledgeBase")}),c.jsx("p",{className:"text-xs text-dash-text-secondary",children:i("clickToSeeHelp")})]})]})}),a&&c.jsx("div",{className:"p-3 bg-dash-surface-hover/20 border-t border-dash-border shrink-0",children:c.jsxs("p",{className:"text-[10px] text-dash-text-muted font-medium flex items-center gap-1.5 italic",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),i("extractedFrom")]})})]})},GP=({variant:t="development"})=>{const{t:e}=X(),n={development:e("developmentFeature"),beta:e("betaFeature"),experimental:e("experimentalFeature")};return c.jsx("span",{className:"text-[9px] bg-orange-500/10 text-orange-500 px-2 py-0.5 rounded-full font-bold border border-orange-500/30 uppercase tracking-wider",children:n[t]})},Mm={codex:{heavy:{model:"gpt-5.4",effort:"xhigh"},balanced:{model:"gpt-5.4",effort:"high"},light:{model:"gpt-5.4-mini",effort:"medium"}},"gemini-cli":{heavy:{model:"gemini-3.1-pro-preview"},balanced:{model:"gemini-3.1-pro-preview"},light:{model:"gemini-3-flash-preview"}}},qP={codex:"Codex","gemini-cli":"Gemini CLI"},Am=["heavy","balanced","light"];function Dm(t,e){return e.split(".").reduce((n,r)=>{if(n!=null&&typeof n=="object"&&r in n)return n[r]},t)}const Tm="bg-transparent border border-dash-border rounded px-2 py-1 text-sm text-dash-text placeholder:text-dash-text-muted focus:border-dash-accent focus:outline-none w-full",YP=({config:t,onChange:e})=>{const{t:n}=X(),[r,s]=m.useState(!1),i=(l,d,h,u)=>{const f=`modelTaxonomy.${l}.${d}.${h}`;e(f,u===""?void 0:u)},o=l=>{for(const d of Am)e(`modelTaxonomy.${l}.${d}.model`,void 0),Mm[l]?.[d]?.effort!==void 0&&e(`modelTaxonomy.${l}.${d}.effort`,void 0)},a=l=>n(l==="heavy"?"taxonomyTierHeavy":l==="balanced"?"taxonomyTierBalanced":"taxonomyTierLight");return c.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-lg overflow-hidden flex flex-col h-full",children:[c.jsxs("button",{type:"button",onClick:()=>s(!r),className:"w-full flex items-center justify-between px-4 py-3 bg-dash-surface-hover/30 hover:bg-dash-surface-hover/50 transition-colors","aria-expanded":!r,"aria-controls":"section-model-taxonomy",children:[c.jsx("h3",{className:"text-sm font-bold text-dash-text uppercase tracking-wider",children:n("sectionModelTaxonomy")}),c.jsx("svg",{className:`w-4 h-4 text-dash-text-muted transition-transform duration-200 ${r?"":"rotate-180"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),!r&&c.jsx("div",{id:"section-model-taxonomy",className:"flex-1 overflow-y-auto min-h-0",children:c.jsxs("div",{className:"px-4 py-3 space-y-4",children:[c.jsx("p",{className:"text-xs text-dash-text-secondary",children:n("taxonomyDescription")}),Object.entries(Mm).map(([l,d])=>{const h=Object.values(d).some(u=>u.effort!==void 0);return c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"text-xs font-semibold text-dash-text uppercase tracking-wider",children:qP[l]??l}),c.jsx("button",{type:"button",onClick:()=>o(l),className:"text-xs text-dash-text-muted hover:text-dash-text px-2 py-0.5 rounded border border-dash-border hover:border-dash-accent transition-colors",children:n("taxonomyResetProvider")})]}),c.jsx("div",{className:"overflow-hidden rounded border border-dash-border",children:c.jsxs("table",{className:"w-full text-xs",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"bg-dash-surface-hover/40 border-b border-dash-border",children:[c.jsx("th",{className:"text-left px-3 py-2 text-dash-text-secondary font-medium w-1/4",children:n("taxonomyTier")}),c.jsx("th",{className:"text-left px-3 py-2 text-dash-text-secondary font-medium",children:n("taxonomyModel")}),h&&c.jsx("th",{className:"text-left px-3 py-2 text-dash-text-secondary font-medium w-1/4",children:n("taxonomyEffort")})]})}),c.jsx("tbody",{children:Am.map(u=>{const f=d[u],p=Dm(t,`modelTaxonomy.${l}.${u}.model`),g=Dm(t,`modelTaxonomy.${l}.${u}.effort`);return c.jsxs("tr",{className:"border-b border-dash-border last:border-0",children:[c.jsx("td",{className:"px-3 py-2 text-dash-text-secondary",children:a(u)}),c.jsx("td",{className:"px-3 py-2",children:c.jsx("input",{type:"text",className:Tm,placeholder:f?.model??"",value:p??"",onChange:x=>i(l,u,"model",x.target.value)})}),h&&c.jsx("td",{className:"px-3 py-2",children:f?.effort!==void 0?c.jsx("input",{type:"text",className:Tm,placeholder:f.effort,value:g??"",onChange:x=>i(l,u,"effort",x.target.value)}):null})]},u)})})]})})]},l)})]})})]})},JP=(t,e)=>{const[n,r]=m.useState(null);return m.useEffect(()=>{const s=t.split(`
|
|
243
|
+
`),i=[];let o=null;for(let a=0;a<=Math.min(e,s.length-1);a++){const l=s[a].trim(),d=l.match(/"([^"]+)"\s*:\s*{/);if(d){i.push(d[1]),a===e&&(o=i.join("."));continue}if(l==="}"||l==="},"){i.pop();continue}const h=l.match(/"([^"]+)"\s*:/);if(h){const u=h[1];if(a===e){o=i.length>0?`${i.join(".")}.${u}`:u;break}}}r(o)},[t,e]),n};function Ky(t){const{scope:e,fetchConfig:n,fetchSchema:r,saveConfig:s,onReset:i}=t,[o,a]=m.useState("{}"),[l,d]=m.useState(0),[h,u]=m.useState(null),[f,p]=m.useState(null),[g,x]=m.useState({}),[b,y]=m.useState({}),[w,C]=m.useState({}),[S,k]=m.useState(!0),[N,v]=m.useState("idle"),[P,O]=m.useState(!1),[E,M]=m.useState(null),[D,$]=m.useState(null),F=JP(o,l),z=Uk(D,F),G=m.useMemo(()=>Wk(z,f),[z,f]);m.useEffect(()=>{(async()=>{try{const[oe,ue]=await Promise.all([n(),r()]),be=oe.local??oe.config;x(be),y(oe.global??{}),C(oe.sources),p(ue),a(JSON.stringify(be,null,2))}catch(oe){console.error("Failed to load config data:",oe)}finally{k(!1)}})()},[n,r]),m.useEffect(()=>{try{JSON.parse(o),u(null)}catch(W){u(W instanceof Error?W.message:"Invalid JSON")}},[o]),m.useEffect(()=>{if(E==="json")try{const W=JSON.parse(o);x(W)}catch{}},[o,E]);const le=m.useCallback(W=>{$(null),M("json"),a(W)},[]),Z=m.useCallback(()=>{$(null)},[]),Q=m.useCallback((W,oe)=>{$(W),M("form"),x(ue=>{const be=Hk(ue,W,oe);return a(JSON.stringify(be,null,2)),be}),C(ue=>({...ue,[W]:e}))},[e]),ce=m.useCallback(async()=>{if(!h){v("saving");try{const W=JSON.parse(o),ue=await s(W)??W;x(ue),a(JSON.stringify(ue,null,2)),v("saved"),setTimeout(()=>v("idle"),2e3)}catch{v("error"),setTimeout(()=>v("idle"),3e3)}}},[o,h,s]),fe=m.useCallback(async()=>{if(O(!1),i){k(!0);try{const W=await i(),oe=W.local??W.config;x(oe),C(W.sources),a(JSON.stringify(oe,null,2))}catch(W){console.error("Failed to reset:",W)}finally{k(!1)}}else{const W={};x(W),a(JSON.stringify(W,null,2))}},[i]);return{jsonText:o,config:g,globalConfig:b,sources:w,schema:f,isLoading:S,saveStatus:N,syntaxError:h,cursorLine:l,showResetConfirm:P,activeFieldPath:z,fieldDoc:G,handleJsonChange:le,handleJsonEditorFocus:Z,handleFormChange:Q,handleSave:ce,handleReset:fe,setCursorLine:d,setFocusedFieldPath:$,setShowResetConfirm:O}}function Pu({storageKey:t,defaultSizes:e,minSizes:n}){const[r,s]=m.useState(()=>{if(typeof window>"u")return e;const d=localStorage.getItem(t);if(d)try{const h=JSON.parse(d);if(Array.isArray(h)&&h.length===e.length){const u=h.reduce((f,p)=>f+p,0);if(Math.abs(u-100)<1)return h}}catch{}return e}),[i,o]=m.useState(!1);m.useEffect(()=>{localStorage.setItem(t,JSON.stringify(r))},[r,t]);const a=m.useCallback((d,h)=>{h.preventDefault(),o(!0);let u=h.currentTarget.parentElement;for(;u&&getComputedStyle(u).display!=="flex";)u=u.parentElement;if(!u)return;const p=u.getBoundingClientRect().width,g=h.clientX,x=[...r],b=w=>{const S=(w.clientX-g)/p*100,k=[...x],N=d,v=d+1;let P=x[N]+S,O=x[v]-S;P<n[N]&&(P=n[N],O=x[N]+x[v]-P),O<n[v]&&(O=n[v],P=x[N]+x[v]-O),k[N]=P,k[v]=O,s(k)},y=()=>{o(!1),document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",y),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",b),document.addEventListener("mouseup",y),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[r,n]),l=m.useCallback(()=>{s(e)},[e]);return{sizes:r,isDragging:i,startDrag:a,reset:l}}const Wo="/api";async function Em(t){const e=`${Wo}/ck-config`,n=await fetch(e);if(!n.ok)throw new Error(`Failed to fetch ck-config: ${n.status}`);return n.json()}async function Lm(t,e){const n=new URLSearchParams({scope:t});e&&n.set("projectId",e);const r=await fetch(`${Wo}/ck-config?${n}`);if(!r.ok)throw new Error(`Failed to fetch ck-config: ${r.status}`);return r.json()}async function Gy(t){const e=await fetch(`${Wo}/ck-config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!e.ok){const n=await e.json().catch(()=>({error:"Unknown error"}));throw new Error(n.error||`Failed to save ck-config: ${e.status}`)}return e.json()}async function qy(){const t=await fetch(`${Wo}/ck-config/schema`);if(!t.ok)throw new Error(`Failed to fetch schema: ${t.status}`);return t.json()}async function QP(t,e,n,r){const s=await fetch(`${Wo}/ck-config/field`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:n,projectId:r,fieldPath:t,value:e})});if(!s.ok){const i=await s.json().catch(()=>({error:"Unknown error"}));throw new Error(i.error||`Failed to update field: ${s.status}`)}}function XP(t,e,n,r){const[s,i]=m.useState(()=>{if(typeof window>"u")return e;const d=localStorage.getItem(t);if(d){const h=Number.parseFloat(d);if(!Number.isNaN(h)&&h>=n&&h<=100-r)return h}return e}),[o,a]=m.useState(!1),l=m.useCallback(d=>{d.preventDefault(),a(!0);const h=d.target.closest("[data-vresize-container]");if(!h)return;const u=p=>{const g=h.getBoundingClientRect(),x=(p.clientY-g.top)/g.height*100;i(Math.max(n,Math.min(100-r,x)))},f=()=>{a(!1),document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",f),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",u),document.addEventListener("mouseup",f),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[n,r]);return m.useEffect(()=>{localStorage.setItem(t,String(s))},[t,s]),{topPct:s,isDragging:o,startDrag:l}}const ZP=()=>{const{t}=X(),e=tn(),{sizes:n,isDragging:r,startDrag:s}=Pu({storageKey:"claudekit-global-config-panels",defaultSizes:[35,40,25],minSizes:[20,25,15]}),i=XP("claudekit-form-taxonomy-split",70,25,15),o=m.useCallback(async()=>await Em(),[]),a=m.useCallback(async f=>{await Gy({scope:"global",config:f})},[]),l=m.useCallback(async()=>await Em(),[]),d=Ky({scope:"global",fetchConfig:o,fetchSchema:qy,saveConfig:a,onReset:l}),h=m.useMemo(()=>[{id:"general",title:t("sectionGeneral"),fields:[{path:"codingLevel",label:t("fieldCodingLevel"),description:t("fieldCodingLevelDesc")},{path:"statusline",label:t("fieldStatusline"),description:t("fieldStatuslineDesc")},{path:"statuslineColors",label:t("fieldStatuslineColors"),description:t("fieldStatuslineColorsDesc")},{path:"locale.thinkingLanguage",label:t("fieldThinkingLanguage"),description:t("fieldThinkingLanguageDesc")},{path:"locale.responseLanguage",label:t("fieldResponseLanguage"),description:t("fieldResponseLanguageDesc")}]},{id:"paths",title:t("sectionPaths"),fields:[{path:"paths.docs",label:t("fieldDocsPath"),description:t("fieldDocsPathDesc")},{path:"paths.plans",label:t("fieldPlansPath"),description:t("fieldPlansPathDesc")}]},{id:"privacy",title:t("sectionPrivacy"),defaultCollapsed:!0,fields:[{path:"privacyBlock",label:t("fieldPrivacyBlock"),description:t("fieldPrivacyBlockDesc")},{path:"trust.enabled",label:t("fieldTrustEnabled"),description:t("fieldTrustEnabledDesc")},{path:"trust.passphrase",label:t("fieldTrustPassphrase"),description:t("fieldTrustPassphraseDesc")}]},{id:"project",title:t("sectionProject"),defaultCollapsed:!0,fields:[{path:"project.type",label:t("fieldProjectType"),description:t("fieldProjectTypeDesc")},{path:"project.packageManager",label:t("fieldPackageManager"),description:t("fieldPackageManagerDesc")},{path:"project.framework",label:t("fieldFramework"),description:t("fieldFrameworkDesc")}]},{id:"integrations",title:t("sectionIntegrations"),defaultCollapsed:!0,fields:[{path:"gemini.model",label:t("fieldGeminiModel"),description:t("fieldGeminiModelDesc")},{path:"skills.research.useGemini",label:t("fieldResearchUseGemini"),description:t("fieldResearchUseGeminiDesc")}]},{id:"hooks",title:t("sectionHooks"),defaultCollapsed:!0,fields:[{path:"hooks.session-init",label:t("fieldHookSessionInit"),description:t("fieldHookSessionInitDesc")},{path:"hooks.subagent-init",label:t("fieldHookSubagentInit"),description:t("fieldHookSubagentInitDesc")},{path:"hooks.descriptive-name",label:t("fieldHookDescriptiveName"),description:t("fieldHookDescriptiveNameDesc")},{path:"hooks.dev-rules-reminder",label:t("fieldHookDevRulesReminder"),description:t("fieldHookDevRulesReminderDesc")},{path:"hooks.usage-context-awareness",label:t("fieldHookUsageContextAwareness"),description:t("fieldHookUsageContextAwarenessDesc")},{path:"hooks.context-tracking",label:t("fieldHookContextTracking"),description:t("fieldHookContextTrackingDesc")},{path:"hooks.scout-block",label:t("fieldHookScoutBlock"),description:t("fieldHookScoutBlockDesc")},{path:"hooks.privacy-block",label:t("fieldHookPrivacyBlock"),description:t("fieldHookPrivacyBlockDesc")},{path:"hooks.post-edit-simplify-reminder",label:t("fieldHookPostEditSimplify"),description:t("fieldHookPostEditSimplifyDesc")}]},{id:"advanced",title:t("sectionAdvanced"),defaultCollapsed:!0,fields:[{path:"docs.maxLoc",label:t("fieldDocsMaxLoc"),description:t("fieldDocsMaxLocDesc")},{path:"plan.namingFormat",label:t("fieldPlanNamingFormat"),description:t("fieldPlanNamingFormatDesc")},{path:"plan.dateFormat",label:t("fieldPlanDateFormat"),description:t("fieldPlanDateFormatDesc")},{path:"plan.validation.mode",label:t("fieldPlanValidationMode"),description:t("fieldPlanValidationModeDesc")},{path:"plan.validation.minQuestions",label:t("fieldPlanMinQuestions"),description:t("fieldPlanMinQuestionsDesc")},{path:"plan.validation.maxQuestions",label:t("fieldPlanMaxQuestions"),description:t("fieldPlanMaxQuestionsDesc")},{path:"assertions",label:t("fieldAssertions"),description:t("fieldAssertionsDesc")}]}],[t]),u=d.showResetConfirm?c.jsxs("div",{className:"flex items-center gap-2 bg-red-500/10 border border-red-500/30 rounded-lg px-2 py-1 animate-in fade-in duration-200",children:[c.jsx("span",{className:"text-xs text-red-500 font-medium",children:t("confirmReset")}),c.jsx("button",{type:"button",onClick:d.handleReset,className:"px-2 py-0.5 rounded bg-red-500 text-white text-xs font-bold hover:bg-red-600 transition-colors",children:t("confirm")}),c.jsx("button",{type:"button",onClick:()=>d.setShowResetConfirm(!1),className:"px-2 py-0.5 rounded bg-dash-surface text-dash-text-secondary text-xs font-bold hover:bg-dash-surface-hover transition-colors border border-dash-border",children:t("cancel")})]}):c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>d.setShowResetConfirm(!0),className:"px-3 py-1.5 rounded-lg bg-dash-surface text-xs font-bold text-dash-text-secondary hover:bg-dash-surface-hover transition-colors border border-dash-border",children:t("resetToDefault")}),c.jsx("button",{type:"button",onClick:d.handleSave,disabled:!!d.syntaxError||d.saveStatus==="saving",className:`px-3 py-1.5 rounded-lg text-xs font-bold transition-all tracking-widest uppercase ${d.syntaxError?"bg-dash-surface text-dash-text-muted cursor-not-allowed border border-dash-border":d.saveStatus==="saved"?"bg-green-500 text-white shadow-lg shadow-green-500/20":d.saveStatus==="error"?"bg-red-500 text-white":"bg-dash-accent text-dash-bg hover:bg-dash-accent-hover shadow-lg shadow-dash-accent/20"}`,children:d.saveStatus==="saving"?t("saving"):d.saveStatus==="saved"?t("saved"):d.saveStatus==="error"?t("saveFailed"):t("saveChanges")})]});return c.jsxs("div",{className:"animate-in fade-in duration-300 w-full h-full flex flex-col transition-colors",children:[c.jsx(K0,{title:t("globalConfig"),filePath:"~/.claude/.ck.json",onBack:()=>e(-1),onSave:d.handleSave,onReset:d.handleReset,saveStatus:d.saveStatus,syntaxError:d.syntaxError,showResetConfirm:d.showResetConfirm,setShowResetConfirm:d.setShowResetConfirm,showActions:!1,showFilePath:!1}),c.jsx("div",{className:"flex-1 flex min-h-0",children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{"data-vresize-container":!0,style:{width:`${n[0]}%`},className:"flex flex-col min-w-0 min-h-0",children:[c.jsx("div",{style:{height:`${d.isLoading?100:i.topPct}%`},className:"min-h-0",children:c.jsx(J0,{width:100,isLoading:d.isLoading,schema:d.schema,config:d.config,sources:d.sources,sections:h,onChange:d.handleFormChange})}),!d.isLoading&&c.jsxs(c.Fragment,{children:[c.jsx(Jt,{direction:"vertical",isDragging:i.isDragging,onMouseDown:i.startDrag}),c.jsx("div",{style:{height:`${100-i.topPct}%`},className:"min-h-0",children:c.jsx(YP,{config:d.config,onChange:d.handleFormChange})})]})]}),c.jsx(Jt,{direction:"horizontal",isDragging:r,onMouseDown:f=>s(0,f)}),c.jsx(Nu,{width:n[1],isLoading:d.isLoading,jsonText:d.jsonText,cursorLine:d.cursorLine,syntaxError:d.syntaxError,onChange:d.handleJsonChange,onCursorLineChange:d.setCursorLine,headerPath:"~/.claude/.ck.json",headerActions:u}),c.jsx(Jt,{direction:"horizontal",isDragging:r,onMouseDown:f=>s(1,f)}),c.jsx(Uy,{width:n[2],fieldDoc:d.fieldDoc,activeFieldPath:d.activeFieldPath})]})})]})};function eO({phase:t}){const e=t.status==="completed"?"border-green-500":t.status==="in-progress"?"border-blue-500":"border-amber-400";return c.jsx("div",{className:`rounded border-l-4 ${e} bg-white dark:bg-gray-800 p-3 shadow-sm`,children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs font-mono text-gray-400 dark:text-gray-500",children:t.phaseId}),c.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:t.name})]})})}function Xc({title:t,phases:e,borderColor:n}){return c.jsxs("div",{className:"flex flex-1 flex-col gap-3 min-w-0","aria-label":`${t} phases`,children:[c.jsxs("div",{className:`rounded-t border-t-2 ${n} bg-gray-50 dark:bg-gray-900 px-3 py-2`,children:[c.jsx("span",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:t}),c.jsx("span",{className:"ml-2 text-xs text-gray-400",children:e.length})]}),c.jsx("div",{className:"flex flex-col gap-2 px-1",children:e.map((r,s)=>c.jsx(eO,{phase:r},`${r.phaseId}-${s}`))})]})}function tO({completed:t,total:e}){const{t:n}=X(),r=e===0?0:Math.round(t/e*100);return c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsxs("div",{className:"flex justify-between text-xs text-gray-500 dark:text-gray-400",children:[c.jsx("span",{children:n("kanbanProgress")}),c.jsxs("span",{children:[t,"/",e," ",n("kanbanPhases")," — ",r,"% ",n("kanbanComplete")]})]}),c.jsx("div",{className:"h-2 w-full rounded bg-gray-200 dark:bg-gray-700",children:c.jsx("div",{className:"h-2 rounded bg-green-500 transition-all",style:{width:`${r}%`}})})]})}function nO(){const{t}=X(),[e]=$2(),n=e.get("file")??"",[r,s]=m.useState([]),[i,o]=m.useState(!1),[a,l]=m.useState(null);if(m.useEffect(()=>{n&&(o(!0),l(null),s([]),fetch(`/api/plan/parse?file=${encodeURIComponent(n)}`).then(p=>{if(!p.ok){const g={400:"kanbanError400",403:"kanbanError403",404:"kanbanError404"};throw new Error(g[p.status]??`error:HTTP:${p.status}`)}return p.json()}).then(p=>s(p.phases)).catch(p=>l(p instanceof Error?p.message:String(p))).finally(()=>o(!1)))},[n]),!n)return c.jsx("div",{className:"flex h-full items-center justify-center text-gray-400 dark:text-gray-500",children:t("kanbanNoFile")});let d=[],h=[],u=[],f=null;try{d=r.filter(p=>p.status==="pending"),h=r.filter(p=>p.status==="in-progress"),u=r.filter(p=>p.status==="completed")}catch(p){f=p instanceof Error?p.message:String(p)}return f?c.jsx("div",{className:"flex h-full items-center justify-center text-red-500 dark:text-red-400",children:t("kanbanLoadError")}):c.jsxs("div",{className:"flex h-full flex-col gap-4 p-6",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-white",children:t("kanbanTitle")}),c.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 truncate max-w-xs",title:n,children:n.replaceAll("\\","/")})]}),r.length>0&&c.jsx(tO,{completed:u.length,total:r.length}),i&&c.jsx("div",{className:"flex flex-1 items-center justify-center text-gray-400",children:t("loading")}),a&&c.jsxs("div",{className:"rounded border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400",children:[t("error"),":"," ",a in{kanbanError400:"",kanbanError403:"",kanbanError404:""}?t(a):a]}),!i&&!a&&r.length===0&&c.jsx("div",{className:"flex flex-1 items-center justify-center text-gray-400 dark:text-gray-500",children:t("kanbanNoPhases")}),!i&&!a&&r.length>0&&c.jsxs("section",{"aria-label":t("kanbanTitle"),className:"flex flex-1 flex-col gap-4 overflow-auto md:flex-row",children:[c.jsx(Xc,{title:t("kanbanStatus_pending"),phases:d,borderColor:"border-amber-400"}),c.jsx(Xc,{title:t("kanbanStatus_in-progress"),phases:h,borderColor:"border-blue-500"}),c.jsx(Xc,{title:t("kanbanStatus_completed"),phases:u,borderColor:"border-green-500"})]})]})}function rO(){const[t,e]=m.useState([]),[n,r]=m.useState(!0),[s,i]=m.useState(null),o=m.useCallback(async()=>{try{r(!0),i(null);const a=await fetch("/api/mcp-servers");if(!a.ok)throw new Error(`Failed to fetch MCP servers: ${a.status}`);const l=await a.json();e(l.servers??[])}catch(a){i(a instanceof Error?a.message:"Failed to load MCP servers"),e([])}finally{r(!1)}},[]);return m.useEffect(()=>{o()},[o]),{servers:t,loading:n,error:s,reload:o}}function sO(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3.5 h-3.5 shrink-0 text-dash-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 12h14M12 5l7 7-7 7"})})}function iO({label:t,count:e}){return c.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[c.jsx("span",{className:"text-xs font-bold text-dash-text-muted uppercase tracking-wider flex-1",children:t}),c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold",children:e})]})}function oO({server:t,selected:e,onClick:n}){return c.jsxs("button",{type:"button",onClick:n,className:["w-full flex items-start gap-2 px-3 py-2 rounded-md transition-colors text-left group",e?"bg-dash-accent/10 border border-dash-accent/30":"hover:bg-dash-surface-hover border border-transparent"].join(" "),children:[c.jsx(sO,{}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:"text-sm font-semibold text-dash-accent font-mono",children:t.name}),c.jsx("p",{className:"text-xs text-dash-text-muted mt-0.5 truncate font-mono",children:t.command})]})]})}function aO({server:t}){const{t:e}=X();return c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("h2",{className:"text-base font-semibold text-dash-text font-mono truncate flex-1",children:t.name}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:e("sessionReadOnly")})]}),c.jsx("div",{className:"flex items-center gap-2 text-xs text-dash-text-muted",children:c.jsx("span",{className:"font-mono px-2 py-0.5 rounded bg-dash-surface border border-dash-border text-dash-accent",children:t.sourceLabel})}),c.jsx("div",{className:"rounded-lg border border-dash-border bg-dash-surface p-5 overflow-x-auto",children:c.jsx("table",{className:"w-full text-sm",children:c.jsxs("tbody",{children:[c.jsxs("tr",{className:"border-b border-dash-border",children:[c.jsx("td",{className:"py-2 pr-4 font-mono text-xs text-dash-text-muted w-28 shrink-0 align-top",children:e("mcpCommand")}),c.jsx("td",{className:"py-2 font-mono text-xs text-dash-text break-all",children:t.command})]}),t.args.length>0&&c.jsxs("tr",{className:"border-b border-dash-border",children:[c.jsx("td",{className:"py-2 pr-4 font-mono text-xs text-dash-text-muted w-28 align-top",children:e("mcpArgs")}),c.jsx("td",{className:"py-2 text-xs text-dash-text",children:c.jsx("div",{className:"flex flex-col gap-1",children:t.args.map((n,r)=>c.jsx("code",{className:"font-mono bg-dash-surface border border-dash-border rounded px-1.5 py-0.5 text-[11px] break-all",children:n},r))})})]}),t.env&&Object.keys(t.env).length>0&&c.jsxs("tr",{className:"border-b border-dash-border",children:[c.jsx("td",{className:"py-2 pr-4 font-mono text-xs text-dash-text-muted w-28 align-top",children:"env"}),c.jsx("td",{className:"py-2 text-xs text-dash-text",children:c.jsx("div",{className:"flex flex-col gap-1",children:Object.keys(t.env).map(n=>c.jsxs("code",{className:"font-mono bg-dash-surface border border-dash-border rounded px-1.5 py-0.5 text-[11px]",children:[n,"=",c.jsx("span",{className:"text-dash-text-muted",children:"***"})]},n))})})]}),c.jsxs("tr",{children:[c.jsx("td",{className:"py-2 pr-4 font-mono text-xs text-dash-text-muted w-28 align-top",children:e("mcpSource")}),c.jsx("td",{className:"py-2 text-xs text-dash-text font-mono",children:t.sourceLabel})]})]})})})]})}const lO=({message:t})=>c.jsx("div",{className:"flex items-center justify-center h-full text-sm text-dash-text-muted",children:t}),cO=()=>{const{t}=X(),{servers:e,loading:n,error:r}=rO(),[s,i]=m.useState(""),[o,a]=m.useState(null),{size:l,isDragging:d,startDrag:h}=Ms({storageKey:"ck-mcp-panel-width",defaultSize:380,minSize:260,maxSize:650}),u=x=>`${x.source}-${x.name}`,f=e.find(x=>u(x)===o)??null,p=m.useMemo(()=>{if(!s.trim())return e;const x=s.toLowerCase();return e.filter(b=>b.name.toLowerCase().includes(x)||b.command.toLowerCase().includes(x)||b.sourceLabel.toLowerCase().includes(x))},[e,s]),g=m.useMemo(()=>{const x=new Map;for(const b of p){const y=x.get(b.sourceLabel)??[];y.push(b),x.set(b.sourceLabel,y)}return x},[p]);return c.jsxs("div",{className:"flex h-full overflow-hidden",children:[c.jsxs("div",{style:{width:`${l}px`},className:"shrink-0 flex flex-col overflow-hidden border-r border-dash-border",children:[c.jsxs("div",{className:"shrink-0 px-4 pt-4 pb-3 border-b border-dash-border",children:[c.jsxs("div",{className:"flex items-start justify-between mb-3",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-base font-bold text-dash-text",children:t("mcpTitle")}),!n&&!r&&c.jsx("p",{className:"text-xs text-dash-text-muted mt-0.5",children:e.length===0?t("mcpNoServers"):`${e.length} ${e.length===1?"server":"servers"} configured`}),c.jsx("p",{className:"text-[11px] text-dash-text-muted font-mono mt-0.5",children:"~/.claude.json + settings.json + .mcp.json"})]}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:t("sessionReadOnly")})]}),c.jsxs("div",{className:"relative",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-dash-text-muted pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),c.jsx("input",{type:"text",value:s,onChange:x=>i(x.target.value),placeholder:t("mcpServerName"),className:"w-full pl-9 pr-4 py-2 text-sm bg-dash-surface border border-dash-border rounded-lg text-dash-text placeholder:text-dash-text-muted focus:outline-none focus:border-dash-accent/50 transition-colors"}),s&&c.jsx("button",{type:"button",onClick:()=>i(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-dash-text-muted hover:text-dash-text transition-colors",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-2 py-2",children:[n&&c.jsx("div",{className:"flex flex-1 items-center justify-center text-dash-text-muted text-sm p-8",children:t("loading")}),!n&&r&&c.jsx("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm m-2",children:r}),!n&&!r&&g.size===0&&c.jsx("div",{className:"flex items-center justify-center p-8 text-dash-text-muted text-sm",children:t("mcpNoServers")}),!n&&!r&&g.size>0&&c.jsx("div",{className:"flex flex-col gap-2 pb-4",children:Array.from(g.entries()).map(([x,b])=>c.jsxs("div",{children:[g.size>1&&c.jsx(iO,{label:x,count:b.length}),c.jsx("div",{className:"space-y-0.5",children:b.map(y=>{const w=u(y);return c.jsx(oO,{server:y,selected:o===w,onClick:()=>a(w)},w)})})]},x))})]})]}),c.jsx(Jt,{onMouseDown:h,isDragging:d,direction:"horizontal"}),c.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:f?c.jsx(aO,{server:f}):c.jsx(lO,{message:t("selectToView")})})]})},Rm=[{key:"agent",labelKey:"migrateTypeAgents",badgeClass:"border-dash-accent/30 text-dash-accent"},{key:"command",labelKey:"migrateTypeCommands",badgeClass:"border-yellow-500/30 text-yellow-400"},{key:"skill",labelKey:"migrateTypeSkills",badgeClass:"border-purple-500/30 text-purple-400"},{key:"config",labelKey:"migrateTypeConfig",badgeClass:"border-teal-500/30 text-teal-400"},{key:"rules",labelKey:"migrateTypeRules",badgeClass:"border-rose-500/30 text-rose-400"},{key:"hooks",labelKey:"migrateTypeHooks",badgeClass:"border-cyan-500/30 text-cyan-400"}],dO=new Set([8203,8204,8205,8288,65279,8232,8233,8234,8235,8236,8237,8238,8294,8295,8296,8297]);function hO(t){return t===9||t===10||t===13?!0:t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159||dO.has(t)}function Ar(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(hO(r)||(e+=n))}return e}function Im(t){if(!t)return"-";const e=t.replace(/\\/g,"/"),n=e.match(/.*\/(\.[^/]+\/)/);if(n?.[1]){const s=(n.index??0)+n[0].length-n[1].length;return e.slice(s)}const r=e.split("/");return r.length>3?`.../${r.slice(-3).join("/")}`:e}function cs(t){return t.success?t.skipped?"skipped":"installed":"failed"}function uO(t){const e={installed:0,skipped:0,failed:0};for(const n of t){const r=cs(n);r==="installed"?e.installed+=1:r==="skipped"?e.skipped+=1:e.failed+=1}return e}function Yy(t){switch(t){case"agent":case"command":case"skill":case"config":case"rules":case"hooks":case"unknown":return t;default:return"unknown"}}function fO(t,e){switch(t){case"failed":return{label:e("migrateStatusFailed"),className:"border-red-500/30 bg-red-500/10 text-red-400"};case"skipped":return{label:e("migrateStatusSkipped"),className:"border-yellow-500/30 bg-yellow-500/10 text-yellow-400"};default:return{label:e("migrateStatusInstalled"),className:"border-green-500/30 bg-green-500/10 text-green-400"}}}function pO(t){const e=new Map;for(const n of t){const r=Yy(n.portableType),s=e.get(r)||[];s.push(n),e.set(r,s)}return e}function mO(t){return[Yy(t.portableType),t.provider,t.providerDisplayName,t.itemName,t.path,t.success,t.skipped,t.overwritten,t.error,t.skipReason].map(n=>n===void 0?"":String(n)).join("|")}function gO(t){if(t.length===0)return!0;const e=t[0].provider;return t.every(n=>n.provider===e)}const bs=({label:t,count:e,className:n})=>e<=0?null:c.jsxs("span",{className:`inline-flex items-center gap-1 rounded-md border px-2.5 py-1 text-xs ${n}`,children:[c.jsx("span",{className:"font-semibold",children:e}),c.jsx("span",{children:t})]}),$m=({labelKey:t,badgeClass:e,items:n,isExpanded:r,onToggle:s,singleProvider:i})=>{const{t:o}=X(),a=n.filter(f=>cs(f)==="installed").length,l=n.filter(f=>cs(f)==="skipped").length,d=n.filter(f=>cs(f)==="failed").length,h=i?"md:grid-cols-[minmax(0,1.5fr)_minmax(0,1.35fr)_auto_minmax(0,1fr)]":"md:grid-cols-[minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,1.2fr)_auto_minmax(0,1fr)]",u=new Map;return c.jsxs("div",{className:"rounded-xl border border-dash-border bg-dash-surface overflow-hidden",children:[c.jsxs("button",{type:"button",onClick:s,className:"w-full flex flex-wrap items-center gap-2 px-4 py-3 text-left hover:bg-dash-surface-hover transition-colors",children:[c.jsx("svg",{className:`w-3.5 h-3.5 text-dash-text-muted transition-transform ${r?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:c.jsx("path",{d:"M9 5l7 7-7 7"})}),c.jsx("p",{className:"text-sm font-semibold text-dash-text",children:o(t)}),c.jsx("span",{className:`inline-flex items-center rounded-full border px-2 py-0.5 text-[11px] font-semibold ${e}`,children:n.length}),c.jsx("span",{className:"hidden sm:block flex-1"}),c.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[11px]",children:[c.jsx(bs,{label:o("migrateStatusInstalled"),count:a,className:"border-green-500/30 bg-green-500/10 text-green-400"}),c.jsx(bs,{label:o("migrateStatusSkipped"),count:l,className:"border-yellow-500/30 bg-yellow-500/10 text-yellow-400"}),c.jsx(bs,{label:o("migrateStatusFailed"),count:d,className:"border-red-500/30 bg-red-500/10 text-red-400"})]})]}),r&&c.jsxs("div",{className:"border-t border-dash-border/80",children:[c.jsxs("div",{className:`hidden md:grid ${h} items-center gap-3 px-4 py-2 border-b border-dash-border/70 text-[10px] font-semibold uppercase tracking-wide text-dash-text-muted`,children:[c.jsx("p",{children:o("migrateItem")}),!i&&c.jsx("p",{children:o("migrateProvider")}),c.jsx("p",{children:o("migratePath")}),c.jsx("p",{children:o("migrateStatus")}),c.jsx("p",{children:o("migrateError")})]}),c.jsx("div",{className:"divide-y divide-dash-border/70",children:n.map(f=>{const p=mO(f),g=u.get(p)??0;u.set(p,g+1);const x=g===0?p:`${p}#${g}`,b=cs(f),y=fO(b,o),w=Ar(f.itemName||Im(f.path)),C=Ar(f.providerDisplayName||f.provider||""),S=Ar(f.path||""),k=Ar(Im(f.path)),N=Ar(f.error||f.skipReason||"");return c.jsxs("div",{className:`grid gap-1.5 ${h} items-start px-4 py-2.5 hover:bg-dash-bg/60 transition-colors`,children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("p",{className:"text-xs font-semibold text-dash-text truncate",title:w,children:w}),c.jsxs("div",{className:"mt-0.5 space-y-0.5 md:hidden",children:[!i&&c.jsx("p",{className:"text-[11px] text-dash-text-secondary truncate",children:C}),c.jsx("p",{className:"font-mono text-[11px] text-dash-text-muted truncate",title:S,children:k}),N&&c.jsx("p",{className:"text-[11px] text-red-400/80 line-clamp-2",title:N,children:N})]})]}),!i&&c.jsx("p",{className:"hidden md:block text-[11px] text-dash-text-secondary truncate",children:C}),c.jsx("p",{className:"hidden md:block font-mono text-[11px] text-dash-text-muted truncate",title:S,children:k}),c.jsx("span",{className:`inline-flex w-fit items-center rounded-full border px-2 py-0.5 text-[11px] font-medium ${y.className}`,children:y.label}),c.jsx("p",{className:`hidden md:block text-[11px] truncate ${N?"text-red-400/80":"text-dash-text-muted"}`,title:N,children:N||"-"})]},x)})})]})]})},xO=({results:t,onReset:e})=>{const{t:n}=X(),[r,s]=m.useState(""),i=m.useDeferredValue(r),[o,a]=m.useState("all"),[l,d]=m.useState(()=>new Set(Rm.map(S=>S.key))),h=m.useMemo(()=>{const S=i.trim().toLowerCase();return t.results.filter(k=>{if(o!=="all"&&cs(k)!==o)return!1;if(!S)return!0;const N=(k.itemName||"").toLowerCase(),v=(k.path||"").toLowerCase(),P=(k.providerDisplayName||k.provider||"").toLowerCase();return N.includes(S)||v.includes(S)||P.includes(S)})},[t.results,i,o]),u=m.useMemo(()=>gO(h),[h]),f=m.useMemo(()=>{if(!u||h.length===0)return"";const S=Array.from(new Set(h.map(k=>k.providerDisplayName?.trim()||"").filter(k=>k.length>0)));return S.length===1?S[0]:h[0]?.provider||""},[h,u]),p=m.useMemo(()=>pO(h),[h]),g=m.useMemo(()=>uO(t.results),[t.results]),x=m.useMemo(()=>[...p.keys()],[p]),b=g.installed+g.skipped+g.failed,y=x.length>0&&x.every(S=>l.has(S)),w=S=>{d(k=>{const N=new Set(k);return N.has(S)?N.delete(S):N.add(S),N})},C=()=>{if(y){d(new Set);return}d(new Set(x))};return c.jsxs("div",{className:"dash-panel p-4 md:p-5 space-y-4",children:[c.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-start md:justify-between",children:[c.jsxs("div",{children:[c.jsxs("h2",{className:"text-base font-semibold text-dash-text",children:[n("migrateSummaryTitle"),u&&f&&c.jsxs("span",{className:"text-dash-text-muted font-normal",children:[" ","· ",Ar(f)]})]}),c.jsxs("p",{className:"text-xs text-dash-text-muted mt-1",children:[b," ",n("migrateSummarySubtitle")]})]}),c.jsx("button",{type:"button",onClick:e,className:"dash-focus-ring px-4 py-2 text-sm font-semibold rounded-md bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover",children:n("migrateSummaryNewMigration")})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[c.jsx(bs,{label:n("migrateStatusInstalled"),count:g.installed,className:"border-green-500/30 bg-green-500/10 text-green-400"}),c.jsx(bs,{label:n("migrateStatusSkipped"),count:g.skipped,className:"border-yellow-500/30 bg-yellow-500/10 text-yellow-400"}),c.jsx(bs,{label:n("migrateStatusFailed"),count:g.failed,className:"border-red-500/30 bg-red-500/10 text-red-400"})]}),t.warnings.length>0&&c.jsx("div",{className:"space-y-2",children:t.warnings.map((S,k)=>c.jsx("div",{className:"px-3 py-2 border border-yellow-500/30 bg-yellow-500/10 rounded-md text-xs text-yellow-400",children:Ar(S)},k))}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("div",{className:"relative",children:[c.jsxs("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 stroke-dash-text-muted",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("circle",{cx:"11",cy:"11",r:"8"}),c.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),c.jsx("input",{type:"text",value:r,onChange:S=>s(S.target.value),placeholder:n("migrateSummarySearchPlaceholder"),className:"dash-focus-ring w-full pl-9 pr-3 py-2 bg-dash-bg border border-dash-border rounded-lg text-dash-text text-sm focus:border-dash-accent transition-colors"})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[["all","installed","skipped","failed"].map(S=>{const k=S==="all"?"migrateSummaryFilterAll":S==="installed"?"migrateStatusInstalled":S==="skipped"?"migrateStatusSkipped":"migrateStatusFailed";return c.jsx("button",{type:"button",onClick:()=>a(S),className:`dash-focus-ring px-3 py-1 text-xs font-medium rounded-full border transition-colors ${o===S?"bg-dash-accent/10 border-dash-accent text-dash-accent":"border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text"}`,children:n(k)},S)}),c.jsx("button",{type:"button",onClick:C,className:"dash-focus-ring ml-1 px-3 py-1 text-xs font-medium rounded-md border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover",children:n(y?"migrateSummaryCollapseAll":"migrateSummaryExpandAll")})]})]}),h.length===0?c.jsx("div",{className:"text-center py-8 text-sm text-dash-text-muted",children:n("migrateSummaryNoResults")}):c.jsxs("div",{className:"space-y-2.5",children:[Rm.map(S=>{const k=p.get(S.key);return!k||k.length===0?null:c.jsx($m,{labelKey:S.labelKey,badgeClass:S.badgeClass,items:k,isExpanded:l.has(S.key),onToggle:()=>w(S.key),singleProvider:u},S.key)}),(()=>{const S=p.get("unknown");return!S||S.length===0?null:c.jsx($m,{labelKey:"migrateTypeUnknown",badgeClass:"border-dash-border text-dash-text-muted",items:S,isExpanded:l.has("unknown"),onToggle:()=>w("unknown"),singleProvider:u})})()]})]})},bO=500;function yO(t){return t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159}function vO(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(yO(r)||(e+=n))}return e}const wO=({diff:t,className:e=""})=>{const n=t.split(`
|
|
244
|
+
`),r=n.slice(0,bO),s=n.length-r.length;return c.jsxs("pre",{className:`text-xs font-mono overflow-x-auto p-3 rounded bg-dash-bg border border-dash-border ${e}`,children:[r.map((i,o)=>{const a=vO(i);let l="text-dash-text";return a.startsWith("+")?l="text-green-400 bg-green-500/10":a.startsWith("-")?l="text-red-400 bg-red-500/10":a.startsWith("@@")&&(l="text-blue-400"),c.jsx("div",{className:l,children:a},`${o}:${a.slice(0,24)}`)}),s>0&&c.jsxs("div",{className:"text-dash-text-muted",children:["... truncated ",s," additional line(s)"]})]})};function kO(t){return t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159}function ri(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(kO(r)||(e+=n))}return e}const SO=({action:t,resolution:e,onResolve:n})=>{const{t:r}=X(),[s,i]=m.useState(!1),o=t.ownedSections&&t.ownedSections.length>0;return c.jsxs("div",{className:"border border-dash-border rounded-lg p-4 mb-3 bg-dash-surface",children:[c.jsxs("div",{className:"flex justify-between items-start gap-4",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"font-mono text-sm text-dash-text truncate",children:[ri(t.provider),"/",ri(t.type),"/",ri(t.item)]}),c.jsx("p",{className:"text-xs text-dash-text-muted mt-1",children:ri(t.reason)}),t.targetPath&&c.jsx("p",{className:"text-xs text-dash-text-secondary mt-1 font-mono truncate",children:ri(t.targetPath)})]}),c.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[c.jsx("button",{type:"button",onClick:()=>n({type:"overwrite"}),className:`dash-focus-ring px-3 py-1.5 text-xs font-semibold rounded-md transition-colors ${e?.type==="overwrite"?"bg-dash-accent text-white":"bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover"}`,children:r("migrateConflictUseCK")}),c.jsx("button",{type:"button",onClick:()=>n({type:"keep"}),className:`dash-focus-ring px-3 py-1.5 text-xs font-semibold rounded-md transition-colors ${e?.type==="keep"?"bg-dash-accent text-white":"bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover"}`,children:r("migrateConflictKeepMine")}),o&&c.jsx("button",{type:"button",onClick:()=>n({type:"smart-merge"}),className:`dash-focus-ring px-3 py-1.5 text-xs font-semibold rounded-md transition-colors ${e?.type==="smart-merge"?"bg-dash-accent text-white":"bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover"}`,children:r("migrateConflictSmartMerge")}),t.diff&&c.jsx("button",{type:"button",onClick:()=>i(!s),className:"dash-focus-ring px-3 py-1.5 text-xs font-medium rounded-md border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover",children:r(s?"migrateConflictHideDiff":"migrateConflictShowDiff")})]})]}),s&&t.diff&&c.jsx(wO,{diff:t.diff,className:"mt-3"}),e&&c.jsxs("div",{className:"mt-2 text-xs text-green-400 flex items-center gap-1.5",children:[c.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 20 20",children:c.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),c.jsxs("span",{children:[r("migrateConflictResolved"),": ",CO(e.type,r)]})]})]})};function CO(t,e){switch(t){case"overwrite":return e("migrateConflictUseCK");case"keep":return e("migrateConflictKeepMine");case"smart-merge":return e("migrateConflictSmartMerge");case"resolved":return e("migrateConflictManual");default:return String(t)}}const jO=[{key:"install",labelKey:"migrateActionInstall",activeClass:"border-green-400 text-green-400",badgeClass:"bg-green-500/10 border-green-500/30 text-green-400"},{key:"update",labelKey:"migrateActionUpdate",activeClass:"border-yellow-400 text-yellow-400",badgeClass:"bg-yellow-500/10 border-yellow-500/30 text-yellow-400"},{key:"conflict",labelKey:"migrateActionConflict",activeClass:"border-red-400 text-red-400",badgeClass:"bg-red-500/10 border-red-500/30 text-red-400"},{key:"delete",labelKey:"migrateActionDelete",activeClass:"border-dash-text-secondary text-dash-text-secondary",badgeClass:"bg-dash-bg border-dash-border text-dash-text-secondary"},{key:"skip",labelKey:"migrateActionSkip",activeClass:"border-dash-text-muted text-dash-text-muted",badgeClass:"bg-dash-bg border-dash-border text-dash-text-muted"}],Bm=["agent","command","skill","config","rules","hooks"],NO={agent:"migrateTypeAgents",command:"migrateTypeCommands",skill:"migrateTypeSkills",config:"migrateTypeConfig",rules:"migrateTypeRules",hooks:"migrateTypeHooks"},PO={agent:"border-dash-accent/30 text-dash-accent",command:"border-yellow-500/30 text-yellow-400",skill:"border-purple-500/30 text-purple-400",config:"border-teal-500/30 text-teal-400",rules:"border-rose-500/30 text-rose-400",hooks:"border-cyan-500/30 text-cyan-400"},Zr=200;function OO(t){return t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159}function $a(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(OO(r)||(e+=n))}return e}function MO(t){const e={install:[],update:[],skip:[],conflict:[],delete:[]};for(const n of t)e[n.action].push(n);return e}function AO(t){const e=new Map;for(const n of t){const r=e.get(n.type)||[];r.push(n),e.set(n.type,r)}return e}const DO=({plan:t,resolutions:e,onResolve:n,actionKey:r})=>{const{t:s}=X(),i=m.useMemo(()=>MO(t.actions),[t.actions]),o=m.useMemo(()=>jO.filter(f=>i[f.key].length>0),[i]),[a,l]=m.useState(()=>i.conflict.length>0?"conflict":i.install.length>0?"install":o[0]?.key??"install");m.useEffect(()=>{i[a]?.length===0&&o.length>0&&l(o[0].key)},[i,a,o]);const d=m.useMemo(()=>i[a]??[],[i,a]),h=m.useMemo(()=>AO(d),[d]),u=f=>{for(const p of i.conflict)n(p,{type:f})};return c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[t.summary.install>0&&c.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-green-500/10 border border-green-500/30 text-green-400",children:[t.summary.install," ",s("migrateActionInstall")]}),t.summary.update>0&&c.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-yellow-500/10 border border-yellow-500/30 text-yellow-400",children:[t.summary.update," ",s("migrateActionUpdate")]}),t.summary.skip>0&&c.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-dash-bg border border-dash-border text-dash-text-muted",children:[t.summary.skip," ",s("migrateActionSkip")]}),t.summary.conflict>0&&c.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-red-500/10 border border-red-500/30 text-red-400",children:[t.summary.conflict," ",s("migrateActionConflict")]}),t.summary.delete>0&&c.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-dash-bg border border-dash-border text-dash-text-secondary",children:[t.summary.delete," ",s("migrateActionDelete")]})]}),o.length>1&&c.jsx("div",{className:"flex gap-1 border-b border-dash-border",children:o.map(f=>{const p=a===f.key;return c.jsxs("button",{type:"button",onClick:()=>l(f.key),className:`px-3 py-2 text-xs font-medium border-b-2 transition-colors ${p?f.activeClass:"border-transparent text-dash-text-muted hover:text-dash-text-secondary"}`,children:[s(f.labelKey)," ",c.jsx("span",{className:`ml-1 px-1.5 py-0.5 rounded text-[10px] border ${f.badgeClass}`,children:i[f.key].length})]},f.key)})}),a==="conflict"&&i.conflict.length>0&&c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsxs("h3",{className:"text-sm font-semibold text-red-400",children:[s("migrateConflictSectionTitle")," (",i.conflict.length,")"]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"button",onClick:()=>u("overwrite"),className:"dash-focus-ring px-3 py-1 text-xs font-medium rounded-md bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover",children:s("migrateConflictOverwriteAll")}),c.jsx("button",{type:"button",onClick:()=>u("keep"),className:"dash-focus-ring px-3 py-1 text-xs font-medium rounded-md bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover",children:s("migrateConflictKeepAll")})]})]}),a==="conflict"?Bm.map(f=>{const p=h.get(f);return!p||p.length===0?null:c.jsxs(Fm,{type:f,count:p.length,children:[p.slice(0,Zr).map(g=>c.jsx(SO,{action:g,resolution:e.get(r(g))||null,onResolve:x=>n(g,x)},r(g))),p.length>Zr&&c.jsxs("div",{className:"text-xs text-dash-text-muted",children:["... ",p.length-Zr," more"]})]},`${a}:${f}`)}):Bm.map(f=>{const p=h.get(f);return!p||p.length===0?null:c.jsxs(Fm,{type:f,count:p.length,defaultExpanded:a!=="skip",children:[p.slice(0,Zr).map(g=>c.jsx(TO,{action:g},`${g.provider}:${g.type}:${g.item}:${g.global}:${g.action}`)),p.length>Zr&&c.jsxs("div",{className:"text-xs text-dash-text-muted",children:["... ",p.length-Zr," more"]})]},`${a}:${f}`)})]})},Fm=({type:t,count:e,defaultExpanded:n=!0,children:r})=>{const{t:s}=X(),[i,o]=m.useState(n),a=PO[t],l=s(NO[t]);return c.jsxs("div",{className:"border border-dash-border rounded-lg bg-dash-surface",children:[c.jsxs("button",{type:"button","aria-expanded":i,onClick:()=>o(!i),className:"w-full px-4 py-2.5 flex items-center justify-between text-left hover:bg-dash-surface-hover transition-colors",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("h4",{className:"text-sm font-semibold text-dash-text",children:l}),c.jsx("span",{className:`px-2 py-0.5 text-xs rounded-md border ${a}`,children:e})]}),c.jsx("svg",{"aria-hidden":"true",className:`w-4 h-4 text-dash-text-muted transition-transform ${i?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),i&&c.jsx("div",{className:"px-4 pt-1 pb-4 space-y-2",children:r})]})},TO=({action:t})=>c.jsxs("div",{className:"px-3 py-2 bg-dash-bg rounded-md border border-dash-border",children:[c.jsxs("div",{className:"font-mono text-xs text-dash-text",children:[$a(t.provider),"/",$a(t.item)]}),c.jsx("div",{className:"text-xs text-dash-text-muted mt-1",children:$a(t.reason)}),t.targetPath&&c.jsx("div",{className:"text-xs text-dash-text-secondary mt-0.5 font-mono truncate",children:$a(t.targetPath)})]});var EO=function(e){return typeof window<"u"?matchMedia&&matchMedia("(prefers-color-scheme: ".concat(e,")")):{matches:!1}},Zc,LO=m.createContext({appearance:"light",setAppearance:function(){},isDarkMode:!1,themeMode:"light",setThemeMode:function(){},browserPrefers:(Zc=EO("dark"))!==null&&Zc!==void 0&&Zc.matches?"dark":"light"}),RO=function(){return m.useContext(LO)};const Jy=(t,e)=>{if(e)return"row";switch(t){case"horizontal":return"row";case"horizontal-reverse":return"row-reverse";case"vertical":default:return"column";case"vertical-reverse":return"column-reverse"}},IO=t=>{if(t)return["space-between","space-around","space-evenly"].includes(t)},$O=(t,e)=>Jy(t,e)==="row",es=t=>typeof t=="number"?`${t}px`:t,BO=({visible:t,flex:e,gap:n,direction:r,horizontal:s,align:i,justify:o,distribution:a,height:l,width:d,padding:h,paddingInline:u,paddingBlock:f,prefixCls:p,as:g="div",className:x,style:b,children:y,wrap:w,ref:C,...S})=>{const k=o||a,v=$O(r,s)&&!d&&IO(k)?"100%":es(d),P={...e!==void 0?{"--lobe-flex":String(e)}:{},...r||s?{"--lobe-flex-direction":Jy(r,s)}:{},...w!==void 0?{"--lobe-flex-wrap":w}:{},...k!==void 0?{"--lobe-flex-justify":k}:{},...i!==void 0?{"--lobe-flex-align":i}:{},...v!==void 0?{"--lobe-flex-width":v}:{},...l!==void 0?{"--lobe-flex-height":es(l)}:{},...h!==void 0?{"--lobe-flex-padding":es(h)}:{},...u!==void 0?{"--lobe-flex-padding-inline":es(u)}:{},...f!==void 0?{"--lobe-flex-padding-block":es(f)}:{},...n!==void 0?{"--lobe-flex-gap":es(n)}:{},...b},O="lobe-flex",E=[O,t===!1?`${O}--hidden`:void 0,p?`${p}-flex`:void 0,x].filter(Boolean).join(" ");return c.jsx(g,{ref:C,...S,className:E,style:P,children:y})};var Qy=m.memo(BO);const FO=({children:t,ref:e,...n})=>c.jsx(Qy,{...n,align:"center",justify:"center",ref:e,children:t});var zO=FO;const VO=/\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;function HO(t){return Array.from(t.match(VO)??[])}function _O(t){return HO(t).map(n=>n.toLowerCase()).join("-")}function WO(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return m.useMemo(()=>r=>{e.forEach(s=>s(r))},e)}const oc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Rs(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function Ou(t){return"nodeType"in t}function St(t){var e,n;return t?Rs(t)?t:Ou(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function Mu(t){const{Document:e}=St(t);return t instanceof e}function Uo(t){return Rs(t)?!1:t instanceof St(t).HTMLElement}function Xy(t){return t instanceof St(t).SVGElement}function Is(t){return t?Rs(t)?t.document:Ou(t)?Mu(t)?t:Uo(t)||Xy(t)?t.ownerDocument:document:document:document}const dn=oc?m.useLayoutEffect:m.useEffect;function ac(t){const e=m.useRef(t);return dn(()=>{e.current=t}),m.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return e.current==null?void 0:e.current(...r)},[])}function UO(){const t=m.useRef(null),e=m.useCallback((r,s)=>{t.current=setInterval(r,s)},[]),n=m.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function Gi(t,e){e===void 0&&(e=[t]);const n=m.useRef(t);return dn(()=>{n.current!==t&&(n.current=t)},e),n}function Ko(t,e){const n=m.useRef();return m.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function Dl(t){const e=ac(t),n=m.useRef(null),r=m.useCallback(s=>{s!==n.current&&e?.(s,n.current),n.current=s},[]);return[n,r]}function Tl(t){const e=m.useRef();return m.useEffect(()=>{e.current=t},[t]),e.current}let ed={};function Go(t,e){return m.useMemo(()=>{if(e)return e;const n=ed[t]==null?0:ed[t]+1;return ed[t]=n,t+"-"+n},[t,e])}function Zy(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((i,o)=>{const a=Object.entries(o);for(const[l,d]of a){const h=i[l];h!=null&&(i[l]=h+t*d)}return i},{...e})}}const ys=Zy(1),qi=Zy(-1);function KO(t){return"clientX"in t&&"clientY"in t}function lc(t){if(!t)return!1;const{KeyboardEvent:e}=St(t.target);return e&&t instanceof e}function GO(t){if(!t)return!1;const{TouchEvent:e}=St(t.target);return e&&t instanceof e}function El(t){if(GO(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return KO(t)?{x:t.clientX,y:t.clientY}:null}const mr=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[mr.Translate.toString(t),mr.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),zm="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function qO(t){return t.matches(zm)?t:t.querySelector(zm)}const YO={display:"none"};function JO(t){let{id:e,value:n}=t;return Re.createElement("div",{id:e,style:YO},n)}function QO(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Re.createElement("div",{id:e,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function XO(){const[t,e]=m.useState("");return{announce:m.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const e1=m.createContext(null);function ZO(t){const e=m.useContext(e1);m.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function e6(){const[t]=m.useState(()=>new Set),e=m.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[m.useCallback(r=>{let{type:s,event:i}=r;t.forEach(o=>{var a;return(a=o[s])==null?void 0:a.call(o,i)})},[t]),e]}const t6={draggable:`
|
|
245
|
+
To pick up a draggable item, press the space bar.
|
|
246
|
+
While dragging, use the arrow keys to move the item.
|
|
247
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
248
|
+
`},n6={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function r6(t){let{announcements:e=n6,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=t6}=t;const{announce:i,announcement:o}=XO(),a=Go("DndLiveRegion"),[l,d]=m.useState(!1);if(m.useEffect(()=>{d(!0)},[]),ZO(m.useMemo(()=>({onDragStart(u){let{active:f}=u;i(e.onDragStart({active:f}))},onDragMove(u){let{active:f,over:p}=u;e.onDragMove&&i(e.onDragMove({active:f,over:p}))},onDragOver(u){let{active:f,over:p}=u;i(e.onDragOver({active:f,over:p}))},onDragEnd(u){let{active:f,over:p}=u;i(e.onDragEnd({active:f,over:p}))},onDragCancel(u){let{active:f,over:p}=u;i(e.onDragCancel({active:f,over:p}))}}),[i,e])),!l)return null;const h=Re.createElement(Re.Fragment,null,Re.createElement(JO,{id:r,value:s.draggable}),Re.createElement(QO,{id:a,announcement:o}));return n?Tr.createPortal(h,n):h}var qe;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(qe||(qe={}));function Ll(){}function Vm(t,e){return m.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function s6(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return m.useMemo(()=>[...e].filter(r=>r!=null),[...e])}const hn=Object.freeze({x:0,y:0});function t1(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function i6(t,e){const n=El(t);if(!n)return"0 0";const r={x:(n.x-e.left)/e.width*100,y:(n.y-e.top)/e.height*100};return r.x+"% "+r.y+"%"}function n1(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function o6(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function Hm(t){let{left:e,top:n,height:r,width:s}=t;return[{x:e,y:n},{x:e+s,y:n},{x:e,y:n+r},{x:e+s,y:n+r}]}function r1(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function _m(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+t.width*.5,y:n+t.height*.5}}const a6=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=_m(e,e.left,e.top),i=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const d=t1(_m(l),s);i.push({id:a,data:{droppableContainer:o,value:d}})}}return i.sort(n1)},l6=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=Hm(e),i=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const d=Hm(l),h=s.reduce((f,p,g)=>f+t1(d[g],p),0),u=Number((h/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:u}})}}return i.sort(n1)};function c6(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),s=Math.min(e.left+e.width,t.left+t.width),i=Math.min(e.top+e.height,t.top+t.height),o=s-r,a=i-n;if(r<s&&n<i){const l=e.width*e.height,d=t.width*t.height,h=o*a,u=h/(l+d-h);return Number(u.toFixed(4))}return 0}const d6=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=[];for(const i of r){const{id:o}=i,a=n.get(o);if(a){const l=c6(a,e);l>0&&s.push({id:o,data:{droppableContainer:i,value:l}})}}return s.sort(o6)};function h6(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function s1(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:hn}function u6(t){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];return s.reduce((o,a)=>({...o,top:o.top+t*a.y,bottom:o.bottom+t*a.y,left:o.left+t*a.x,right:o.right+t*a.x}),{...n})}}const f6=u6(1);function i1(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function p6(t,e,n){const r=i1(e);if(!r)return t;const{scaleX:s,scaleY:i,x:o,y:a}=r,l=t.left-o-(1-s)*parseFloat(n),d=t.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),h=s?t.width/s:t.width,u=i?t.height/i:t.height;return{width:h,height:u,top:d,right:l+h,bottom:d+u,left:l}}const m6={ignoreTransform:!1};function $s(t,e){e===void 0&&(e=m6);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:d,transformOrigin:h}=St(t).getComputedStyle(t);d&&(n=p6(n,d,h))}const{top:r,left:s,width:i,height:o,bottom:a,right:l}=n;return{top:r,left:s,width:i,height:o,bottom:a,right:l}}function Wm(t){return $s(t,{ignoreTransform:!0})}function g6(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function x6(t,e){return e===void 0&&(e=St(t).getComputedStyle(t)),e.position==="fixed"}function b6(t,e){e===void 0&&(e=St(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=e[s];return typeof i=="string"?n.test(i):!1})}function cc(t,e){const n=[];function r(s){if(e!=null&&n.length>=e||!s)return n;if(Mu(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!Uo(s)||Xy(s)||n.includes(s))return n;const i=St(t).getComputedStyle(s);return s!==t&&b6(s,i)&&n.push(s),x6(s,i)?n:r(s.parentNode)}return t?r(t):n}function o1(t){const[e]=cc(t,1);return e??null}function td(t){return!oc||!t?null:Rs(t)?t:Ou(t)?Mu(t)||t===Is(t).scrollingElement?window:Uo(t)?t:null:null}function a1(t){return Rs(t)?t.scrollX:t.scrollLeft}function l1(t){return Rs(t)?t.scrollY:t.scrollTop}function Ph(t){return{x:a1(t),y:l1(t)}}var et;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(et||(et={}));function c1(t){return!oc||!t?!1:t===document.scrollingElement}function d1(t){const e={x:0,y:0},n=c1(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},s=t.scrollTop<=e.y,i=t.scrollLeft<=e.x,o=t.scrollTop>=r.y,a=t.scrollLeft>=r.x;return{isTop:s,isLeft:i,isBottom:o,isRight:a,maxScroll:r,minScroll:e}}const y6={x:.2,y:.2};function v6(t,e,n,r,s){let{top:i,left:o,right:a,bottom:l}=n;r===void 0&&(r=10),s===void 0&&(s=y6);const{isTop:d,isBottom:h,isLeft:u,isRight:f}=d1(t),p={x:0,y:0},g={x:0,y:0},x={height:e.height*s.y,width:e.width*s.x};return!d&&i<=e.top+x.height?(p.y=et.Backward,g.y=r*Math.abs((e.top+x.height-i)/x.height)):!h&&l>=e.bottom-x.height&&(p.y=et.Forward,g.y=r*Math.abs((e.bottom-x.height-l)/x.height)),!f&&a>=e.right-x.width?(p.x=et.Forward,g.x=r*Math.abs((e.right-x.width-a)/x.width)):!u&&o<=e.left+x.width&&(p.x=et.Backward,g.x=r*Math.abs((e.left+x.width-o)/x.width)),{direction:p,speed:g}}function w6(t){if(t===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}const{top:e,left:n,right:r,bottom:s}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:s,width:t.clientWidth,height:t.clientHeight}}function h1(t){return t.reduce((e,n)=>ys(e,Ph(n)),hn)}function k6(t){return t.reduce((e,n)=>e+a1(n),0)}function S6(t){return t.reduce((e,n)=>e+l1(n),0)}function u1(t,e){if(e===void 0&&(e=$s),!t)return;const{top:n,left:r,bottom:s,right:i}=e(t);o1(t)&&(s<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const C6=[["x",["left","right"],k6],["y",["top","bottom"],S6]];class Au{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=cc(n),s=h1(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[i,o,a]of C6)for(const l of o)Object.defineProperty(this,l,{get:()=>{const d=a(r),h=s[i]-d;return this.rect[l]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class wi{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var s;(s=this.target)==null||s.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function j6(t){const{EventTarget:e}=St(t);return t instanceof e?t:Is(t)}function nd(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var Wt;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Wt||(Wt={}));function Um(t){t.preventDefault()}function N6(t){t.stopPropagation()}var we;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(we||(we={}));const f1={start:[we.Space,we.Enter],cancel:[we.Esc],end:[we.Space,we.Enter,we.Tab]},P6=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case we.Right:return{...n,x:n.x+25};case we.Left:return{...n,x:n.x-25};case we.Down:return{...n,y:n.y+25};case we.Up:return{...n,y:n.y-25}}};class Du{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new wi(Is(n)),this.windowListeners=new wi(St(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Wt.Resize,this.handleCancel),this.windowListeners.add(Wt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Wt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&u1(r),n(hn)}handleKeyDown(e){if(lc(e)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:i=f1,coordinateGetter:o=P6,scrollBehavior:a="smooth"}=s,{code:l}=e;if(i.end.includes(l)){this.handleEnd(e);return}if(i.cancel.includes(l)){this.handleCancel(e);return}const{collisionRect:d}=r.current,h=d?{x:d.left,y:d.top}:hn;this.referenceCoordinates||(this.referenceCoordinates=h);const u=o(e,{active:n,context:r.current,currentCoordinates:h});if(u){const f=qi(u,h),p={x:0,y:0},{scrollableAncestors:g}=r.current;for(const x of g){const b=e.code,{isTop:y,isRight:w,isLeft:C,isBottom:S,maxScroll:k,minScroll:N}=d1(x),v=w6(x),P={x:Math.min(b===we.Right?v.right-v.width/2:v.right,Math.max(b===we.Right?v.left:v.left+v.width/2,u.x)),y:Math.min(b===we.Down?v.bottom-v.height/2:v.bottom,Math.max(b===we.Down?v.top:v.top+v.height/2,u.y))},O=b===we.Right&&!w||b===we.Left&&!C,E=b===we.Down&&!S||b===we.Up&&!y;if(O&&P.x!==u.x){const M=x.scrollLeft+f.x,D=b===we.Right&&M<=k.x||b===we.Left&&M>=N.x;if(D&&!f.y){x.scrollTo({left:M,behavior:a});return}D?p.x=x.scrollLeft-M:p.x=b===we.Right?x.scrollLeft-k.x:x.scrollLeft-N.x,p.x&&x.scrollBy({left:-p.x,behavior:a});break}else if(E&&P.y!==u.y){const M=x.scrollTop+f.y,D=b===we.Down&&M<=k.y||b===we.Up&&M>=N.y;if(D&&!f.x){x.scrollTo({top:M,behavior:a});return}D?p.y=x.scrollTop-M:p.y=b===we.Down?x.scrollTop-k.y:x.scrollTop-N.y,p.y&&x.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(e,ys(qi(u,this.referenceCoordinates),p))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Du.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=f1,onActivation:s}=e,{active:i}=n;const{code:o}=t.nativeEvent;if(r.start.includes(o)){const a=i.activatorNode.current;return a&&t.target!==a?!1:(t.preventDefault(),s?.({event:t.nativeEvent}),!0)}return!1}}];function Km(t){return!!(t&&"distance"in t)}function Gm(t){return!!(t&&"delay"in t)}class Tu{constructor(e,n,r){var s;r===void 0&&(r=j6(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:i}=e,{target:o}=i;this.props=e,this.events=n,this.document=Is(o),this.documentListeners=new wi(this.document),this.listeners=new wi(r),this.windowListeners=new wi(St(o)),this.initialCoordinates=(s=El(i))!=null?s:hn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Wt.Resize,this.handleCancel),this.windowListeners.add(Wt.DragStart,Um),this.windowListeners.add(Wt.VisibilityChange,this.handleCancel),this.windowListeners.add(Wt.ContextMenu,Um),this.documentListeners.add(Wt.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Gm(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Km(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:r,onPending:s}=this.props;s(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(Wt.Click,N6,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Wt.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:a}}=i;if(!s)return;const l=(n=El(e))!=null?n:hn,d=qi(s,l);if(!r&&a){if(Km(a)){if(a.tolerance!=null&&nd(d,a.tolerance))return this.handleCancel();if(nd(d,a.distance))return this.handleStart()}if(Gm(a)&&nd(d,a.tolerance))return this.handleCancel();this.handlePending(a,d);return}e.cancelable&&e.preventDefault(),o(l)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===we.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const O6={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Eu extends Tu{constructor(e){const{event:n}=e,r=Is(n.target);super(e,O6,r)}}Eu.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const M6={move:{name:"mousemove"},end:{name:"mouseup"}};var Oh;(function(t){t[t.RightClick=2]="RightClick"})(Oh||(Oh={}));class A6 extends Tu{constructor(e){super(e,M6,Is(e.event.target))}}A6.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===Oh.RightClick?!1:(r?.({event:n}),!0)}}];const rd={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class D6 extends Tu{constructor(e){super(e,rd)}static setup(){return window.addEventListener(rd.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(rd.move.name,e)};function e(){}}}D6.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:s}=n;return s.length>1?!1:(r?.({event:n}),!0)}}];var ki;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(ki||(ki={}));var Rl;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Rl||(Rl={}));function T6(t){let{acceleration:e,activator:n=ki.Pointer,canScroll:r,draggingRect:s,enabled:i,interval:o=5,order:a=Rl.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:h,delta:u,threshold:f}=t;const p=L6({delta:u,disabled:!i}),[g,x]=UO(),b=m.useRef({x:0,y:0}),y=m.useRef({x:0,y:0}),w=m.useMemo(()=>{switch(n){case ki.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case ki.DraggableRect:return s}},[n,s,l]),C=m.useRef(null),S=m.useCallback(()=>{const N=C.current;if(!N)return;const v=b.current.x*y.current.x,P=b.current.y*y.current.y;N.scrollBy(v,P)},[]),k=m.useMemo(()=>a===Rl.TreeOrder?[...d].reverse():d,[a,d]);m.useEffect(()=>{if(!i||!d.length||!w){x();return}for(const N of k){if(r?.(N)===!1)continue;const v=d.indexOf(N),P=h[v];if(!P)continue;const{direction:O,speed:E}=v6(N,P,w,e,f);for(const M of["x","y"])p[M][O[M]]||(E[M]=0,O[M]=0);if(E.x>0||E.y>0){x(),C.current=N,g(S,o),b.current=E,y.current=O;return}}b.current={x:0,y:0},y.current={x:0,y:0},x()},[e,S,r,x,i,o,JSON.stringify(w),JSON.stringify(p),g,d,k,h,JSON.stringify(f)])}const E6={x:{[et.Backward]:!1,[et.Forward]:!1},y:{[et.Backward]:!1,[et.Forward]:!1}};function L6(t){let{delta:e,disabled:n}=t;const r=Tl(e);return Ko(s=>{if(n||!r||!s)return E6;const i={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[et.Backward]:s.x[et.Backward]||i.x===-1,[et.Forward]:s.x[et.Forward]||i.x===1},y:{[et.Backward]:s.y[et.Backward]||i.y===-1,[et.Forward]:s.y[et.Forward]||i.y===1}}},[n,e,r])}function R6(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return Ko(s=>{var i;return e==null?null:(i=r??s)!=null?i:null},[r,e])}function I6(t,e){return m.useMemo(()=>t.reduce((n,r)=>{const{sensor:s}=r,i=s.activators.map(o=>({eventName:o.eventName,handler:e(o.handler,r)}));return[...n,...i]},[]),[t,e])}var Yi;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Yi||(Yi={}));var Mh;(function(t){t.Optimized="optimized"})(Mh||(Mh={}));const qm=new Map;function $6(t,e){let{dragging:n,dependencies:r,config:s}=e;const[i,o]=m.useState(null),{frequency:a,measure:l,strategy:d}=s,h=m.useRef(t),u=b(),f=Gi(u),p=m.useCallback(function(y){y===void 0&&(y=[]),!f.current&&o(w=>w===null?y:w.concat(y.filter(C=>!w.includes(C))))},[f]),g=m.useRef(null),x=Ko(y=>{if(u&&!n)return qm;if(!y||y===qm||h.current!==t||i!=null){const w=new Map;for(let C of t){if(!C)continue;if(i&&i.length>0&&!i.includes(C.id)&&C.rect.current){w.set(C.id,C.rect.current);continue}const S=C.node.current,k=S?new Au(l(S),S):null;C.rect.current=k,k&&w.set(C.id,k)}return w}return y},[t,i,n,u,l]);return m.useEffect(()=>{h.current=t},[t]),m.useEffect(()=>{u||p()},[n,u]),m.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),m.useEffect(()=>{u||typeof a!="number"||g.current!==null||(g.current=setTimeout(()=>{p(),g.current=null},a))},[a,u,p,...r]),{droppableRects:x,measureDroppableContainers:p,measuringScheduled:i!=null};function b(){switch(d){case Yi.Always:return!1;case Yi.BeforeDragging:return n;default:return!n}}}function Lu(t,e){return Ko(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function B6(t,e){return Lu(t,e)}function F6(t){let{callback:e,disabled:n}=t;const r=ac(e),s=m.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return m.useEffect(()=>()=>s?.disconnect(),[s]),s}function dc(t){let{callback:e,disabled:n}=t;const r=ac(e),s=m.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return m.useEffect(()=>()=>s?.disconnect(),[s]),s}function z6(t){return new Au($s(t),t)}function Ym(t,e,n){e===void 0&&(e=z6);const[r,s]=m.useState(null);function i(){s(l=>{if(!t)return null;if(t.isConnected===!1){var d;return(d=l??n)!=null?d:null}const h=e(t);return JSON.stringify(l)===JSON.stringify(h)?l:h})}const o=F6({callback(l){if(t)for(const d of l){const{type:h,target:u}=d;if(h==="childList"&&u instanceof HTMLElement&&u.contains(t)){i();break}}}}),a=dc({callback:i});return dn(()=>{i(),t?(a?.observe(t),o?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),o?.disconnect())},[t]),r}function V6(t){const e=Lu(t);return s1(t,e)}const Jm=[];function H6(t){const e=m.useRef(t),n=Ko(r=>t?r&&r!==Jm&&t&&e.current&&t.parentNode===e.current.parentNode?r:cc(t):Jm,[t]);return m.useEffect(()=>{e.current=t},[t]),n}function _6(t){const[e,n]=m.useState(null),r=m.useRef(t),s=m.useCallback(i=>{const o=td(i.target);o&&n(a=>a?(a.set(o,Ph(o)),new Map(a)):null)},[]);return m.useEffect(()=>{const i=r.current;if(t!==i){o(i);const a=t.map(l=>{const d=td(l);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,Ph(d)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=t}return()=>{o(t),o(i)};function o(a){a.forEach(l=>{const d=td(l);d?.removeEventListener("scroll",s)})}},[s,t]),m.useMemo(()=>t.length?e?Array.from(e.values()).reduce((i,o)=>ys(i,o),hn):h1(t):hn,[t,e])}function Qm(t,e){e===void 0&&(e=[]);const n=m.useRef(null);return m.useEffect(()=>{n.current=null},e),m.useEffect(()=>{const r=t!==hn;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?qi(t,n.current):hn}function W6(t){m.useEffect(()=>{if(!oc)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n?.()}},t.map(e=>{let{sensor:n}=e;return n}))}function U6(t,e){return m.useMemo(()=>t.reduce((n,r)=>{let{eventName:s,handler:i}=r;return n[s]=o=>{i(o,e)},n},{}),[t,e])}function p1(t){return m.useMemo(()=>t?g6(t):null,[t])}const Xm=[];function K6(t,e){e===void 0&&(e=$s);const[n]=t,r=p1(n?St(n):null),[s,i]=m.useState(Xm);function o(){i(()=>t.length?t.map(l=>c1(l)?r:new Au(e(l),l)):Xm)}const a=dc({callback:o});return dn(()=>{a?.disconnect(),o(),t.forEach(l=>a?.observe(l))},[t]),s}function m1(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return Uo(e)?e:t}function G6(t){let{measure:e}=t;const[n,r]=m.useState(null),s=m.useCallback(d=>{for(const{target:h}of d)if(Uo(h)){r(u=>{const f=e(h);return u?{...u,width:f.width,height:f.height}:f});break}},[e]),i=dc({callback:s}),o=m.useCallback(d=>{const h=m1(d);i?.disconnect(),h&&i?.observe(h),r(h?e(h):null)},[e,i]),[a,l]=Dl(o);return m.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const q6=[{sensor:Eu,options:{}},{sensor:Du,options:{}}],Y6={current:{}},nl={draggable:{measure:Wm},droppable:{measure:Wm,strategy:Yi.WhileDragging,frequency:Mh.Optimized},dragOverlay:{measure:$s}};class Si extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const J6={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Si,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ll},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:nl,measureDroppableContainers:Ll,windowRect:null,measuringScheduled:!1},g1={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Ll,draggableNodes:new Map,over:null,measureDroppableContainers:Ll},qo=m.createContext(g1),x1=m.createContext(J6);function Q6(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Si}}}function X6(t,e){switch(e.type){case qe.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case qe.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case qe.DragEnd:case qe.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case qe.RegisterDroppable:{const{element:n}=e,{id:r}=n,s=new Si(t.droppable.containers);return s.set(r,n),{...t,droppable:{...t.droppable,containers:s}}}case qe.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const o=new Si(t.droppable.containers);return o.set(n,{...i,disabled:s}),{...t,droppable:{...t.droppable,containers:o}}}case qe.UnregisterDroppable:{const{id:n,key:r}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const i=new Si(t.droppable.containers);return i.delete(n),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function Z6(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:s}=m.useContext(qo),i=Tl(r),o=Tl(n?.id);return m.useEffect(()=>{if(!e&&!r&&i&&o!=null){if(!lc(i)||document.activeElement===i.target)return;const a=s.get(o);if(!a)return;const{activatorNode:l,node:d}=a;if(!l.current&&!d.current)return;requestAnimationFrame(()=>{for(const h of[l.current,d.current]){if(!h)continue;const u=qO(h);if(u){u.focus();break}}})}},[r,e,s,o,i]),null}function b1(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((s,i)=>i({transform:s,...r}),n):n}function e7(t){return m.useMemo(()=>({draggable:{...nl.draggable,...t?.draggable},droppable:{...nl.droppable,...t?.droppable},dragOverlay:{...nl.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function t7(t){let{activeNode:e,measure:n,initialRect:r,config:s=!0}=t;const i=m.useRef(!1),{x:o,y:a}=typeof s=="boolean"?{x:s,y:s}:s;dn(()=>{if(!o&&!a||!e){i.current=!1;return}if(i.current||!r)return;const d=e?.node.current;if(!d||d.isConnected===!1)return;const h=n(d),u=s1(h,r);if(o||(u.x=0),a||(u.y=0),i.current=!0,Math.abs(u.x)>0||Math.abs(u.y)>0){const f=o1(d);f&&f.scrollBy({top:u.y,left:u.x})}},[e,o,a,r,n])}const hc=m.createContext({...hn,scaleX:1,scaleY:1});var Xn;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Xn||(Xn={}));const n7=m.memo(function(e){var n,r,s,i;let{id:o,accessibility:a,autoScroll:l=!0,children:d,sensors:h=q6,collisionDetection:u=d6,measuring:f,modifiers:p,...g}=e;const x=m.useReducer(X6,void 0,Q6),[b,y]=x,[w,C]=e6(),[S,k]=m.useState(Xn.Uninitialized),N=S===Xn.Initialized,{draggable:{active:v,nodes:P,translate:O},droppable:{containers:E}}=b,M=v!=null?P.get(v):null,D=m.useRef({initial:null,translated:null}),$=m.useMemo(()=>{var We;return v!=null?{id:v,data:(We=M?.data)!=null?We:Y6,rect:D}:null},[v,M]),F=m.useRef(null),[z,G]=m.useState(null),[le,Z]=m.useState(null),Q=Gi(g,Object.values(g)),ce=Go("DndDescribedBy",o),fe=m.useMemo(()=>E.getEnabled(),[E]),W=e7(f),{droppableRects:oe,measureDroppableContainers:ue,measuringScheduled:be}=$6(fe,{dragging:N,dependencies:[O.x,O.y],config:W.droppable}),Pe=R6(P,v),Qe=m.useMemo(()=>le?El(le):null,[le]),U=oa(),ve=B6(Pe,W.draggable.measure);t7({activeNode:v!=null?P.get(v):null,config:U.layoutShiftCompensation,initialRect:ve,measure:W.draggable.measure});const te=Ym(Pe,W.draggable.measure,ve),Ae=Ym(Pe?Pe.parentElement:null),pe=m.useRef({activatorEvent:null,active:null,activeNode:Pe,collisionRect:null,collisions:null,droppableRects:oe,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),_e=E.getNodeFor((n=pe.current.over)==null?void 0:n.id),I=G6({measure:W.dragOverlay.measure}),K=(r=I.nodeRef.current)!=null?r:Pe,de=N?(s=I.rect)!=null?s:te:null,Oe=!!(I.nodeRef.current&&I.rect),Tt=V6(Oe?null:te),Kn=p1(K?St(K):null),Ct=H6(N?_e??Pe:null),Gr=K6(Ct),qr=b1(p,{transform:{x:O.x-Tt.x,y:O.y-Tt.y,scaleX:1,scaleY:1},activatorEvent:le,active:$,activeNodeRect:te,containerNodeRect:Ae,draggingNodeRect:de,over:pe.current.over,overlayNodeRect:I.rect,scrollableAncestors:Ct,scrollableAncestorRects:Gr,windowRect:Kn}),ta=Qe?ys(Qe,O):null,mn=_6(Ct),vr=Qm(mn),na=Qm(mn,[te]),gn=ys(qr,vr),at=de?f6(de,qr):null,pt=$&&at?u({active:$,collisionRect:at,droppableRects:oe,droppableContainers:fe,pointerCoordinates:ta}):null,Ws=r1(pt,"id"),[xn,Yr]=m.useState(null),uc=Oe?qr:ys(qr,na),sn=h6(uc,(i=xn?.rect)!=null?i:null,te),Jr=m.useRef(null),Us=m.useCallback((We,mt)=>{let{sensor:lt,options:bn}=mt;if(F.current==null)return;const gt=P.get(F.current);if(!gt)return;const Xe=We.nativeEvent,xt=new lt({active:F.current,activeNode:gt,event:Xe,options:bn,context:pe,onAbort(Ke){if(!P.get(Ke))return;const{onDragAbort:j}=Q.current,A={id:Ke};j?.(A),w({type:"onDragAbort",event:A})},onPending(Ke,yn,j,A){if(!P.get(Ke))return;const{onDragPending:B}=Q.current,V={id:Ke,constraint:yn,initialCoordinates:j,offset:A};B?.(V),w({type:"onDragPending",event:V})},onStart(Ke){const yn=F.current;if(yn==null)return;const j=P.get(yn);if(!j)return;const{onDragStart:A}=Q.current,T={activatorEvent:Xe,active:{id:yn,data:j.data,rect:D}};Tr.unstable_batchedUpdates(()=>{A?.(T),k(Xn.Initializing),y({type:qe.DragStart,initialCoordinates:Ke,active:yn}),w({type:"onDragStart",event:T}),G(Jr.current),Z(Xe)})},onMove(Ke){y({type:qe.DragMove,coordinates:Ke})},onEnd:$n(qe.DragEnd),onCancel:$n(qe.DragCancel)});Jr.current=xt;function $n(Ke){return async function(){const{active:j,collisions:A,over:T,scrollAdjustedTranslate:B}=pe.current;let V=null;if(j&&B){const{cancelDrop:ee}=Q.current;V={activatorEvent:Xe,active:j,collisions:A,delta:B,over:T},Ke===qe.DragEnd&&typeof ee=="function"&&await Promise.resolve(ee(V))&&(Ke=qe.DragCancel)}F.current=null,Tr.unstable_batchedUpdates(()=>{y({type:Ke}),k(Xn.Uninitialized),Yr(null),G(null),Z(null),Jr.current=null;const ee=Ke===qe.DragEnd?"onDragEnd":"onDragCancel";if(V){const J=Q.current[ee];J?.(V),w({type:ee,event:V})}})}}},[P]),ra=m.useCallback((We,mt)=>(lt,bn)=>{const gt=lt.nativeEvent,Xe=P.get(bn);if(F.current!==null||!Xe||gt.dndKit||gt.defaultPrevented)return;const xt={active:Xe};We(lt,mt.options,xt)===!0&&(gt.dndKit={capturedBy:mt.sensor},F.current=bn,Us(lt,mt))},[P,Us]),sa=I6(h,ra);W6(h),dn(()=>{te&&S===Xn.Initializing&&k(Xn.Initialized)},[te,S]),m.useEffect(()=>{const{onDragMove:We}=Q.current,{active:mt,activatorEvent:lt,collisions:bn,over:gt}=pe.current;if(!mt||!lt)return;const Xe={active:mt,activatorEvent:lt,collisions:bn,delta:{x:gn.x,y:gn.y},over:gt};Tr.unstable_batchedUpdates(()=>{We?.(Xe),w({type:"onDragMove",event:Xe})})},[gn.x,gn.y]),m.useEffect(()=>{const{active:We,activatorEvent:mt,collisions:lt,droppableContainers:bn,scrollAdjustedTranslate:gt}=pe.current;if(!We||F.current==null||!mt||!gt)return;const{onDragOver:Xe}=Q.current,xt=bn.get(Ws),$n=xt&&xt.rect.current?{id:xt.id,rect:xt.rect.current,data:xt.data,disabled:xt.disabled}:null,Ke={active:We,activatorEvent:mt,collisions:lt,delta:{x:gt.x,y:gt.y},over:$n};Tr.unstable_batchedUpdates(()=>{Yr($n),Xe?.(Ke),w({type:"onDragOver",event:Ke})})},[Ws]),dn(()=>{pe.current={activatorEvent:le,active:$,activeNode:Pe,collisionRect:at,collisions:pt,droppableRects:oe,draggableNodes:P,draggingNode:K,draggingNodeRect:de,droppableContainers:E,over:xn,scrollableAncestors:Ct,scrollAdjustedTranslate:gn},D.current={initial:de,translated:at}},[$,Pe,pt,at,P,K,de,oe,E,xn,Ct,gn]),T6({...U,delta:O,draggingRect:at,pointerCoordinates:ta,scrollableAncestors:Ct,scrollableAncestorRects:Gr});const ia=m.useMemo(()=>({active:$,activeNode:Pe,activeNodeRect:te,activatorEvent:le,collisions:pt,containerNodeRect:Ae,dragOverlay:I,draggableNodes:P,droppableContainers:E,droppableRects:oe,over:xn,measureDroppableContainers:ue,scrollableAncestors:Ct,scrollableAncestorRects:Gr,measuringConfiguration:W,measuringScheduled:be,windowRect:Kn}),[$,Pe,te,le,pt,Ae,I,P,E,oe,xn,ue,Ct,Gr,W,be,Kn]),Qr=m.useMemo(()=>({activatorEvent:le,activators:sa,active:$,activeNodeRect:te,ariaDescribedById:{draggable:ce},dispatch:y,draggableNodes:P,over:xn,measureDroppableContainers:ue}),[le,sa,$,te,y,ce,P,xn,ue]);return Re.createElement(e1.Provider,{value:C},Re.createElement(qo.Provider,{value:Qr},Re.createElement(x1.Provider,{value:ia},Re.createElement(hc.Provider,{value:sn},d)),Re.createElement(Z6,{disabled:a?.restoreFocus===!1})),Re.createElement(r6,{...a,hiddenTextDescribedById:ce}));function oa(){const We=z?.autoScrollEnabled===!1,mt=typeof l=="object"?l.enabled===!1:l===!1,lt=N&&!We&&!mt;return typeof l=="object"?{...l,enabled:lt}:{enabled:lt}}}),r7=m.createContext(null),Zm="button",s7="Draggable";function i7(t){let{id:e,data:n,disabled:r=!1,attributes:s}=t;const i=Go(s7),{activators:o,activatorEvent:a,active:l,activeNodeRect:d,ariaDescribedById:h,draggableNodes:u,over:f}=m.useContext(qo),{role:p=Zm,roleDescription:g="draggable",tabIndex:x=0}=s??{},b=l?.id===e,y=m.useContext(b?hc:r7),[w,C]=Dl(),[S,k]=Dl(),N=U6(o,e),v=Gi(n);dn(()=>(u.set(e,{id:e,key:i,node:w,activatorNode:S,data:v}),()=>{const O=u.get(e);O&&O.key===i&&u.delete(e)}),[u,e]);const P=m.useMemo(()=>({role:p,tabIndex:x,"aria-disabled":r,"aria-pressed":b&&p===Zm?!0:void 0,"aria-roledescription":g,"aria-describedby":h.draggable}),[r,p,x,b,g,h.draggable]);return{active:l,activatorEvent:a,activeNodeRect:d,attributes:P,isDragging:b,listeners:r?void 0:N,node:w,over:f,setNodeRef:C,setActivatorNodeRef:k,transform:y}}function y1(){return m.useContext(x1)}const o7="Droppable",a7={timeout:25};function v1(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:s}=t;const i=Go(o7),{active:o,dispatch:a,over:l,measureDroppableContainers:d}=m.useContext(qo),h=m.useRef({disabled:n}),u=m.useRef(!1),f=m.useRef(null),p=m.useRef(null),{disabled:g,updateMeasurementsFor:x,timeout:b}={...a7,...s},y=Gi(x??r),w=m.useCallback(()=>{if(!u.current){u.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{d(Array.isArray(y.current)?y.current:[y.current]),p.current=null},b)},[b]),C=dc({callback:w,disabled:g||!o}),S=m.useCallback((P,O)=>{C&&(O&&(C.unobserve(O),u.current=!1),P&&C.observe(P))},[C]),[k,N]=Dl(S),v=Gi(e);return m.useEffect(()=>{!C||!k.current||(C.disconnect(),u.current=!1,C.observe(k.current))},[k,C]),m.useEffect(()=>(a({type:qe.RegisterDroppable,element:{id:r,key:i,disabled:n,node:k,rect:f,data:v}}),()=>a({type:qe.UnregisterDroppable,key:i,id:r})),[r]),m.useEffect(()=>{n!==h.current.disabled&&(a({type:qe.SetDroppableDisabled,id:r,key:i,disabled:n}),h.current.disabled=n)},[r,i,n,a]),{active:o,rect:f,isOver:l?.id===r,node:k,over:l,setNodeRef:N}}function l7(t){let{animation:e,children:n}=t;const[r,s]=m.useState(null),[i,o]=m.useState(null),a=Tl(n);return!n&&!r&&a&&s(a),dn(()=>{if(!i)return;const l=r?.key,d=r?.props.id;if(l==null||d==null){s(null);return}Promise.resolve(e(d,i)).then(()=>{s(null)})},[e,r,i]),Re.createElement(Re.Fragment,null,n,r?m.cloneElement(r,{ref:o}):null)}const c7={x:0,y:0,scaleX:1,scaleY:1};function d7(t){let{children:e}=t;return Re.createElement(qo.Provider,{value:g1},Re.createElement(hc.Provider,{value:c7},e))}const h7={position:"fixed",touchAction:"none"},u7=t=>lc(t)?"transform 250ms ease":void 0,f7=m.forwardRef((t,e)=>{let{as:n,activatorEvent:r,adjustScale:s,children:i,className:o,rect:a,style:l,transform:d,transition:h=u7}=t;if(!a)return null;const u=s?d:{...d,scaleX:1,scaleY:1},f={...h7,width:a.width,height:a.height,top:a.top,left:a.left,transform:mr.Transform.toString(u),transformOrigin:s&&r?i6(r,a):void 0,transition:typeof h=="function"?h(r):h,...l};return Re.createElement(n,{className:o,style:f,ref:e},i)}),p7=t=>e=>{let{active:n,dragOverlay:r}=e;const s={},{styles:i,className:o}=t;if(i!=null&&i.active)for(const[a,l]of Object.entries(i.active))l!==void 0&&(s[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(i!=null&&i.dragOverlay)for(const[a,l]of Object.entries(i.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(const[l,d]of Object.entries(s))n.node.style.setProperty(l,d);o!=null&&o.active&&n.node.classList.remove(o.active)}},m7=t=>{let{transform:{initial:e,final:n}}=t;return[{transform:mr.Transform.toString(e)},{transform:mr.Transform.toString(n)}]},g7={duration:250,easing:"ease",keyframes:m7,sideEffects:p7({styles:{active:{opacity:"0"}}})};function x7(t){let{config:e,draggableNodes:n,droppableContainers:r,measuringConfiguration:s}=t;return ac((i,o)=>{if(e===null)return;const a=n.get(i);if(!a)return;const l=a.node.current;if(!l)return;const d=m1(o);if(!d)return;const{transform:h}=St(o).getComputedStyle(o),u=i1(h);if(!u)return;const f=typeof e=="function"?e:b7(e);return u1(l,s.draggable.measure),f({active:{id:i,data:a.data,node:l,rect:s.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:o,rect:s.dragOverlay.measure(d)},droppableContainers:r,measuringConfiguration:s,transform:u})})}function b7(t){const{duration:e,easing:n,sideEffects:r,keyframes:s}={...g7,...t};return i=>{let{active:o,dragOverlay:a,transform:l,...d}=i;if(!e)return;const h={x:a.rect.left-o.rect.left,y:a.rect.top-o.rect.top},u={scaleX:l.scaleX!==1?o.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?o.rect.height*l.scaleY/a.rect.height:1},f={x:l.x-h.x,y:l.y-h.y,...u},p=s({...d,active:o,dragOverlay:a,transform:{initial:l,final:f}}),[g]=p,x=p[p.length-1];if(JSON.stringify(g)===JSON.stringify(x))return;const b=r?.({active:o,dragOverlay:a,...d}),y=a.node.animate(p,{duration:e,easing:n,fill:"forwards"});return new Promise(w=>{y.onfinish=()=>{b?.(),w()}})}}let eg=0;function y7(t){return m.useMemo(()=>{if(t!=null)return eg++,eg},[t])}const v7=Re.memo(t=>{let{adjustScale:e=!1,children:n,dropAnimation:r,style:s,transition:i,modifiers:o,wrapperElement:a="div",className:l,zIndex:d=999}=t;const{activatorEvent:h,active:u,activeNodeRect:f,containerNodeRect:p,draggableNodes:g,droppableContainers:x,dragOverlay:b,over:y,measuringConfiguration:w,scrollableAncestors:C,scrollableAncestorRects:S,windowRect:k}=y1(),N=m.useContext(hc),v=y7(u?.id),P=b1(o,{activatorEvent:h,active:u,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:b.rect,over:y,overlayNodeRect:b.rect,scrollableAncestors:C,scrollableAncestorRects:S,transform:N,windowRect:k}),O=Lu(f),E=x7({config:r,draggableNodes:g,droppableContainers:x,measuringConfiguration:w}),M=O?b.setRef:void 0;return Re.createElement(d7,null,Re.createElement(l7,{animation:E},u&&v?Re.createElement(f7,{key:v,id:u.id,ref:M,as:a,activatorEvent:h,adjustScale:e,className:l,transition:i,rect:O,style:{zIndex:d,...s},transform:P},n):null))});function Ru(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function w7(t,e){return t.reduce((n,r,s)=>{const i=e.get(r);return i&&(n[s]=i),n},Array(t.length))}function Ba(t){return t!==null&&t>=0}function k7(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function S7(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const Fa={scaleX:1,scaleY:1},C7=t=>{var e;let{rects:n,activeNodeRect:r,activeIndex:s,overIndex:i,index:o}=t;const a=(e=n[s])!=null?e:r;if(!a)return null;const l=j7(n,o,s);if(o===s){const d=n[i];return d?{x:s<i?d.left+d.width-(a.left+a.width):d.left-a.left,y:0,...Fa}:null}return o>s&&o<=i?{x:-a.width-l,y:0,...Fa}:o<s&&o>=i?{x:a.width+l,y:0,...Fa}:{x:0,y:0,...Fa}};function j7(t,e,n){const r=t[e],s=t[e-1],i=t[e+1];return!r||!s&&!i?0:n<e?s?r.left-(s.left+s.width):i.left-(r.left+r.width):i?i.left-(r.left+r.width):r.left-(s.left+s.width)}const w1=t=>{let{rects:e,activeIndex:n,overIndex:r,index:s}=t;const i=Ru(e,r,n),o=e[s],a=i[s];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},k1="Sortable",S1=Re.createContext({activeIndex:-1,containerId:k1,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:w1,disabled:{draggable:!1,droppable:!1}});function N7(t){let{children:e,id:n,items:r,strategy:s=w1,disabled:i=!1}=t;const{active:o,dragOverlay:a,droppableRects:l,over:d,measureDroppableContainers:h}=y1(),u=Go(k1,n),f=a.rect!==null,p=m.useMemo(()=>r.map(N=>typeof N=="object"&&"id"in N?N.id:N),[r]),g=o!=null,x=o?p.indexOf(o.id):-1,b=d?p.indexOf(d.id):-1,y=m.useRef(p),w=!k7(p,y.current),C=b!==-1&&x===-1||w,S=S7(i);dn(()=>{w&&g&&h(p)},[w,p,g,h]),m.useEffect(()=>{y.current=p},[p]);const k=m.useMemo(()=>({activeIndex:x,containerId:u,disabled:S,disableTransforms:C,items:p,overIndex:b,useDragOverlay:f,sortedRects:w7(p,l),strategy:s}),[x,u,S.draggable,S.droppable,C,p,b,l,f,s]);return Re.createElement(S1.Provider,{value:k},e)}const P7=t=>{let{id:e,items:n,activeIndex:r,overIndex:s}=t;return Ru(n,r,s).indexOf(e)},O7=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:s,items:i,newIndex:o,previousItems:a,previousContainerId:l,transition:d}=t;return!d||!r||a!==i&&s===o?!1:n?!0:o!==s&&e===l},M7={duration:200,easing:"ease"},C1="transform",A7=mr.Transition.toString({property:C1,duration:0,easing:"linear"}),D7={roleDescription:"sortable"};function T7(t){let{disabled:e,index:n,node:r,rect:s}=t;const[i,o]=m.useState(null),a=m.useRef(n);return dn(()=>{if(!e&&n!==a.current&&r.current){const l=s.current;if(l){const d=$s(r.current,{ignoreTransform:!0}),h={x:l.left-d.left,y:l.top-d.top,scaleX:l.width/d.width,scaleY:l.height/d.height};(h.x||h.y)&&o(h)}}n!==a.current&&(a.current=n)},[e,n,r,s]),m.useEffect(()=>{i&&o(null)},[i]),i}function E7(t){let{animateLayoutChanges:e=O7,attributes:n,disabled:r,data:s,getNewIndex:i=P7,id:o,strategy:a,resizeObserverConfig:l,transition:d=M7}=t;const{items:h,containerId:u,activeIndex:f,disabled:p,disableTransforms:g,sortedRects:x,overIndex:b,useDragOverlay:y,strategy:w}=m.useContext(S1),C=L7(r,p),S=h.indexOf(o),k=m.useMemo(()=>({sortable:{containerId:u,index:S,items:h},...s}),[u,s,S,h]),N=m.useMemo(()=>h.slice(h.indexOf(o)),[h,o]),{rect:v,node:P,isOver:O,setNodeRef:E}=v1({id:o,data:k,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...l}}),{active:M,activatorEvent:D,activeNodeRect:$,attributes:F,setNodeRef:z,listeners:G,isDragging:le,over:Z,setActivatorNodeRef:Q,transform:ce}=i7({id:o,data:k,attributes:{...D7,...n},disabled:C.draggable}),fe=WO(E,z),W=!!M,oe=W&&!g&&Ba(f)&&Ba(b),ue=!y&&le,be=ue&&oe?ce:null,Qe=oe?be??(a??w)({rects:x,activeNodeRect:$,activeIndex:f,overIndex:b,index:S}):null,U=Ba(f)&&Ba(b)?i({id:o,items:h,activeIndex:f,overIndex:b}):S,ve=M?.id,te=m.useRef({activeId:ve,items:h,newIndex:U,containerId:u}),Ae=h!==te.current.items,pe=e({active:M,containerId:u,isDragging:le,isSorting:W,id:o,index:S,items:h,newIndex:te.current.newIndex,previousItems:te.current.items,previousContainerId:te.current.containerId,transition:d,wasDragging:te.current.activeId!=null}),_e=T7({disabled:!pe,index:S,node:P,rect:v});return m.useEffect(()=>{W&&te.current.newIndex!==U&&(te.current.newIndex=U),u!==te.current.containerId&&(te.current.containerId=u),h!==te.current.items&&(te.current.items=h)},[W,U,u,h]),m.useEffect(()=>{if(ve===te.current.activeId)return;if(ve!=null&&te.current.activeId==null){te.current.activeId=ve;return}const K=setTimeout(()=>{te.current.activeId=ve},50);return()=>clearTimeout(K)},[ve]),{active:M,activeIndex:f,attributes:F,data:k,rect:v,index:S,newIndex:U,items:h,isOver:O,isSorting:W,isDragging:le,listeners:G,node:P,overIndex:b,over:Z,setNodeRef:fe,setActivatorNodeRef:Q,setDroppableNodeRef:E,setDraggableNodeRef:z,transform:_e??Qe,transition:I()};function I(){if(_e||Ae&&te.current.newIndex===S)return A7;if(!(ue&&!lc(D)||!d)&&(W||pe))return mr.Transition.toString({...d,property:C1})}}function L7(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t?.draggable)!=null?n:e.draggable,droppable:(r=t?.droppable)!=null?r:e.droppable}}function Il(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const R7=[we.Down,we.Right,we.Up,we.Left],I7=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:a}}=e;if(R7.includes(t.code)){if(t.preventDefault(),!n||!r)return;const l=[];i.getEnabled().forEach(u=>{if(!u||u!=null&&u.disabled)return;const f=s.get(u.id);if(f)switch(t.code){case we.Down:r.top<f.top&&l.push(u);break;case we.Up:r.top>f.top&&l.push(u);break;case we.Left:r.left>f.left&&l.push(u);break;case we.Right:r.left<f.left&&l.push(u);break}});const d=l6({collisionRect:r,droppableRects:s,droppableContainers:l});let h=r1(d,"id");if(h===o?.id&&d.length>1&&(h=d[1].id),h!=null){const u=i.get(n.id),f=i.get(h),p=f?s.get(f.id):null,g=f?.node.current;if(g&&p&&u&&f){const b=cc(g).some((N,v)=>a[v]!==N),y=j1(u,f),w=$7(u,f),C=b||!y?{x:0,y:0}:{x:w?r.width-p.width:0,y:w?r.height-p.height:0},S={x:p.left,y:p.top};return C.x&&C.y?S:qi(S,C)}}}};function j1(t,e){return!Il(t)||!Il(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function $7(t,e){return!Il(t)||!Il(e)||!j1(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}m.createContext(null);var B7=function(e,n){if(n){if(e&&n==="#000")return"0 0 0 1px rgba(255,255,255,0.1) inset";if(!e&&n==="#fff")return"0 0 0 1px rgba(0,0,0,0.05) inset"}};function Ji(t){"@babel/helpers - typeof";return Ji=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ji(t)}var F7=["shape","color","background","size","style","iconMultiple","Icon","iconStyle","iconClassName"];function tg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function za(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?tg(Object(n),!0).forEach(function(r){z7(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function z7(t,e,n){return e=V7(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function V7(t){var e=H7(t,"string");return Ji(e)=="symbol"?e:String(e)}function H7(t,e){if(Ji(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ji(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function _7(t,e){if(t==null)return{};var n=W7(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function W7(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var br=m.memo(function(t){var e=t.shape,n=e===void 0?"circle":e,r=t.color,s=r===void 0?"#fff":r,i=t.background,o=t.size,a=t.style,l=t.iconMultiple,d=l===void 0?.75:l,h=t.Icon,u=t.iconStyle,f=t.iconClassName,p=_7(t,F7),g=RO(),x=g.isDarkMode;return c.jsx(zO,za(za({flex:"none",style:za({background:i,borderRadius:n==="circle"?"50%":Math.floor(o*.1),boxShadow:B7(x,i),color:s,height:o,width:o},a)},p),{},{children:h&&c.jsx(h,{className:f,color:s,size:o,style:za({transform:"scale(".concat(d,")")},u)})}))});function Qi(t){"@babel/helpers - typeof";return Qi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qi(t)}var U7=["Icon","style","Text","color","size","spaceMultiple","textMultiple","extra","extraStyle","showText","showLogo","extraClassName","iconProps","inverse"];function ng(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Yn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ng(Object(n),!0).forEach(function(r){K7(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ng(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function K7(t,e,n){return e=G7(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function G7(t){var e=q7(t,"string");return Qi(e)=="symbol"?e:String(e)}function q7(t,e){if(Qi(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Qi(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Y7(t,e){if(t==null)return{};var n=J7(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function J7(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var yr=m.memo(function(t){var e=t.Icon,n=t.style,r=t.Text,s=t.color,i=t.size,o=i===void 0?24:i,a=t.spaceMultiple,l=a===void 0?1:a,d=t.textMultiple,h=d===void 0?1:d,u=t.extra,f=t.extraStyle,p=t.showText,g=p===void 0?!0:p,x=t.showLogo,b=x===void 0?!0:x,y=t.extraClassName,w=t.iconProps,C=t.inverse,S=Y7(t,U7),k=e&&b&&c.jsx(e,Yn(Yn({size:o},w),{},{style:Yn(C?{marginLeft:o*l}:{marginRight:o*l},w?.style)})),N=g&&r&&c.jsx(r,{size:o*h});return c.jsxs(Qy,Yn(Yn({align:"center",flex:"none",horizontal:!0,justify:"flex-start",style:Yn({color:s},n)},S),{},{children:[C?c.jsxs(c.Fragment,{children:[N,k]}):c.jsxs(c.Fragment,{children:[k,N]}),u&&c.jsx("span",{className:y,style:Yn({fontSize:o*h*.95,lineHeight:1},f),children:u})]}))}),Q7=function(e,n){return m.useMemo(function(){var r=Array.from({length:n},function(s,i){var o="lobe-icons-".concat(_O(e),"-fill-").concat(i);return{fill:"url(#".concat(o,")"),id:o}});return r},[e,n])},Bs="Claude",X7=.8,Z7=.1,N1="#D97757",e8=N1,t8="#fff",n8=.75;function Xi(t){"@babel/helpers - typeof";return Xi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xi(t)}var r8=["size","style"];function rg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function sd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?rg(Object(n),!0).forEach(function(r){s8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):rg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function s8(t,e,n){return e=i8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i8(t){var e=o8(t,"string");return Xi(e)=="symbol"?e:String(e)}function o8(t,e){if(Xi(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Xi(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function a8(t,e){if(t==null)return{};var n=l8(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function l8(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var Iu=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=a8(t,r8);return c.jsxs("svg",sd(sd({fill:"currentColor",fillRule:"evenodd",height:n,style:sd({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Bs}),c.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"})]}))});function Zi(t){"@babel/helpers - typeof";return Zi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zi(t)}function sg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function c8(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?sg(Object(n),!0).forEach(function(r){d8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):sg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function d8(t,e,n){return e=h8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function h8(t){var e=u8(t,"string");return Zi(e)=="symbol"?e:String(e)}function u8(t,e){if(Zi(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Zi(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function f8(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var p8=m.memo(function(t){var e=Object.assign({},(f8(t),t));return c.jsx(br,c8({Icon:Iu,"aria-label":Bs,background:e8,color:t8,iconMultiple:n8},e))});function eo(t){"@babel/helpers - typeof";return eo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},eo(t)}var m8=["size","style"];function ig(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function id(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ig(Object(n),!0).forEach(function(r){g8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ig(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function g8(t,e,n){return e=x8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function x8(t){var e=b8(t,"string");return eo(e)=="symbol"?e:String(e)}function b8(t,e){if(eo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(eo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function y8(t,e){if(t==null)return{};var n=v8(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function v8(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var P1=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=y8(t,m8);return c.jsxs("svg",id(id({height:n,style:id({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Bs}),c.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z",fill:"#D97757",fillRule:"nonzero"})]}))});function to(t){"@babel/helpers - typeof";return to=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},to(t)}var w8=["size","style"];function og(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function od(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?og(Object(n),!0).forEach(function(r){k8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):og(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function k8(t,e,n){return e=S8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function S8(t){var e=C8(t,"string");return to(e)=="symbol"?e:String(e)}function C8(t,e){if(to(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(to(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function j8(t,e){if(t==null)return{};var n=N8(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function N8(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var O1=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=j8(t,w8);return c.jsxs("svg",od(od({fill:"currentColor",fillRule:"nonzero",height:n,style:od({flex:"none",lineHeight:1},r),viewBox:"0 0 97 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Bs}),c.jsx("path",{d:"M13.623 20.222c-3.417 0-5.753-1.901-6.855-4.827a12.992 12.992 0 01-.838-4.772c0-4.907 2.206-8.315 7.08-8.315 3.275 0 5.297 1.425 6.448 4.826h1.402l-.19-4.69C18.709 1.18 16.258.543 13.276.543c-4.2 0-7.775 1.874-9.763 5.254a11.357 11.357 0 00-1.511 5.872c0 3.753 1.777 7.08 5.113 8.926a11.95 11.95 0 005.943 1.398c3.254 0 5.835-.617 8.122-1.697l.593-5.172h-1.43c-.858 2.362-1.88 3.78-3.574 4.534-.831.373-1.88.564-3.146.564zm14.74-17.914L28.499 0h-.967L23.23 1.29v.699l1.907.882v16.142c0 1.1-.565 1.344-2.043 1.528v1.18h7.319v-1.18c-1.484-.184-2.042-.428-2.042-1.528V2.315l-.007-.007zm29.104 19.685h.565l4.95-.937v-1.208l-.695-.054c-1.157-.109-1.457-.346-1.457-1.29V9.897l.137-2.763h-.783l-4.678.672v1.181l.457.082c1.266.183 1.64.536 1.64 1.419v7.67c-1.212.937-2.369 1.527-3.744 1.527-1.525 0-2.471-.774-2.471-2.58V9.905l.136-2.763h-.804l-4.684.672v1.181l.484.082c1.266.183 1.64.536 1.64 1.418v7.08c0 3 1.703 4.426 4.412 4.426 2.07 0 3.765-1.1 5.038-2.627L57.474 22l-.007-.007zm-13.602-9.55c0-3.836-2.043-5.309-5.733-5.309-3.254 0-5.616 1.344-5.616 3.57 0 .666.238 1.175.721 1.528l2.478-.326c-.109-.746-.163-1.201-.163-1.391 0-1.263.674-1.901 2.042-1.901 2.022 0 3.044 1.419 3.044 3.7v.746l-5.106 1.527c-1.702.462-2.67.863-3.316 1.8a3.386 3.386 0 00-.476 1.9c0 2.172 1.497 3.706 4.057 3.706 1.852 0 3.493-.835 4.922-2.416.51 1.581 1.294 2.416 2.69 2.416 1.13 0 2.15-.455 3.063-1.344l-.272-.937a4.363 4.363 0 01-1.178.163c-.783 0-1.157-.617-1.157-1.826v-5.607zm-6.536 7.378c-1.396 0-2.26-.808-2.26-2.226 0-.964.456-1.528 1.43-1.854l4.139-1.31v3.965c-1.321.997-2.097 1.425-3.31 1.425zm43.095 1.235v-1.208l-.701-.054c-1.158-.109-1.45-.346-1.45-1.29V2.308L78.409 0h-.974l-4.302 1.29v.699l1.906.882V8.18a6.024 6.024 0 00-3.656-1.046c-4.276 0-7.612 3.245-7.612 8.098 0 3.998 2.397 6.761 6.346 6.761 2.042 0 3.819-.99 4.922-2.525l-.136 2.525h.571l4.95-.937zm-8.96-12.313c2.043 0 3.575 1.181 3.575 3.353v6.11a4.91 4.91 0 01-3.547 1.425c-2.928 0-4.412-2.308-4.412-5.39 0-3.462 1.695-5.498 4.385-5.498zm19.424 3.055c-.381-1.792-1.484-2.81-3.016-2.81-2.288 0-3.874 1.717-3.874 4.18 0 3.646 1.934 6.008 5.059 6.008a5.858 5.858 0 005.03-2.953l.913.245c-.408 3.163-3.281 5.525-6.808 5.525-4.14 0-6.992-3.054-6.992-7.399 0-4.378 3.098-7.46 7.237-7.46 3.09 0 5.27 1.853 5.97 5.07l-10.783 3.3V14.05l7.264-2.247v-.006z"})]}))});function no(t){"@babel/helpers - typeof";return no=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},no(t)}var P8=["type"];function ag(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function O8(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ag(Object(n),!0).forEach(function(r){M8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ag(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function M8(t,e,n){return e=A8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function A8(t){var e=D8(t,"string");return no(e)=="symbol"?e:String(e)}function D8(t,e){if(no(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(no(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function T8(t,e){if(t==null)return{};var n=E8(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function E8(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var L8=m.memo(function(t){var e=t.type,n=e===void 0?"mono":e,r=T8(t,P8),s=n==="color"?P1:Iu;return c.jsx(yr,O8({Icon:s,Text:O1,"aria-label":Bs,spaceMultiple:Z7,textMultiple:X7},r))}),Ur=Iu;Ur.Color=P1;Ur.Text=O1;Ur.Combine=L8;Ur.Avatar=p8;Ur.colorPrimary=N1;Ur.title=Bs;var Yo="OpenAI",R8=.75,I8=.1,M1="#000",A1="#19C37D",D1="#AB68FF",T1="#F86AA4",$u="#F9C322",E1="#0099FF",L1="#0000FE",$8=M1,B8="#fff",F8=.75;function ro(t){"@babel/helpers - typeof";return ro=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ro(t)}var z8=["size","style"];function lg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function ad(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?lg(Object(n),!0).forEach(function(r){V8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):lg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function V8(t,e,n){return e=H8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function H8(t){var e=_8(t,"string");return ro(e)=="symbol"?e:String(e)}function _8(t,e){if(ro(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ro(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function W8(t,e){if(t==null)return{};var n=U8(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function U8(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var Bu=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=W8(t,z8);return c.jsxs("svg",ad(ad({fill:"currentColor",fillRule:"evenodd",height:n,style:ad({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Yo}),c.jsx("path",{d:"M21.55 10.004a5.416 5.416 0 00-.478-4.501c-1.217-2.09-3.662-3.166-6.05-2.66A5.59 5.59 0 0010.831 1C8.39.995 6.224 2.546 5.473 4.838A5.553 5.553 0 001.76 7.496a5.487 5.487 0 00.691 6.5 5.416 5.416 0 00.477 4.502c1.217 2.09 3.662 3.165 6.05 2.66A5.586 5.586 0 0013.168 23c2.443.006 4.61-1.546 5.361-3.84a5.553 5.553 0 003.715-2.66 5.488 5.488 0 00-.693-6.497v.001zm-8.381 11.558a4.199 4.199 0 01-2.675-.954c.034-.018.093-.05.132-.074l4.44-2.53a.71.71 0 00.364-.623v-6.176l1.877 1.069c.02.01.033.029.036.05v5.115c-.003 2.274-1.87 4.118-4.174 4.123zM4.192 17.78a4.059 4.059 0 01-.498-2.763c.032.02.09.055.131.078l4.44 2.53c.225.13.504.13.73 0l5.42-3.088v2.138a.068.068 0 01-.027.057L9.9 19.288c-1.999 1.136-4.552.46-5.707-1.51h-.001zM3.023 8.216A4.15 4.15 0 015.198 6.41l-.002.151v5.06a.711.711 0 00.364.624l5.42 3.087-1.876 1.07a.067.067 0 01-.063.005l-4.489-2.559c-1.995-1.14-2.679-3.658-1.53-5.63h.001zm15.417 3.54l-5.42-3.088L14.896 7.6a.067.067 0 01.063-.006l4.489 2.557c1.998 1.14 2.683 3.662 1.529 5.633a4.163 4.163 0 01-2.174 1.807V12.38a.71.71 0 00-.363-.623zm1.867-2.773a6.04 6.04 0 00-.132-.078l-4.44-2.53a.731.731 0 00-.729 0l-5.42 3.088V7.325a.068.068 0 01.027-.057L14.1 4.713c2-1.137 4.555-.46 5.707 1.513.487.833.664 1.809.499 2.757h.001zm-11.741 3.81l-1.877-1.068a.065.065 0 01-.036-.051V6.559c.001-2.277 1.873-4.122 4.181-4.12.976 0 1.92.338 2.671.954-.034.018-.092.05-.131.073l-4.44 2.53a.71.71 0 00-.365.623l-.003 6.173v.002zm1.02-2.168L12 9.25l2.414 1.375v2.75L12 14.75l-2.415-1.375v-2.75z"})]}))}),Hr="Gemini",K8=.8,G8=.2,R1="#fff",q8=R1,Y8="#fff",J8=.8;function so(t){"@babel/helpers - typeof";return so=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},so(t)}var Q8=["size","style"];function cg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function ld(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?cg(Object(n),!0).forEach(function(r){X8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):cg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function X8(t,e,n){return e=Z8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Z8(t){var e=eM(t,"string");return so(e)=="symbol"?e:String(e)}function eM(t,e){if(so(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(so(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function tM(t,e){return iM(t)||sM(t,e)||rM(t,e)||nM()}function nM(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
249
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rM(t,e){if(t){if(typeof t=="string")return dg(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return dg(t,e)}}function dg(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function sM(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,a=[],l=!0,d=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(h){d=!0,s=h}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw s}}return a}}function iM(t){if(Array.isArray(t))return t}function oM(t,e){if(t==null)return{};var n=aM(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function aM(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var Fu=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=oM(t,Q8),i=Q7(Hr,3),o=tM(i,3),a=o[0],l=o[1],d=o[2];return c.jsxs("svg",ld(ld({height:n,style:ld({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Hr}),c.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"#3186FF"}),c.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:a.fill}),c.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:l.fill}),c.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:d.fill}),c.jsxs("defs",{children:[c.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:a.id,x1:"7",x2:"11",y1:"15.5",y2:"12",children:[c.jsx("stop",{stopColor:"#08B962"}),c.jsx("stop",{offset:"1",stopColor:"#08B962",stopOpacity:"0"})]}),c.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:l.id,x1:"8",x2:"11.5",y1:"5.5",y2:"11",children:[c.jsx("stop",{stopColor:"#F94543"}),c.jsx("stop",{offset:"1",stopColor:"#F94543",stopOpacity:"0"})]}),c.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:d.id,x1:"3.5",x2:"17.5",y1:"13.5",y2:"12",children:[c.jsx("stop",{stopColor:"#FABC12"}),c.jsx("stop",{offset:".46",stopColor:"#FABC12",stopOpacity:"0"})]})]})]}))});function io(t){"@babel/helpers - typeof";return io=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},io(t)}function hg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function lM(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?hg(Object(n),!0).forEach(function(r){cM(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):hg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function cM(t,e,n){return e=dM(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function dM(t){var e=hM(t,"string");return io(e)=="symbol"?e:String(e)}function hM(t,e){if(io(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(io(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function uM(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var fM=m.memo(function(t){var e=Object.assign({},(uM(t),t));return c.jsx(br,lM({Icon:Fu,"aria-label":Hr,background:q8,color:Y8,iconMultiple:J8},e))});function oo(t){"@babel/helpers - typeof";return oo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},oo(t)}var pM=["size","style"];function ug(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function cd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ug(Object(n),!0).forEach(function(r){mM(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ug(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function mM(t,e,n){return e=gM(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function gM(t){var e=xM(t,"string");return oo(e)=="symbol"?e:String(e)}function xM(t,e){if(oo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(oo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function bM(t,e){if(t==null)return{};var n=yM(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function yM(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var I1=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=bM(t,pM);return c.jsxs("svg",cd(cd({fill:"currentColor",fillRule:"evenodd",height:n,style:cd({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Hr}),c.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z"})]}))});function ao(t){"@babel/helpers - typeof";return ao=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ao(t)}var vM=["size","style"];function fg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function dd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?fg(Object(n),!0).forEach(function(r){wM(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):fg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function wM(t,e,n){return e=kM(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function kM(t){var e=SM(t,"string");return ao(e)=="symbol"?e:String(e)}function SM(t,e){if(ao(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ao(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function CM(t,e){if(t==null)return{};var n=jM(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function jM(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var $1=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=CM(t,vM);return c.jsxs("svg",dd(dd({fill:"currentColor",fillRule:"evenodd",height:n,style:dd({flex:"none",lineHeight:1},r),viewBox:"0 0 98 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Hr}),c.jsx("path",{d:"M21.186 12.67c0 2.649-.786 4.759-2.359 6.33-1.766 1.87-4.09 2.806-6.969 2.806-2.756 0-5.088-.953-6.996-2.86C2.954 17.04 2 14.693 2 11.904c0-2.789.954-5.137 2.862-7.043C6.77 2.953 9.102 2 11.858 2c1.396 0 2.712.247 3.949.741 1.236.495 2.252 1.192 3.047 2.092l-1.749 1.748c-.583-.706-1.338-1.258-2.266-1.655a7.49 7.49 0 00-2.981-.596c-2.067 0-3.816.715-5.247 2.145-1.413 1.448-2.12 3.257-2.12 5.428s.707 3.98 2.12 5.428c1.431 1.43 3.18 2.145 5.247 2.145 1.89 0 3.463-.53 4.717-1.588 1.254-1.06 1.979-2.516 2.173-4.37h-6.89v-2.277h9.196c.088.495.132.971.132 1.43m7.652-4.633c1.946 0 3.494.629 4.645 1.886 1.15 1.257 1.726 3.018 1.726 5.282l-.027.268H24.877c.036 1.284.464 2.318 1.285 3.102.82.785 1.802 1.177 2.944 1.177 1.57 0 2.802-.784 3.694-2.354l2.195 1.07a6.54 6.54 0 01-2.45 2.595C31.503 21.688 30.32 22 29 22c-1.927 0-3.516-.66-4.765-1.98-1.249-1.319-1.873-2.986-1.873-5.001 0-1.997.606-3.66 1.82-4.988 1.213-1.329 2.766-1.993 4.657-1.993m-.053 2.247c-.928 0-1.727.285-2.396.856-.67.57-1.11 1.337-1.325 2.3h7.522c-.071-.91-.442-1.663-1.111-2.26-.67-.598-1.566-.896-2.69-.896M39.247 21.53h-2.455V8.465h2.348v1.813h.107c.374-.64.947-1.173 1.721-1.6.774-.427 1.544-.64 2.309-.64.96 0 1.806.222 2.535.667a3.931 3.931 0 011.601 1.84c1.085-1.671 2.589-2.507 4.51-2.507 1.513 0 2.678.462 3.496 1.387.819.924 1.228 2.24 1.228 3.946v8.16h-2.455v-7.786c0-1.227-.223-2.112-.668-2.654-.444-.542-1.192-.813-2.241-.813-.943 0-1.735.4-2.375 1.2-.64.8-.961 1.742-.961 2.826v7.227h-2.455v-7.786c0-1.227-.223-2.112-.668-2.654-.444-.542-1.191-.813-2.241-.813-.943 0-1.735.4-2.375 1.2-.64.8-.961 1.742-.961 2.826v7.227zM61.911 3.93c0 .48-.17.89-.508 1.228a1.675 1.675 0 01-1.23.508c-.48 0-.89-.17-1.229-.508a1.673 1.673 0 01-.508-1.228c0-.481.17-.89.508-1.229a1.675 1.675 0 011.23-.508c.48 0 .89.17 1.23.508.338.338.507.748.507 1.228m-.11 4.514v13.088h-2.857V8.443h2.857zM80 3.93c0 .48-.17.89-.508 1.228a1.675 1.675 0 01-1.23.508c-.48 0-.89-.17-1.229-.508a1.673 1.673 0 01-.508-1.228c0-.481.17-.89.508-1.229a1.675 1.675 0 011.23-.508c.48 0 .89.17 1.23.508.338.338.507.748.507 1.228m-.11 4.514v13.088h-2.857V8.443h2.857zm-16.343.022h2.349v1.813h.107c.373-.64.947-1.173 1.721-1.6a4.935 4.935 0 012.415-.64c1.601 0 2.833.458 3.696 1.373.863.916 1.294 2.218 1.294 3.907v8.213h-2.455v-8.053c-.053-2.133-1.13-3.2-3.229-3.2-.978 0-1.797.395-2.455 1.187-.658.79-.987 1.737-.987 2.84v7.226h-2.456V8.465z"})]}))});function lo(t){"@babel/helpers - typeof";return lo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lo(t)}var NM=["type"];function pg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function PM(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?pg(Object(n),!0).forEach(function(r){OM(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):pg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function OM(t,e,n){return e=MM(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function MM(t){var e=AM(t,"string");return lo(e)=="symbol"?e:String(e)}function AM(t,e){if(lo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(lo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function DM(t,e){if(t==null)return{};var n=TM(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function TM(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var EM=m.memo(function(t){var e=t.type,n=e===void 0?"mono":e,r=DM(t,NM),s=n==="color"?Fu:I1;return c.jsx(yr,PM({Icon:s,Text:$1,"aria-label":Hr,spaceMultiple:G8,textMultiple:K8},r))}),Kr=I1;Kr.Color=Fu;Kr.Text=$1;Kr.Combine=EM;Kr.Avatar=fM;Kr.colorPrimary=R1;Kr.title=Hr;function co(t){"@babel/helpers - typeof";return co=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},co(t)}var LM=["type"];function mg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function RM(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?mg(Object(n),!0).forEach(function(r){IM(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):mg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function IM(t,e,n){return e=$M(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $M(t){var e=BM(t,"string");return co(e)=="symbol"?e:String(e)}function BM(t,e){if(co(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(co(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function FM(t,e){if(t==null)return{};var n=zM(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function zM(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var VM=m.memo(function(t){var e=t.type,n=e===void 0?"normal":e,r=FM(t,LM),s=m.useMemo(function(){switch(n){case"gpt3":return A1;case"gpt4":return D1;case"gpt5":return T1;case"o3":case"o1":return $u;case"oss":return E1;case"platform":return L1;default:return $8}},[n]);return c.jsx(br,RM({Icon:Bu,"aria-label":Yo,background:s,color:B8,iconMultiple:F8},r))});function ho(t){"@babel/helpers - typeof";return ho=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ho(t)}var HM=["size","style"];function gg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function hd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?gg(Object(n),!0).forEach(function(r){_M(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):gg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function _M(t,e,n){return e=WM(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function WM(t){var e=UM(t,"string");return ho(e)=="symbol"?e:String(e)}function UM(t,e){if(ho(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ho(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function KM(t,e){if(t==null)return{};var n=GM(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function GM(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var B1=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=KM(t,HM);return c.jsxs("svg",hd(hd({fill:"currentColor",fillRule:"evenodd",height:n,style:hd({flex:"none",lineHeight:1},r),viewBox:"0 0 84 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Yo}),c.jsx("path",{d:"M2 10.955c0 5.276 3.376 8.955 8.054 8.955 4.678 0 8.054-3.679 8.054-8.955S14.732 2 10.054 2C5.423 2 2.068 5.606 2 10.797L2 10.955zm13.021 0c0 3.775-2.05 6.22-4.967 6.22-2.918 0-4.968-2.445-4.968-6.22 0-3.776 2.05-6.22 4.968-6.22 2.917 0 4.967 2.444 4.967 6.22zm11.778 8.955c3.545 0 5.57-3.001 5.57-6.607 0-3.607-2.025-6.608-5.57-6.608-1.64 0-2.845.654-3.64 1.598V6.937h-2.894V24h2.893v-5.688c.796.944 2.002 1.598 3.641 1.598zm-3.713-6.97c0-2.397 1.35-3.703 3.135-3.703 2.097 0 3.23 1.645 3.23 4.066 0 2.42-1.133 4.066-3.23 4.066-1.785 0-3.135-1.332-3.135-3.68v-.75zM40.2 19.91c2.532 0 4.533-1.331 5.425-3.558l-2.483-.944c-.386 1.307-1.52 2.033-2.942 2.033-1.857 0-3.159-1.331-3.376-3.51h8.874v-.967c0-3.485-1.953-6.269-5.619-6.269-3.665 0-6.028 2.88-6.028 6.608 0 3.92 2.532 6.607 6.15 6.607zm-.145-10.77c1.833 0 2.701 1.21 2.725 2.614H36.97c.434-1.719 1.591-2.614 3.086-2.614zm7.814 10.504h2.894v-7.455c0-1.815 1.326-2.783 2.628-2.783 1.591 0 2.218 1.137 2.218 2.71v7.528h2.894V11.27c0-2.735-1.592-4.575-4.244-4.575-1.64 0-2.773.75-3.496 1.598V6.937h-2.894v12.707zM66.978 2.266l-6.56 17.378h3.063l1.471-3.97h7.475l1.495 3.97h3.11L70.475 2.266h-3.496zm1.687 3.437l2.75 7.26h-5.45l2.7-7.26zM82 2.317h-3.086v17.377H82V2.317z"})]}))});function uo(t){"@babel/helpers - typeof";return uo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},uo(t)}var qM=["extraStyle"];function xg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function bg(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?xg(Object(n),!0).forEach(function(r){YM(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):xg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function YM(t,e,n){return e=JM(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function JM(t){var e=QM(t,"string");return uo(e)=="symbol"?e:String(e)}function QM(t,e){if(uo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(uo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function XM(t,e){if(t==null)return{};var n=ZM(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function ZM(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var eA=m.memo(function(t){var e=t.extraStyle,n=XM(t,qM);return c.jsx(yr,bg({Icon:Bu,Text:B1,"aria-label":Yo,extraStyle:bg({fontWeight:600},e),spaceMultiple:I8,textMultiple:R8},n))}),zt=Bu;zt.Text=B1;zt.Combine=eA;zt.Avatar=VM;zt.colorPrimary=M1;zt.colorGpt3=A1;zt.colorGpt4=D1;zt.colorGpt5=T1;zt.colorO1=$u;zt.colorO3=$u;zt.colorOss=E1;zt.colorPlatform=L1;zt.title=Yo;var Jo="GithubCopilot",tA=.75,nA=.3,F1="#000",rA=F1,sA="#fff",iA=.75;function fo(t){"@babel/helpers - typeof";return fo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fo(t)}var oA=["size","style"];function yg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function ud(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?yg(Object(n),!0).forEach(function(r){aA(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):yg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function aA(t,e,n){return e=lA(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function lA(t){var e=cA(t,"string");return fo(e)=="symbol"?e:String(e)}function cA(t,e){if(fo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(fo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dA(t,e){if(t==null)return{};var n=hA(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function hA(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var zu=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=dA(t,oA);return c.jsxs("svg",ud(ud({fill:"currentColor",fillRule:"evenodd",height:n,style:ud({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Jo}),c.jsx("path",{d:"M19.245 5.364c1.322 1.36 1.877 3.216 2.11 5.817.622 0 1.2.135 1.592.654l.73.964c.21.278.323.61.323.955v2.62c0 .339-.173.669-.453.868C20.239 19.602 16.157 21.5 12 21.5c-4.6 0-9.205-2.583-11.547-4.258-.28-.2-.452-.53-.453-.868v-2.62c0-.345.113-.679.321-.956l.73-.963c.392-.517.974-.654 1.593-.654l.029-.297c.25-2.446.81-4.213 2.082-5.52 2.461-2.54 5.71-2.851 7.146-2.864h.198c1.436.013 4.685.323 7.146 2.864zm-7.244 4.328c-.284 0-.613.016-.962.05-.123.447-.305.85-.57 1.108-1.05 1.023-2.316 1.18-2.994 1.18-.638 0-1.306-.13-1.851-.464-.516.165-1.012.403-1.044.996a65.882 65.882 0 00-.063 2.884l-.002.48c-.002.563-.005 1.126-.013 1.69.002.326.204.63.51.765 2.482 1.102 4.83 1.657 6.99 1.657 2.156 0 4.504-.555 6.985-1.657a.854.854 0 00.51-.766c.03-1.682.006-3.372-.076-5.053-.031-.596-.528-.83-1.046-.996-.546.333-1.212.464-1.85.464-.677 0-1.942-.157-2.993-1.18-.266-.258-.447-.661-.57-1.108-.32-.032-.64-.049-.96-.05zm-2.525 4.013c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zm5 0c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zM7.635 5.087c-1.05.102-1.935.438-2.385.906-.975 1.037-.765 3.668-.21 4.224.405.394 1.17.657 1.995.657h.09c.649-.013 1.785-.176 2.73-1.11.435-.41.705-1.433.675-2.47-.03-.834-.27-1.52-.63-1.813-.39-.336-1.275-.482-2.265-.394zm6.465.394c-.36.292-.6.98-.63 1.813-.03 1.037.24 2.06.675 2.47.968.957 2.136 1.104 2.776 1.11h.044c.825 0 1.59-.263 1.995-.657.555-.556.765-3.187-.21-4.224-.45-.468-1.335-.804-2.385-.906-.99-.088-1.875.058-2.265.394zM12 7.615c-.24 0-.525.015-.84.044.03.16.045.336.06.526l-.001.159a2.94 2.94 0 01-.014.25c.225-.022.425-.027.612-.028h.366c.187 0 .387.006.612.028-.015-.146-.015-.277-.015-.409.015-.19.03-.365.06-.526a9.29 9.29 0 00-.84-.044z"})]}))});function po(t){"@babel/helpers - typeof";return po=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},po(t)}function vg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function uA(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?vg(Object(n),!0).forEach(function(r){fA(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function fA(t,e,n){return e=pA(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function pA(t){var e=mA(t,"string");return po(e)=="symbol"?e:String(e)}function mA(t,e){if(po(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(po(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function gA(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var xA=m.memo(function(t){var e=Object.assign({},(gA(t),t));return c.jsx(br,uA({Icon:zu,"aria-label":Jo,background:rA,color:sA,iconMultiple:iA},e))});function mo(t){"@babel/helpers - typeof";return mo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},mo(t)}var bA=["size","style"];function wg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function fd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?wg(Object(n),!0).forEach(function(r){yA(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function yA(t,e,n){return e=vA(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vA(t){var e=wA(t,"string");return mo(e)=="symbol"?e:String(e)}function wA(t,e){if(mo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(mo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function kA(t,e){if(t==null)return{};var n=SA(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function SA(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var z1=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=kA(t,bA);return c.jsxs("svg",fd(fd({fill:"currentColor",fillRule:"evenodd",height:n,style:fd({flex:"none",lineHeight:1},r),viewBox:"0 0 154 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Jo}),c.jsx("path",{d:"M2 11.875c0 5.256 3.013 8.506 8.19 8.506 4.76 0 8.027-2.72 8.027-7.722v-1.545h-7.982v2.928h4.095c-.161 1.96-1.68 3.25-4.049 3.25-2.6 0-4.347-1.498-4.347-4.334V10.7c0-2.582 1.518-4.31 4.186-4.31 1.91 0 3.267.922 3.68 2.374h3.865c-.437-3.366-3.427-5.625-7.499-5.625C5.29 3.138 2 6.366 2 11.875zm17.308-5.44h3.496V3h-3.496v3.435zm0 13.715h3.496V7.795h-3.496V20.15zm10.544-9.52h2.438V7.795h-2.438V3.922h-3.496v3.873H24.17v2.835h2.186v6.8c0 1.637.69 2.72 2.76 2.72h3.174v-2.766h-2.438V10.63zm3.994 9.52h3.727v-7.076h7.568v7.076h3.726V3.346h-3.726v6.777h-7.568V3.346h-3.727V20.15zM62.385 7.795h-3.497v6.523c0 1.868-1.012 3.205-2.668 3.205-1.38 0-2.162-.83-2.162-2.56V7.796h-3.52v7.722c0 2.95 1.357 4.864 4.118 4.864 1.955 0 3.29-.945 4.002-2.49h.207l.46 2.26h3.06V7.794zm1.698 12.355h3.06l.436-2.213h.207c.713 1.591 2.3 2.444 4.072 2.444 3.174 0 5.015-2.374 5.015-6.385 0-4.057-1.887-6.432-5.084-6.432-1.978 0-3.428 1.014-4.003 2.49h-.207V3h-3.496v17.15zm3.496-5.624v-1.06c0-1.845 1.173-3.043 2.99-3.043 1.657 0 2.738.853 2.738 2.581v1.983c0 1.521-.874 2.559-2.714 2.559-1.864 0-3.014-1.222-3.014-3.02zm21.8 5.855c4.21 0 7.177-2.351 7.683-6.063h-3.151c-.46 2.098-2.186 3.389-4.486 3.389-2.852 0-4.67-1.867-4.67-4.518v-2.743c0-2.882 1.887-4.634 4.716-4.634 2.53 0 4.072 1.36 4.44 3.366h3.151c-.368-3.665-3.243-6.063-7.499-6.063-5.038 0-7.982 3.274-7.982 8.668 0 5.348 2.898 8.598 7.798 8.598zm8.533-6.34c0 3.92 2.346 6.34 5.98 6.34 3.796 0 6.004-2.536 6.004-6.34 0-4.056-2.484-6.338-6.003-6.338-3.635 0-5.981 2.397-5.981 6.339zm2.898.992V13.12c0-1.89 1.22-3.066 3.083-3.066 1.817 0 3.082 1.152 3.082 3.066v1.913c0 1.96-1.288 2.997-3.082 2.997-1.749 0-3.083-1.015-3.083-2.997zM111.018 24h2.853v-6.132h.184c.667 1.453 2.116 2.398 4.186 2.398 3.083 0 4.992-2.26 4.992-6.293 0-3.942-1.863-6.27-4.992-6.27-1.863 0-3.427.852-4.186 2.397h-.184l-.345-2.167h-2.508V24zm6.211-6.063c-2.024 0-3.358-1.314-3.358-3.342v-1.222c0-2.005 1.31-3.342 3.381-3.342 2.002 0 3.037 1.152 3.037 2.881v2.144c0 1.815-1.16 2.849-2.973 2.88l-.087.001zm7.1-11.733h2.83V3.115h-2.83v3.09zm0 13.946h2.83V7.933h-2.83V20.15zm4.338 0h2.83V3.115h-2.83V20.15zm9.927-12.447c3.52 0 6.004 2.282 6.004 6.339 0 3.803-2.208 6.339-6.004 6.339-3.634 0-5.98-2.42-5.98-6.34 0-3.941 2.346-6.338 5.98-6.338zm10.922-3.689v3.919H152v2.328h-2.484v7.607H152v2.282h-2.99c-1.749 0-2.324-.922-2.324-2.282v-7.607h-2.185V7.933h2.185V4.014h2.83zm-10.922 6.04c-1.863 0-3.082 1.175-3.082 3.066v1.913c0 1.982 1.334 2.997 3.082 2.997 1.795 0 3.083-1.038 3.083-2.997V13.12c0-1.914-1.265-3.066-3.083-3.066z"})]}))});function go(t){"@babel/helpers - typeof";return go=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},go(t)}function kg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function CA(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?kg(Object(n),!0).forEach(function(r){jA(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):kg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function jA(t,e,n){return e=NA(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function NA(t){var e=PA(t,"string");return go(e)=="symbol"?e:String(e)}function PA(t,e){if(go(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(go(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function OA(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var MA=m.memo(function(t){var e=Object.assign({},(OA(t),t));return c.jsx(yr,CA({Icon:zu,Text:z1,"aria-label":Jo,spaceMultiple:nA,textMultiple:tA},e))}),Fs=zu;Fs.Text=z1;Fs.Combine=MA;Fs.Avatar=xA;Fs.colorPrimary=F1;Fs.title=Jo;var Qo="Cline",AA=.7,DA=.2,V1="#323B43",TA=V1,EA="#fff",LA=.6;function xo(t){"@babel/helpers - typeof";return xo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xo(t)}var RA=["size","style"];function Sg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function pd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Sg(Object(n),!0).forEach(function(r){IA(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Sg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function IA(t,e,n){return e=$A(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $A(t){var e=BA(t,"string");return xo(e)=="symbol"?e:String(e)}function BA(t,e){if(xo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(xo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function FA(t,e){if(t==null)return{};var n=zA(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function zA(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var Vu=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=FA(t,RA);return c.jsxs("svg",pd(pd({fill:"currentColor",fillRule:"evenodd",height:n,style:pd({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Qo}),c.jsx("path",{d:"M17.035 3.991c2.75 0 4.98 2.24 4.98 5.003v1.667l1.45 2.896a1.01 1.01 0 01-.002.909l-1.448 2.864v1.668c0 2.762-2.23 5.002-4.98 5.002H7.074c-2.751 0-4.98-2.24-4.98-5.002V17.33l-1.48-2.855a1.01 1.01 0 01-.003-.927l1.482-2.887V8.994c0-2.763 2.23-5.003 4.98-5.003h9.962zM8.265 9.6a2.274 2.274 0 00-2.274 2.274v4.042a2.274 2.274 0 004.547 0v-4.042A2.274 2.274 0 008.265 9.6zm7.326 0a2.274 2.274 0 00-2.274 2.274v4.042a2.274 2.274 0 104.548 0v-4.042A2.274 2.274 0 0015.59 9.6z"}),c.jsx("path",{d:"M12.054 5.558a2.779 2.779 0 100-5.558 2.779 2.779 0 000 5.558z"})]}))});function bo(t){"@babel/helpers - typeof";return bo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bo(t)}function Cg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function VA(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Cg(Object(n),!0).forEach(function(r){HA(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Cg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function HA(t,e,n){return e=_A(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _A(t){var e=WA(t,"string");return bo(e)=="symbol"?e:String(e)}function WA(t,e){if(bo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(bo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function UA(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var KA=m.memo(function(t){var e=Object.assign({},(UA(t),t));return c.jsx(br,VA({Icon:Vu,"aria-label":Qo,background:TA,color:EA,iconMultiple:LA},e))});function yo(t){"@babel/helpers - typeof";return yo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yo(t)}var GA=["size","style"];function jg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function md(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?jg(Object(n),!0).forEach(function(r){qA(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):jg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function qA(t,e,n){return e=YA(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function YA(t){var e=JA(t,"string");return yo(e)=="symbol"?e:String(e)}function JA(t,e){if(yo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(yo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function QA(t,e){if(t==null)return{};var n=XA(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function XA(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var H1=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=QA(t,GA);return c.jsxs("svg",md(md({fill:"currentColor",fillRule:"evenodd",height:n,style:md({flex:"none",lineHeight:1},r),viewBox:"0 0 88 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Qo}),c.jsx("path",{d:"M79.558 21.986c-1.13 0-2.167-.189-3.108-.565a7.128 7.128 0 01-2.403-1.569 6.933 6.933 0 01-1.554-2.331 7.876 7.876 0 01-.537-2.925v-.58c0-1.196.189-2.279.566-3.25.376-.97.894-1.798 1.554-2.486a6.84 6.84 0 012.289-1.582 7.005 7.005 0 012.797-.566c1.103 0 2.078.189 2.925.566.848.367 1.56.88 2.134 1.54.575.668 1.008 1.464 1.3 2.388.292.923.438 1.93.438 3.023v1.456H75.362v.07c.103.67.263 1.23.48 1.682.217.452.513.857.89 1.215.377.377.82.669 1.328.876.518.207 1.084.31 1.696.31.838 0 1.62-.16 2.346-.48a4.71 4.71 0 001.794-1.398l1.808 1.752c-.508.734-1.29 1.394-2.345 1.978-1.046.584-2.313.876-3.8.876zm-.41-13.113c-.48 0-.927.09-1.342.269-.405.17-.768.414-1.088.735-.32.33-.589.725-.805 1.187a6.25 6.25 0 00-.48 1.568h7.191v-.226c0-.443-.08-.88-.24-1.314a3.545 3.545 0 00-.678-1.159 3.004 3.004 0 00-1.074-.763c-.424-.198-.919-.297-1.484-.297zM55.043 21.703V6.415h3.052l.212 2.176c.207-.292.433-.56.678-.805.255-.255.523-.48.806-.679a5.555 5.555 0 013.179-.975 6.5 6.5 0 012.148.34 4.11 4.11 0 011.667 1.073c.461.49.82 1.117 1.074 1.88.254.753.381 1.667.381 2.74v9.538h-3.377v-9.48c0-.632-.07-1.16-.212-1.583-.141-.424-.348-.763-.621-1.018a2.3 2.3 0 00-.99-.537 4.736 4.736 0 00-1.328-.17c-.414 0-.8.057-1.158.17a3.421 3.421 0 00-1.611 1.004 4.282 4.282 0 00-.523.706v10.908h-3.377zM38.44 6.415h8.111v12.49h4.493v2.798H38.441v-2.797h4.705v-9.68H38.44V6.416zm4.395-3.956c0-.274.047-.523.141-.75a1.69 1.69 0 01.41-.607c.17-.16.372-.282.607-.367.245-.094.519-.141.82-.141.509 0 .918.131 1.23.395.32.254.503.584.55.99.066.414-.004.776-.212 1.087-.207.302-.508.504-.904.608a1.48 1.48 0 01-.706.353c-.273.057-.575.033-.905-.07a1.396 1.396 0 01-.777-.552 1.758 1.758 0 01-.254-.946zM20.934 0h8.238v18.906h4.634v2.797H20.934v-2.797h4.832V2.812h-4.832V0zM16.71 15.373c-.095.999-.33 1.908-.707 2.727a6.672 6.672 0 01-1.484 2.077 6.542 6.542 0 01-2.218 1.357c-.848.31-1.79.466-2.826.466-.848 0-1.63-.113-2.346-.339a6.467 6.467 0 01-1.893-.99 6.55 6.55 0 01-1.413-1.426 9.438 9.438 0 01-1.003-1.851c-.274-.66-.48-1.375-.622-2.148A14.34 14.34 0 012 12.83v-2.812c0-.8.066-1.573.198-2.317.132-.744.33-1.446.593-2.106A8.284 8.284 0 013.88 3.603a7.296 7.296 0 011.555-1.54 6.953 6.953 0 011.836-.904A7.256 7.256 0 019.49.834c1.083 0 2.049.16 2.896.48.858.32 1.588.773 2.19 1.357a6.337 6.337 0 011.442 2.147c.358.839.588 1.771.692 2.798h-3.391a6.568 6.568 0 00-.353-1.653c-.17-.5-.405-.923-.707-1.272a2.977 2.977 0 00-1.144-.791c-.453-.188-.994-.283-1.625-.283-.443 0-.843.062-1.201.184-.349.122-.66.297-.933.523a3.385 3.385 0 00-.947 1.074 7.033 7.033 0 00-.607 1.455c-.123.471-.217.975-.283 1.512a15.25 15.25 0 00-.084 1.625v2.84c0 .688.037 1.333.113 1.936.084.602.212 1.154.381 1.653.132.414.297.791.495 1.13.207.34.452.631.734.876.292.264.627.466 1.004.608.386.132.824.198 1.314.198.584 0 1.102-.085 1.554-.255.452-.17.838-.419 1.159-.749.31-.32.56-.72.748-1.2.189-.481.311-1.032.368-1.654h3.405z"})]}))});function vo(t){"@babel/helpers - typeof";return vo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vo(t)}function Ng(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function ZA(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ng(Object(n),!0).forEach(function(r){eD(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ng(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function eD(t,e,n){return e=tD(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tD(t){var e=nD(t,"string");return vo(e)=="symbol"?e:String(e)}function nD(t,e){if(vo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(vo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function rD(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var sD=m.memo(function(t){var e=Object.assign({},(rD(t),t));return c.jsx(yr,ZA({Icon:Vu,Text:H1,"aria-label":Qo,iconProps:{shape:"square"},spaceMultiple:DA,textMultiple:AA},e))}),zs=Vu;zs.Text=H1;zs.Combine=sD;zs.Avatar=KA;zs.colorPrimary=V1;zs.title=Qo;var Xo="Cursor",iD=.7,oD=.1,_1="#000",aD=_1,lD="#fff",cD=.6;function wo(t){"@babel/helpers - typeof";return wo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wo(t)}var dD=["size","style"];function Pg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function gd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Pg(Object(n),!0).forEach(function(r){hD(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Pg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function hD(t,e,n){return e=uD(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function uD(t){var e=fD(t,"string");return wo(e)=="symbol"?e:String(e)}function fD(t,e){if(wo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(wo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function pD(t,e){if(t==null)return{};var n=mD(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function mD(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var Hu=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=pD(t,dD);return c.jsxs("svg",gd(gd({fill:"currentColor",fillRule:"evenodd",height:n,style:gd({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Xo}),c.jsx("path",{d:"M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z"})]}))});function ko(t){"@babel/helpers - typeof";return ko=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ko(t)}function Og(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function gD(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Og(Object(n),!0).forEach(function(r){xD(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Og(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function xD(t,e,n){return e=bD(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function bD(t){var e=yD(t,"string");return ko(e)=="symbol"?e:String(e)}function yD(t,e){if(ko(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ko(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function vD(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var wD=m.memo(function(t){var e=Object.assign({},(vD(t),t));return c.jsx(br,gD({Icon:Hu,"aria-label":Xo,background:aD,color:lD,iconMultiple:cD},e))});function So(t){"@babel/helpers - typeof";return So=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},So(t)}var kD=["size","style"];function Mg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function xd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Mg(Object(n),!0).forEach(function(r){SD(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Mg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function SD(t,e,n){return e=CD(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function CD(t){var e=jD(t,"string");return So(e)=="symbol"?e:String(e)}function jD(t,e){if(So(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(So(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ND(t,e){if(t==null)return{};var n=PD(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function PD(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var W1=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=ND(t,kD);return c.jsxs("svg",xd(xd({fill:"currentColor",fillRule:"evenodd",height:n,style:xd({flex:"none",lineHeight:1},r),viewBox:"0 0 123 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Xo}),c.jsx("path",{d:"M11.995 2.33h6.516v3.582h-6.295C8.82 5.912 6.169 7.868 6.169 12c0 4.133 2.65 6.089 6.047 6.089h6.295v3.581H11.72C6.03 21.67 2 18.336 2 12c0-6.337 4.307-9.67 9.995-9.67zm9.829 0h4.03V14.15c0 2.947 1.354 4.325 4.53 4.325 3.175 0 4.528-1.377 4.528-4.325V2.33h4.03v12.644c0 4.297-2.733 7.025-8.559 7.025-5.826 0-8.56-2.755-8.56-7.052V2.33zm38.185 5.483c0 2.149-1.243 3.801-2.9 4.518v.055c1.74.248 2.624 1.488 2.65 3.169l.084 6.115h-4.031l-.083-5.454c-.027-1.212-.745-1.956-2.181-1.956h-6.71v7.41h-4.03V2.33h11.127c3.644 0 6.074 1.846 6.074 5.483zm-4.059.55c0-1.652-.883-2.561-2.54-2.561H46.84v5.123h6.626c1.518 0 2.485-.909 2.485-2.562zm19.3 7.66c0-1.378-.884-1.957-2.209-2.067l-4.473-.413c-3.866-.358-5.881-1.873-5.881-5.537 0-3.664 2.485-5.675 6.046-5.675h9.885V5.8h-9.609c-1.38 0-2.263.717-2.263 2.094 0 1.378.91 2.039 2.291 2.15l4.556.385c3.452.303 5.715 1.874 5.715 5.565 0 3.691-2.402 5.675-5.798 5.675H63.184V18.2h9.94c1.297 0 2.126-.882 2.126-2.177zM91.097 2c6.074 0 9.912 3.884 9.912 9.972C101.01 18.061 97.006 22 90.932 22s-9.912-3.94-9.912-10.028C81.02 5.884 85.024 2 91.098 2zm5.743 10c0-4.077-2.374-6.474-5.826-6.474-3.451 0-5.826 2.397-5.826 6.474s2.375 6.473 5.826 6.473c3.452 0 5.826-2.396 5.826-6.473zM121 7.813c0 2.149-1.242 3.801-2.899 4.518v.055c1.739.248 2.623 1.488 2.65 3.169l.083 6.115h-4.031l-.083-5.454c-.027-1.212-.745-1.956-2.181-1.956h-6.709v7.41h-4.031V2.33h11.127c3.645 0 6.074 1.846 6.074 5.483zm-4.059.55c0-1.652-.883-2.561-2.54-2.561h-6.571v5.123h6.626c1.518 0 2.485-.909 2.485-2.562z"})]}))});function Co(t){"@babel/helpers - typeof";return Co=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Co(t)}function Ag(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function OD(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ag(Object(n),!0).forEach(function(r){MD(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ag(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function MD(t,e,n){return e=AD(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function AD(t){var e=DD(t,"string");return Co(e)=="symbol"?e:String(e)}function DD(t,e){if(Co(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Co(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function TD(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var ED=m.memo(function(t){var e=Object.assign({},(TD(t),t));return c.jsx(yr,OD({Icon:Hu,Text:W1,"aria-label":Xo,spaceMultiple:oD,textMultiple:iD},e))}),Vs=Hu;Vs.Text=W1;Vs.Combine=ED;Vs.Avatar=wD;Vs.colorPrimary=_1;Vs.title=Xo;var Zo="Goose",LD=.7,RD=.2,U1="#fff",ID=U1,$D="#000",BD=.65;function jo(t){"@babel/helpers - typeof";return jo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jo(t)}var FD=["size","style"];function Dg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function bd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Dg(Object(n),!0).forEach(function(r){zD(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Dg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function zD(t,e,n){return e=VD(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function VD(t){var e=HD(t,"string");return jo(e)=="symbol"?e:String(e)}function HD(t,e){if(jo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(jo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function _D(t,e){if(t==null)return{};var n=WD(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function WD(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var _u=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=_D(t,FD);return c.jsxs("svg",bd(bd({fill:"currentColor",fillRule:"evenodd",height:n,style:bd({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Zo}),c.jsx("path",{d:"M21.595 23.61c1.167-.254 2.405-.944 2.405-.944l-2.167-1.784a12.124 12.124 0 01-2.695-3.131 12.127 12.127 0 00-3.97-4.049l-.794-.462a1.115 1.115 0 01-.488-.815.844.844 0 01.154-.575c.413-.582 2.548-3.115 2.94-3.44.503-.416 1.065-.762 1.586-1.159.074-.056.148-.112.221-.17.003-.002.007-.004.009-.007.167-.131.325-.272.45-.438.453-.524.563-.988.59-1.193-.061-.197-.244-.639-.753-1.148.319.02.705.272 1.056.569.235-.376.481-.773.727-1.171.165-.266-.08-.465-.086-.471h-.001V3.22c-.007-.007-.206-.25-.471-.086-.567.35-1.134.702-1.639 1.021 0 0-.597-.012-1.305.599a2.464 2.464 0 00-.438.45l-.007.009c-.058.072-.114.147-.17.221-.397.521-.743 1.083-1.16 1.587-.323.391-2.857 2.526-3.44 2.94a.842.842 0 01-.574.153 1.115 1.115 0 01-.815-.488l-.462-.794a12.123 12.123 0 00-4.049-3.97 12.133 12.133 0 01-3.13-2.695L1.332 0S.643 1.238.39 2.405c.352.428 1.27 1.49 2.34 2.302C1.58 4.167.73 3.75.06 3.4c-.103.765-.063 1.92.043 2.816.726.317 1.961.806 3.219 1.066-1.006.236-2.11.278-2.961.262.15.554.358 1.119.64 1.688.119.263.25.52.39.77.452.125 2.222.383 3.164.171l-2.51.897a27.776 27.776 0 002.544 2.726c2.031-1.092 2.494-1.241 4.018-2.238-2.467 2.008-3.108 2.828-3.8 3.67l-.483.678c-.25.351-.469.725-.65 1.117-.61 1.31-1.47 4.1-1.47 4.1-.154.486.202.842.674.674 0 0 2.79-.861 4.1-1.47.392-.182.766-.4 1.118-.65l.677-.483c.227-.187.453-.37.701-.586 0 0 1.705 2.02 3.458 3.349l.896-2.511c-.211.942.046 2.712.17 3.163.252.142.509.272.772.392.569.28 1.134.49 1.688.64-.016-.853.026-1.956.261-2.962.26 1.258.75 2.493 1.067 3.219.895.106 2.051.146 2.816.043a73.87 73.87 0 01-1.308-2.67c.811 1.07 1.874 1.988 2.302 2.34h-.001z"})]}))});function No(t){"@babel/helpers - typeof";return No=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},No(t)}function Tg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function UD(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Tg(Object(n),!0).forEach(function(r){KD(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Tg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function KD(t,e,n){return e=GD(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function GD(t){var e=qD(t,"string");return No(e)=="symbol"?e:String(e)}function qD(t,e){if(No(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(No(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function YD(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var JD=m.memo(function(t){var e=Object.assign({},(YD(t),t));return c.jsx(br,UD({Icon:_u,"aria-label":Zo,background:ID,color:$D,iconMultiple:BD},e))});function Po(t){"@babel/helpers - typeof";return Po=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Po(t)}var QD=["size","style"];function Eg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function yd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Eg(Object(n),!0).forEach(function(r){XD(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Eg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function XD(t,e,n){return e=ZD(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ZD(t){var e=eT(t,"string");return Po(e)=="symbol"?e:String(e)}function eT(t,e){if(Po(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Po(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function tT(t,e){if(t==null)return{};var n=nT(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function nT(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var K1=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=tT(t,QD);return c.jsxs("svg",yd(yd({fill:"currentColor",fillRule:"evenodd",height:n,style:yd({flex:"none",lineHeight:1},r),viewBox:"0 0 87 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Zo}),c.jsx("path",{d:"M17.122 16.607c0 4.696-3.219 7.393-7.774 7.393-3.674 0-6.255-1.546-7.257-4.637l3.401-1.21c.486 1.786 1.852 2.907 3.856 2.907 2.46 0 4.13-1.211 4.13-4.12v-1.122c-.85 1.121-2.46 2-4.494 2C4.61 17.818 2 14.273 2 9.909 2 5.546 4.611 2 8.984 2c2.004 0 3.644.879 4.494 2V2.303h3.644v14.303zm-3.583-6.85c0-2.908-1.58-4.575-3.857-4.575-2.52 0-4.008 1.757-4.008 4.727 0 2.94 1.488 4.727 4.008 4.727 2.278 0 3.857-1.666 3.857-4.515v-.363zM35.546 10.273c0 4.94-3.188 8.273-7.683 8.273-4.494 0-7.682-3.334-7.682-8.273C20.181 5.333 23.37 2 27.863 2c4.495 0 7.683 3.333 7.683 8.273zm-11.69 0c0 3.242 1.548 5.212 4.007 5.212 2.46 0 4.009-1.97 4.009-5.212 0-3.243-1.549-5.212-4.009-5.212-2.46 0-4.008 1.97-4.008 5.212zM52.957 10.273c0 4.94-3.188 8.273-7.682 8.273s-7.682-3.334-7.682-8.273C37.593 5.333 40.78 2 45.275 2s7.682 3.333 7.682 8.273zm-11.69 0c0 3.242 1.548 5.212 4.008 5.212s4.008-1.97 4.008-5.212c0-3.243-1.549-5.212-4.008-5.212-2.46 0-4.008 1.97-4.008 5.212zM54.336 15.182L57.069 13c.941 1.546 2.763 2.576 4.615 2.576 1.549 0 2.976-.546 2.976-1.97 0-1.364-1.336-1.515-3.856-2.03-2.52-.515-5.405-1.152-5.405-4.546 0-2.909 2.55-5.03 6.224-5.03 2.794 0 5.284 1.242 6.438 3L65.6 7.212c-.91-1.424-2.429-2.242-4.19-2.242-1.488 0-2.46.666-2.46 1.727 0 1.152 1.154 1.364 3.158 1.788 2.703.576 6.104 1.151 6.104 4.788 0 3.211-2.946 5.273-6.56 5.273-2.945 0-5.89-1.182-7.317-3.364zM77.965 18.546c-4.555 0-7.743-3.364-7.743-8.273 0-4.667 3.157-8.273 7.59-8.273 4.616 0 7.076 3.485 7.076 7.849v1.212H73.713c.274 2.727 1.913 4.394 4.252 4.394 1.791 0 3.218-.91 3.704-2.546l3.128 1.182c-1.124 2.787-3.644 4.455-6.832 4.455zm-.183-13.485c-1.882 0-3.34 1.12-3.886 3.272h7.318c-.03-1.757-1.124-3.272-3.432-3.272z"})]}))});function Oo(t){"@babel/helpers - typeof";return Oo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Oo(t)}function Lg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function rT(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Lg(Object(n),!0).forEach(function(r){sT(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Lg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function sT(t,e,n){return e=iT(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function iT(t){var e=oT(t,"string");return Oo(e)=="symbol"?e:String(e)}function oT(t,e){if(Oo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Oo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function aT(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var lT=m.memo(function(t){var e=Object.assign({},(aT(t),t));return c.jsx(yr,rT({Icon:_u,Text:K1,"aria-label":Zo,iconProps:{shape:"square"},spaceMultiple:RD,textMultiple:LD},e))}),Hs=_u;Hs.Text=K1;Hs.Combine=lT;Hs.Avatar=JD;Hs.colorPrimary=U1;Hs.title=Zo;var ea="Windsurf",cT=.7,dT=.2,G1="#fff",hT=G1,uT="#000",fT=.75;function Mo(t){"@babel/helpers - typeof";return Mo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mo(t)}var pT=["size","style"];function Rg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function vd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Rg(Object(n),!0).forEach(function(r){mT(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Rg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function mT(t,e,n){return e=gT(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function gT(t){var e=xT(t,"string");return Mo(e)=="symbol"?e:String(e)}function xT(t,e){if(Mo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Mo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function bT(t,e){if(t==null)return{};var n=yT(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function yT(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var Wu=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=bT(t,pT);return c.jsxs("svg",vd(vd({fill:"currentColor",fillRule:"evenodd",height:n,style:vd({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:ea}),c.jsx("path",{clipRule:"evenodd",d:"M23.78 5.004h-.228a2.187 2.187 0 00-2.18 2.196v4.912c0 .98-.804 1.775-1.76 1.775a1.818 1.818 0 01-1.472-.773L13.168 5.95a2.197 2.197 0 00-1.81-.95c-1.134 0-2.154.972-2.154 2.173v4.94c0 .98-.797 1.775-1.76 1.775-.57 0-1.136-.289-1.472-.773L.408 5.098C.282 4.918 0 5.007 0 5.228v4.284c0 .216.066.426.188.604l5.475 7.889c.324.466.8.812 1.351.938 1.377.316 2.645-.754 2.645-2.117V11.89c0-.98.787-1.775 1.76-1.775h.002c.586 0 1.135.288 1.472.773l4.972 7.163a2.15 2.15 0 001.81.95c1.158 0 2.151-.973 2.151-2.173v-4.939c0-.98.787-1.775 1.76-1.775h.194c.122 0 .22-.1.22-.222V5.225a.221.221 0 00-.22-.222z"})]}))});function Ao(t){"@babel/helpers - typeof";return Ao=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ao(t)}function Ig(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function vT(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ig(Object(n),!0).forEach(function(r){wT(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ig(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function wT(t,e,n){return e=kT(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function kT(t){var e=ST(t,"string");return Ao(e)=="symbol"?e:String(e)}function ST(t,e){if(Ao(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ao(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function CT(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var jT=m.memo(function(t){var e=Object.assign({},(CT(t),t));return c.jsx(br,vT({Icon:Wu,"aria-label":ea,background:hT,color:uT,iconMultiple:fT},e))});function Do(t){"@babel/helpers - typeof";return Do=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Do(t)}var NT=["size","style"];function $g(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function wd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?$g(Object(n),!0).forEach(function(r){PT(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$g(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function PT(t,e,n){return e=OT(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function OT(t){var e=MT(t,"string");return Do(e)=="symbol"?e:String(e)}function MT(t,e){if(Do(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Do(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function AT(t,e){if(t==null)return{};var n=DT(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function DT(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var q1=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=AT(t,NT);return c.jsxs("svg",wd(wd({fill:"currentColor",fillRule:"evenodd",height:n,style:wd({flex:"none",lineHeight:1},r),viewBox:"0 0 111 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:ea}),c.jsx("path",{clipRule:"evenodd",d:"M33.412 7.182h-1.715a.316.316 0 00-.315.316v13.79c0 .174.14.316.315.316h1.715a.316.316 0 00.316-.317V7.498a.316.316 0 00-.316-.316zm-1.772-5.18h1.828c.174 0 .315.141.315.316V4.57a.316.316 0 01-.315.316H31.64a.316.316 0 01-.315-.316V2.318c0-.175.141-.317.315-.317zM43.676 6.79c-1.927 0-3.324.671-4.218 1.653a.457.457 0 01-.782-.322v-.623a.316.316 0 00-.316-.316h-1.686a.316.316 0 00-.316.316v13.79c0 .174.142.316.316.316h1.687a.316.316 0 00.316-.317v-8.729c0-3.025.587-3.697 3.8-3.697s3.742.533 3.742 3.557v8.868c0 .175.142.317.316.317h1.715a.316.316 0 00.316-.317v-9.513c0-3.445-1.956-4.986-4.889-4.986v.003h-.001zm17.518 1.849a.457.457 0 00.782-.322V2.319c0-.175.142-.316.316-.316h1.687c.174 0 .316.141.316.316v18.97a.316.316 0 01-.316.316h-1.687a.316.316 0 01-.316-.316v-.819c.017-.418-.489-.62-.782-.322-.81 1.008-2.374 1.848-4.47 1.848-3.685 0-6.088-2.632-6.088-7.533 0-5.18 2.68-7.673 6.172-7.673 2.095 0 3.604.84 4.386 1.849zm-8.018 5.767c0 4.733.587 5.434 4.414 5.434 3.8 0 4.386-.701 4.386-5.434 0-4.733-.559-5.461-4.386-5.461s-4.414.728-4.414 5.461zm20.924-.894l-2.763-.476c-2.04-.364-2.404-.98-2.404-2.045.028-1.457.587-2.184 3.296-2.184 2.538 0 3.35.752 3.525 2.376.017.16.152.284.313.284h1.677c.18 0 .326-.151.316-.333-.163-2.788-2.709-4.346-5.746-4.346-3.408 0-5.67 1.82-5.67 4.426 0 2.38 1.844 3.417 4.05 3.837l3.046.56c1.676.31 2.235.87 2.235 1.933 0 1.709-.587 2.437-3.464 2.437s-3.673-.832-3.858-2.518a.315.315 0 00-.313-.282h-1.687a.318.318 0 00-.317.325c.08 3.004 2.797 4.493 6.034 4.493 3.52 0 5.949-1.82 5.949-4.566 0-2.408-1.845-3.501-4.219-3.921zm12.21 6.414c3.128 0 3.715-.672 3.715-3.697V7.502c0-.174.141-.316.316-.316h1.714c.175 0 .316.142.316.316v13.79a.316.316 0 01-.316.316h-1.714a.316.316 0 01-.316-.317v-.6c-.007-.429-.45-.642-.755-.343-.892.98-2.289 1.652-4.161 1.652-2.877 0-4.833-1.54-4.833-4.986V7.501c0-.175.142-.317.316-.317h1.715c.174 0 .316.142.316.317v8.868c0 3.024.558 3.557 3.687 3.557zm19.782-12.744v-1.85c0-.727.588-1.316 1.314-1.316h1.276a.316.316 0 00.315-.317V2.317a.316.316 0 00-.315-.317h-.885c-2.514 0-4.051 1.4-4.051 3.81v1.372h-1.859c-1.647.002-2.94.229-3.803 1.26-.317.302-.755.076-.755-.36V7.5a.316.316 0 00-.315-.317h-1.715a.316.316 0 00-.316.317v13.789c0 .174.141.316.316.316h1.715a.316.316 0 00.315-.316v-8.645c0-2.857.727-3.528 3.855-3.528h2.562V21.29c0 .175.141.317.316.317h1.715a.316.316 0 00.315-.317V9.116h2.593a.316.316 0 00.315-.317V7.501a.316.316 0 00-.315-.317h-2.593v-.002zM21.834 18.008a.561.561 0 001.091.005l3.933-15.772A.318.318 0 0127.166 2h1.963c.21 0 .363.199.31.403l-4.947 18.972a.305.305 0 01-.295.228h-3.502a.31.31 0 01-.3-.234L16.285 5.5a.56.56 0 00-.543-.42h-.036a.562.562 0 00-.542.42l-4.11 15.87a.31.31 0 01-.299.234H7.253a.304.304 0 01-.295-.228L2.011 2.403A.321.321 0 012.32 2h1.963c.145 0 .272.1.308.241l3.932 15.772a.56.56 0 001.09-.005l3.78-15.764A.316.316 0 0113.7 2h4.047c.146 0 .273.1.307.244l3.779 15.764z"})]}))});function To(t){"@babel/helpers - typeof";return To=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},To(t)}function Bg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function TT(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Bg(Object(n),!0).forEach(function(r){ET(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Bg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ET(t,e,n){return e=LT(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function LT(t){var e=RT(t,"string");return To(e)=="symbol"?e:String(e)}function RT(t,e){if(To(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(To(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function IT(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var $T=m.memo(function(t){var e=Object.assign({},(IT(t),t));return c.jsx(yr,TT({Icon:Wu,Text:q1,"aria-label":ea,iconProps:{shape:"square"},spaceMultiple:dT,textMultiple:cT},e))}),_s=Wu;_s.Text=q1;_s.Combine=$T;_s.Avatar=jT;_s.colorPrimary=G1;_s.title=ea;const BT={"claude-code":Ur.Avatar,cursor:Vs.Avatar,codex:zt.Avatar,"gemini-cli":Kr.Avatar,goose:Hs.Avatar,"github-copilot":Fs.Avatar,windsurf:_s.Avatar,cline:zs.Avatar},FT={antigravity:"/agents/antigravity.png",droid:"/agents/droid.png",opencode:"/agents/opencode.svg",amp:"/agents/amp.png",kilo:"/agents/kilo.png",roo:"/agents/roo.png",openhands:"/agents/openhands.png"};function zT(t){return t.split(/\s+/).map(e=>e[0]).join("").toUpperCase().slice(0,2)}const Y1=({agentName:t,displayName:e,size:n=20})=>{const r=BT[t];if(r)return c.jsx(r,{size:n});const s=FT[t];return s?c.jsx("img",{src:s,alt:e,className:"rounded object-contain",style:{width:n,height:n}}):c.jsx("div",{className:"flex items-center justify-center rounded bg-dash-surface-hover text-dash-text-muted font-semibold",style:{width:n,height:n,fontSize:n*.45},children:zT(e)})};function kd(t){return JSON.stringify([t.provider,t.type,t.item,t.global])}function VT(t){if(typeof t=="string"){const e=t.trim();return e.length>0?e:null}if(typeof t=="object"&&t!==null){const e=t;for(const n of["message","error","detail","details","reason"]){const r=e[n];if(typeof r=="string"&&r.trim().length>0)return r.trim()}}return null}async function Fg(t,e){const r=(await t.text().catch(()=>"")).trim();if(!r)return e;try{const s=JSON.parse(r);return VT(s)||e}catch{return r}}function HT(){const[t,e]=m.useState("idle"),[n,r]=m.useState(null),[s,i]=m.useState(new Map),[o,a]=m.useState(null),[l,d]=m.useState(null),h=m.useRef(0),u=m.useRef(0),f=m.useRef(null),p=m.useRef(null),g=m.useCallback(async C=>{e("reconciling"),d(null),a(null),h.current+=1;const S=h.current;f.current?.abort();const k=new AbortController;f.current=k;try{const N=new URLSearchParams({providers:C.providers.join(","),global:String(C.global),agents:String(C.include.agents??!0),commands:String(C.include.commands??!0),skills:String(C.include.skills??!0),config:String(C.include.config??!0),rules:String(C.include.rules??!0),hooks:String(C.include.hooks??!0)});C.source&&N.set("source",C.source);const v=await fetch(`/api/migrate/reconcile?${N.toString()}`,{signal:k.signal});if(!v.ok){const O=await Fg(v,"Failed to reconcile migration plan");throw new Error(O)}const P=await v.json();if(S!==h.current)return;r(P.plan),i(new Map),e("reviewing")}catch(N){if(k.signal.aborted||N instanceof DOMException&&N.name==="AbortError"||S!==h.current)return;d(N instanceof Error?N.message:"Failed to reconcile"),e("error")}},[]),x=m.useCallback((C,S)=>{i(k=>{const N=new Map(k);return N.set(kd(C),S),N})},[]),b=m.useCallback(async()=>{if(!n)return d("No plan to execute"),e("error"),!1;e("executing"),d(null),u.current+=1;const C=u.current;p.current?.abort();const S=new AbortController;p.current=S;try{const k=Object.fromEntries(s.entries()),N=await fetch("/api/migrate/execute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:n,resolutions:k}),signal:S.signal});if(C!==u.current)return!1;if(!N.ok){const P=await Fg(N,"Failed to execute migration");if(N.status===501)return d(P||"Plan execution is not available in this server build"),e("reviewing"),!1;throw new Error(P)}const v=await N.json();return C!==u.current?!1:(a({results:v.results,counts:v.counts,warnings:v.warnings??[],discovery:v.discovery}),e("complete"),!0)}catch(k){return S.signal.aborted||k instanceof DOMException&&k.name==="AbortError"||C!==u.current||(d(k instanceof Error?k.message:"Failed to execute migration"),e("error")),!1}},[n,s]),y=m.useCallback(()=>{f.current?.abort(),p.current?.abort(),e("idle"),r(null),i(new Map),a(null),d(null)},[]),w=m.useMemo(()=>n?n.actions.filter(C=>C.action==="conflict").every(C=>s.has(kd(C))):!0,[n,s]);return{phase:t,plan:n,resolutions:s,results:o,error:l,reconcile:g,resolve:x,execute:b,reset:y,allConflictsResolved:w,actionKey:kd}}const _T={agents:!0,commands:!0,skills:!0,config:!0,rules:!0,hooks:!0},Ut=["agents","commands","skills","config","rules","hooks"],Dr={agents:"migrateTypeAgents",commands:"migrateTypeCommands",skills:"migrateTypeSkills",config:"migrateTypeConfig",rules:"migrateTypeRules",hooks:"migrateTypeHooks"},zg={detected:"#D4A574","not-detected":"#8B9DC3"},jt=({label:t,value:e,tone:n="default"})=>{const r=n==="accent"?"text-dash-accent":n==="success"?"text-green-400":"text-dash-text";return c.jsxs("div",{className:"rounded-lg border border-dash-border bg-dash-bg/70 px-3 py-2.5",children:[c.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-dash-text-muted",children:t}),c.jsx("p",{className:`mt-1 text-lg font-semibold ${r}`,children:e})]})};function Vg(t,e){return t.success?t.skipped?{label:e("migrateStatusSkipped"),className:"text-yellow-400"}:{label:e("migrateStatusInstalled"),className:"text-green-400"}:{label:e("migrateStatusFailed"),className:"text-red-400"}}const WT=new Set([8203,8204,8205,8288,65279,8232,8233,8234,8235,8236,8237,8238,8294,8295,8296,8297]);function UT(t){return t===9||t===10||t===13?!0:t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159||WT.has(t)}function Hg(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(UT(r)||(e+=n))}return e}const KT=({provider:t,include:e,isSelected:n,cardClickToggles:r,onToggleSelect:s,onOpenDetails:i,t:o})=>{const a=Ut.filter(d=>t.capabilities[d]).length,l=Ut.some(d=>e[d]&&!t.capabilities[d]);return c.jsxs("div",{className:`relative rounded-xl border px-4 py-3 cursor-pointer transition-all ${n?"bg-dash-accent-subtle border-dash-accent/30 shadow-sm shadow-dash-accent/10":l?"bg-dash-surface border-yellow-500/25 hover:bg-dash-surface-hover hover:border-yellow-500/40":"bg-dash-surface border-dash-border hover:bg-dash-surface-hover hover:border-dash-accent/25"}`,children:[c.jsx("button",{type:"button",onClick:()=>r?s(t.name):i(t.name),"aria-label":r?`${t.displayName} deselect`:`${t.displayName} details`,className:"absolute inset-0 z-10 rounded-xl dash-focus-ring"}),c.jsxs("div",{className:"relative flex flex-col gap-3 lg:grid lg:grid-cols-[minmax(0,1.25fr)_140px_minmax(0,220px)_auto] lg:items-center lg:gap-4",children:[c.jsxs("div",{className:"min-w-0 space-y-1.5",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(Y1,{agentName:t.name,displayName:t.displayName,size:18}),c.jsx("span",{className:"text-sm font-semibold text-dash-text truncate",children:t.displayName}),t.recommended&&c.jsx("span",{className:"text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded border border-dash-accent/30 text-dash-accent",children:o("migrateFilterRecommended")}),t.commandsGlobalOnly&&c.jsx("span",{className:"text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded border border-yellow-500/30 text-yellow-400",children:o("migrateGlobalOnlyCommandsShort")})]}),c.jsxs("div",{className:"text-xs text-dash-text-muted truncate",children:[t.name," · ",a,"/",Ut.length," ",o("migrateCapabilitiesLabel")]})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[11px] lg:flex-col lg:items-start lg:gap-1",children:[c.jsx("span",{className:t.detected?"text-dash-accent":"text-dash-text-muted",children:t.detected?o("migrateDetectedTag"):o("migrateNotDetectedTag")}),c.jsx("span",{className:"text-dash-text-muted",children:t.recommended?o("migrateFilterRecommended"):"-"})]}),c.jsx("div",{className:"flex flex-wrap gap-1",children:Ut.map(d=>{const h=t.capabilities[d],u=e[d];return c.jsx("span",{className:`text-[10px] uppercase px-1.5 py-0.5 rounded border ${h&&u?"border-dash-accent/45 text-dash-accent":h?"border-dash-border text-dash-text-secondary":"border-dash-border text-dash-text-muted opacity-60"}`,children:o(Dr[d])},d)})}),c.jsx("div",{className:"relative z-20 flex justify-start lg:justify-end",children:c.jsx("button",{type:"button",onClick:d=>{d.stopPropagation(),s(t.name)},className:`dash-focus-ring px-4 py-1.5 text-xs font-semibold rounded-md transition-colors ${n?"bg-transparent text-dash-text-secondary border border-dash-border hover:bg-dash-surface-hover":"bg-dash-accent text-white hover:bg-dash-accent/90"}`,children:o(n?"migrateSelectedButton":"migrateSelectButton")})})]})]})},GT=({provider:t,include:e,isSelected:n,latestResult:r,onToggleSelect:s,onClose:i,t:o})=>{const a=m.useRef(null),l=m.useRef(null),d=m.useCallback(()=>{const f=l.current;l.current=null,f&&document.contains(f)&&f.focus()},[]),h=m.useCallback(()=>{i(),d()},[i,d]),u=m.useCallback(()=>{const f=a.current;if(f?.open){f.close();return}i(),d()},[i,d]);return m.useEffect(()=>{const f=a.current;if(f){if(!f.open){l.current=document.activeElement instanceof HTMLElement?document.activeElement:null;try{f.showModal()}catch{d(),i()}}return()=>{if(f.open){f.close();return}d()}}},[i,d]),c.jsx("dialog",{ref:a,"aria-label":t.displayName,onClose:h,onCancel:f=>{f.preventDefault(),u()},onClick:f=>{f.target===f.currentTarget&&u()},className:"fixed inset-0 z-50 m-0 h-full max-h-none w-full max-w-none overflow-hidden border-0 bg-transparent p-0 backdrop:bg-black/50",children:c.jsxs("div",{className:"ml-auto h-full w-full sm:w-[460px] bg-dash-surface border-l border-dash-border shadow-2xl flex flex-col animate-slide-in",children:[c.jsx("div",{className:"px-6 py-5 border-b border-dash-border",children:c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2.5",children:[c.jsx(Y1,{agentName:t.name,displayName:t.displayName,size:22}),c.jsx("h2",{className:"text-xl font-bold text-dash-text truncate",children:t.displayName})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mt-2",children:[c.jsx("span",{className:"text-[11px] text-dash-text-muted font-mono",children:t.name}),c.jsx("span",{className:`text-[10px] uppercase tracking-wide px-2 py-0.5 rounded border ${t.detected?"border-dash-accent/30 text-dash-accent":"border-dash-border text-dash-text-muted"}`,children:t.detected?o("migrateDetectedTag"):o("migrateNotDetectedTag")}),t.recommended&&c.jsx("span",{className:"text-[10px] uppercase tracking-wide px-2 py-0.5 rounded border border-dash-accent/30 text-dash-accent",children:o("migrateFilterRecommended")})]})]}),c.jsx("button",{type:"button",onClick:u,"aria-label":o("detailPanelClose"),className:"w-8 h-8 flex items-center justify-center rounded-md text-dash-text-muted hover:bg-dash-surface-hover hover:text-dash-text transition-colors",children:c.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[c.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18",strokeWidth:2}),c.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18",strokeWidth:2})]})})]})}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-6",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wide text-dash-text-muted mb-2.5",children:o("migrateCapabilitiesSection")}),c.jsx("div",{className:"space-y-1.5",children:Ut.map(f=>{const p=t.capabilities[f],g=e[f];return c.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-dash-bg rounded-md",children:[c.jsx("span",{className:"text-sm text-dash-text",children:o(Dr[f])}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:`text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded border ${g?"border-dash-accent/35 text-dash-accent":"border-dash-border text-dash-text-muted"}`,children:o(g?"migrateIncludedEnabled":"migrateIncludedDisabled")}),c.jsx("span",{className:`text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded border ${p?"border-green-500/35 text-green-400":"border-red-500/30 text-red-400"}`,children:o(p?"migrateSupported":"migrateUnsupportedShort")})]})]},f)})})]}),t.commandsGlobalOnly&&e.commands&&c.jsx("div",{className:"px-3 py-2 border border-yellow-500/30 bg-yellow-500/10 rounded text-xs text-yellow-400",children:o("migrateGlobalForced")}),c.jsxs("div",{children:[c.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wide text-dash-text-muted mb-2.5",children:o("migrateLatestTarget")}),r?c.jsxs("div",{className:"px-3 py-2 bg-dash-bg rounded-md border border-dash-border space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"text-xs text-dash-text-muted",children:o("migrateStatus")}),c.jsx("span",{className:`text-xs font-semibold ${Vg(r,o).className}`,children:Vg(r,o).label})]}),c.jsx("p",{className:"text-xs font-mono text-dash-text break-all",children:Hg(r.path||"-")}),(r.error||r.skipReason)&&c.jsx("p",{className:"text-xs text-red-400 break-words",children:Hg(r.error||r.skipReason||"-")})]}):c.jsx("p",{className:"text-sm text-dash-text-muted",children:o("migrateNoResultForProvider")})]})]}),c.jsxs("div",{className:"px-6 py-4 border-t border-dash-border flex items-center justify-between gap-2",children:[c.jsx("button",{type:"button",onClick:()=>s(t.name),className:`px-4 py-2 text-sm font-semibold rounded-md transition-colors ${n?"bg-transparent text-dash-text-secondary border border-dash-border hover:bg-dash-surface-hover":"bg-dash-accent text-white hover:bg-dash-accent/90"}`,children:o(n?"migrateUnselectProvider":"migrateSelectProviderAction")}),c.jsx("button",{type:"button",onClick:u,"aria-label":o("detailPanelClose"),className:"px-4 py-2 text-sm font-medium rounded-md border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover",children:o("detailPanelClose")})]})]})})},qT=()=>{const{t}=X(),e=HT(),[n,r]=m.useState([]),[s,i]=m.useState(null),[o,a]=m.useState([]),[l,d]=m.useState(_T),[h,u]=m.useState(!0),[f,p]=m.useState(!0),[g,x]=m.useState(!1),[b,y]=m.useState(null),[w,C]=m.useState(""),S=m.useDeferredValue(w),[k,N]=m.useState("all"),[v,P]=m.useState(null),O=m.useRef(0),E=m.useCallback(async(I=!1)=>{O.current+=1;const K=O.current;try{I?x(!0):p(!0),y(null);const[de,Oe]=await Promise.all([uk(),Of()]);if(K!==O.current)return;r(de.providers),i(Oe),a(Tt=>{if(Tt.length===0)return[];const Kn=de.providers.map(Ct=>Ct.name);return Tt.filter(Ct=>Kn.includes(Ct))})}catch(de){if(K!==O.current)return;y(de instanceof Error?de.message:t("migrateDetectFailed"))}finally{K===O.current&&(p(!1),x(!1))}},[t]);m.useEffect(()=>{E()},[E]);const M=m.useMemo(()=>{const I=new Map;for(const K of n)I.set(K.name,K);return I},[n]),D=m.useMemo(()=>v&&M.get(v)||null,[v,M]);m.useEffect(()=>{v&&!M.has(v)&&P(null)},[v,M]);const $=m.useCallback(()=>{P(null)},[]),F=m.useMemo(()=>new Set(o),[o]),z=m.useMemo(()=>n.filter(I=>I.detected).length,[n]),G=o.length,le=m.useMemo(()=>n.filter(I=>I.recommended).length,[n]),Z=m.useMemo(()=>Ut.filter(I=>l[I]).length,[l]),Q=m.useMemo(()=>{const I=[];l.commands&&o.includes("codex")&&!h&&M.get("codex")?.commandsGlobalOnly&&I.push(t("migrateGlobalForced"));for(const K of Ut){if(!l[K])continue;const de=o.filter(Oe=>!M.get(Oe)?.capabilities[K]).map(Oe=>M.get(Oe)?.displayName||Oe);de.length>0&&I.push(`${t("migrateUnsupported")}: ${t(Dr[K])} -> ${de.join(", ")}`)}return I},[l,h,M,o,t]),ce=m.useCallback(I=>{if(I==="codex"){a(["codex"]);return}if(I==="antigravity"){a(["antigravity"]);return}if(I==="core"){const de=["codex","antigravity","droid"].filter(Oe=>n.some(Tt=>Tt.name===Oe));a(de);return}const K=n.filter(de=>de.detected).map(de=>de.name);a(K)},[n]),fe=m.useCallback(I=>{a(K=>K.includes(I)?K.filter(de=>de!==I):[...K,I])},[]),W=m.useCallback(I=>{d(K=>({...K,[I]:!K[I]}))},[]),oe=m.useMemo(()=>{const I=[...n];return I.sort((K,de)=>{const Oe=F.has(K.name),Tt=F.has(de.name);return Oe!==Tt?Oe?-1:1:K.detected!==de.detected?K.detected?-1:1:K.recommended!==de.recommended?K.recommended?-1:1:K.displayName.localeCompare(de.displayName)}),I},[n,F]),ue=m.useMemo(()=>{const I=S.trim().toLowerCase();return oe.filter(K=>{if(k==="selected"&&!F.has(K.name)||k==="detected"&&!K.detected||k==="recommended"&&!K.recommended||k==="not-detected"&&K.detected)return!1;if(!I)return!0;const de=Ut.filter(Oe=>K.capabilities[Oe]).map(Oe=>t(Dr[Oe]).toLowerCase());return K.displayName.toLowerCase().includes(I)||K.name.toLowerCase().includes(I)||de.some(Oe=>Oe.includes(I))})},[S,k,F,oe,t]),be=m.useMemo(()=>{const I=ue.filter(Oe=>Oe.detected),K=ue.filter(Oe=>!Oe.detected),de=[];return I.length>0&&de.push({key:"detected",label:t("migrateDetectedTag"),providers:I}),K.length>0&&de.push({key:"not-detected",label:t("migrateNotDetectedTag"),providers:K}),de},[ue,t]),Pe=m.useMemo(()=>({all:n.length,selected:G,detected:n.filter(I=>I.detected).length,recommended:n.filter(I=>I.recommended).length,"not-detected":n.filter(I=>!I.detected).length}),[n,G]),Qe=m.useMemo(()=>ue.map(I=>I.name),[ue]),U=m.useCallback(()=>{a(I=>{const K=new Set(I);for(const de of Qe)K.add(de);return Array.from(K)})},[Qe]),ve=m.useCallback(()=>{a([])},[]),te=m.useCallback(async()=>{if(o.length===0){y(t("migrateSelectProvider"));return}if(Z===0){y(t("migrateNoTypesEnabled"));return}await e.reconcile({providers:o,global:h,include:l})},[Z,l,h,o,t,e]),Ae=m.useCallback(async()=>{if(y(null),!!await e.execute())try{const K=await Of();i(K)}catch(K){console.error("Failed to refresh discovery:",K)}},[e]),pe=m.useMemo(()=>{const I=new Map;if(!e.results)return I;for(const K of e.results.results)I.set(K.provider,K);return I},[e.results]);m.useEffect(()=>{const I=K=>{const de=K.target,Oe=!!(de&&(de instanceof HTMLInputElement||de instanceof HTMLTextAreaElement||de.isContentEditable||de.closest('[contenteditable="true"], [role="textbox"]'))),Tt=K.metaKey||K.ctrlKey||K.altKey;K.key==="/"&&!Oe&&!Tt&&(K.preventDefault(),document.getElementById("migrate-search")?.focus())};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[]);const _e=e.phase==="idle"&&o.length>0&&Z>0;return f?c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsxs("div",{className:"text-center",children:[c.jsx("div",{className:"w-8 h-8 border-4 border-dash-accent border-t-transparent rounded-full animate-spin mx-auto mb-3"}),c.jsx("p",{className:"text-dash-text-muted",children:t("migrateDiscovering")})]})}):c.jsxs("div",{className:"relative h-full overflow-hidden",children:[c.jsxs("div",{className:"pointer-events-none absolute inset-0 -z-10 overflow-hidden",children:[c.jsx("div",{className:"absolute -top-24 -right-8 h-64 w-64 rounded-full bg-dash-accent/10 blur-3xl"}),c.jsx("div",{className:"absolute -bottom-28 -left-10 h-72 w-72 rounded-full bg-dash-accent/5 blur-3xl"})]}),c.jsxs("div",{className:"h-full overflow-y-auto space-y-4 pb-8",children:[c.jsx("section",{className:"dash-panel dash-sticky-glass sticky top-0 z-20 px-4 py-4 md:px-6 md:py-5",children:c.jsxs("div",{className:"flex flex-col gap-4 xl:flex-row xl:items-end xl:justify-between",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsx("p",{className:"mono text-[10px] uppercase tracking-[0.16em] text-dash-text-muted",children:t("migrate")}),c.jsx("h1",{className:"text-xl md:text-2xl font-semibold text-dash-text",children:t("migrateTitle")}),c.jsx("p",{className:"text-sm text-dash-text-secondary max-w-3xl",children:t("migrateSubtitle")})]}),e.phase==="complete"&&e.results?c.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:[c.jsx(jt,{label:t("migrateInstalled"),value:e.results.counts.installed,tone:"success"}),c.jsx(jt,{label:t("migrateSkipped"),value:e.results.counts.skipped}),c.jsx(jt,{label:t("migrateFailed"),value:e.results.counts.failed})]}):c.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[c.jsx(jt,{label:t("migrateTypeAgents"),value:s?.counts.agents??0}),c.jsx(jt,{label:t("migrateDetectedProviders"),value:z,tone:"success"}),c.jsx(jt,{label:t("migrateSelectedProviders"),value:G,tone:"accent"}),c.jsx(jt,{label:t("migrateTypes"),value:Z})]})]})}),b&&c.jsx("div",{className:"px-4 py-3 border border-red-500/30 bg-red-500/10 rounded-lg text-sm text-red-400",children:b}),c.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1.55fr)_minmax(0,340px)]",children:[c.jsxs("section",{className:"order-2 xl:order-1 space-y-4",children:[e.phase==="reviewing"&&e.plan&&c.jsxs("div",{className:"dash-panel flex flex-col max-h-[calc(100vh-200px)]",children:[c.jsxs("div",{className:"flex items-center justify-between p-5 pb-4",children:[c.jsx("h2",{className:"text-lg font-semibold text-dash-text",children:t("migrateReviewPlan")}),c.jsx("button",{type:"button",onClick:()=>e.reset(),className:"dash-focus-ring px-3 py-1.5 text-xs font-medium rounded-md border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover",children:t("cancel")})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-5 pb-4",children:[c.jsx(DO,{plan:e.plan,resolutions:e.resolutions,onResolve:e.resolve,actionKey:e.actionKey}),e.error&&c.jsx("div",{className:"mt-4 px-3 py-2 border border-red-500/30 bg-red-500/10 rounded text-xs text-red-400",children:e.error})]}),c.jsxs("div",{className:"flex items-center justify-end gap-3 px-5 py-4 border-t border-dash-border bg-dash-surface rounded-b-xl",children:[e.plan.hasConflicts&&!e.allConflictsResolved&&c.jsx("p",{className:"text-xs text-yellow-400",children:t("migrateResolveConflicts")}),c.jsx("button",{type:"button",onClick:Ae,disabled:e.plan.hasConflicts&&!e.allConflictsResolved,className:"dash-focus-ring px-4 py-2 bg-dash-accent text-white rounded-md text-sm font-semibold hover:bg-dash-accent/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:t("migrateExecutePlan")})]})]}),e.phase==="complete"&&e.results&&c.jsx(xO,{results:e.results,onReset:e.reset}),e.phase==="error"&&e.error&&c.jsxs("div",{className:"dash-panel p-5",children:[c.jsx("div",{className:"px-4 py-3 border border-red-500/30 bg-red-500/10 rounded-lg text-sm text-red-400",children:e.error}),c.jsx("button",{type:"button",onClick:e.reset,className:"mt-4 dash-focus-ring px-4 py-2 bg-dash-bg border border-dash-border rounded-md text-sm text-dash-text-secondary hover:bg-dash-surface-hover",children:t("tryAgain")})]}),(e.phase==="reconciling"||e.phase==="executing")&&c.jsx("div",{className:"dash-panel p-5",children:c.jsx("div",{className:"flex items-center justify-center py-8",children:c.jsxs("div",{className:"text-center",children:[c.jsx("div",{className:"w-8 h-8 border-4 border-dash-accent border-t-transparent rounded-full animate-spin mx-auto mb-3"}),c.jsx("p",{className:"text-dash-text-muted",children:e.phase==="reconciling"?t("migrateReconciling"):t("migrateExecuting")})]})})}),e.phase==="idle"&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"dash-panel p-4 md:p-5 space-y-4",children:[c.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center",children:[c.jsxs("div",{className:"relative flex-1",children:[c.jsxs("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 stroke-dash-text-muted",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("circle",{cx:"11",cy:"11",r:"8"}),c.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),c.jsx("input",{id:"migrate-search",type:"text",value:w,onChange:I=>C(I.target.value),placeholder:t("migrateSearchProviders"),className:"dash-focus-ring w-full pl-9 pr-12 py-2 bg-dash-bg border border-dash-border rounded-lg text-dash-text text-sm focus:border-dash-accent transition-colors"}),c.jsx("span",{className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-[11px] text-dash-text-muted bg-dash-surface-hover border border-dash-border px-1.5 py-0.5 rounded",children:t("searchShortcut")})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("button",{type:"button",onClick:()=>E(!0),disabled:g,className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-50 whitespace-nowrap",children:t(g?"checking":"migrateRefresh")}),c.jsx("button",{type:"button",onClick:U,disabled:Qe.length===0,className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-50 whitespace-nowrap",children:t("migrateSelectVisible")}),c.jsx("button",{type:"button",onClick:ve,disabled:G===0,className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-50 whitespace-nowrap",children:t("migrateClearSelection")})]})]}),c.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{key:"all",label:t("categoryAll")},{key:"selected",label:t("migrateSelectedProviders")},{key:"detected",label:t("migrateDetectedProviders")},{key:"recommended",label:t("migrateFilterRecommended")},{key:"not-detected",label:t("migrateNotDetectedTag")}].map(I=>c.jsxs("button",{type:"button",onClick:()=>N(I.key),className:`dash-focus-ring px-3 py-1 text-xs font-medium rounded-full border transition-all whitespace-nowrap ${k===I.key?"bg-dash-accent/10 border-dash-accent text-dash-accent":"border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text"}`,children:[I.label,c.jsx("span",{className:"opacity-60 ml-1 text-[10px]",children:Pe[I.key]})]},I.key))}),c.jsxs("div",{children:[c.jsx("p",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wide text-dash-text-muted",children:t("migrateTypes")}),c.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Ut.map(I=>c.jsx("button",{type:"button",onClick:()=>W(I),className:`dash-focus-ring px-2.5 py-1 text-[11px] uppercase tracking-wide rounded-md border transition-colors ${l[I]?"border-dash-accent/45 text-dash-accent bg-dash-accent/5":"border-dash-border text-dash-text-muted hover:bg-dash-surface-hover"}`,children:t(Dr[I])},I))})]})]}),c.jsxs("div",{className:"dash-panel p-4 md:p-5",children:[c.jsx("h2",{className:"text-sm font-semibold text-dash-text mb-4",children:t("migrateSourceSummary")}),c.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 xl:grid-cols-6 gap-3",children:Ut.map(I=>c.jsxs("div",{className:"px-3 py-2 bg-dash-bg border border-dash-border rounded-md text-center",children:[c.jsx("p",{className:"text-[11px] uppercase tracking-wide text-dash-text-muted",children:t(Dr[I])}),c.jsx("p",{className:"text-lg font-semibold text-dash-text",children:s?.counts[I]??0})]},I))})]}),c.jsxs("div",{className:"dash-panel p-4 md:p-5",children:[c.jsxs("div",{className:"flex items-center justify-between mb-4",children:[c.jsx("h2",{className:"text-sm font-semibold text-dash-text",children:t("migrateProvidersHeading")}),c.jsxs("p",{className:"text-xs text-dash-text-muted",children:[ue.length," ",t("migrateProvidersCountSuffix")]})]}),n.length===0?c.jsx("div",{className:"text-sm text-dash-text-muted",children:t("migrateNoProviders")}):ue.length===0?c.jsx("div",{className:"text-sm text-dash-text-muted",children:t("migrateNoProvidersMatch")}):c.jsx("div",{className:"space-y-5",children:be.map(I=>c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-2.5 mb-3",children:[c.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:zg[I.key]}}),c.jsx("h2",{className:"text-[13px] font-semibold uppercase tracking-wide",style:{color:zg[I.key]},children:I.label}),c.jsxs("span",{className:"text-[11px] text-dash-text-muted ml-auto",children:[I.providers.length," ",t("migrateProvidersCountSuffix")]}),c.jsx("div",{className:"flex-1 h-px bg-dash-border ml-3"})]}),c.jsx("div",{className:"space-y-2",children:I.providers.map(K=>c.jsx(KT,{provider:K,include:l,isSelected:F.has(K.name),cardClickToggles:k==="selected",onToggleSelect:fe,onOpenDetails:P,t},K.name))})]},I.key))})]})]})]}),c.jsx("aside",{className:"order-1 xl:order-2 space-y-4 self-start xl:sticky xl:top-[84px]",children:e.phase==="complete"&&e.results?c.jsxs("div",{className:"dash-panel p-4 md:p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-semibold text-dash-text",children:t("migrateSummaryTitle")}),c.jsxs("p",{className:"text-xs text-dash-text-muted mt-1",children:[e.results.counts.installed+e.results.counts.skipped+e.results.counts.failed," ",t("migrateSummarySubtitle")]})]}),c.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[c.jsx(jt,{label:t("migrateInstalled"),value:e.results.counts.installed,tone:"success"}),c.jsx(jt,{label:t("migrateSkipped"),value:e.results.counts.skipped}),c.jsx(jt,{label:t("migrateFailed"),value:e.results.counts.failed})]}),e.results.discovery&&c.jsxs("div",{className:"space-y-1.5",children:[c.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-dash-text-muted",children:t("migrateTypes")}),Ut.map(I=>{const K=e.results?.discovery?.[I]??0;return K===0?null:c.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-dash-bg rounded-md text-xs",children:[c.jsx("span",{className:"text-dash-text-secondary",children:t(Dr[I])}),c.jsx("span",{className:"font-semibold text-dash-text",children:K})]},I)})]}),o.length>0&&c.jsxs("div",{className:"space-y-1.5",children:[c.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-dash-text-muted",children:t("migrateSummaryProviders")}),c.jsx("div",{className:"flex flex-wrap gap-1.5",children:o.map(I=>{const K=M.get(I);return c.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded border border-dash-accent/30 text-dash-accent",children:K?.displayName||I},I)})})]}),c.jsx("div",{className:"text-[10px] px-3 py-1.5 bg-dash-bg rounded-md text-dash-text-muted",children:t(h?"migrateScopeGlobal":"migrateScopeProject")}),c.jsx("button",{type:"button",onClick:e.reset,className:"dash-focus-ring w-full px-4 py-2.5 bg-dash-accent text-white rounded-md text-sm font-semibold hover:bg-dash-accent/90 transition-colors",children:t("migrateSummaryNewMigration")})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"dash-panel p-4 md:p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-semibold text-dash-text",children:t("migrateActionSummaryTitle")}),c.jsxs("p",{className:"text-xs text-dash-text-muted mt-1",children:[G," ",t("migrateProvidersCountSuffix")," ·"," ",Z,"/",Ut.length," ",t("migrateTypes")]})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[c.jsx(jt,{label:t("migrateSelectedProviders"),value:G,tone:"accent"}),c.jsx(jt,{label:t("migrateDetectedProviders"),value:z}),c.jsx(jt,{label:t("migrateTypes"),value:Z}),c.jsx(jt,{label:t("migrateFilterRecommended"),value:le,tone:"success"})]}),c.jsxs("div",{className:"inline-flex w-full rounded-md border border-dash-border overflow-hidden",children:[c.jsx("button",{type:"button",onClick:()=>u(!1),className:`dash-focus-ring flex-1 px-3 py-2 text-sm ${h?"bg-dash-bg text-dash-text-secondary":"bg-dash-accent-subtle text-dash-accent"}`,children:t("migrateScopeProject")}),c.jsx("button",{type:"button",onClick:()=>u(!0),className:`dash-focus-ring flex-1 px-3 py-2 text-sm border-l border-dash-border ${h?"bg-dash-accent-subtle text-dash-accent":"bg-dash-bg text-dash-text-secondary"}`,children:t("migrateScopeGlobal")})]}),c.jsx("button",{type:"button",onClick:te,disabled:!_e,className:"dash-focus-ring w-full px-4 py-2.5 bg-dash-accent text-white rounded-md text-sm font-semibold hover:bg-dash-accent/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:e.phase==="reconciling"?t("migrateRunning"):t("migrateRun")}),Q.length>0&&c.jsx("div",{className:"space-y-2",children:Q.map((I,K)=>c.jsx("p",{className:"text-xs px-3 py-2 border border-yellow-500/30 bg-yellow-500/10 rounded text-yellow-400",children:I},`${I}-${K}`))})]}),c.jsxs("div",{className:"dash-panel-muted p-4",children:[c.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-wide text-dash-text-muted",children:t("migrateSelectProviderAction")}),c.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[c.jsx("button",{type:"button",onClick:()=>ce("codex"),className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover",children:t("migratePresetCodex")}),c.jsx("button",{type:"button",onClick:()=>ce("antigravity"),className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover",children:t("migratePresetAntigravity")}),c.jsx("button",{type:"button",onClick:()=>ce("core"),className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover",children:t("migratePresetCore")}),c.jsx("button",{type:"button",onClick:()=>ce("detected"),className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover",children:t("migratePresetDetected")})]})]})]})})]})]}),D&&c.jsx(GT,{provider:D,include:l,isSelected:F.has(D.name),latestResult:pe.get(D.name)||null,onToggleSelect:fe,onClose:$,t})]})},YT=({featureId:t,name:e,description:n,included:r})=>{const{t:s}=X();return c.jsxs("div",{"data-testid":`feature-card-${t}`,className:`p-4 rounded-lg border transition-all ${r?"border-[var(--dash-accent)] bg-[var(--dash-surface)] shadow-sm":"border-[var(--dash-border)] bg-[var(--dash-bg)] opacity-50"}`,children:[c.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r?c.jsx("svg",{className:"w-5 h-5 text-[var(--dash-accent)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):c.jsx("svg",{className:"w-5 h-5 text-[var(--dash-text-muted)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),c.jsx("h4",{className:"font-medium text-[var(--dash-text)]",children:s(e)})]}),c.jsx("p",{className:"text-sm text-[var(--dash-text-muted)] leading-relaxed",children:s(n)})]})},JT=({selectedKit:t,onKitSelect:e,onInstall:n,installing:r})=>{const{t:s}=X(),[i,o]=m.useState(1);return c.jsxs("div",{className:"space-y-6","data-testid":"install-wizard",children:[c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx(Sd,{number:1,active:i===1,label:s("stepChooseKit")}),c.jsx("div",{className:"flex-1 h-px bg-[var(--dash-border)]"}),c.jsx(Sd,{number:2,active:i===2,label:s("stepConfigure")}),c.jsx("div",{className:"flex-1 h-px bg-[var(--dash-border)]"}),c.jsx(Sd,{number:3,active:i===3,label:s("stepInstall")})]}),c.jsxs("div",{className:"min-h-[200px]",children:[i===1&&c.jsx(QT,{onSelect:e,selected:t}),i===2&&t&&c.jsx(XT,{kit:t}),i===3&&c.jsx(ZT,{installing:r})]}),c.jsxs("div",{className:"flex justify-between pt-4 border-t border-[var(--dash-border)]",children:[i>1?c.jsx("button",{onClick:()=>o(a=>a-1),className:"px-4 py-2 text-sm font-medium text-[var(--dash-text)] bg-[var(--dash-surface)] border border-[var(--dash-border)] rounded-lg hover:bg-[var(--dash-surface-hover)] transition-colors","data-testid":"wizard-back",children:s("back")}):c.jsx("div",{}),i<3&&t&&c.jsx("button",{onClick:()=>o(a=>a+1),className:"px-4 py-2 text-sm font-medium text-white bg-[var(--dash-accent)] rounded-lg hover:opacity-90 transition-opacity","data-testid":"wizard-next",children:s("next")}),i===3&&c.jsx("button",{onClick:n,disabled:r,className:"px-4 py-2 text-sm font-medium text-white bg-[var(--dash-accent)] rounded-lg hover:opacity-90 transition-opacity disabled:opacity-50 disabled:cursor-not-allowed","data-testid":"wizard-install",children:s("install")})]})]})},Sd=({number:t,active:e,label:n})=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold transition-colors ${e?"bg-[var(--dash-accent)] text-white":"bg-[var(--dash-surface)] text-[var(--dash-text-muted)] border border-[var(--dash-border)]"}`,children:t}),c.jsx("span",{className:`text-sm font-medium ${e?"text-[var(--dash-text)]":"text-[var(--dash-text-muted)]"}`,children:n})]}),QT=({onSelect:t,selected:e})=>{const{t:n}=X();return c.jsxs("div",{className:"space-y-4",children:[c.jsx("p",{className:"text-[var(--dash-text-muted)]",children:e?`Selected: ${e===jn.ENGINEER?n("kitEngineerName"):n("kitMarketingName")}`:"Please select a kit above"}),e&&c.jsxs("button",{type:"button",onClick:()=>t(e===jn.ENGINEER?jn.MARKETING:jn.ENGINEER),className:"text-sm text-[var(--dash-accent)] hover:underline",children:["Switch to ",e===jn.ENGINEER?n("kitMarketingName"):n("kitEngineerName")]})]})},XT=()=>c.jsx("div",{className:"text-[var(--dash-text-muted)]",children:"Configuration preview placeholder"}),ZT=({installing:t})=>c.jsx("div",{className:"text-[var(--dash-text-muted)]",children:t?"Installing...":"Ready to install"}),eE=({kit:t,onGetStarted:e})=>{const{t:n}=X(),r=tn(),s=t===jn.ENGINEER?"kitEngineerName":t===jn.MARKETING?"kitMarketingName":"kitEngineerName";return c.jsxs("div",{className:"text-center py-12 space-y-6","data-testid":"success-screen",children:[c.jsx("div",{className:"w-16 h-16 mx-auto bg-green-100 rounded-full flex items-center justify-center",children:c.jsx("svg",{className:"w-10 h-10 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})}),c.jsx("h2",{className:"text-2xl font-bold text-[var(--dash-text)]",children:n("installSuccess")}),c.jsx("p",{className:"text-[var(--dash-text-muted)] max-w-md mx-auto",children:n("installSuccessDesc").replace("{kit}",n(s))}),c.jsxs("div",{className:"flex gap-4 justify-center pt-4",children:[c.jsx("button",{onClick:e,className:"px-6 py-2.5 text-sm font-medium text-white bg-[var(--dash-accent)] rounded-lg hover:opacity-90 transition-opacity","data-testid":"get-started-btn",children:n("getStarted")}),c.jsx("button",{onClick:()=>r("/"),className:"px-6 py-2.5 text-sm font-medium text-[var(--dash-text)] bg-[var(--dash-surface)] border border-[var(--dash-border)] rounded-lg hover:bg-[var(--dash-surface-hover)] transition-colors","data-testid":"dashboard-btn",children:n("goToDashboard")})]})]})},tE=[{id:"agents",name:"featureAgents",description:"featureAgentsDesc",engineer:!0,marketing:!0},{id:"hooks",name:"featureHooks",description:"featureHooksDesc",engineer:!0,marketing:!0},{id:"skills",name:"featureSkills",description:"featureSkillsDesc",engineer:!0,marketing:!0},{id:"multiagent",name:"featureMultiAgent",description:"featureMultiAgentDesc",engineer:!0,marketing:!1},{id:"content",name:"featureContent",description:"featureContentDesc",engineer:!1,marketing:!0},{id:"social",name:"featureSocial",description:"featureSocialDesc",engineer:!1,marketing:!0}],J1={engineer:{id:"engineer",name:"kitEngineerName",tagline:"kitEngineerTagline",primaryColor:"text-blue-500",features:["agents","hooks","skills","multiagent"]},marketing:{id:"marketing",name:"kitMarketingName",tagline:"kitMarketingTagline",primaryColor:"text-purple-500",features:["agents","hooks","skills","content","social"]}};function nE(t){const e=J1[t];return e?tE.filter(n=>e.features.includes(n.id)):(console.warn(`Unknown kit type: ${t}`),[])}const rE=({kit:t,selected:e,onSelect:n,features:r})=>{const{t:s}=X();return c.jsxs("button",{type:"button",onClick:n,className:`p-6 rounded-lg border-2 text-left transition-all w-full ${e?"border-[var(--dash-accent)] bg-[var(--dash-surface)] shadow-md":"border-[var(--dash-border)] hover:border-[var(--dash-accent)]/50"}`,children:[c.jsx("h3",{className:`text-xl font-bold ${t.primaryColor}`,children:s(t.name)}),c.jsx("p",{className:"text-[var(--dash-text-muted)] mt-1",children:s(t.tagline)}),c.jsx("div",{className:"mt-4 space-y-2",children:r.slice(0,3).map(i=>c.jsx(YT,{featureId:i.id,name:i.name,description:i.description,included:!0},i.id))})]})},sE=()=>{const{t}=X(),e=tn(),[n,r]=m.useState(null),[s,i]=m.useState(!1),[o,a]=m.useState(!1),[l,d]=m.useState(null),h=async()=>{if(n){i(!0),d(null);try{const f=await fetch("/api/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kit:n})});if(!f.ok)throw new Error(`Installation failed: ${f.statusText}`);a(!0)}catch(f){const p=f instanceof Error?f.message:"Unknown error occurred";d(p),console.error("Install failed:",f)}finally{i(!1)}}};if(o&&n)return c.jsx(eE,{kit:n,onGetStarted:()=>e("/")});const u=f=>f==="engineer"?jn.ENGINEER:jn.MARKETING;return c.jsxs("div",{className:"max-w-4xl mx-auto py-8 px-4",children:[c.jsxs("header",{className:"text-center mb-8",children:[c.jsx("h1",{className:"text-3xl font-bold text-[var(--dash-text)]",children:t("onboardingTitle")}),c.jsx("p",{className:"mt-2 text-[var(--dash-text-muted)]",children:t("onboardingSubtitle")})]}),c.jsx("section",{className:"grid md:grid-cols-2 gap-6 mb-8",children:Object.values(J1).map(f=>{const p=u(f.id);return c.jsx(rE,{kit:f,selected:n===p,onSelect:()=>r(p),features:nE(f.id)},f.id)})}),l&&c.jsxs("div",{className:"mb-6 p-4 rounded-lg bg-red-100 border border-red-300 text-red-800",children:[c.jsx("p",{className:"font-medium",children:"Installation Error"}),c.jsx("p",{className:"text-sm mt-1",children:l}),c.jsx("button",{type:"button",onClick:()=>d(null),className:"mt-2 text-sm underline hover:no-underline",children:"Dismiss"})]}),n&&c.jsx(JT,{selectedKit:n,onKitSelect:r,onInstall:h,installing:s})]})},iE=()=>{const{t}=X(),e=tn(),{projectId:n}=Bh(),[r,s]=m.useState(null),{sizes:i,isDragging:o,startDrag:a}=Pu({storageKey:"claudekit-project-config-panels",defaultSizes:[35,40,25],minSizes:[20,25,15]}),l=m.useCallback(async()=>{if(!n)throw new Error("No project ID");const[x,b,y]=await Promise.all([Lm("project",n),Lm("global"),I0()]),w=y.find(C=>C.id===n);return w&&s(w.path),{...x,global:b.config??{}}},[n]),d=m.useCallback(async x=>n?(await Gy({scope:"project",projectId:n,config:x})).config:void 0,[n]),h=Ky({scope:"project",fetchConfig:l,fetchSchema:qy,saveConfig:d}),u=m.useCallback(x=>{const b=Td(h.config,x),y=Td(h.globalConfig,x);return b!==void 0&&y!==void 0&&b!==y},[h.config,h.globalConfig]),f=m.useMemo(()=>[{id:"paths",title:t("sectionPaths"),fields:[{path:"paths.docs",label:t("fieldDocsPath"),description:t("fieldDocsPathDesc")},{path:"paths.plans",label:t("fieldPlansPath"),description:t("fieldPlansPathDesc")}]},{id:"project",title:t("sectionProject"),fields:[{path:"project.type",label:t("fieldProjectType"),description:t("fieldProjectTypeDesc")},{path:"project.packageManager",label:t("fieldPackageManager"),description:t("fieldPackageManagerDesc")},{path:"project.framework",label:t("fieldFramework"),description:t("fieldFrameworkDesc")}]},{id:"privacy",title:t("sectionPrivacy"),defaultCollapsed:!0,fields:[{path:"privacyBlock",label:t("fieldPrivacyBlock"),description:t("fieldPrivacyBlockDesc")}]},{id:"advanced",title:t("sectionAdvanced"),defaultCollapsed:!0,fields:[{path:"docs.maxLoc",label:t("fieldDocsMaxLoc"),description:t("fieldDocsMaxLocDesc")},{path:"plan.namingFormat",label:t("fieldPlanNamingFormat"),description:t("fieldPlanNamingFormatDesc")}]}],[t]),p=h.activeFieldPath&&u(h.activeFieldPath)?c.jsx("span",{className:"text-[9px] bg-orange-500/10 text-orange-500 px-1.5 py-0.5 rounded font-bold border border-orange-500/30",children:t("localOverride")}):null,g=h.fieldDoc?c.jsxs("section",{className:"bg-blue-500/5 p-3 rounded-lg border border-blue-500/20",children:[c.jsx("h4",{className:"text-[10px] font-bold text-blue-500 uppercase tracking-widest mb-1",children:t("inheritedFromGlobal")}),c.jsxs("p",{className:"text-[12px] text-dash-text-secondary leading-normal",children:[t("viewGlobalConfig")," ",c.jsx("button",{onClick:()=>e("/config/global"),className:"text-dash-accent hover:underline font-medium",children:t("globalConfig")})]})]}):null;return c.jsxs("div",{className:"animate-in fade-in duration-300 w-full h-full flex flex-col transition-colors",children:[c.jsx(K0,{title:t("projectConfig"),filePath:r?`${r}/.claude/.ck.json`:".claude/.ck.json",onBack:()=>e(`/project/${n}`),onSave:h.handleSave,onReset:h.handleReset,saveStatus:h.saveStatus,syntaxError:h.syntaxError,showResetConfirm:h.showResetConfirm,setShowResetConfirm:h.setShowResetConfirm}),c.jsxs("div",{className:"flex-1 flex min-h-0",children:[c.jsx(J0,{width:i[0],isLoading:h.isLoading,schema:h.schema,config:h.config,sources:h.sources,sections:f,onChange:h.handleFormChange,onFieldFocus:h.setFocusedFieldPath}),c.jsx(Jt,{direction:"horizontal",isDragging:o,onMouseDown:x=>a(0,x)}),c.jsx(Nu,{width:i[1],isLoading:h.isLoading,jsonText:h.jsonText,cursorLine:h.cursorLine,syntaxError:h.syntaxError,onChange:h.handleJsonChange,onEditorFocus:h.handleJsonEditorFocus,onCursorLineChange:h.setCursorLine}),c.jsx(Jt,{direction:"horizontal",isDragging:o,onMouseDown:x=>a(1,x)}),c.jsx(Uy,{width:i[2],fieldDoc:h.fieldDoc,activeFieldPath:h.activeFieldPath,overrideBadge:p,extraContent:g})]})]})},Ht="__global__",oE=({project:t})=>{const{t:e}=X(),n=tn(),{skills:r,loading:s}=fk(),{sessions:i,loading:o}=pk(t.id),[a,l]=m.useState(null),[d,h]=m.useState(!0),[u,f]=m.useState(null),[p,g]=m.useState(Ht),[x,b]=m.useState(Ht),y=async(M,D)=>{try{await ok(M,t.path,D,t.id)}catch($){alert(`${e("actionFailed")}: ${$ instanceof Error?$.message:M}`)}},w=m.useCallback(()=>{const M=new AbortController;return h(!0),f(null),ik(t.id,M.signal).then(D=>{l(D),g(D.preferences.project.terminalApp||Ht),b(D.preferences.project.editorApp||Ht)}).catch(D=>{D instanceof DOMException&&D.name==="AbortError"||(l(null),g(Ht),b(Ht),f(e("actionOptionsLoadFailed")))}).finally(()=>{M.signal.aborted||h(!1)}),M},[t.id,e]);m.useEffect(()=>{const M=w();return()=>{M.abort()}},[w]);const C=r.filter(M=>t.skills.includes(M.id)),S=a?.terminals||[],k=a?.editors||[],N=S.find(M=>M.id===a?.defaults.terminalApp)?.label||a?.defaults.terminalApp,v=k.find(M=>M.id===a?.defaults.editorApp)?.label||a?.defaults.editorApp,P=m.useMemo(()=>S.find(M=>p===Ht?M.id===a?.defaults.terminalApp:M.id===p),[S,p,a?.defaults.terminalApp]),O=m.useMemo(()=>k.find(M=>x===Ht?M.id===a?.defaults.editorApp:M.id===x),[k,x,a?.defaults.editorApp]),E=async(M,D)=>{if(!t.id.startsWith("discovered-"))try{await $0(t.id,{preferences:{[M]:D===Ht?null:D}})}catch($){const F=$ instanceof Error?$.message:"Failed to save preference";alert(`${e("actionFailed")}: ${F}`)}};return c.jsxs("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-500 transition-colors flex flex-col h-full",children:[c.jsx("section",{className:"mb-6 shrink-0",children:c.jsxs("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-4",children:[c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[c.jsx("h1",{className:"text-3xl font-bold tracking-tight text-dash-text",children:t.name}),c.jsx(aE,{status:t.health}),c.jsx(GP,{variant:"beta"})]}),c.jsxs("p",{className:"text-dash-text-secondary mono text-sm flex items-center gap-2 italic",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),t.path]})]}),c.jsx("div",{className:"flex items-center gap-3",children:c.jsx("span",{className:"text-[10px] text-dash-text-muted font-bold uppercase tracking-widest bg-dash-surface border border-dash-border px-2 py-1 rounded",children:i.length>0?`${i.length} ${e("sessions")}`:e("noSessions")})})]})}),c.jsxs("section",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6 shrink-0",children:[u?c.jsxs("div",{className:"col-span-2 md:col-span-4 rounded-lg border border-orange-500/30 bg-orange-500/5 px-3 py-2 text-xs text-orange-700 dark:text-orange-300 flex items-center justify-between gap-3",children:[c.jsx("span",{children:u}),c.jsx("button",{onClick:()=>void w(),className:"rounded border border-orange-500/40 px-2 py-1 font-semibold hover:bg-orange-500/10 transition-colors",children:e("tryAgain")})]}):null,c.jsx(_g,{icon:"📟",label:e("terminal"),sub:P?`${P.openMode==="open-app"?e("openAppOnly"):e("openAtPath")} • ${P.label}`:e("terminalSub"),onClick:()=>y("terminal",p===Ht?void 0:p),disabled:d||!P&&S.length>0,options:S,value:p,fallbackLabel:a?`${e("useGlobalFallback")} (${N})`:e("useGlobalFallback"),onChange:async M=>{g(M),await E("terminalApp",M)}}),c.jsx(_g,{icon:"💻",label:e("editor"),sub:O?`${O.openMode==="open-app"?e("openAppOnly"):e("openAtPath")} • ${O.label}`:e("editorSub"),onClick:()=>y("editor",x===Ht?void 0:x),disabled:d||!O&&k.length>0,options:k,value:x,fallbackLabel:a?`${e("useGlobalFallback")} (${v})`:e("useGlobalFallback"),onChange:async M=>{b(M),await E("editorApp",M)}}),c.jsx(Ah,{icon:"🤖",label:e("launch"),sub:e("launchSub"),highlight:!0,onClick:()=>y("launch")}),c.jsx(Ah,{icon:"⚙️",label:e("config"),sub:e("configSub"),onClick:()=>n(`/config/project/${t.id}`)})]}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 flex-1 min-h-0",children:[c.jsx("div",{className:"lg:col-span-2 flex flex-col gap-6 min-h-0",children:c.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-xl overflow-hidden shadow-sm flex-1 flex flex-col min-h-0",children:[c.jsx("div",{className:"px-4 py-3 border-b border-dash-border flex items-center justify-between bg-dash-surface-hover/50 shrink-0",children:c.jsx("h3",{className:"text-sm font-bold text-dash-text-secondary uppercase tracking-widest",children:e("recentSessions")})}),c.jsx("div",{className:"divide-y divide-dash-border overflow-y-auto flex-1",children:o?c.jsx("div",{className:"p-4 text-center text-dash-text-muted animate-pulse",children:e("loadingSessions")}):i.length===0?c.jsx("div",{className:"p-4 text-center text-dash-text-muted",children:e("noSessionsFound")}):i.map(M=>c.jsxs("button",{type:"button",className:"w-full text-left p-4 hover:bg-dash-surface-hover transition-colors group cursor-pointer",onClick:()=>n(`/sessions/${t.id}/${M.id}`),children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsx("span",{className:"text-xs font-bold text-dash-accent",children:M.timestamp}),c.jsx("span",{className:"text-[10px] text-dash-text-muted font-medium group-hover:text-dash-text-secondary transition-colors",children:M.duration})]}),c.jsx("p",{className:"text-sm text-dash-text-secondary leading-relaxed truncate",children:M.summary})]},M.id))})]})}),c.jsxs("div",{className:"flex flex-col gap-6 min-h-0",children:[c.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-xl p-6 shadow-sm shrink-0",children:[c.jsxs("h3",{className:"text-sm font-bold text-dash-text-secondary uppercase tracking-widest mb-4 flex items-center gap-2",children:[e("configuration"),c.jsx("span",{className:"text-[10px] font-normal text-dash-text-muted normal-case",children:e("globalSettings")})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsx(Va,{label:e("activeKit"),value:t.kitType}),c.jsx(Va,{label:e("aiModel"),value:t.model}),c.jsx(Va,{label:e("hooks"),value:`${t.activeHooks} ${e("active")}`}),c.jsx(Va,{label:e("mcpServers"),value:`${t.mcpServers} ${e("connected")}`})]}),c.jsx("button",{onClick:()=>n(`/config/project/${t.id}`),className:"w-full mt-6 py-2 rounded-lg bg-dash-bg text-xs font-bold text-dash-text-secondary hover:bg-dash-surface-hover transition-colors border border-dash-border",children:e("editProjectConfig")})]}),c.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-xl shadow-sm flex flex-col flex-1 min-h-0",children:[c.jsx("div",{className:"p-4 pb-2 border-b border-dash-border shrink-0",children:c.jsxs("h3",{className:"text-sm font-bold text-dash-text-secondary uppercase tracking-widest flex items-center justify-between",children:[e("globalSkills"),c.jsx("span",{className:"text-[10px] bg-dash-accent-subtle text-dash-accent px-1.5 py-0.5 rounded-full",children:s?"...":r.length})]})}),c.jsx("div",{className:"overflow-y-auto flex-1 px-4 py-2 space-y-2",children:s?c.jsx("div",{className:"text-center text-dash-text-muted animate-pulse py-4",children:e("loadingSkills")}):(C.length>0?C:r).map(M=>c.jsxs("div",{className:"flex flex-col gap-0.5 border-l-2 border-dash-accent/20 pl-3 py-1",children:[c.jsx("span",{className:"text-sm font-semibold text-dash-text",children:M.name}),c.jsx("p",{className:"text-[10px] text-dash-text-muted leading-tight line-clamp-1",children:M.description||e("noDescription")})]},M.id))}),c.jsx("div",{className:"p-4 pt-2 border-t border-dash-border shrink-0",children:c.jsxs("a",{href:"https://kits.vibery.app/",target:"_blank",rel:"noopener noreferrer",className:"text-xs font-bold text-dash-text-muted hover:text-dash-accent transition-colors text-center block",children:[e("browseSkillsMarketplace")," →"]})})]})]})]})]})},aE=({status:t})=>{const e={[nr.HEALTHY]:"bg-dash-accent-subtle text-dash-accent border-dash-accent/20",[nr.WARNING]:"bg-orange-500/10 text-orange-600 border-orange-500/20",[nr.ERROR]:"bg-red-500/10 text-red-600 border-red-500/20",[nr.LOADING]:"bg-dash-border/20 text-dash-text-muted border-dash-border",[nr.UNKNOWN]:"bg-dash-border/20 text-dash-text-muted border-dash-border"};return c.jsx("span",{className:`px-2 py-0.5 rounded-full text-[10px] font-bold border uppercase tracking-widest ${e[t]}`,children:t})},_g=({icon:t,label:e,sub:n,disabled:r,options:s,value:i,fallbackLabel:o,onClick:a,onChange:l})=>c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx(Ah,{icon:t,label:e,sub:n,onClick:a,disabled:r}),c.jsxs("select",{value:i,onChange:d=>void l(d.target.value),className:"w-full rounded-md border border-dash-border bg-dash-surface px-2 py-1 text-xs text-dash-text-secondary",children:[c.jsx("option",{value:Ht,children:o}),s.map(d=>c.jsx("option",{value:d.id,disabled:!d.available,children:`${d.label} • ${d.detected?"Detected":"Not detected"}`},d.id))]})]}),Ah=({icon:t,label:e,sub:n,highlight:r,onClick:s,disabled:i})=>c.jsxs("button",{onClick:s,disabled:i,className:`p-4 rounded-xl border flex flex-col gap-1 transition-all group ${r?"bg-dash-accent-subtle border-dash-accent/30 hover:bg-dash-accent-glow hover:border-dash-accent/50 shadow-sm shadow-dash-accent/5":"bg-dash-surface border-dash-border hover:bg-dash-surface-hover hover:border-dash-text-muted shadow-sm"} ${i?"opacity-50 cursor-not-allowed":""}`,children:[c.jsx("span",{className:"text-2xl mb-1 group-hover:scale-110 transition-transform",children:t}),c.jsx("span",{className:"text-sm font-bold text-dash-text",children:e}),c.jsx("span",{className:"text-[10px] text-dash-text-muted font-medium truncate italic",children:n})]}),Va=({label:t,value:e})=>c.jsxs("div",{className:"flex items-center justify-between text-xs py-1.5 border-b border-dash-border/50 last:border-0",children:[c.jsx("span",{className:"text-dash-text-muted font-medium",children:t}),c.jsx("span",{className:"text-dash-text font-bold mono uppercase text-[10px] tracking-tight",children:e})]}),lE=()=>{const{t}=X(),{project:e}=Lw();return e?c.jsx(oE,{project:e}):c.jsxs("div",{className:"flex flex-col items-center justify-center h-full space-y-4 opacity-50",children:[c.jsx("div",{className:"w-16 h-16 rounded-full bg-dash-surface border border-dash-border flex items-center justify-center",children:c.jsx("span",{className:"text-2xl text-dash-text-muted",children:"📂"})}),c.jsx("p",{className:"text-lg text-dash-text-secondary font-bold",children:t("selectProject")})]})},cE={Bash:{colorClass:"text-purple-500 dark:text-purple-400",bgClass:"bg-gray-100 dark:bg-[#1a1b26]"},Read:{colorClass:"text-blue-400",bgClass:"bg-blue-500/5"},Write:{colorClass:"text-emerald-400",bgClass:"bg-emerald-500/5"},Edit:{colorClass:"text-amber-400",bgClass:"bg-amber-500/5"},MultiEdit:{colorClass:"text-amber-400",bgClass:"bg-amber-500/5"},Grep:{colorClass:"text-cyan-400",bgClass:"bg-cyan-500/5"},Glob:{colorClass:"text-cyan-400",bgClass:"bg-cyan-500/5"},Agent:{colorClass:"text-violet-400",bgClass:"bg-violet-500/5"},WebSearch:{colorClass:"text-indigo-400",bgClass:"bg-indigo-500/5"},WebFetch:{colorClass:"text-indigo-400",bgClass:"bg-indigo-500/5"},Skill:{colorClass:"text-pink-400",bgClass:"bg-pink-500/5"}},dE={colorClass:"text-dash-text-muted",bgClass:"bg-dash-bg/50"};function hE(t,e){return t.length<=e?t:`${t.slice(0,e)}…`}function uE(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}const fE=({toolName:t,toolInput:e,result:n,isError:r=!1,skillName:s})=>{const{t:i}=X(),[o,a]=m.useState(!1),l=cE[t]??dE,d=t==="Bash",h=t==="Skill"&&s,u=n?hE(n.trim(),80):null;return c.jsxs("div",{className:`rounded-lg border overflow-hidden ${h?"border-pink-500/20 bg-pink-500/5":`border-dash-border ${l.bgClass}`}`,children:[c.jsxs("button",{type:"button",onClick:()=>a(f=>!f),className:"flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-white/5 transition-colors","aria-expanded":o,children:[c.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:`shrink-0 transition-transform duration-150 ${o?"rotate-90":""}`,children:c.jsx("path",{d:"M6 4l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),h?c.jsxs(c.Fragment,{children:[c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0 text-pink-500 dark:text-pink-400",children:c.jsx("path",{d:"M8.5 1.5L3 9h4.5l-1 5.5L13 7H8.5l1-5.5z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})}),c.jsx("span",{className:"font-semibold text-sm text-pink-600 dark:text-pink-400",children:"Skill:"}),c.jsx("span",{className:"font-mono text-sm text-pink-600 dark:text-pink-400",children:s})]}):c.jsx("span",{className:`font-mono font-semibold text-sm ${l.colorClass}`,children:t}),!o&&u&&c.jsx("span",{className:"ml-2 truncate text-xs text-dash-text-muted",children:u})]}),o&&c.jsxs("div",{className:"border-t border-dash-border/50 flex flex-col gap-0",children:[e&&c.jsxs("div",{className:"px-3 py-2",children:[c.jsx("div",{className:"mb-1 text-[10px] uppercase tracking-wider text-dash-text-muted",children:i("sessionToolInput")}),c.jsx("pre",{className:"max-h-48 overflow-y-auto whitespace-pre-wrap break-words rounded text-xs text-dash-text",children:uE(e)})]}),n&&c.jsxs("div",{className:`px-3 py-2 ${e?"border-t border-dash-border/30":""}`,children:[c.jsx("div",{className:"mb-1 text-[10px] uppercase tracking-wider text-dash-text-muted",children:i("sessionToolResult")}),c.jsx("pre",{className:`max-h-64 overflow-y-auto whitespace-pre-wrap break-words rounded text-xs ${d?"bg-gray-100 dark:bg-[#1a1b26] px-2 py-1.5 text-gray-800 dark:text-[#9ece6a] font-mono":r?"border border-red-500/30 bg-red-500/5 px-2 py-1.5 text-red-400":"text-dash-text"}`,children:n})]})]})]})};function pE(t){const e=[];for(const r of t.matchAll(/<command-name>\/?(.+?)<\/command-name>/g))e.push(r[1].trim());for(const r of t.matchAll(/^###\s+Skill:\s+(.+?)$/gm))e.push(r[1].trim());for(const r of t.matchAll(/Launching skill:\s+(\S+)/g))e.push(r[1].trim());if(/Base directory for this skill:/i.test(t)){const r=t.match(/^#\s+(.+?)(?:\s*[-—]|$)/m);r&&e.push(r[1].trim())}const n=new Set;return e.filter(r=>{const s=r.toLowerCase();return n.has(s)?!1:(n.add(s),!0)})}function Q1(t){return t.replace(/<command-message>[\s\S]*?<\/command-message>\s*/g,"").replace(/<command-name>[\s\S]*?<\/command-name>\s*/g,"").replace(/<command-args>[\s\S]*?<\/command-args>\s*/g,"").replace(/^Base directory for this skill:.*$/gm,"").replace(/^<!--.*?-->\s*$/gm,"").replace(/^\n+/,"").trim()}function mE(t){const e=t.match(/<command-args>([\s\S]*?)<\/command-args>/),n=e?e[1].trim():null,r=t.indexOf("Base directory for this skill:"),s=r!==-1?t.slice(r):t;return[n,Q1(s)]}function gE(t){if(!t)return null;try{const e=JSON.parse(t);return typeof e.skill=="string"?e.skill:null}catch{return null}}function xE({name:t}){return c.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 mr-2 rounded border border-pink-500/30 bg-pink-500/10 text-pink-600 dark:text-pink-400 text-xs font-semibold align-middle",children:[c.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0",children:c.jsx("path",{d:"M8.5 1.5L3 9h4.5l-1 5.5L13 7H8.5l1-5.5z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})}),"Skill: ",t]})}function Dh({name:t,text:e}){const n=e.split(`
|
|
250
|
+
`).length;return c.jsxs("details",{className:"rounded-lg border border-pink-500/20 bg-pink-500/5 dark:bg-pink-500/5 overflow-hidden",children:[c.jsxs("summary",{className:"flex cursor-pointer select-none items-center gap-1.5 px-3 py-2 text-sm text-pink-600 dark:text-pink-400 hover:text-pink-500 dark:hover:text-pink-300",children:[c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0",children:c.jsx("path",{d:"M8.5 1.5L3 9h4.5l-1 5.5L13 7H8.5l1-5.5z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})}),c.jsx("span",{className:"font-semibold",children:"Skill:"}),c.jsx("span",{className:"font-mono",children:t}),c.jsxs("span",{className:"ml-auto shrink-0 text-[10px] text-pink-500/50 dark:text-pink-400/40",children:[n," lines"]})]}),c.jsx("div",{className:"max-h-64 overflow-y-auto border-t border-pink-500/10 px-3 pb-3 pt-2",children:c.jsx(As,{content:e})})]})}function bE({text:t}){const{t:e}=X();return c.jsxs("details",{className:"rounded-lg border border-dash-border bg-dash-bg/50",children:[c.jsxs("summary",{className:"flex cursor-pointer select-none items-center gap-1.5 px-3 py-2 text-sm text-dash-text-muted hover:text-dash-text",children:[c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0 opacity-60",children:c.jsx("path",{d:"M8 2C5.8 2 4 3.8 4 6c0 .8.2 1.5.6 2.1C3.6 8.6 3 9.7 3 11c0 1.7 1.1 3 2.5 3H8h2.5c1.4 0 2.5-1.3 2.5-3 0-1.3-.6-2.4-1.6-2.9.4-.6.6-1.3.6-2.1 0-2.2-1.8-4-4-4z",fill:"currentColor",opacity:"0.5"})}),c.jsx("span",{children:e("sessionThinking")})]}),c.jsx("pre",{className:"max-h-48 overflow-y-auto whitespace-pre-wrap break-words px-3 pb-3 pt-1 text-sm text-dash-text-muted",children:t})]})}function yE(t){const e=t.split(/^###\s+Skill:\s+/m);return e.length<=1?[]:e.slice(1).map(n=>{const r=n.indexOf(`
|
|
251
|
+
`),s=r!==-1?n.slice(0,r).trim():n.trim(),i=r!==-1?Q1(n.slice(r+1)):"";return{name:s,content:i}})}function vE(t){const e=t.match(/^\[([a-z-]+)\]\n([\s\S]*)$/);return e?{tag:e[1],content:e[2]}:{tag:"",content:t}}const wE={"task-notification":"Task Notification","system-reminder":"System Context","local-command-stdout":"Command Output","local-command-caveat":"Command Note","antml:thinking":"Thinking"};function kE({text:t}){const{t:e}=X(),{tag:n,content:r}=vE(t),s=yE(r);if(s.length>0)return c.jsx("div",{className:"flex flex-col gap-1.5",children:s.map(o=>c.jsx(Dh,{name:o.name,text:o.content},o.name))});if(n==="local-command-stdout"){const o=r.match(/Launching skill:\s+(\S+)/);if(o)return c.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-xs text-pink-500/70 dark:text-pink-400/60",children:[c.jsx("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0",children:c.jsx("path",{d:"M8.5 1.5L3 9h4.5l-1 5.5L13 7H8.5l1-5.5z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})}),c.jsxs("span",{children:["Launching skill: ",c.jsx("span",{className:"font-mono font-semibold",children:o[1]})]})]})}const i=wE[n]||e("sessionSystemContext");return c.jsxs("details",{className:"rounded-lg border border-dash-border/60 bg-dash-bg/30 overflow-hidden",children:[c.jsxs("summary",{className:"flex cursor-pointer select-none items-center gap-1.5 px-3 py-1.5 text-xs text-dash-text-muted hover:text-dash-text",children:[c.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0 opacity-50",children:[c.jsx("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("path",{d:"M8 7v4.5M8 5.5v.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]}),c.jsx("span",{children:i})]}),c.jsx("div",{className:"max-h-48 overflow-y-auto border-t border-dash-border/40 px-3 pb-2 pt-1",children:c.jsx("pre",{className:"text-[11px] text-dash-text-muted whitespace-pre-wrap break-words font-mono",children:r})})]})}const SE=20;function CE({text:t}){const[e,n]=m.useState(!1),r=t.split(`
|
|
252
|
+
`),s=r.slice(0,6).join(`
|
|
253
|
+
`);return c.jsxs("div",{"data-search-content":!0,children:[c.jsx(As,{content:e?t:s}),!e&&c.jsxs("div",{className:"mt-1 text-[10px] text-dash-text-muted",children:["...",r.length-6," more lines"]}),c.jsx("button",{type:"button",onClick:()=>n(i=>!i),className:"mt-1 text-[11px] font-semibold text-dash-accent hover:text-dash-accent-hover transition-colors",children:e?"Collapse":"Expand all"})]})}const jE=({block:t})=>{switch(t.type){case"text":{if(!t.text)return null;const e=pE(t.text);if(e.length>0){const[n,r]=mE(t.text);return n?c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("p",{className:"text-sm text-dash-text leading-relaxed","data-search-content":!0,children:[e.map(s=>c.jsx(xE,{name:s},s)),c.jsx("span",{className:"whitespace-pre-wrap break-words",children:n})]}),r&&c.jsx(Dh,{name:e[0],text:r})]}):r?c.jsx("div",{className:"flex flex-col gap-1.5",children:e.map(s=>c.jsx(Dh,{name:s,text:r},s))}):null}return t.text.split(`
|
|
254
|
+
`).length>SE?c.jsx(CE,{text:t.text}):c.jsx("div",{"data-search-content":!0,children:c.jsx(As,{content:t.text})})}case"thinking":return t.text?c.jsx(bE,{text:t.text}):null;case"tool_use":{const e=t.toolName==="Skill"?gE(t.toolInput):null;return c.jsx(fE,{toolName:t.toolName??"Unknown",toolInput:t.toolInput,result:t.result,isError:t.isError,skillName:e??void 0})}case"system":return t.text?c.jsx(kE,{text:t.text}):null;case"tool_result":return null;default:return null}};function NE(t){const e=[];for(const n of t){const r=e[e.length-1];r&&r.role===n.role?r.messages.push(n):e.push({role:n.role,timestamp:n.timestamp??"",messages:[n]})}return e}function PE({group:t}){const{t:e}=X(),n=t.role==="user",r=t.messages.length;return c.jsxs("div",{className:`flex flex-col gap-2 rounded-lg border p-4 ${n?"bg-blue-50/50 dark:bg-blue-900/10 border-blue-200/60 dark:border-blue-800/40":"bg-dash-surface border-dash-border"}`,children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider ${n?"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300":"bg-dash-accent-subtle text-dash-accent"}`,children:e(n?"sessionUser":"sessionAssistant")}),t.timestamp&&c.jsx("span",{className:"text-[10px] text-dash-text-muted",children:new Date(t.timestamp).toLocaleTimeString()}),r>1&&c.jsxs("span",{className:"text-[10px] text-dash-text-muted ml-auto",children:[r," ",e("sessionGroupMessages")]})]}),t.messages.map((s,i)=>c.jsx("div",{className:"flex flex-col gap-1.5",children:s.contentBlocks.map((o,a)=>c.jsx(jE,{block:o,role:t.role},`${o.type}-${o.toolUseId??a}`))},s.timestamp??`msg-${i}`))]})}const OE=({messages:t})=>{const e=NE(t);return c.jsx("div",{className:"flex flex-col gap-3",children:e.map((n,r)=>c.jsx(PE,{group:n},`group-${n.timestamp||r}`))})},Uu="data-search-mark",Th="bg-yellow-300/40 text-dash-text rounded-sm px-0.5",ME="ring-2 ring-dash-accent bg-yellow-300/60";function Cd(t){for(const e of t.querySelectorAll(`mark[${Uu}]`)){const n=e.parentNode;n&&(n.replaceChild(document.createTextNode(e.textContent??""),e),n.normalize())}}function AE(t,e){const n=e.toLowerCase(),r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode(a){const l=a.parentElement;return!l||l.tagName==="MARK"||!l.closest("[data-search-content]")?NodeFilter.FILTER_REJECT:a.textContent?.toLowerCase().includes(n)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}),s=[];let i=r.nextNode();for(;i;)s.push(i),i=r.nextNode();let o=0;for(const a of s){const l=a.textContent??"",d=a.parentNode;if(!d)continue;const h=document.createDocumentFragment();let u=0,f=l.toLowerCase().indexOf(n,0);for(;f!==-1;){f>u&&h.appendChild(document.createTextNode(l.slice(u,f)));const p=document.createElement("mark");p.setAttribute(Uu,""),p.setAttribute("data-match-index",String(o)),p.className=Th,p.textContent=l.slice(f,f+e.length),h.appendChild(p),o++,u=f+e.length,f=l.toLowerCase().indexOf(n,u)}u<l.length&&h.appendChild(document.createTextNode(l.slice(u))),d.replaceChild(h,a)}return o}const DE=({containerRef:t,visible:e})=>{const{t:n}=X(),[r,s]=m.useState(""),[i,o]=m.useState(""),[a,l]=m.useState(0),[d,h]=m.useState(0),u=m.useRef(null);m.useEffect(()=>{const p=setTimeout(()=>o(r),300);return()=>clearTimeout(p)},[r]),m.useEffect(()=>{e&&u.current?.focus()},[e]),m.useEffect(()=>{const p=t.current;if(!p)return;if(Cd(p),!i.trim()){l(0),h(0);return}const g=AE(p,i.trim());l(g),h(g>0?1:0)},[i,t]),m.useEffect(()=>{const p=t.current;if(!p||a===0)return;const g=p.querySelectorAll(`mark[${Uu}]`);g.forEach((x,b)=>{x.className=b===d-1?`${Th} ${ME}`:Th}),g[d-1]?.scrollIntoView({behavior:"smooth",block:"center"})},[d,a,t]),m.useEffect(()=>{!e&&t.current&&Cd(t.current)},[e,t]),m.useEffect(()=>()=>{t.current&&Cd(t.current)},[t]);const f=m.useCallback(p=>{a!==0&&h(g=>(g-1+p+a)%a+1)},[a]);return e?c.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-dash-border bg-dash-surface",children:[c.jsxs("svg",{className:"w-4 h-4 text-dash-text-muted shrink-0",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:[c.jsx("circle",{cx:"11",cy:"11",r:"8"}),c.jsx("path",{d:"m21 21-4.35-4.35"})]}),c.jsx("input",{ref:u,type:"text",value:r,onChange:p=>s(p.target.value),placeholder:n("sessionSearchPlaceholder"),className:"flex-1 bg-dash-bg border border-dash-border rounded-lg px-3 py-1.5 text-sm text-dash-text outline-none focus:border-dash-accent min-w-0"}),c.jsx("span",{className:"text-xs text-dash-text-muted whitespace-nowrap shrink-0",children:a===0?n("sessionNoResults"):`${d}/${a} ${n("sessionSearchResults")}`}),c.jsx("button",{type:"button",onClick:()=>f(-1),disabled:a===0,className:"p-1 rounded hover:bg-dash-hover disabled:opacity-40","aria-label":"previous match",children:c.jsx("svg",{className:"w-4 h-4 text-dash-text",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:c.jsx("path",{d:"m18 15-6-6-6 6"})})}),c.jsx("button",{type:"button",onClick:()=>f(1),disabled:a===0,className:"p-1 rounded hover:bg-dash-hover disabled:opacity-40","aria-label":"next match",children:c.jsx("svg",{className:"w-4 h-4 text-dash-text",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:c.jsx("path",{d:"m6 9 6 6 6-6"})})})]}):null},Nr=50;function TE({messageCount:t,toolCallCount:e,duration:n}){const{t:r}=X();return c.jsxs("div",{className:"flex items-center gap-4 px-3 py-2 rounded-lg bg-dash-surface border border-dash-border text-xs text-dash-text-muted",children:[c.jsxs("span",{children:[c.jsx("strong",{className:"text-dash-text",children:t})," ",r("sessionMessages")]}),c.jsxs("span",{children:[c.jsx("strong",{className:"text-dash-text",children:e})," ",r("sessionToolCalls")]}),n&&c.jsxs("span",{children:[r("sessionDuration"),": ",c.jsx("strong",{className:"text-dash-text",children:n})]})]})}function Wg({offset:t,limit:e,total:n,onPrev:r,onNext:s}){const i=t+1,o=Math.min(t+e,n);return n<=e?null:c.jsxs("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg bg-dash-surface border border-dash-border text-xs text-dash-text-muted",children:[c.jsxs("span",{children:[i,"–",o," / ",n]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"button",onClick:r,disabled:t<=0,className:"px-2 py-1 rounded border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:"←"}),c.jsx("button",{type:"button",onClick:s,disabled:o>=n,className:"px-2 py-1 rounded border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:"→"})]})]})}const EE=()=>{const{t}=X(),e=tn(),{projectId:n,sessionId:r}=Bh(),s=m.useRef(null),[i,o]=m.useState(!1),[a,l]=m.useState(0),{data:d,loading:h,error:u}=xk(n,r,Nr,a),f=d?.summary.messageCount??0,p=!h&&!u&&d&&d.messages.length>0;return c.jsxs("div",{className:"flex flex-col h-full p-6 gap-4 max-w-4xl mx-auto w-full",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("button",{type:"button",onClick:()=>e(`/project/${encodeURIComponent(n??"")}`),className:"w-8 h-8 rounded-lg flex items-center justify-center text-dash-text-muted hover:bg-dash-surface-hover hover:text-dash-text transition-colors shrink-0","aria-label":t("sessionBack"),children:c.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("h1",{className:"text-xl font-bold text-dash-text",children:t("sessionDetail")}),c.jsx("p",{className:"text-[10px] text-dash-text-muted font-mono truncate",children:r})]}),p&&c.jsx("button",{type:"button",onClick:()=>o(g=>!g),className:`w-8 h-8 rounded-lg flex items-center justify-center transition-colors shrink-0 ${i?"bg-dash-accent/10 text-dash-accent":"text-dash-text-muted hover:bg-dash-surface-hover hover:text-dash-text"}`,"aria-label":"Search",children:c.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:t("sessionReadOnly")})]}),h&&c.jsx("div",{className:"flex flex-1 items-center justify-center text-dash-text-muted text-sm",children:t("sessionLoading")}),!h&&u&&c.jsxs("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm",children:[t("sessionError"),": ",u]}),!h&&!u&&d&&d.messages.length===0&&c.jsx("div",{className:"flex flex-1 items-center justify-center text-dash-text-muted text-sm",children:t("noSessionsData")}),p&&c.jsxs(c.Fragment,{children:[c.jsx(TE,{messageCount:d.summary.messageCount,toolCallCount:d.summary.toolCallCount,duration:d.summary.duration}),c.jsx(DE,{containerRef:s,visible:i}),c.jsx(Wg,{offset:a,limit:Nr,total:f,onPrev:()=>l(g=>Math.max(0,g-Nr)),onNext:()=>l(g=>g+Nr)}),c.jsx("div",{ref:s,className:"overflow-y-auto flex-1",children:c.jsx(OE,{messages:d.messages})}),c.jsx(Wg,{offset:a,limit:Nr,total:f,onPrev:()=>l(g=>Math.max(0,g-Nr)),onNext:()=>l(g=>g+Nr)})]})]})},X1="/api";async function LE(){const t=await fetch(`${X1}/skills/browse`);if(!t.ok)throw new Error("Failed to fetch skills browser list");return(await t.json()).skills}async function RE(t){const e=await fetch(`${X1}/skills/browse/${encodeURIComponent(t)}`);if(!e.ok)throw e.status===404?new Error(`Skill "${t}" not found`):new Error("Failed to fetch skill detail");return e.json()}function IE(){const[t,e]=m.useState([]),[n,r]=m.useState(!0),[s,i]=m.useState(null),o=m.useCallback(async()=>{r(!0),i(null);try{const a=await LE();e(a)}catch(a){i(a instanceof Error?a.message:"Failed to load skills")}finally{r(!1)}},[]);return m.useEffect(()=>{o()},[o]),{skills:t,loading:n,error:s,reload:o}}function $E(t){const[e,n]=m.useState(null),[r,s]=m.useState(!0),[i,o]=m.useState(null),a=m.useCallback(async()=>{s(!0),o(null);try{const l=await RE(t);n(l)}catch(l){o(l instanceof Error?l.message:"Failed to load skill detail")}finally{s(!1)}},[t]);return m.useEffect(()=>{a()},[a]),{detail:e,loading:r,error:i,reload:a}}function BE(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3.5 h-3.5 shrink-0 text-dash-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}function FE({skill:t,selected:e,onClick:n}){return c.jsxs("button",{type:"button",onClick:n,className:["w-full flex items-start gap-2 px-3 py-2 rounded-md transition-colors text-left group",e?"bg-dash-accent/10 border border-dash-accent/30":"hover:bg-dash-surface-hover border border-transparent"].join(" "),children:[c.jsx(BE,{}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[c.jsx("span",{className:"text-sm font-semibold text-dash-accent font-mono",children:t.name}),t.source==="github"&&c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-medium shrink-0",children:"GitHub"})]}),t.description&&c.jsx("p",{className:"text-xs text-dash-text-muted mt-0.5 truncate",children:t.description})]})]})}const zE=({name:t})=>{const{t:e}=X(),{detail:n,loading:r,error:s}=$E(t);return r?c.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-dash-text-muted",children:e("loadingSkills")}):s?c.jsx("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm",children:s}):n?c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("h2",{className:"text-base font-semibold text-dash-text font-mono truncate flex-1",children:n.name}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:e("sessionReadOnly")})]}),n.description&&c.jsx("div",{className:"rounded-lg border border-dash-border bg-dash-surface px-4 py-3",children:c.jsx("p",{className:"text-sm text-dash-text-muted",children:n.description})}),c.jsx("div",{className:"flex items-center gap-2 text-xs text-dash-text-muted",children:c.jsxs("span",{className:"font-mono px-2 py-0.5 rounded bg-dash-surface border border-dash-border text-dash-accent",children:["~/.claude/skills/",n.name,"/SKILL.md"]})}),n.triggers&&n.triggers.length>0&&c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsxs("span",{className:"text-xs text-dash-text-muted",children:[e("skillTriggers"),":"]}),n.triggers.map(i=>c.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-dash-surface border border-dash-border text-dash-accent",children:i},i))]}),c.jsx("div",{className:"rounded-lg border border-dash-border bg-dash-surface p-5 overflow-x-auto",children:c.jsx(As,{content:n.content})})]}):null},VE=({message:t})=>c.jsx("div",{className:"flex items-center justify-center h-full text-sm text-dash-text-muted",children:t});function HE({label:t,count:e}){return c.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[c.jsx("span",{className:"text-xs font-bold text-dash-text-muted uppercase tracking-wider flex-1",children:t}),c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold",children:e})]})}const _E=()=>{const{t}=X(),{skills:e,loading:n,error:r}=IE(),[s,i]=m.useState(""),[o,a]=m.useState(null),{size:l,isDragging:d,startDrag:h}=Ms({storageKey:"ck-skills-panel-width",defaultSize:380,minSize:260,maxSize:650}),u=m.useMemo(()=>{if(!s.trim())return e;const p=s.toLowerCase();return e.filter(g=>g.name.toLowerCase().includes(p)||g.description?.toLowerCase().includes(p)||g.triggers?.some(x=>x.toLowerCase().includes(p)))},[e,s]),f=m.useMemo(()=>{const p=new Map;for(const g of u){const x=g.source==="github"?"GitHub":t("skillLocal"),b=p.get(x)??[];b.push(g),p.set(x,b)}return p},[u,t]);return c.jsxs("div",{className:"flex h-full overflow-hidden",children:[c.jsxs("div",{style:{width:`${l}px`},className:"shrink-0 flex flex-col overflow-hidden border-r border-dash-border",children:[c.jsxs("div",{className:"shrink-0 px-4 pt-4 pb-3 border-b border-dash-border",children:[c.jsxs("div",{className:"flex items-start justify-between mb-3",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-base font-bold text-dash-text",children:t("skillsBrowser")}),!n&&!r&&c.jsx("p",{className:"text-xs text-dash-text-muted mt-0.5",children:t("skillsCount").replace("{count}",String(e.length))}),c.jsx("p",{className:"text-[11px] text-dash-text-muted font-mono mt-0.5",children:"~/.claude/skills/"})]}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:t("sessionReadOnly")})]}),c.jsxs("div",{className:"relative",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-dash-text-muted pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),c.jsx("input",{type:"text",value:s,onChange:p=>i(p.target.value),placeholder:t("searchSkillsBrowserPlaceholder"),className:"w-full pl-9 pr-4 py-2 text-sm bg-dash-surface border border-dash-border rounded-lg text-dash-text placeholder:text-dash-text-muted focus:outline-none focus:border-dash-accent/50 transition-colors"}),s&&c.jsx("button",{type:"button",onClick:()=>i(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-dash-text-muted hover:text-dash-text transition-colors",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-2 py-2",children:[n&&c.jsx("div",{className:"flex flex-1 items-center justify-center text-dash-text-muted text-sm p-8",children:t("loadingSkills")}),!n&&r&&c.jsx("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm m-2",children:r}),!n&&!r&&f.size===0&&c.jsx("div",{className:"flex items-center justify-center p-8 text-dash-text-muted text-sm",children:t("noSkillsBrowserFound")}),!n&&!r&&f.size>0&&c.jsx("div",{className:"flex flex-col gap-2 pb-4",children:Array.from(f.entries()).map(([p,g])=>c.jsxs("div",{children:[f.size>1&&c.jsx(HE,{label:p,count:g.length}),c.jsx("div",{className:"space-y-0.5",children:g.map(x=>c.jsx(FE,{skill:x,selected:o===x.name,onClick:()=>a(x.name)},x.name))})]},p))})]})]}),c.jsx(Jt,{onMouseDown:h,isDragging:d,direction:"horizontal"}),c.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:o?c.jsx(zE,{name:o}):c.jsx(VE,{message:t("selectToView")})})]})},Z1=["model","context","quota","directory","git","cost","changes","agents","todos"],$l={contextLow:"green",contextMid:"yellow",contextHigh:"red",accent:"cyan",muted:"dim",separator:"dim",quotaLow:"green",quotaHigh:"yellow"},WE=[["model","context","quota"],["directory","git","cost","changes"],["agents","todos"]],ev={model:{icon:"🤖"},quota:{icon:"⌛"},directory:{icon:"📁"},git:{icon:"🌿"},cost:{icon:"💰"},changes:{icon:"📝"},agents:{icon:"🔄"},todos:{icon:"✅"}},Zn={baseMode:"full",lines:WE,sectionConfig:ev,theme:$l,responsiveBreakpoint:.85,maxAgentRows:4,todoTruncation:50},UE={model:"claude-sonnet-4-6",context:"▰▰▰▰▰▰▱▱▱▱▱▱ 52%",quota:"5h 31% wk 33%",directory:"~/projects/myapp",git:"main (2, +1, 3↑)",cost:"$0.042",changes:"+128 -34",agents:"○ planner ● researcher",todos:"▸ Implement auth (3 done, 4 pending)"},tv={green:"#4ade80",yellow:"#facc15",red:"#f87171",cyan:"#22d3ee",blue:"#60a5fa",magenta:"#e879f9",white:"#f1f5f9",dim:"#64748b",default:"#94a3b8",brightGreen:"#86efac",brightYellow:"#fde68a",brightRed:"#fca5a5",brightCyan:"#67e8f9",brightBlue:"#93c5fd",brightMagenta:"#f0abfc",brightWhite:"#ffffff"},Ku={model:"cyan",directory:"blue",git:"magenta",cost:"dim",changes:"brightYellow",agents:"brightCyan",todos:"brightGreen"},Ug=[{name:"Default",labelKey:"statuslinePresetDefault",theme:$l,sectionColors:Ku},{name:"Monochrome",labelKey:"statuslinePresetMonochrome",theme:{contextLow:"white",contextMid:"white",contextHigh:"white",accent:"white",muted:"dim",separator:"dim",quotaLow:"white",quotaHigh:"white"},sectionColors:{model:"white",directory:"white",git:"white",cost:"dim",changes:"white",agents:"white",todos:"white"}},{name:"Nord",labelKey:"statuslinePresetNord",theme:{contextLow:"brightCyan",contextMid:"blue",contextHigh:"magenta",accent:"brightCyan",muted:"dim",separator:"dim",quotaLow:"brightCyan",quotaHigh:"brightBlue"},sectionColors:{model:"brightCyan",directory:"brightBlue",git:"brightCyan",cost:"dim",changes:"brightYellow",agents:"blue",todos:"brightCyan"}},{name:"Dracula",labelKey:"statuslinePresetDracula",theme:{contextLow:"brightGreen",contextMid:"brightYellow",contextHigh:"brightRed",accent:"brightMagenta",muted:"dim",separator:"dim",quotaLow:"brightCyan",quotaHigh:"brightMagenta"},sectionColors:{model:"brightMagenta",directory:"brightCyan",git:"brightGreen",cost:"dim",changes:"brightYellow",agents:"brightMagenta",todos:"brightGreen"}},{name:"Catppuccin",labelKey:"statuslinePresetCatppuccin",theme:{contextLow:"brightGreen",contextMid:"brightYellow",contextHigh:"red",accent:"brightBlue",muted:"dim",separator:"dim",quotaLow:"brightBlue",quotaHigh:"brightMagenta"},sectionColors:{model:"brightBlue",directory:"brightYellow",git:"brightMagenta",cost:"dim",changes:"brightGreen",agents:"brightBlue",todos:"brightCyan"}},{name:"Gruvbox",labelKey:"statuslinePresetGruvbox",theme:{contextLow:"brightGreen",contextMid:"yellow",contextHigh:"red",accent:"brightYellow",muted:"dim",separator:"dim",quotaLow:"brightYellow",quotaHigh:"red"},sectionColors:{model:"brightYellow",directory:"brightGreen",git:"red",cost:"dim",changes:"yellow",agents:"brightYellow",todos:"brightGreen"}},{name:"Tokyo Night",labelKey:"statuslinePresetTokyoNight",theme:{contextLow:"cyan",contextMid:"brightBlue",contextHigh:"brightMagenta",accent:"brightBlue",muted:"dim",separator:"dim",quotaLow:"brightCyan",quotaHigh:"brightMagenta"},sectionColors:{model:"brightBlue",directory:"cyan",git:"brightMagenta",cost:"dim",changes:"brightCyan",agents:"brightBlue",todos:"brightGreen"}},{name:"Solarized",labelKey:"statuslinePresetSolarized",theme:{contextLow:"green",contextMid:"yellow",contextHigh:"red",accent:"blue",muted:"dim",separator:"dim",quotaLow:"cyan",quotaHigh:"yellow"},sectionColors:{model:"blue",directory:"cyan",git:"green",cost:"dim",changes:"yellow",agents:"blue",todos:"green"}},{name:"Rose Pine",labelKey:"statuslinePresetRosePine",theme:{contextLow:"brightGreen",contextMid:"brightYellow",contextHigh:"brightRed",accent:"magenta",muted:"dim",separator:"dim",quotaLow:"magenta",quotaHigh:"brightRed"},sectionColors:{model:"magenta",directory:"brightBlue",git:"brightMagenta",cost:"dim",changes:"brightYellow",agents:"magenta",todos:"brightGreen"}},{name:"One Dark",labelKey:"statuslinePresetOneDark",theme:{contextLow:"green",contextMid:"brightYellow",contextHigh:"brightRed",accent:"brightCyan",muted:"dim",separator:"dim",quotaLow:"brightCyan",quotaHigh:"brightRed"},sectionColors:{model:"brightCyan",directory:"blue",git:"brightRed",cost:"dim",changes:"brightYellow",agents:"brightCyan",todos:"green"}},{name:"Ayu",labelKey:"statuslinePresetAyu",theme:{contextLow:"brightGreen",contextMid:"brightYellow",contextHigh:"red",accent:"yellow",muted:"dim",separator:"white",quotaLow:"brightYellow",quotaHigh:"red"},sectionColors:{model:"yellow",directory:"brightCyan",git:"brightYellow",cost:"dim",changes:"brightGreen",agents:"yellow",todos:"brightGreen"}},{name:"Kanagawa",labelKey:"statuslinePresetKanagawa",theme:{contextLow:"cyan",contextMid:"brightYellow",contextHigh:"red",accent:"brightMagenta",muted:"dim",separator:"dim",quotaLow:"brightBlue",quotaHigh:"brightMagenta"},sectionColors:{model:"brightMagenta",directory:"cyan",git:"brightYellow",cost:"dim",changes:"brightBlue",agents:"brightMagenta",todos:"cyan"}},{name:"Stealth",labelKey:"statuslinePresetStealth",theme:{contextLow:"dim",contextMid:"dim",contextHigh:"brightRed",accent:"dim",muted:"dim",separator:"dim",quotaLow:"dim",quotaHigh:"brightRed"},sectionColors:{model:"dim",directory:"dim",git:"dim",cost:"dim",changes:"dim",agents:"dim",todos:"dim"}},{name:"Hacker",labelKey:"statuslinePresetHacker",theme:{contextLow:"green",contextMid:"brightGreen",contextHigh:"brightGreen",accent:"brightGreen",muted:"green",separator:"green",quotaLow:"green",quotaHigh:"brightGreen"},sectionColors:{model:"brightGreen",directory:"green",git:"brightGreen",cost:"green",changes:"brightGreen",agents:"green",todos:"brightGreen"}}],KE=({sectionId:t,label:e,config:n,onConfigChange:r,onRemove:s})=>{const{t:i}=X(),[o,a]=m.useState(!1),{attributes:l,listeners:d,setNodeRef:h,transform:u,transition:f,isDragging:p}=E7({id:t}),g={transform:mr.Transform.toString(u),transition:f,opacity:p?.4:1,zIndex:p?50:void 0},x=S=>{r({...n,icon:S.target.value||void 0})},b=S=>{r({...n,label:S.target.value||void 0})},y=S=>{const k=Number.parseInt(S.target.value,10);r({...n,maxWidth:Number.isNaN(k)?void 0:Math.max(10,Math.min(200,k))})},w=n.icon??"",C=n.label??e;return c.jsxs("div",{ref:h,style:g,className:"relative",children:[c.jsxs("div",{className:`group flex items-center gap-1 px-2 py-1 rounded-md border cursor-pointer select-none transition-all ${p?"border-dash-accent bg-dash-accent/20 shadow-lg":"border-dash-border bg-dash-surface hover:border-dash-accent/60 hover:bg-dash-surface-hover"}`,children:[c.jsx("span",{...l,...d,className:"text-dash-text-muted cursor-grab active:cursor-grabbing shrink-0 opacity-50 group-hover:opacity-100 transition-opacity","aria-label":"drag handle",children:"⠿"}),c.jsxs("button",{type:"button",onClick:()=>a(S=>!S),className:"flex items-center gap-1 text-xs text-dash-text min-w-0","aria-label":i(o?"statuslineCollapseSettings":"statuslineExpandSettings"),children:[w&&c.jsx("span",{className:"shrink-0",children:w}),c.jsx("span",{className:"truncate",children:C}),c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:`w-3 h-3 shrink-0 text-dash-text-muted transition-transform ${o?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),s&&c.jsx("button",{type:"button",onClick:S=>{S.stopPropagation(),s()},className:"text-dash-text-muted/40 hover:text-red-400 transition-colors shrink-0","aria-label":"remove section",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&c.jsxs("div",{className:"absolute top-full left-0 z-20 mt-1 w-56 p-3 rounded-lg border border-dash-border bg-dash-surface shadow-xl space-y-2",children:[c.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[c.jsxs("div",{children:[c.jsx("label",{htmlFor:`chip-icon-${t}`,className:"block text-[10px] font-medium text-dash-text-muted mb-1",children:i("statuslineIconOverride")}),c.jsx("input",{id:`chip-icon-${t}`,type:"text",value:n.icon??"",onChange:x,placeholder:i("statuslineIconPlaceholder"),maxLength:20,className:"w-full text-xs px-2 py-1 rounded border border-dash-border bg-dash-bg text-dash-text placeholder-dash-text-muted focus:outline-none focus:border-dash-accent"})]}),c.jsxs("div",{children:[c.jsx("label",{htmlFor:`chip-label-${t}`,className:"block text-[10px] font-medium text-dash-text-muted mb-1",children:i("statuslineLabelOverride")}),c.jsx("input",{id:`chip-label-${t}`,type:"text",value:n.label??"",onChange:b,placeholder:e,maxLength:50,className:"w-full text-xs px-2 py-1 rounded border border-dash-border bg-dash-bg text-dash-text placeholder-dash-text-muted focus:outline-none focus:border-dash-accent"})]})]}),c.jsxs("div",{children:[c.jsx("label",{htmlFor:`chip-maxwidth-${t}`,className:"block text-[10px] font-medium text-dash-text-muted mb-1",children:i("statuslineMaxWidth")}),c.jsx("input",{id:`chip-maxwidth-${t}`,type:"number",min:10,max:200,value:n.maxWidth??"",onChange:y,placeholder:i("statuslineMaxWidthPlaceholder"),className:"w-full text-xs px-2 py-1 rounded border border-dash-border bg-dash-bg text-dash-text placeholder-dash-text-muted focus:outline-none focus:border-dash-accent"})]}),c.jsx("button",{type:"button",onClick:()=>a(!1),className:"w-full text-[10px] py-0.5 text-dash-text-muted hover:text-dash-text transition-colors",children:i("closeModal")})]})]})},GE={model:"statuslineSectionModelLabel",context:"statuslineSectionContextLabel",quota:"statuslineSectionQuotaLabel",directory:"statuslineSectionDirectoryLabel",git:"statuslineSectionGitLabel",cost:"statuslineSectionCostLabel",changes:"statuslineSectionChangesLabel",agents:"statuslineSectionAgentsLabel",todos:"statuslineSectionTodosLabel"},Kg=({containerId:t,sectionIds:e,sectionConfig:n,onConfigChange:r,onRemoveSection:s,headerLabel:i,onRemove:o,isPool:a=!1})=>{const{t:l}=X(),{setNodeRef:d,isOver:h}=v1({id:t});return c.jsxs("div",{className:`rounded-lg border transition-colors ${a?"border-dash-border/50 bg-dash-bg/50":h?"border-dash-accent/60 bg-dash-accent/5":"border-dash-border bg-dash-surface"}`,children:[i&&c.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-dash-border/50",children:[c.jsx("span",{className:`text-xs font-medium uppercase tracking-wider ${a?"text-dash-text-muted/70":"text-dash-text-muted"}`,children:i}),o&&c.jsx("button",{type:"button",onClick:o,className:"text-xs text-dash-text-muted hover:text-red-400 transition-colors px-1","aria-label":l("statuslineRemoveLine"),children:l("statuslineRemoveLine")})]}),c.jsx("div",{ref:d,className:"p-2 min-h-[44px]",children:c.jsx(N7,{items:e,strategy:C7,children:c.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.length===0?c.jsx("span",{className:"text-xs text-dash-text-muted/50 italic px-1 py-0.5",children:a?l("statuslineDragToLine"):"—"}):e.map(u=>c.jsx(KE,{sectionId:u,label:l(GE[u]??"statuslineSectionModelLabel"),config:n[u]??{},onConfigChange:f=>r(u,f),onRemove:!a&&s?()=>s(u):void 0},u))})})})]})};function Gg(t,e,n){for(let r=0;r<t.length;r++)if(t[r].includes(n))return`line-${r}`;return e.includes(n)?"pool":null}const qE=({lines:t,sectionConfig:e,onLinesChange:n,onSectionConfigChange:r})=>{const{t:s}=X(),[i,o]=m.useState(null),a=s6(Vm(Eu),Vm(Du,{coordinateGetter:I7})),l=new Set(t.flat()),d=Z1.filter(b=>!l.has(b)),h=b=>{o(String(b.active.id))},u=b=>{o(null);const{active:y,over:w}=b;if(!w)return;const C=String(y.id),S=String(w.id),k=Gg(t,d,C);let N=Gg(t,d,S);if(N||(S.startsWith("line-")||S==="pool")&&(N=S),!k||!N||C===S)return;const v=t.map(E=>[...E]),P=E=>{if(E==="pool")return[...d];const M=Number.parseInt(E.replace("line-",""),10);return v[M]??[]},O=(E,M)=>{if(E==="pool")return;const D=Number.parseInt(E.replace("line-",""),10);v[D]=M};if(k===N){const E=P(k),M=E.indexOf(C),D=E.indexOf(S);M!==-1&&D!==-1&&O(k,Ru(E,M,D))}else{const E=P(k),M=P(N),D=E.filter(G=>G!==C),$=M.indexOf(S),F=$===-1?M.length:$,z=[...M.slice(0,F),C,...M.slice(F)];k!=="pool"&&O(k,D),N!=="pool"&&O(N,z)}n(v)},f=()=>{n([...t,[]])},p=b=>{t[b];const y=t.filter((w,C)=>C!==b);n(y)},g=(b,y)=>{r({...e,[b]:y})},x=(b,y)=>{const w=t.map((C,S)=>S===b?C.filter(k=>k!==y):[...C]);n(w)};return c.jsxs("div",{className:"space-y-2",children:[c.jsx("p",{className:"text-xs text-dash-text-muted px-1",children:s("statuslineDragHint")}),c.jsxs(n7,{sensors:a,collisionDetection:a6,onDragStart:h,onDragEnd:u,children:[c.jsx("div",{className:"space-y-2",children:t.map((b,y)=>c.jsx(Kg,{containerId:`line-${y}`,sectionIds:b,sectionConfig:e,onConfigChange:g,onRemoveSection:w=>x(y,w),headerLabel:`${s("statuslineLine")} ${y+1}`,onRemove:()=>p(y)},`line-zone-${y}`))}),c.jsxs("button",{type:"button",onClick:f,className:"w-full text-xs px-3 py-2 rounded-lg border border-dashed border-dash-border text-dash-text-muted hover:border-dash-accent/60 hover:text-dash-text transition-colors",children:["+ ",s("statuslineAddLine")]}),c.jsxs("div",{className:"pt-0.5",children:[c.jsx("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider mb-1 px-1",children:s("statuslineHiddenSections")}),c.jsx(Kg,{containerId:"pool",sectionIds:d,sectionConfig:e,onConfigChange:g,isPool:!0})]}),c.jsx(v7,{children:i?c.jsx("div",{className:"px-2 py-1 rounded-md border border-dash-accent bg-dash-accent/20 text-xs text-dash-text shadow-xl opacity-90",children:i}):null})]})]})},Rt=tv;function YE(t){return Rt[t]??Rt.default}const JE=({sectionId:t,config:e,theme:n})=>{const r=UE[t]??t,s=e.icon??"";let i=e.color??Ku[t]??n.accent;t==="context"&&!e.color&&(i=n.contextMid),t==="quota"&&!e.color&&(i=n.quotaLow);const o=YE(i),a=e.label?`${s} ${e.label}: ${r}`:s?`${s} ${r}`:r,l=e.maxWidth&&a.length>e.maxWidth?`${a.slice(0,e.maxWidth-1)}…`:a;return c.jsx("span",{className:"font-mono text-xs whitespace-nowrap",style:{color:o},children:l})},QE=c.jsx("span",{className:"font-mono text-xs",style:{color:Rt.dim},children:" │ "}),XE=({sectionIds:t,sectionConfig:e,theme:n})=>{const{t:r}=X();return c.jsx("div",{className:"flex items-center gap-0 py-0.5 px-2 rounded mb-0.5 last:mb-0 overflow-hidden",style:{backgroundColor:"#313244"},children:t.length===0?c.jsx("span",{className:"text-xs font-mono opacity-30",style:{color:Rt.dim},children:r("statuslinePreviewEmptyLine")}):t.map((s,i)=>c.jsxs("span",{className:"flex items-center shrink-0",children:[c.jsx(JE,{sectionId:s,config:e[s]??{},theme:n}),i<t.length-1&&QE]},s))})},ZE=({lines:t,sectionConfig:e,theme:n})=>{const{t:r}=X(),s=t.reduce((i,o)=>i+o.length,0);return c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"text-xs text-dash-text-muted",children:r("statuslinePreview")}),c.jsxs("span",{className:"text-xs text-dash-text-muted/60",children:[s," ",r("statuslineSectionsVisible")]})]}),c.jsxs("div",{className:"rounded-lg overflow-hidden border border-dash-border shadow-lg",children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-[#1e1e2e] border-b border-[#313244]",children:[c.jsxs("div",{className:"flex gap-1.5",children:[c.jsx("span",{className:"w-3 h-3 rounded-full bg-[#f38ba8]"}),c.jsx("span",{className:"w-3 h-3 rounded-full bg-[#f9e2af]"}),c.jsx("span",{className:"w-3 h-3 rounded-full bg-[#a6e3a1]"})]}),c.jsx("span",{className:"text-xs text-[#6c7086] font-mono ml-2",children:r("statuslinePreviewTitle")})]}),c.jsxs("div",{className:"bg-[#1e1e2e] px-3 py-2 font-mono text-xs overflow-x-auto select-none",children:[c.jsxs("div",{className:"mb-1",children:[c.jsx("span",{style:{color:Rt.green},children:"user@machine"}),c.jsx("span",{style:{color:Rt.dim},children:":"}),c.jsx("span",{style:{color:Rt.blue},children:"~/projects/myapp"}),c.jsx("span",{style:{color:Rt.white},children:" $ "})]}),t.length===0?c.jsx("div",{className:"py-0.5 px-2 rounded mb-0.5",style:{backgroundColor:"#313244"},children:c.jsx("span",{className:"text-xs font-mono opacity-30",style:{color:Rt.dim},children:r("statuslinePreviewNoLines")})}):t.map((i,o)=>c.jsx(XE,{sectionIds:i,sectionConfig:e,theme:n},o)),c.jsxs("div",{className:"mt-1 flex items-center",children:[c.jsx("span",{style:{color:Rt.green},children:"user@machine"}),c.jsx("span",{style:{color:Rt.dim},children:":"}),c.jsx("span",{style:{color:Rt.blue},children:"~/projects/myapp"}),c.jsx("span",{style:{color:Rt.white},children:" $ "}),c.jsx("span",{className:"inline-block w-2 h-4 bg-white/70 animate-pulse ml-0.5"})]})]})]})]})},eL={model:"statuslineSectionModelLabel",context:"statuslineSectionContextLabel",quota:"statuslineSectionQuotaLabel",directory:"statuslineSectionDirectoryLabel",git:"statuslineSectionGitLabel",cost:"statuslineSectionCostLabel",changes:"statuslineSectionChangesLabel",agents:"statuslineSectionAgentsLabel",todos:"statuslineSectionTodosLabel"},tL=["green","yellow","red","cyan","blue","magenta","white","dim","brightGreen","brightYellow","brightRed","brightCyan","brightBlue","brightMagenta","brightWhite"],Bl=tv,Bn=({field:t,label:e,value:n,onChange:r})=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-3 h-3 rounded-full shrink-0 border border-white/20",style:{backgroundColor:Bl[n]??Bl.default}}),c.jsx("label",{htmlFor:`color-${t}`,className:"text-xs text-dash-text-muted w-24 shrink-0",children:e}),c.jsx("select",{id:`color-${t}`,value:n,onChange:s=>r(s.target.value),className:"flex-1 text-xs px-2 py-1 rounded border border-dash-border bg-dash-bg text-dash-text focus:outline-none focus:border-dash-accent",children:tL.map(s=>c.jsx("option",{value:s,children:s},s))})]}),nL=({theme:t,sectionConfig:e,onChange:n,onSectionConfigChange:r})=>{const{t:s}=X(),i=(d,h)=>{n({...t,[d]:h})},o=(d,h)=>{r({...e,[d]:{...e[d],color:h}})},a=d=>{n({...d.theme});const h={...e};for(const[u,f]of Object.entries(d.sectionColors))h[u]={...h[u],color:f};r(h)},l=Ug.findIndex(d=>d.theme.contextLow===t.contextLow&&d.theme.contextMid===t.contextMid&&d.theme.contextHigh===t.contextHigh&&d.theme.accent===t.accent&&d.theme.muted===t.muted&&d.theme.separator===t.separator&&d.theme.quotaLow===t.quotaLow&&d.theme.quotaHigh===t.quotaHigh);return c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-medium text-dash-text-muted mb-2 uppercase tracking-wider",children:s("statuslineTheme")}),c.jsx("div",{className:"grid grid-cols-2 gap-2",children:Ug.map((d,h)=>c.jsx("button",{type:"button",onClick:()=>a(d),className:`text-xs px-3 py-2 rounded border transition-colors text-left ${l===h?"border-dash-accent bg-dash-accent/10 text-dash-accent":"border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text"}`,children:c.jsxs("span",{className:"flex items-center gap-1",children:[[d.sectionColors.model,d.theme.contextMid,d.sectionColors.git,d.sectionColors.changes].map((u,f)=>c.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:Bl[u]??Bl.default}},f)),c.jsx("span",{className:"ml-0.5",children:s(d.labelKey)})]})},d.name))})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider",children:["▰ ",s("statuslineColorContextGroup")]}),c.jsx(Bn,{field:"contextLow",label:s("statuslineColorContextLow"),value:t.contextLow,onChange:d=>i("contextLow",d)}),c.jsx(Bn,{field:"contextMid",label:s("statuslineColorContextMid"),value:t.contextMid,onChange:d=>i("contextMid",d)}),c.jsx(Bn,{field:"contextHigh",label:s("statuslineColorContextHigh"),value:t.contextHigh,onChange:d=>i("contextHigh",d)})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider",children:["⌛ ",s("statuslineColorQuotaGroup")]}),c.jsx(Bn,{field:"quotaLow",label:s("statuslineQuotaLow"),value:t.quotaLow,onChange:d=>i("quotaLow",d)}),c.jsx(Bn,{field:"quotaHigh",label:s("statuslineQuotaHigh"),value:t.quotaHigh,onChange:d=>i("quotaHigh",d)})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider",children:s("statuslineColorGeneralGroup")}),c.jsx(Bn,{field:"accent",label:s("statuslineColorAccent"),value:t.accent,onChange:d=>i("accent",d)}),c.jsx(Bn,{field:"muted",label:s("statuslineColorMuted"),value:t.muted,onChange:d=>i("muted",d)}),c.jsx(Bn,{field:"separator",label:s("statuslineColorSeparator"),value:t.separator,onChange:d=>i("separator",d)})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider",children:s("statuslineColorSectionGroup")}),Z1.filter(d=>d!=="context"&&d!=="quota").map(d=>{const h=e[d]?.icon??ev[d]?.icon??"",u=s(eL[d]??"statuslineSectionModelLabel");return c.jsx(Bn,{field:`section-${d}`,label:h?`${h} ${u}`:u,value:e[d]?.color??Ku[d]??"default",onChange:f=>o(d,f)},d)})]})]})]})};function rL(t){return{baseMode:t.baseMode??Zn.baseMode,lines:t.lines??Zn.lines,sectionConfig:t.sectionConfig??Zn.sectionConfig,theme:t.theme?{...$l,...t.theme}:$l,responsiveBreakpoint:t.responsiveBreakpoint??Zn.responsiveBreakpoint,maxAgentRows:t.maxAgentRows??Zn.maxAgentRows,todoTruncation:t.todoTruncation??Zn.todoTruncation}}const sL=()=>{const{t}=X(),[e,n]=m.useState(Zn),[r,s]=m.useState(!0),[i,o]=m.useState(!1),[a,l]=m.useState(null),[d,h]=m.useState(!1),[u,f]=m.useState(!1),{size:p,isDragging:g,startDrag:x}=Ms({storageKey:"ck-statusline-preview-width",defaultSize:500,minSize:300,maxSize:900,direction:"horizontal",invert:!0});m.useEffect(()=>{let k=!1;return fetch("/api/ck-config?scope=global").then(N=>{if(!N.ok)throw new Error(`Failed to fetch config: ${N.status}`);return N.json()}).then(N=>{if(k)return;const v=N.config.statuslineLayout;v&&n(rL(v))}).catch(()=>{k||f(!0)}).finally(()=>{k||s(!1)}),()=>{k=!0}},[]);const b=m.useCallback(async()=>{o(!0),l(null),h(!1);try{await QP("statuslineLayout",e,"global"),h(!0),setTimeout(()=>h(!1),3e3)}catch(k){l(k instanceof Error?k.message:"Unknown error")}finally{o(!1)}},[e]),y=m.useCallback(()=>{n(Zn),h(!1),l(null)},[]),w=m.useCallback(k=>{n(N=>({...N,lines:k}))},[]),C=m.useCallback(k=>{n(N=>({...N,sectionConfig:k}))},[]),S=m.useCallback(k=>{n(N=>({...N,theme:k}))},[]);return r?c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsx("div",{className:"text-dash-text-muted text-sm",children:t("loading")})}):c.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[c.jsx("div",{className:"shrink-0 px-6 py-4 border-b border-dash-border bg-dash-surface",children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-lg font-bold text-dash-text",children:t("statuslineBuilder")}),c.jsx("p",{className:"text-sm text-dash-text-muted mt-0.5",children:t("statuslineBuilderDescription")})]}),d&&c.jsx("div",{className:"text-xs text-green-400 bg-green-400/10 border border-green-400/20 rounded px-3 py-1.5",children:t("statuslineSaved")}),u&&c.jsx("div",{className:"bg-orange-50 dark:bg-orange-950 text-orange-700 dark:text-orange-300 px-4 py-2 rounded-md text-sm border border-orange-200 dark:border-orange-800",children:t("statuslineLoadErrorSaveDisabled")}),a&&c.jsxs("div",{className:"text-xs text-red-400 bg-red-400/10 border border-red-400/20 rounded px-3 py-1.5",children:[t("statuslineSaveError"),": ",a]})]})}),c.jsxs("div",{className:"flex-1 overflow-hidden flex",children:[c.jsxs("div",{className:"flex-1 min-w-0 flex flex-col border-r border-dash-border overflow-hidden",children:[c.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:c.jsx(nL,{theme:e.theme,sectionConfig:e.sectionConfig,onChange:S,onSectionConfigChange:C})}),c.jsxs("div",{className:"shrink-0 px-4 py-3 border-t border-dash-border bg-dash-surface flex gap-2",children:[c.jsx("button",{type:"button",onClick:y,className:"text-xs px-3 py-1.5 rounded border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text transition-colors",children:t("statuslineResetDefaults")}),c.jsx("button",{type:"button",onClick:b,disabled:i||u,className:"flex-1 text-xs px-3 py-1.5 rounded border border-dash-accent bg-dash-accent/10 text-dash-accent hover:bg-dash-accent/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed font-medium",children:i?`${t("saving")}…`:t("statuslineSave")})]})]}),c.jsx(Jt,{direction:"horizontal",isDragging:g,onMouseDown:x}),c.jsxs("div",{className:"shrink-0 overflow-y-auto p-4 bg-dash-bg space-y-4",style:{width:p},children:[c.jsx(ZE,{lines:e.lines,sectionConfig:e.sectionConfig,theme:e.theme}),c.jsx(qE,{lines:e.lines,sectionConfig:e.sectionConfig,onLinesChange:w,onSectionConfigChange:C})]})]})]})},iL=({components:t,isChecking:e,isUpdating:n,onCheckAll:r,onUpdateAll:s,className:i})=>{const{t:o}=X(),a=t.filter(h=>h.status==="update-available").length,l=t.length>0&&t.every(h=>h.status==="up-to-date"||h.status==="idle"),d=t.filter(h=>h.status==="up-to-date").length;return c.jsxs("div",{className:`flex flex-wrap items-center gap-2 ${i??""}`,children:[c.jsxs("div",{className:"inline-flex items-center gap-2 rounded-lg border border-dash-border bg-dash-surface px-3 py-2 text-xs",children:[c.jsx("output",{className:"inline-flex items-center gap-2","aria-live":"polite","aria-atomic":"true",children:e?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),c.jsx("span",{className:"text-dash-text-secondary",children:o("checkingAll")})]}):a>0?c.jsx("span",{className:"text-amber-500 font-semibold",children:o("updatesAvailable").replace("{count}",a.toString())}):l?c.jsx("span",{className:"text-emerald-500 font-semibold",children:o("allUpToDate")}):c.jsx("span",{className:"text-dash-text-secondary font-medium",children:o("readyToScan")})}),d>0&&c.jsx("span",{className:"mono text-dash-text-muted border-l border-dash-border pl-2",children:d})]}),c.jsx("button",{type:"button",onClick:r,disabled:e||n,className:"dash-focus-ring px-3 py-2 rounded-lg text-xs font-semibold border border-dash-border bg-dash-surface text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:o("checkAll")}),a>0&&c.jsx("button",{type:"button",onClick:s,disabled:n,className:"dash-focus-ring px-3 py-2 rounded-lg text-xs font-semibold bg-dash-accent text-dash-bg hover:bg-dash-accent-hover disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:o("updateAll")})]})},oL=({value:t,onChange:e,disabled:n=!1})=>{const{t:r}=X();return c.jsxs("fieldset",{className:"inline-flex items-center rounded-xl border border-dash-border bg-dash-surface p-1 gap-1",role:"radiogroup","aria-label":"Update channel",children:[c.jsxs("label",{className:`dash-focus-ring px-3.5 py-2 text-xs font-semibold rounded-lg transition-colors cursor-pointer ${t==="stable"?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover"} ${n?"opacity-50 cursor-not-allowed":""}`,children:[c.jsx("input",{type:"radio",name:"channel",value:"stable",checked:t==="stable",onChange:()=>e("stable"),disabled:n,className:"sr-only"}),r("channelStable")]}),c.jsxs("label",{className:`dash-focus-ring px-3.5 py-2 text-xs font-semibold rounded-lg transition-colors cursor-pointer ${t==="beta"?"bg-amber-500/15 text-amber-500":"text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover"} ${n?"opacity-50 cursor-not-allowed":""}`,children:[c.jsx("input",{type:"radio",name:"channel",value:"beta",checked:t==="beta",onChange:()=>e("beta"),disabled:n,className:"sr-only"}),r("channelBeta")]})]})},aL={idle:{color:"bg-dash-text-muted",pulse:!1},checking:{color:"bg-dash-text-muted",pulse:!0},"up-to-date":{color:"bg-emerald-500",pulse:!1},"update-available":{color:"bg-amber-500",pulse:!1}},nv=({status:t,ariaLabel:e,size:n="sm"})=>{const r=aL[t],s=n==="sm"?"w-2 h-2":"w-2.5 h-2.5";return c.jsx("span",{className:`
|
|
255
|
+
inline-block rounded-full ${s} ${r.color}
|
|
256
|
+
${r.pulse?"animate-pulse motion-reduce:animate-none":""}
|
|
257
|
+
`,role:"status","aria-label":e})},Gu=({isOpen:t,onClose:e,target:n,kitName:r,targetVersion:s,onComplete:i,mode:o="single",components:a=[]})=>{const{t:l}=X(),[d,h]=m.useState("running"),[u,f]=m.useState([]),[p,g]=m.useState([]),[x,b]=m.useState(!1),[y,w]=m.useState(0),C=m.useRef(null),S=m.useRef(null);m.useEffect(()=>{x&&S.current&&S.current.scrollIntoView({behavior:"smooth"})},[x]);const k=m.useCallback(async()=>{if(a.length===0){h("success");return}for(let v=0;v<a.length;v++){w(v);const P=a[v];try{const O=P.id==="cli",E=new URLSearchParams({target:O?"cli":"kit"});O||E.set("kit",P.id);const M=new EventSource(`/api/system/update?${E}`);C.current=M,await new Promise((D,$)=>{M.onmessage=F=>{try{const z=JSON.parse(F.data);z.type==="phase"&&z.name&&f(G=>[...G,`[${P.name}] ${z.name}`]),z.type==="output"&&z.text&&g(G=>[...G,z.text]),z.type==="error"&&(h("error"),g(G=>[...G,`[ERROR ${P.name}] ${z.message||"Unknown error"}`]),M.close(),$()),z.type==="complete"&&(z.code===0?(M.close(),D()):(h("error"),M.close(),$()))}catch(z){console.error("Failed to parse SSE message:",z),M.close(),$(z)}},M.onerror=()=>{h("error"),g(F=>[...F,`[ERROR ${P.name}] Connection lost`]),M.close(),$()}})}catch(O){console.error(`Failed to update ${P.name}:`,O)}}h("success"),i()},[a,i]);m.useEffect(()=>{if(t)if(o==="batch")k();else{const v=new URLSearchParams({target:n});r&&v.set("kit",r),s&&v.set("version",s);const P=new EventSource(`/api/system/update?${v}`);return C.current=P,P.onmessage=O=>{try{const E=JSON.parse(O.data);E.type==="phase"&&E.name&&f(M=>[...M,E.name]),E.type==="output"&&E.text&&g(M=>[...M,E.text]),E.type==="error"&&(h("error"),g(M=>[...M,`[ERROR] ${E.message||"Unknown error"}`])),E.type==="complete"&&(h(E.code===0?"success":"error"),P.close(),E.code===0&&i())}catch(E){console.error("Failed to parse SSE message:",E)}},P.onerror=()=>{h("error"),g(O=>[...O,"[ERROR] Connection lost"]),P.close()},()=>{P.close()}}},[t,n,r,s,i,o,k]);const N=()=>{d!=="running"&&(h("running"),f([]),g([]),b(!1),w(0),e())};return t?c.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:c.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-lg shadow-lg w-full max-w-2xl max-h-[80vh] flex flex-col",children:[c.jsx("div",{className:"px-6 py-4 border-b border-dash-border",children:c.jsx("h2",{className:"text-lg font-bold text-dash-text",children:l(d==="running"?"updating":d==="success"?"updateSuccess":"updateFailed")})}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[o==="batch"&&a.length>0&&c.jsxs("div",{className:"text-sm text-dash-text-secondary",children:[d==="running"&&c.jsxs("span",{children:["Updating ",y+1," of ",a.length,":"," ",a[y]?.name]}),d==="success"&&c.jsxs("span",{className:"text-emerald-500",children:["All ",a.length," components updated"]})]}),u.length>0&&c.jsx("div",{className:"space-y-2",children:u.map((v,P)=>c.jsxs("div",{className:"flex items-center gap-2 text-sm text-dash-text-secondary",children:[c.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-dash-accent"}),c.jsx("span",{children:v})]},`${v}-${P}`))}),d==="running"&&c.jsxs("div",{className:"flex items-center gap-2 text-sm text-dash-text-muted",children:[c.jsx("span",{className:"w-4 h-4 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),c.jsx("span",{children:l("updating")})]}),p.length>0&&c.jsxs("div",{children:[c.jsx("button",{type:"button",onClick:()=>b(!x),className:"text-xs text-dash-accent hover:text-dash-accent-hover transition-colors",children:l(x?"hideDetails":"showDetails")}),x&&c.jsxs("div",{className:"mt-2 bg-dash-bg border border-dash-border rounded p-3 max-h-64 overflow-y-auto",children:[c.jsx("pre",{className:"text-xs mono text-dash-text whitespace-pre-wrap",children:p.join(`
|
|
258
|
+
`)}),c.jsx("div",{ref:S})]})]})]}),c.jsx("div",{className:"px-6 py-4 border-t border-dash-border flex justify-end",children:c.jsx("button",{type:"button",onClick:N,disabled:d==="running",className:`px-4 py-2 rounded text-sm font-medium transition-colors ${d==="running"?"bg-dash-bg text-dash-text-muted cursor-not-allowed":"bg-dash-accent text-white hover:bg-dash-accent-hover"}`,children:l("closeModal")})})]})}):null},rv=({target:t,kitName:e,currentVersion:n,latestVersion:r,onVersionSelect:s})=>{const{t:i}=X(),[o,a]=m.useState([]),[l,d]=m.useState(!1),[h,u]=m.useState(r);m.useEffect(()=>{(async()=>{d(!0);try{const g=new URLSearchParams({target:t});e&&g.set("kit",e);const b=await(await fetch(`/api/system/versions?${g}`)).json();b.versions&&a(b.versions)}catch(g){console.error("Failed to fetch versions:",g)}finally{d(!1)}})()},[t,e]);const f=p=>{u(p),s(p)};return l?c.jsxs("span",{className:"text-xs text-dash-text-muted flex items-center gap-1.5",children:[c.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),i("loadingVersions")]}):c.jsx("select",{value:h,onChange:p=>f(p.target.value),className:`text-xs text-amber-500 hover:text-amber-600 font-medium transition-colors
|
|
259
|
+
bg-transparent border border-amber-500/30 rounded px-2 py-1
|
|
260
|
+
focus:outline-none focus:ring-2 focus:ring-amber-500/50
|
|
261
|
+
cursor-pointer appearance-none`,title:i("selectVersion"),children:o.map(p=>{const g=p.version===r,x=p.version===n,b=`v${p.version.replace(/^v/,"")}${g?` (${i("latestVersion")})`:""}${p.isPrerelease?` [${i("prereleaseLabel")}]`:""}${x?` - ${i("currentVersionLabel")}`:""}`;return c.jsx("option",{value:p.version,disabled:x,children:b},p.version)})})},lL=({version:t,installedAt:e,channel:n="stable",externalStatus:r,externalLatestVersion:s,onStatusChange:i,disabled:o,packageManager:a,installLocation:l})=>{const{t:d}=X(),[h,u]=m.useState("idle"),[f,p]=m.useState(null),[g,x]=m.useState(!1),[b,y]=m.useState(null),w=r??h,C=s??f,S=async()=>{const N=P=>{i||u(P)},v=P=>{i||p(P)};N("checking"),i&&i("checking",null);try{const O=await(await fetch(`/api/system/check-updates?target=cli&channel=${n}`)).json();O.updateAvailable?(N("update-available"),v(O.latest),i&&i("update-available",O.latest)):(N("up-to-date"),i&&i("up-to-date",null))}catch{N("idle"),i&&i("idle",null)}},k=async()=>{window.location.reload()};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"dash-panel p-5 transition-colors hover:border-dash-accent/30",children:[c.jsxs("div",{className:"flex items-center justify-between gap-4",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap min-w-0",children:[c.jsx(nv,{status:w,ariaLabel:d(w==="up-to-date"?"upToDate":w==="update-available"?"updateAvailable":"checking")}),c.jsx("h3",{className:"text-base font-semibold text-dash-text",children:d("cliCard")}),n==="beta"&&c.jsx("span",{className:"px-2 py-0.5 text-[11px] font-semibold bg-amber-500/15 text-amber-500 rounded border border-amber-500/20",children:d("betaBadge")})]}),c.jsx(cL,{status:w,currentVersion:t,latestVersion:C,onCheck:S,onUpdate:()=>x(!0),onVersionSelect:y,disabled:o})]}),c.jsxs("div",{className:"mt-3 space-y-3",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-dash-text-secondary",children:[c.jsxs("span",{className:"px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70 mono",children:[d("currentVersionLabel"),": v",t.replace(/^v/,"")]}),e&&c.jsx("span",{className:"px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70 text-dash-text-muted",children:new Date(e).toLocaleDateString()})]}),(a||l)&&c.jsxs("div",{className:"grid grid-cols-1 gap-1 text-xs sm:grid-cols-2",children:[a&&c.jsx(qg,{label:d("cliPackageManager"),value:a}),l&&c.jsx(qg,{label:d("cliInstallLocation"),value:l,mono:!0})]}),w==="update-available"&&C&&c.jsxs("div",{className:"inline-flex items-center rounded-md border border-amber-500/25 bg-amber-500/10 px-2.5 py-1 text-xs text-amber-500 font-medium",children:["v",t.replace(/^v/,"")," ","->"," v",C.replace(/^v/,"")]})]})]}),c.jsx(Gu,{isOpen:g,onClose:()=>x(!1),target:"cli",targetVersion:b??C??void 0,onComplete:k})]})},cL=({status:t,currentVersion:e,latestVersion:n,onCheck:r,onUpdate:s,onVersionSelect:i,disabled:o})=>{const{t:a}=X();return t==="checking"?c.jsxs("span",{className:"text-xs text-dash-text-muted flex items-center gap-1.5 px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70",children:[c.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),a("checking")]}):t==="up-to-date"?c.jsx("span",{className:"px-2.5 py-1 text-xs rounded-md border border-emerald-500/30 bg-emerald-500/10 text-emerald-500 font-semibold",children:a("upToDate")}):t==="update-available"&&n?c.jsx("div",{className:"flex items-center gap-2",children:c.jsx(rv,{target:"cli",currentVersion:e,latestVersion:n,onVersionSelect:l=>{i(l),s()}})}):c.jsx("button",{type:"button",onClick:r,disabled:o,className:"dash-focus-ring px-3 py-2 rounded-lg text-xs font-semibold border border-dash-border bg-dash-surface text-dash-accent hover:text-dash-accent-hover hover:bg-dash-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:a("checkForUpdates")})},qg=({label:t,value:e,mono:n})=>c.jsxs("div",{className:"flex items-center justify-between rounded border border-dash-border/60 bg-dash-bg/50 px-2 py-1",children:[c.jsx("span",{className:"text-dash-text-muted text-[10px] uppercase tracking-wide shrink-0 mr-2",children:t}),c.jsx("span",{className:`break-all text-right text-dash-text-secondary ${n?"mono text-[11px]":"text-xs"}`,children:e})]});function dL(t){let e=0,n=0,r=0;for(const s of t)s.ownership==="ck"?e++:s.ownership==="user"?n++:s.ownership==="ck-modified"&&r++;return{ck:e,user:n,modified:r}}function hL(t){const e=new Set,n=new Set,r=new Set;let s=0,i=0,o=0;for(const a of t){const l=a.path;if(l.startsWith("skills/")){const d=l.split("/");d.length>=2&&d[1]&&e.add(d[1])}else if(l.startsWith("commands/")){const d=l.split("/");d.length>=2&&d[1]&&n.add(d[1])}else if(l.startsWith("hooks/")){const d=l.split("/");d.length>=2&&d[1]&&r.add(d[1])}else l==="hooks.json"?i++:l.startsWith("rules/")?s++:l.startsWith("settings/")||l==="settings.json"?i++:o++}return{skills:e.size,commands:n.size,rules:s,hooks:r.size,settings:i,other:o}}const uL=({kitName:t,kit:e,channel:n="stable",externalStatus:r,externalLatestVersion:s,onStatusChange:i,disabled:o})=>{const{t:a}=X(),[l,d]=m.useState("idle"),[h,u]=m.useState(null),[f,p]=m.useState(!1),[g,x]=m.useState(null),b=r??l,y=s??h,w=e.files??[],C=hL(w),S=Object.values(C).reduce((P,O)=>P+O,0),k=dL(w),N=async()=>{const P=E=>{i||d(E)},O=E=>{i||u(E)};P("checking"),i&&i("checking",null);try{const M=await(await fetch(`/api/system/check-updates?target=kit&kit=${t}&channel=${n}`)).json();M.updateAvailable?(P("update-available"),O(M.latest),i&&i("update-available",M.latest)):(P("up-to-date"),i&&i("up-to-date",null))}catch{P("idle"),i&&i("idle",null)}},v=async()=>{window.location.reload()};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"dash-panel p-5 space-y-4 transition-colors hover:border-dash-accent/30",children:[c.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx(nv,{status:b,ariaLabel:a(b==="up-to-date"?"upToDate":b==="update-available"?"updateAvailable":"checking")}),c.jsxs("h3",{className:"text-base font-semibold text-dash-text capitalize",children:[t," Kit"]}),n==="beta"&&c.jsx("span",{className:"px-2 py-0.5 text-[11px] font-semibold bg-amber-500/15 text-amber-500 rounded border border-amber-500/20",children:a("betaBadge")})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-dash-text-secondary",children:[c.jsxs("span",{className:"px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70 mono",children:[a("currentVersionLabel"),": v",(e.version??"?").replace(/^v/,"")]}),e.installedAt&&c.jsx("span",{className:"px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70 text-dash-text-muted",children:new Date(e.installedAt).toLocaleDateString()}),c.jsxs("span",{className:"px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70 mono",children:[a("components"),": ",S]})]}),b==="update-available"&&y&&c.jsxs("div",{className:"inline-flex items-center rounded-md border border-amber-500/25 bg-amber-500/10 px-2.5 py-1 text-xs text-amber-500 font-medium",children:["v",(e.version??"?").replace(/^v/,"")," ","->"," v",y.replace(/^v/,"")]})]}),c.jsx(fL,{status:b,currentVersion:e.version??"0.0.0",latestVersion:y,kitName:t,onCheck:N,onUpdate:()=>p(!0),onVersionSelect:x,disabled:o})]}),w.length>0&&c.jsx("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-2 xl:grid-cols-3",children:Object.entries(C).filter(([,P])=>P>0).map(([P,O])=>c.jsxs("div",{className:"flex items-center justify-between px-2.5 py-2 bg-dash-bg/70 border border-dash-border rounded-lg text-xs",children:[c.jsx("span",{className:"text-dash-text-secondary capitalize",children:P}),c.jsx("span",{className:"font-bold mono text-dash-text",children:O})]},P))}),(k.user>0||k.modified>0)&&c.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-dash-text-muted",children:[k.user>0&&c.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-md border border-dash-border bg-dash-bg/70",children:[c.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500 shrink-0"}),k.user," ",a("ownershipUser")]}),k.modified>0&&c.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-md border border-dash-border bg-dash-bg/70",children:[c.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-500 shrink-0"}),k.modified," ",a("ownershipModified")]})]}),w.length===0&&c.jsx("p",{className:"text-xs text-dash-text-muted",children:a("noTrackedFiles")})]}),c.jsx(Gu,{isOpen:f,onClose:()=>p(!1),target:"kit",kitName:t,targetVersion:g??y??void 0,onComplete:v})]})},fL=({status:t,currentVersion:e,latestVersion:n,kitName:r,onCheck:s,onUpdate:i,onVersionSelect:o,disabled:a})=>{const{t:l}=X();return t==="checking"?c.jsxs("span",{className:"text-xs text-dash-text-muted flex items-center gap-1.5 px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70",children:[c.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),l("checking")]}):t==="up-to-date"?c.jsx("span",{className:"px-2.5 py-1 text-xs rounded-md border border-emerald-500/30 bg-emerald-500/10 text-emerald-500 font-semibold",children:l("upToDate")}):t==="update-available"&&n?c.jsx("div",{className:"flex items-center gap-2",children:c.jsx(rv,{target:"kit",kitName:r,currentVersion:e,latestVersion:n,onVersionSelect:d=>{o(d),i()}})}):c.jsx("button",{type:"button",onClick:s,disabled:a,className:"dash-focus-ring px-3 py-2 rounded-lg text-xs font-semibold border border-dash-border bg-dash-surface text-dash-accent hover:text-dash-accent-hover hover:bg-dash-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:l("checkForUpdates")})},Yg="claudekit-update-channel",Jg="claudekit-system-filter",pL=t=>/-(alpha|beta|rc|dev|next)/.test(t),mL=t=>t==="all"||t==="updates"||t==="up-to-date"||t==="cli"||t==="kits"?t:"all",Qg=t=>t==="update-available"?0:t==="checking"?1:t==="idle"?2:3,gL=({metadata:t})=>{const{t:e}=X(),[n,r]=m.useState(null),[s,i]=m.useState([]),[o,a]=m.useState(!1),[l,d]=m.useState(!1),[h,u]=m.useState(!1),[f,p]=m.useState("stable"),[g,x]=m.useState(()=>mL(localStorage.getItem(Jg))),b=m.useRef(!1),y=m.useRef(0),w=m.useMemo(()=>!t.kits||typeof t.kits!="object"?[]:Object.entries(t.kits),[t.kits]),C=w.length>0,S=t.name,k=t.version,N=t.installedAt,v=w.length>0||S;m.useEffect(()=>{if(!n)return;const U=[];if(U.push({id:"cli",type:"cli",status:"idle",currentVersion:n.cliVersion,latestVersion:null}),C&&w.length>0)for(const[ve,te]of w){const Ae=te;U.push({id:ve,type:"kit",status:"idle",currentVersion:Ae.version??"?",latestVersion:null})}else S&&U.push({id:S,type:"kit",status:"idle",currentVersion:k??"?",latestVersion:null});i(U)},[n,C,w,S,k]),m.useEffect(()=>{fetch("/api/system/info").then(U=>U.json()).then(r).catch(()=>r(null))},[]),m.useEffect(()=>{const U=localStorage.getItem(Yg);U==="stable"||U==="beta"?p(U):n?.cliVersion&&p(pL(n.cliVersion)?"beta":"stable")},[n?.cliVersion]);const P=U=>{p(U),localStorage.setItem(Yg,U)};m.useEffect(()=>{localStorage.setItem(Jg,g)},[g]);const O=(U,ve,te)=>{i(Ae=>Ae.map(pe=>pe.id===U?{...pe,status:ve,latestVersion:te}:pe))},E=m.useCallback(async()=>{if(s.length===0)return;const U=y.current+1;y.current=U,a(!0),i(ve=>ve.map(te=>te.status==="checking"&&te.latestVersion===null?te:{...te,status:"checking",latestVersion:null}));try{const ve=s.map(async Ae=>{try{const pe=Ae.type==="cli"?`target=cli&channel=${f}`:`target=kit&kit=${Ae.id}&channel=${f}`,I=await(await fetch(`/api/system/check-updates?${pe}`)).json();return{id:Ae.id,status:I.updateAvailable?"update-available":"up-to-date",latestVersion:I.latest}}catch{return{id:Ae.id,status:"idle",latestVersion:null}}}),te=await Promise.all(ve);if(y.current!==U)return;i(Ae=>Ae.map(pe=>{const _e=te.find(I=>I.id===pe.id);return _e?{...pe,status:_e.status,latestVersion:_e.latestVersion}:pe}))}finally{y.current===U&&a(!1)}},[f,s]),M=U=>{x(U),(U==="updates"||U==="up-to-date")&&!o&&!l&&s.length>0&&s.every(te=>te.status==="idle")&&(b.current=!0,E())},D=()=>{u(!0)},$=()=>{window.location.reload()},F=s.filter(U=>U.status==="update-available").length,z=s.filter(U=>U.status==="up-to-date").length,G=s.filter(U=>U.status==="up-to-date"||U.status==="update-available").length,le=s.some(U=>U.status==="checking"),Z=C&&w.length>0?w.length:S?1:0,Q=s.find(U=>U.id==="cli")?.status??"idle",ce=m.useMemo(()=>C&&w.length>0?w.map(([U,ve])=>({id:U,kitName:U,kit:ve})):S?[{id:S,kitName:S,kit:{version:k,installedAt:N}}]:[],[C,w,S,k,N]),fe=m.useMemo(()=>{const ve=[...ce.map(te=>({...te,status:s.find(Ae=>Ae.id===te.id)?.status??"idle"}))].sort((te,Ae)=>{const pe=Qg(te.status)-Qg(Ae.status);return pe!==0?pe:te.kitName.localeCompare(Ae.kitName)});return g==="updates"?ve.filter(te=>te.status==="update-available"):g==="up-to-date"?ve.filter(te=>te.status==="up-to-date"):g==="cli"?[]:ve},[ce,s,g]),W=g==="all"||g==="cli"||g==="updates"&&Q==="update-available"||g==="up-to-date"&&Q==="up-to-date",oe=(W?1:0)+fe.length;m.useEffect(()=>{if(!(!(g==="updates"||g==="up-to-date")||b.current)&&!(o||l||s.length===0)){if(!s.every(ve=>ve.status==="idle")){b.current=!0;return}b.current=!0,E()}},[E,o,l,s,g]);const ue=m.useMemo(()=>oe!==0?"":(g==="updates"||g==="up-to-date")&&le?e("checkingAll"):(g==="updates"||g==="up-to-date")&&G===0?e("runCheckAllForFilter"):g==="updates"&&G>0&&F===0?e("noUpdatesFound"):g==="up-to-date"&&G>0&&z===0?e("noUpToDateYet"):e("noComponentsMatchFilter"),[oe,g,le,G,F,z,e]),be=!v&&g!=="cli",Pe=e("componentFilterUpdatesCount").replace("{count}",F.toString()),Qe=e("componentFilterUpToDateCount").replace("{count}",z.toString());return c.jsxs("div",{className:"relative",children:[c.jsxs("div",{className:"pointer-events-none absolute inset-0 -z-10 overflow-hidden",children:[c.jsx("div",{className:"absolute -top-20 -right-8 h-56 w-56 rounded-full bg-dash-accent/10 blur-3xl"}),c.jsx("div",{className:"absolute -bottom-24 -left-10 h-64 w-64 rounded-full bg-dash-accent/5 blur-3xl"})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsx("section",{className:"dash-panel dash-sticky-glass p-4 md:p-5 sticky top-0 z-10",children:c.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsx("p",{className:"mono text-[10px] uppercase tracking-[0.16em] text-dash-text-muted",children:e("systemControlTower")}),c.jsx("h2",{className:"text-xl md:text-2xl font-semibold text-dash-text",children:e("systemOverviewTitle")}),c.jsx("p",{className:"text-sm text-dash-text-secondary max-w-2xl",children:e("systemOverviewDesc")})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(oL,{value:f,onChange:P,disabled:o||l}),s.length>0&&c.jsx(iL,{components:s,isChecking:o,isUpdating:l,onCheckAll:E,onUpdateAll:D})]})]})}),c.jsxs("section",{className:"grid grid-cols-2 gap-3 xl:grid-cols-5",children:[c.jsx(si,{label:e("components"),value:s.length.toString()}),c.jsx(si,{label:e("kitsLabel"),value:Z.toString()}),c.jsx(si,{label:e("updateAvailable"),value:F.toString(),tone:"accent"}),c.jsx(si,{label:e("upToDate"),value:z.toString(),tone:"success"}),c.jsx(si,{label:e("checkedComponents"),value:G.toString()})]}),c.jsxs("section",{className:"space-y-3",children:[c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 px-1",children:[c.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text",children:e("installedComponentsHeading")}),c.jsxs("fieldset",{className:"flex items-center gap-2",children:[c.jsx("legend",{className:"sr-only",children:e("installedComponentsHeading")}),c.jsx(ii,{label:e("componentFilterAll"),value:g,activeValue:"all",onClick:()=>M("all")}),c.jsx(ii,{label:Pe,value:g,activeValue:"updates",onClick:()=>M("updates")}),c.jsx(ii,{label:Qe,value:g,activeValue:"up-to-date",onClick:()=>M("up-to-date")}),c.jsx(ii,{label:e("componentFilterCli"),value:g,activeValue:"cli",onClick:()=>M("cli")}),c.jsx(ii,{label:e("componentFilterKits"),value:g,activeValue:"kits",onClick:()=>M("kits")})]})]}),W&&c.jsx(lL,{version:n?.cliVersion??"...",installedAt:void 0,externalStatus:s.find(U=>U.id==="cli")?.status,externalLatestVersion:s.find(U=>U.id==="cli")?.latestVersion??null,onStatusChange:(U,ve)=>O("cli",U,ve),disabled:o||l,channel:f,packageManager:n?.packageManager,installLocation:n?.installLocation}),fe.map(U=>{const ve=s.find(te=>te.id===U.id);return c.jsx(uL,{kitName:U.kitName,kit:U.kit,externalStatus:ve?.status,externalLatestVersion:ve?.latestVersion??null,onStatusChange:(te,Ae)=>O(U.id,te,Ae),disabled:o||l,channel:f},U.id)}),be&&c.jsx("div",{className:"dash-panel-muted p-6 text-center opacity-80",children:c.jsx("p",{className:"text-sm text-dash-text-secondary",children:e("noKitInstalled")})}),!be&&oe===0&&c.jsx("div",{className:"dash-panel-muted p-6 text-center opacity-80",children:c.jsx("p",{className:"text-sm text-dash-text-secondary",children:ue})})]}),n&&c.jsx(xL,{systemInfo:n})]}),c.jsx(Gu,{isOpen:h,onClose:()=>u(!1),target:"cli",mode:"batch",components:s.filter(U=>U.status==="update-available").map(U=>({id:U.id,name:U.id==="cli"?"CLI":`${U.id} Kit`})),onComplete:$})]})},si=({label:t,value:e,tone:n="default"})=>{const r=n==="accent"?"text-dash-accent":n==="success"?"text-emerald-500":"text-dash-text";return c.jsxs("div",{className:"dash-panel p-3",children:[c.jsx("p",{className:"text-[11px] uppercase tracking-wide text-dash-text-muted",children:t}),c.jsx("p",{className:`mt-1 mono text-xl font-semibold ${r}`,children:e})]})};function Xg({label:t,value:e,ok:n}){const r=n===!0?"bg-emerald-500":n===!1?"bg-red-500":"bg-dash-text-muted/40";return c.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-dash-border bg-dash-bg/70 px-3 py-2",children:[c.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${r}`}),c.jsx("span",{className:"text-xs text-dash-text-muted flex-1",children:t}),c.jsx("span",{className:"mono text-xs text-dash-text-secondary break-all text-right",children:e})]})}function xL({systemInfo:t}){const{t:e}=X(),n=[{label:"Claude CLI",value:`v${t.cliVersion}`,ok:!!t.cliVersion},{label:"Git",value:t.gitVersion??"not found",ok:!!t.gitVersion},{label:"GitHub CLI",value:t.ghVersion??"not found",ok:t.ghVersion?!0:null},{label:"Node.js",value:t.nodeVersion,ok:!!t.nodeVersion},{label:"Bun",value:t.bunVersion,ok:!!t.bunVersion},{label:e("envShell"),value:t.shell??"unknown",ok:t.shell?!0:null}],r=[{label:e("osVersion"),value:t.os},{label:e("claudeConfigPath"),value:t.configPath},{label:e("envHomeDir"),value:t.homeDir??"~"}];return t.cpuCores&&r.push({label:e("envCpuCores"),value:`${t.cpuCores} cores`}),t.totalMemoryGb&&r.push({label:e("envTotalMemory"),value:`${t.totalMemoryGb} GB`}),c.jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[c.jsxs("div",{className:"dash-panel p-4 space-y-3",children:[c.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text",children:"Health Check"}),c.jsx("div",{className:"space-y-1.5",children:n.map(s=>c.jsx(Xg,{label:s.label,value:s.value,ok:s.ok},s.label))})]}),c.jsxs("div",{className:"dash-panel p-4 space-y-3",children:[c.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text",children:e("environment")}),c.jsx("div",{className:"space-y-1.5",children:r.map(s=>c.jsx(Xg,{label:s.label,value:s.value,ok:null},s.label))})]})]})}const ii=({label:t,value:e,activeValue:n,onClick:r})=>{const s=e===n;return c.jsx("button",{type:"button",onClick:r,"aria-pressed":s,className:`dash-focus-ring px-2.5 py-1.5 rounded-lg text-[11px] font-semibold border transition-colors ${s?"border-dash-accent/30 bg-dash-accent-subtle text-dash-accent":"border-dash-border bg-dash-surface text-dash-text-muted hover:text-dash-text hover:bg-dash-surface-hover"}`,children:t})},jd="~/.claude/settings.json",Ha="{}",bL=()=>{const{t}=X(),[e,n]=m.useState(!0),[r,s]=m.useState(jd),[i,o]=m.useState(Ha),[a,l]=m.useState(Ha),[d,h]=m.useState(0),[u,f]=m.useState(!1),[p,g]=m.useState(!1),[x,b]=m.useState("idle"),[y,w]=m.useState(null),[C,S]=m.useState(null);m.useEffect(()=>{let O=!1;return(async()=>{n(!0),g(!1);try{const M=await ak();if(O)return;const D=JSON.stringify(M.settings??{},null,2);s(M.path||jd),f(!!M.exists),o(D),l(D),w(null)}catch{if(O)return;g(!0),f(!1),s(jd),o(Ha),l(Ha)}finally{O||n(!1)}})(),()=>{O=!0}},[]);const k=O=>{l(O),S(null);try{JSON.parse(O),w(null)}catch(E){w(E instanceof Error?E.message:"Invalid JSON")}},N=()=>{l(i),w(null),S(null),b("idle")},v=async()=>{if(!(e||y)){b("saving"),S(null);try{const O=JSON.parse(a),E=JSON.stringify(O,null,2),M=await lk(O);o(E),l(E),f(!0),b("saved"),S(M.backupPath?`${t("settingsBackupSaved")}: ${M.backupPath}`:t("saved")),setTimeout(()=>b("idle"),2e3)}catch(O){b("error"),S(O instanceof Error?O.message:t("saveFailed")),setTimeout(()=>b("idle"),3e3)}}},P=a!==i;return c.jsxs("section",{className:"h-full min-h-0 flex flex-col rounded-xl border border-dash-border bg-dash-surface p-3 shadow-sm",children:[c.jsxs("div",{className:"mb-2 flex items-end justify-between gap-3 px-1",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text",children:t("settingsJsonHeading")}),c.jsx("p",{className:"mono text-[11px] text-dash-text-muted truncate",children:r})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{type:"button",onClick:N,disabled:e||!P||x==="saving",className:"px-3 py-1.5 rounded-lg bg-dash-surface text-xs font-bold text-dash-text-secondary hover:bg-dash-surface-hover transition-colors border border-dash-border disabled:opacity-50 disabled:cursor-not-allowed",children:t("discard")}),c.jsx("button",{type:"button",onClick:v,disabled:e||x==="saving"||!!y||!P,className:`px-3 py-1.5 rounded-lg text-xs font-bold transition-all tracking-widest uppercase disabled:opacity-50 disabled:cursor-not-allowed ${x==="saved"?"bg-green-500 text-white shadow-lg shadow-green-500/20":x==="error"?"bg-red-500 text-white":"bg-dash-accent text-dash-bg hover:bg-dash-accent-hover shadow-lg shadow-dash-accent/20"}`,children:t(x==="saving"?"saving":x==="saved"?"saved":x==="error"?"saveFailed":"saveChanges")})]})]}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(Nu,{width:100,isLoading:e,jsonText:a,cursorLine:d,syntaxError:y,onChange:k,onCursorLineChange:h})}),C&&c.jsx("p",{className:`mt-2 px-1 text-xs ${x==="error"?"text-red-500":"text-dash-text-muted"}`,children:C}),!e&&!p&&!u&&c.jsx("p",{className:"mt-2 px-1 text-xs text-dash-text-muted",children:t("settingsJsonMissing")}),!e&&p&&c.jsx("p",{className:"mt-2 px-1 text-xs text-red-500",children:t("settingsJsonLoadFailed")})]})},Zg=()=>{const[t,e]=m.useState({}),{sizes:n,isDragging:r,startDrag:s}=Pu({storageKey:"claudekit-global-system-panels",defaultSizes:[70,30],minSizes:[45,20]});return m.useEffect(()=>{hk().then(e).catch(()=>e({}))},[]),c.jsxs("div",{className:"h-full flex min-h-0",children:[c.jsx("div",{style:{width:`${n[0]}%`},className:"min-w-0 h-full overflow-auto pr-1",children:c.jsx(gL,{metadata:t})}),c.jsx(Jt,{direction:"horizontal",isDragging:r,onMouseDown:i=>s(0,i)}),c.jsx("div",{style:{width:`${n[1]}%`},className:"min-w-0 h-full overflow-hidden",children:c.jsx(bL,{})})]})},yL=A2([{path:"/",element:c.jsx(wk,{}),children:[{index:!0,element:c.jsx(Zg,{})},{path:"dashboard",element:c.jsx(Zg,{})},{path:"config/global",element:c.jsx(ZP,{})},{path:"config/project/:projectId",element:c.jsx(iE,{})},{path:"project/:projectId",element:c.jsx(lE,{})},{path:"onboarding",element:c.jsx(sE,{})},{path:"migrate",element:c.jsx(qT,{})},{path:"statusline",element:c.jsx(sL,{})},{path:"mcp",element:c.jsx(cO,{})},{path:"kanban",element:c.jsx(nO,{})},{path:"sessions/:projectId/:sessionId",element:c.jsx(EE,{})},{path:"agents",element:c.jsx(Ek,{})},{path:"commands",element:c.jsx(Vk,{})},{path:"skills",element:c.jsx(_E,{})},{path:"*",element:c.jsx(r2,{to:"/",replace:!0})}]}]),sv=document.getElementById("root");if(!sv)throw document.body.innerHTML='<div style="padding:20px;color:red;">Fatal: Root element not found</div>',new Error("Root element #root not found");Nd.createRoot(sv).render(c.jsx(Re.StrictMode,{children:c.jsx(K2,{children:c.jsx(G2,{children:c.jsx(_2,{router:yL})})})}));
|