claudekit-cli 3.36.0-dev.21 → 3.36.0-dev.23

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.
@@ -1,4 +1,4 @@
1
- var Py=Object.defineProperty;var Ny=(n,e,t)=>e in n?Py(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Cd=(n,e,t)=>Ny(n,typeof e!="symbol"?e+"":e,t);import{r as g,a as em,R as Ay,b as My}from"./vendor-DNUgy55u.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();var tm={exports:{}},Pa={};/**
1
+ var Nx=Object.defineProperty;var Ax=(n,e,t)=>e in n?Nx(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var jd=(n,e,t)=>Ax(n,typeof e!="symbol"?e+"":e,t);import{r as g,a as nm,R as Mx,b as Dx}from"./vendor-DNUgy55u.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();var rm={exports:{}},Pa={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@ var Py=Object.defineProperty;var Ny=(n,e,t)=>e in n?Py(n,e,{enumerable:!0,config
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Ty=g,Dy=Symbol.for("react.element"),Ey=Symbol.for("react.fragment"),Ry=Object.prototype.hasOwnProperty,Ly=Ty.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Iy={key:!0,ref:!0,__self:!0,__source:!0};function nm(n,e,t){var r,i={},s=null,o=null;t!==void 0&&(s=""+t),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)Ry.call(e,r)&&!Iy.hasOwnProperty(r)&&(i[r]=e[r]);if(n&&n.defaultProps)for(r in e=n.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:Dy,type:n,key:s,ref:o,props:i,_owner:Ly.current}}Pa.Fragment=Ey;Pa.jsx=nm;Pa.jsxs=nm;tm.exports=Pa;var d=tm.exports,ac={},jd=em;ac.createRoot=jd.createRoot,ac.hydrateRoot=jd.hydrateRoot;/**
9
+ */var Tx=g,Ex=Symbol.for("react.element"),Rx=Symbol.for("react.fragment"),Lx=Object.prototype.hasOwnProperty,Ix=Tx.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,$x={key:!0,ref:!0,__self:!0,__source:!0};function im(n,e,t){var r,i={},s=null,o=null;t!==void 0&&(s=""+t),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)Lx.call(e,r)&&!$x.hasOwnProperty(r)&&(i[r]=e[r]);if(n&&n.defaultProps)for(r in e=n.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:Ex,type:n,key:s,ref:o,props:i,_owner:Ix.current}}Pa.Fragment=Rx;Pa.jsx=im;Pa.jsxs=im;rm.exports=Pa;var h=rm.exports,ac={},Od=nm;ac.createRoot=Od.createRoot,ac.hydrateRoot=Od.hydrateRoot;/**
10
10
  * react-router v7.11.0
11
11
  *
12
12
  * Copyright (c) Remix Software Inc.
@@ -15,59 +15,59 @@ var Py=Object.defineProperty;var Ny=(n,e,t)=>e in n?Py(n,e,{enumerable:!0,config
15
15
  * LICENSE.md file in the root directory of this source tree.
16
16
  *
17
17
  * @license MIT
18
- */var rm=n=>{throw TypeError(n)},$y=(n,e,t)=>e.has(n)||rm("Cannot "+t),Za=(n,e,t)=>($y(n,e,"read from private field"),t?t.call(n):e.get(n)),By=(n,e,t)=>e.has(n)?rm("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Od="popstate";function Fy(n={}){function e(r,i){let{pathname:s,search:o,hash:a}=r.location;return Ti("",{pathname:s,search:o,hash:a},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function t(r,i){return typeof i=="string"?i:on(i)}return zy(e,t,null,n)}function ce(n,e){if(n===!1||n===null||typeof n>"u")throw new Error(e)}function Ee(n,e){if(!n){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function Vy(){return Math.random().toString(36).substring(2,10)}function Pd(n,e){return{usr:n.state,key:n.key,idx:e}}function Ti(n,e,t=null,r){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof e=="string"?Vn(e):e,state:t,key:e&&e.key||r||Vy()}}function on({pathname:n="/",search:e="",hash:t=""}){return e&&e!=="?"&&(n+=e.charAt(0)==="?"?e:"?"+e),t&&t!=="#"&&(n+=t.charAt(0)==="#"?t:"#"+t),n}function Vn(n){let e={};if(n){let t=n.indexOf("#");t>=0&&(e.hash=n.substring(t),n=n.substring(0,t));let r=n.indexOf("?");r>=0&&(e.search=n.substring(r),n=n.substring(0,r)),n&&(e.pathname=n)}return e}function zy(n,e,t,r={}){let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,a="POP",l=null,c=h();c==null&&(c=0,o.replaceState({...o.state,idx:c},""));function h(){return(o.state||{idx:null}).idx}function u(){a="POP";let y=h(),v=y==null?null:y-c;c=y,l&&l({action:a,location:b.location,delta:v})}function f(y,v){a="PUSH";let w=Ti(b.location,y,v);c=h()+1;let C=Pd(w,c),j=b.createHref(w);try{o.pushState(C,"",j)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;i.location.assign(j)}s&&l&&l({action:a,location:b.location,delta:1})}function p(y,v){a="REPLACE";let w=Ti(b.location,y,v);c=h();let C=Pd(w,c),j=b.createHref(w);o.replaceState(C,"",j),s&&l&&l({action:a,location:b.location,delta:0})}function m(y){return im(y)}let b={get action(){return a},get location(){return n(i,o)},listen(y){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(Od,u),l=y,()=>{i.removeEventListener(Od,u),l=null}},createHref(y){return e(i,y)},createURL:m,encodeLocation(y){let v=m(y);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:f,replace:p,go(y){return o.go(y)}};return b}function im(n,e=!1){let t="http://localhost";typeof window<"u"&&(t=window.location.origin!=="null"?window.location.origin:window.location.href),ce(t,"No window.location.(origin|href) available to create URL");let r=typeof n=="string"?n:on(n);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=t+r),new URL(r,t)}var gi,Nd=class{constructor(n){if(By(this,gi,new Map),n)for(let[e,t]of n)this.set(e,t)}get(n){if(Za(this,gi).has(n))return Za(this,gi).get(n);if(n.defaultValue!==void 0)return n.defaultValue;throw new Error("No value found for context")}set(n,e){Za(this,gi).set(n,e)}};gi=new WeakMap;var _y=new Set(["lazy","caseSensitive","path","id","index","children"]);function Hy(n){return _y.has(n)}var Wy=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function Uy(n){return Wy.has(n)}function Ky(n){return n.index===!0}function Di(n,e,t=[],r={},i=!1){return n.map((s,o)=>{let a=[...t,String(o)],l=typeof s.id=="string"?s.id:a.join("-");if(ce(s.index!==!0||!s.children,"Cannot specify children on an index route"),ce(i||!r[l],`Found a route id collision on id "${l}". Route id's must be globally unique within Data Router usages`),Ky(s)){let c={...s,id:l};return r[l]=Ad(c,e(c)),c}else{let c={...s,id:l,children:void 0};return r[l]=Ad(c,e(c)),s.children&&(c.children=Di(s.children,e,a,r,i)),c}})}function Ad(n,e){return Object.assign(n,{...e,...typeof e.lazy=="object"&&e.lazy!=null?{lazy:{...n.lazy,...e.lazy}}:{}})}function jn(n,e,t="/"){return bi(n,e,t,!1)}function bi(n,e,t,r){let i=typeof e=="string"?Vn(e):e,s=Et(i.pathname||"/",t);if(s==null)return null;let o=sm(n);qy(o);let a=null;for(let l=0;a==null&&l<o.length;++l){let c=s1(s);a=r1(o[l],c,r)}return a}function Gy(n,e){let{route:t,pathname:r,params:i}=n;return{id:t.id,pathname:r,params:i,data:e[t.id],loaderData:e[t.id],handle:t.handle}}function sm(n,e=[],t=[],r="",i=!1){let s=(o,a,l=i,c)=>{let h={relativePath:c===void 0?o.path||"":c,caseSensitive:o.caseSensitive===!0,childrenIndex:a,route:o};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(r)&&l)return;ce(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=rn([r,h.relativePath]),f=t.concat(h);o.children&&o.children.length>0&&(ce(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),sm(o.children,e,f,u,l)),!(o.path==null&&!o.index)&&e.push({path:u,score:t1(u,o.index),routesMeta:f})};return n.forEach((o,a)=>{if(o.path===""||!o.path?.includes("?"))s(o,a);else for(let l of om(o.path))s(o,a,!0,l)}),e}function om(n){let e=n.split("/");if(e.length===0)return[];let[t,...r]=e,i=t.endsWith("?"),s=t.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=om(r.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&a.push(...o),a.map(l=>n.startsWith("/")&&l===""?"/":l)}function qy(n){n.sort((e,t)=>e.score!==t.score?t.score-e.score:n1(e.routesMeta.map(r=>r.childrenIndex),t.routesMeta.map(r=>r.childrenIndex)))}var Jy=/^:[\w-]+$/,Yy=3,Qy=2,Xy=1,Zy=10,e1=-2,Md=n=>n==="*";function t1(n,e){let t=n.split("/"),r=t.length;return t.some(Md)&&(r+=e1),e&&(r+=Qy),t.filter(i=>!Md(i)).reduce((i,s)=>i+(Jy.test(s)?Yy:s===""?Xy:Zy),r)}function n1(n,e){return n.length===e.length&&n.slice(0,-1).every((r,i)=>r===e[i])?n[n.length-1]-e[e.length-1]:0}function r1(n,e,t=!1){let{routesMeta:r}=n,i={},s="/",o=[];for(let a=0;a<r.length;++a){let l=r[a],c=a===r.length-1,h=s==="/"?e:e.slice(s.length)||"/",u=Zo({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},h),f=l.route;if(!u&&c&&t&&!r[r.length-1].route.index&&(u=Zo({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},h)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:rn([s,u.pathname]),pathnameBase:l1(rn([s,u.pathnameBase])),route:f}),u.pathnameBase!=="/"&&(s=rn([s,u.pathnameBase]))}return o}function Zo(n,e){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[t,r]=i1(n.path,n.caseSensitive,n.end),i=e.match(t);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),a=i.slice(1);return{params:r.reduce((c,{paramName:h,isOptional:u},f)=>{if(h==="*"){let m=a[f]||"";o=s.slice(0,s.length-m.length).replace(/(.)\/+$/,"$1")}const p=a[f];return u&&!p?c[h]=void 0:c[h]=(p||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:n}}function i1(n,e=!1,t=!0){Ee(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let r=[],i="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(r.push({paramName:"*"}),i+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):t?i+="\\/*$":n!==""&&n!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function s1(n){try{return n.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Ee(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),n}}function Et(n,e){if(e==="/")return n;if(!n.toLowerCase().startsWith(e.toLowerCase()))return null;let t=e.endsWith("/")?e.length-1:e.length,r=n.charAt(t);return r&&r!=="/"?null:n.slice(t)||"/"}function o1({basename:n,pathname:e}){return e==="/"?n:rn([n,e])}var am=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Na=n=>am.test(n);function a1(n,e="/"){let{pathname:t,search:r="",hash:i=""}=typeof n=="string"?Vn(n):n,s;if(t)if(Na(t))s=t;else{if(t.includes("//")){let o=t;t=t.replace(/\/\/+/g,"/"),Ee(!1,`Pathnames cannot have embedded double slashes - normalizing ${o} -> ${t}`)}t.startsWith("/")?s=Td(t.substring(1),"/"):s=Td(t,e)}else s=e;return{pathname:s,search:c1(r),hash:h1(i)}}function Td(n,e){let t=e.replace(/\/+$/,"").split("/");return n.split("/").forEach(i=>{i===".."?t.length>1&&t.pop():i!=="."&&t.push(i)}),t.length>1?t.join("/"):"/"}function el(n,e,t,r){return`Cannot include a '${n}' character in a manually specified \`to.${e}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${t}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function lm(n){return n.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Aa(n){let e=lm(n);return e.map((t,r)=>r===e.length-1?t.pathname:t.pathnameBase)}function Ma(n,e,t,r=!1){let i;typeof n=="string"?i=Vn(n):(i={...n},ce(!i.pathname||!i.pathname.includes("?"),el("?","pathname","search",i)),ce(!i.pathname||!i.pathname.includes("#"),el("#","pathname","hash",i)),ce(!i.search||!i.search.includes("#"),el("#","search","hash",i)));let s=n===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=t;else{let u=e.length-1;if(!r&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),u-=1;i.pathname=f.join("/")}a=u>=0?e[u]:"/"}let l=a1(i,a),c=o&&o!=="/"&&o.endsWith("/"),h=(s||o===".")&&t.endsWith("/");return!l.pathname.endsWith("/")&&(c||h)&&(l.pathname+="/"),l}var rn=n=>n.join("/").replace(/\/\/+/g,"/"),l1=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),c1=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,h1=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,Is=class{constructor(n,e,t,r=!1){this.status=n,this.statusText=e||"",this.internal=r,t instanceof Error?(this.data=t.toString(),this.error=t):this.data=t}};function Ei(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function $s(n){return n.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var cm=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function hm(n,e){let t=n;if(typeof t!="string"||!am.test(t))return{absoluteURL:void 0,isExternal:!1,to:t};let r=t,i=!1;if(cm)try{let s=new URL(window.location.href),o=t.startsWith("//")?new URL(s.protocol+t):new URL(t),a=Et(o.pathname,e);o.origin===s.origin&&a!=null?t=a+o.search+o.hash:i=!0}catch{Ee(!1,`<Link to="${t}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:t}}var An=Symbol("Uninstrumented");function d1(n,e){let t={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};n.forEach(i=>i({id:e.id,index:e.index,path:e.path,instrument(s){let o=Object.keys(t);for(let a of o)s[a]&&t[a].push(s[a])}}));let r={};if(typeof e.lazy=="function"&&t.lazy.length>0){let i=vr(t.lazy,e.lazy,()=>{});i&&(r.lazy=i)}if(typeof e.lazy=="object"){let i=e.lazy;["middleware","loader","action"].forEach(s=>{let o=i[s],a=t[`lazy.${s}`];if(typeof o=="function"&&a.length>0){let l=vr(a,o,()=>{});l&&(r.lazy=Object.assign(r.lazy||{},{[s]:l}))}})}return["loader","action"].forEach(i=>{let s=e[i];if(typeof s=="function"&&t[i].length>0){let o=s[An]??s,a=vr(t[i],o,(...l)=>Dd(l[0]));a&&(a[An]=o,r[i]=a)}}),e.middleware&&e.middleware.length>0&&t.middleware.length>0&&(r.middleware=e.middleware.map(i=>{let s=i[An]??i,o=vr(t.middleware,s,(...a)=>Dd(a[0]));return o?(o[An]=s,o):i})),r}function u1(n,e){let t={navigate:[],fetch:[]};if(e.forEach(r=>r({instrument(i){let s=Object.keys(i);for(let o of s)i[o]&&t[o].push(i[o])}})),t.navigate.length>0){let r=n.navigate[An]??n.navigate,i=vr(t.navigate,r,(...s)=>{let[o,a]=s;return{to:typeof o=="number"||typeof o=="string"?o:o?on(o):".",...Ed(n,a??{})}});i&&(i[An]=r,n.navigate=i)}if(t.fetch.length>0){let r=n.fetch[An]??n.fetch,i=vr(t.fetch,r,(...s)=>{let[o,,a,l]=s;return{href:a??".",fetcherKey:o,...Ed(n,l??{})}});i&&(i[An]=r,n.fetch=i)}return n}function vr(n,e,t){return n.length===0?null:async(...r)=>{let i=await dm(n,t(...r),()=>e(...r),n.length-1);if(i.type==="error")throw i.value;return i.value}}async function dm(n,e,t,r){let i=n[r],s;if(i){let o,a=async()=>(o?console.error("You cannot call instrumented handlers more than once"):o=dm(n,e,t,r-1),s=await o,ce(s,"Expected a result"),s.type==="error"&&s.value instanceof Error?{status:"error",error:s.value}:{status:"success",error:void 0});try{await i(a,e)}catch(l){console.error("An instrumentation function threw an error:",l)}o||await a(),await o}else try{s={type:"success",value:await t()}}catch(o){s={type:"error",value:o}}return s||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function Dd(n){let{request:e,context:t,params:r,unstable_pattern:i}=n;return{request:f1(e),params:{...r},unstable_pattern:i,context:p1(t)}}function Ed(n,e){return{currentUrl:on(n.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 f1(n){return{method:n.method,url:n.url,headers:{get:(...e)=>n.headers.get(...e)}}}function p1(n){if(g1(n)){let e={...n};return Object.freeze(e),e}else return{get:e=>n.get(e)}}var m1=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function g1(n){if(n===null||typeof n!="object")return!1;const e=Object.getPrototypeOf(n);return e===Object.prototype||e===null||Object.getOwnPropertyNames(e).sort().join("\0")===m1}var um=["POST","PUT","PATCH","DELETE"],b1=new Set(um),y1=["GET",...um],x1=new Set(y1),fm=new Set([301,302,303,307,308]),v1=new Set([307,308]),tl={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},w1={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},si={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},k1=n=>({hasErrorBoundary:!!n.hasErrorBoundary}),pm="remix-router-transitions",mm=Symbol("ResetLoaderData");function S1(n){const e=n.window?n.window:typeof window<"u"?window:void 0,t=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u";ce(n.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=n.hydrationRouteProperties||[],i=n.mapRouteProperties||k1,s=i;if(n.unstable_instrumentations){let S=n.unstable_instrumentations;s=P=>({...i(P),...d1(S.map(M=>M.route).filter(Boolean),P)})}let o={},a=Di(n.routes,s,void 0,o),l,c=n.basename||"/";c.startsWith("/")||(c=`/${c}`);let h=n.dataStrategy||N1,u={...n.future},f=null,p=new Set,m=null,b=null,y=null,v=n.hydrationData!=null,w=jn(a,n.history.location,c),C=!1,j=null,k;if(w==null&&!n.patchRoutesOnNavigation){let S=Ot(404,{pathname:n.history.location.pathname}),{matches:P,route:M}=oo(a);k=!0,w=P,j={[M.id]:S}}else if(w&&!n.hydrationData&&to(w,a,n.history.location.pathname).active&&(w=null),w)if(w.some(S=>S.route.lazy))k=!1;else if(!w.some(S=>hh(S.route)))k=!0;else{let S=n.hydrationData?n.hydrationData.loaderData:null,P=n.hydrationData?n.hydrationData.errors:null;if(P){let M=w.findIndex($=>P[$.route.id]!==void 0);k=w.slice(0,M+1).every($=>!cc($.route,S,P))}else k=w.every(M=>!cc(M.route,S,P))}else{k=!1,w=[];let S=to(null,a,n.history.location.pathname);S.active&&S.matches&&(C=!0,w=S.matches)}let O,x={historyAction:n.history.action,location:n.history.location,matches:w,initialized:k,navigation:tl,restoreScrollPosition:n.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:n.hydrationData&&n.hydrationData.loaderData||{},actionData:n.hydrationData&&n.hydrationData.actionData||null,errors:n.hydrationData&&n.hydrationData.errors||j,fetchers:new Map,blockers:new Map},T="POP",A=null,R=!1,N,L=!1,W=new Map,F=null,B=!1,q=!1,de=new Set,z=new Map,J=0,ie=-1,le=new Map,fe=new Set,we=new Map,ke=new Map,Ae=new Set,Qe=new Map,mt,Y=null;function Me(){if(f=n.history.listen(({action:S,location:P,delta:M})=>{if(mt){mt(),mt=void 0;return}Ee(Qe.size===0||M!=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 $=xd({currentLocation:x.location,nextLocation:P,historyAction:S});if($&&M!=null){let V=new Promise(Z=>{mt=Z});n.history.go(M*-1),eo($,{state:"blocked",location:P,proceed(){eo($,{state:"proceeding",proceed:void 0,reset:void 0,location:P}),V.then(()=>n.history.go(M))},reset(){let Z=new Map(x.blockers);Z.set($,si),ve({blockers:Z})}}),A?.resolve(),A=null;return}return oe(S,P)}),t){K1(e,W);let S=()=>G1(e,W);e.addEventListener("pagehide",S),F=()=>e.removeEventListener("pagehide",S)}return x.initialized||oe("POP",x.location,{initialHydration:!0}),O}function Se(){f&&f(),F&&F(),p.clear(),N&&N.abort(),x.fetchers.forEach((S,P)=>Ya(P)),x.blockers.forEach((S,P)=>yd(P))}function Ie(S){return p.add(S),()=>p.delete(S)}function ve(S,P={}){S.matches&&(S.matches=S.matches.map(V=>{let Z=o[V.route.id],Q=V.route;return Q.element!==Z.element||Q.errorElement!==Z.errorElement||Q.hydrateFallbackElement!==Z.hydrateFallbackElement?{...V,route:Z}:V})),x={...x,...S};let M=[],$=[];x.fetchers.forEach((V,Z)=>{V.state==="idle"&&(Ae.has(Z)?M.push(Z):$.push(Z))}),Ae.forEach(V=>{!x.fetchers.has(V)&&!z.has(V)&&M.push(V)}),[...p].forEach(V=>V(x,{deletedFetchers:M,newErrors:S.errors??null,viewTransitionOpts:P.viewTransitionOpts,flushSync:P.flushSync===!0})),M.forEach(V=>Ya(V)),$.forEach(V=>x.fetchers.delete(V))}function gt(S,P,{flushSync:M}={}){let $=x.actionData!=null&&x.navigation.formMethod!=null&&Ze(x.navigation.formMethod)&&x.navigation.state==="loading"&&S.state?._isRedirect!==!0,V;P.actionData?Object.keys(P.actionData).length>0?V=P.actionData:V=null:$?V=x.actionData:V=null;let Z=P.loaderData?Hd(x.loaderData,P.loaderData,P.matches||[],P.errors):x.loaderData,Q=x.blockers;Q.size>0&&(Q=new Map(Q),Q.forEach((se,te)=>Q.set(te,si)));let X=B?!1:wd(S,P.matches||x.matches),ee=R===!0||x.navigation.formMethod!=null&&Ze(x.navigation.formMethod)&&S.state?._isRedirect!==!0;l&&(a=l,l=void 0),B||T==="POP"||(T==="PUSH"?n.history.push(S,S.state):T==="REPLACE"&&n.history.replace(S,S.state));let re;if(T==="POP"){let se=W.get(x.location.pathname);se&&se.has(S.pathname)?re={currentLocation:x.location,nextLocation:S}:W.has(S.pathname)&&(re={currentLocation:S,nextLocation:x.location})}else if(L){let se=W.get(x.location.pathname);se?se.add(S.pathname):(se=new Set([S.pathname]),W.set(x.location.pathname,se)),re={currentLocation:x.location,nextLocation:S}}ve({...P,actionData:V,loaderData:Z,historyAction:T,location:S,initialized:!0,navigation:tl,revalidation:"idle",restoreScrollPosition:X,preventScrollReset:ee,blockers:Q},{viewTransitionOpts:re,flushSync:M===!0}),T="POP",R=!1,L=!1,B=!1,q=!1,A?.resolve(),A=null,Y?.resolve(),Y=null}async function I(S,P){if(A?.resolve(),A=null,typeof S=="number"){A||(A=Gd());let ye=A.promise;return n.history.go(S),ye}let M=lc(x.location,x.matches,c,S,P?.fromRouteId,P?.relative),{path:$,submission:V,error:Z}=Rd(!1,M,P),Q=x.location,X=Ti(x.location,$,P&&P.state);X={...X,...n.history.encodeLocation(X)};let ee=P&&P.replace!=null?P.replace:void 0,re="PUSH";ee===!0?re="REPLACE":ee===!1||V!=null&&Ze(V.formMethod)&&V.formAction===x.location.pathname+x.location.search&&(re="REPLACE");let se=P&&"preventScrollReset"in P?P.preventScrollReset===!0:void 0,te=(P&&P.flushSync)===!0,be=xd({currentLocation:Q,nextLocation:X,historyAction:re});if(be){eo(be,{state:"blocked",location:X,proceed(){eo(be,{state:"proceeding",proceed:void 0,reset:void 0,location:X}),I(S,P)},reset(){let ye=new Map(x.blockers);ye.set(be,si),ve({blockers:ye})}});return}await oe(re,X,{submission:V,pendingError:Z,preventScrollReset:se,replace:P&&P.replace,enableViewTransition:P&&P.viewTransition,flushSync:te,callSiteDefaultShouldRevalidate:P&&P.unstable_defaultShouldRevalidate})}function G(){Y||(Y=Gd()),Ja(),ve({revalidation:"loading"});let S=Y.promise;return x.navigation.state==="submitting"?S:x.navigation.state==="idle"?(oe(x.historyAction,x.location,{startUninterruptedRevalidation:!0}),S):(oe(T||x.historyAction,x.navigation.location,{overrideNavigation:x.navigation,enableViewTransition:L===!0}),S)}async function oe(S,P,M){N&&N.abort(),N=null,T=S,B=(M&&M.startUninterruptedRevalidation)===!0,Sy(x.location,x.matches),R=(M&&M.preventScrollReset)===!0,L=(M&&M.enableViewTransition)===!0;let $=l||a,V=M&&M.overrideNavigation,Z=M?.initialHydration&&x.matches&&x.matches.length>0&&!C?x.matches:jn($,P,c),Q=(M&&M.flushSync)===!0;if(Z&&x.initialized&&!q&&I1(x.location,P)&&!(M&&M.submission&&Ze(M.submission.formMethod))){gt(P,{matches:Z},{flushSync:Q});return}let X=to(Z,$,P.pathname);if(X.active&&X.matches&&(Z=X.matches),!Z){let{error:We,notFoundMatches:rt,route:Ce}=Qa(P.pathname);gt(P,{matches:rt,loaderData:{},errors:{[Ce.id]:We}},{flushSync:Q});return}N=new AbortController;let ee=br(n.history,P,N.signal,M&&M.submission),re=n.getContext?await n.getContext():new Nd,se;if(M&&M.pendingError)se=[On(Z).route.id,{type:"error",error:M.pendingError}];else if(M&&M.submission&&Ze(M.submission.formMethod)){let We=await Te(ee,P,M.submission,Z,re,X.active,M&&M.initialHydration===!0,{replace:M.replace,flushSync:Q});if(We.shortCircuited)return;if(We.pendingActionResult){let[rt,Ce]=We.pendingActionResult;if(vt(Ce)&&Ei(Ce.error)&&Ce.error.status===404){N=null,gt(P,{matches:We.matches,loaderData:{},errors:{[rt]:Ce.error}});return}}Z=We.matches||Z,se=We.pendingActionResult,V=nl(P,M.submission),Q=!1,X.active=!1,ee=br(n.history,ee.url,ee.signal)}let{shortCircuited:te,matches:be,loaderData:ye,errors:Ke}=await Ut(ee,P,Z,re,X.active,V,M&&M.submission,M&&M.fetcherSubmission,M&&M.replace,M&&M.initialHydration===!0,Q,se,M&&M.callSiteDefaultShouldRevalidate);te||(N=null,gt(P,{matches:be||Z,...Wd(se),loaderData:ye,errors:Ke}))}async function Te(S,P,M,$,V,Z,Q,X={}){Ja();let ee=W1(P,M);if(ve({navigation:ee},{flushSync:X.flushSync===!0}),Z){let te=await no($,P.pathname,S.signal);if(te.type==="aborted")return{shortCircuited:!0};if(te.type==="error"){if(te.partialMatches.length===0){let{matches:ye,route:Ke}=oo(a);return{matches:ye,pendingActionResult:[Ke.id,{type:"error",error:te.error}]}}let be=On(te.partialMatches).route.id;return{matches:te.partialMatches,pendingActionResult:[be,{type:"error",error:te.error}]}}else if(te.matches)$=te.matches;else{let{notFoundMatches:be,error:ye,route:Ke}=Qa(P.pathname);return{matches:be,pendingActionResult:[Ke.id,{type:"error",error:ye}]}}}let re,se=Vo($,P);if(!se.route.action&&!se.route.lazy)re={type:"error",error:Ot(405,{method:S.method,pathname:P.pathname,routeId:se.route.id})};else{let te=Or(s,o,S,$,se,Q?[]:r,V),be=await ni(S,te,V,null);if(re=be[se.route.id],!re){for(let ye of $)if(be[ye.route.id]){re=be[ye.route.id];break}}if(S.signal.aborted)return{shortCircuited:!0}}if(er(re)){let te;return X&&X.replace!=null?te=X.replace:te=Vd(re.response.headers.get("Location"),new URL(S.url),c)===x.location.pathname+x.location.search,await Wn(S,re,!0,{submission:M,replace:te}),{shortCircuited:!0}}if(vt(re)){let te=On($,se.route.id);return(X&&X.replace)!==!0&&(T="PUSH"),{matches:$,pendingActionResult:[te.route.id,re,se.route.id]}}return{matches:$,pendingActionResult:[se.route.id,re]}}async function Ut(S,P,M,$,V,Z,Q,X,ee,re,se,te,be){let ye=Z||nl(P,Q),Ke=Q||X||Kd(ye),We=!B&&!re;if(V){if(We){let Xe=Zs(te);ve({navigation:ye,...Xe!==void 0?{actionData:Xe}:{}},{flushSync:se})}let ge=await no(M,P.pathname,S.signal);if(ge.type==="aborted")return{shortCircuited:!0};if(ge.type==="error"){if(ge.partialMatches.length===0){let{matches:pr,route:Gn}=oo(a);return{matches:pr,loaderData:{},errors:{[Gn.id]:ge.error}}}let Xe=On(ge.partialMatches).route.id;return{matches:ge.partialMatches,loaderData:{},errors:{[Xe]:ge.error}}}else if(ge.matches)M=ge.matches;else{let{error:Xe,notFoundMatches:pr,route:Gn}=Qa(P.pathname);return{matches:pr,loaderData:{},errors:{[Gn.id]:Xe}}}}let rt=l||a,{dsMatches:Ce,revalidatingFetchers:Ct}=Ld(S,$,s,o,n.history,x,M,Ke,P,re?[]:r,re===!0,q,de,Ae,we,fe,rt,c,n.patchRoutesOnNavigation!=null,te,be);if(ie=++J,!n.dataStrategy&&!Ce.some(ge=>ge.shouldLoad)&&!Ce.some(ge=>ge.route.middleware&&ge.route.middleware.length>0)&&Ct.length===0){let ge=gd();return gt(P,{matches:M,loaderData:{},errors:te&&vt(te[1])?{[te[0]]:te[1].error}:null,...Wd(te),...ge?{fetchers:new Map(x.fetchers)}:{}},{flushSync:se}),{shortCircuited:!0}}if(We){let ge={};if(!V){ge.navigation=ye;let Xe=Zs(te);Xe!==void 0&&(ge.actionData=Xe)}Ct.length>0&&(ge.fetchers=ti(Ct)),ve(ge,{flushSync:se})}Ct.forEach(ge=>{fn(ge.key),ge.controller&&z.set(ge.key,ge.controller)});let Un=()=>Ct.forEach(ge=>fn(ge.key));N&&N.signal.addEventListener("abort",Un);let{loaderResults:ri,fetcherResults:wn}=await fd(Ce,Ct,S,$);if(S.signal.aborted)return{shortCircuited:!0};N&&N.signal.removeEventListener("abort",Un),Ct.forEach(ge=>z.delete(ge.key));let Kt=ao(ri);if(Kt)return await Wn(S,Kt.result,!0,{replace:ee}),{shortCircuited:!0};if(Kt=ao(wn),Kt)return fe.add(Kt.key),await Wn(S,Kt.result,!0,{replace:ee}),{shortCircuited:!0};let{loaderData:Xa,errors:ii}=_d(x,M,ri,te,Ct,wn);re&&x.errors&&(ii={...x.errors,...ii});let Kn=gd(),ro=bd(ie),io=Kn||ro||Ct.length>0;return{matches:M,loaderData:Xa,errors:ii,...io?{fetchers:new Map(x.fetchers)}:{}}}function Zs(S){if(S&&!vt(S[1]))return{[S[0]]:S[1].data};if(x.actionData)return Object.keys(x.actionData).length===0?null:x.actionData}function ti(S){return S.forEach(P=>{let M=x.fetchers.get(P.key),$=oi(void 0,M?M.data:void 0);x.fetchers.set(P.key,$)}),new Map(x.fetchers)}async function gy(S,P,M,$){fn(S);let V=($&&$.flushSync)===!0,Z=l||a,Q=lc(x.location,x.matches,c,M,P,$?.relative),X=jn(Z,Q,c),ee=to(X,Z,Q);if(ee.active&&ee.matches&&(X=ee.matches),!X){un(S,P,Ot(404,{pathname:Q}),{flushSync:V});return}let{path:re,submission:se,error:te}=Rd(!0,Q,$);if(te){un(S,P,te,{flushSync:V});return}let be=n.getContext?await n.getContext():new Nd,ye=($&&$.preventScrollReset)===!0;if(se&&Ze(se.formMethod)){await by(S,P,re,X,be,ee.active,V,ye,se,$&&$.unstable_defaultShouldRevalidate);return}we.set(S,{routeId:P,path:re}),await yy(S,P,re,X,be,ee.active,V,ye,se)}async function by(S,P,M,$,V,Z,Q,X,ee,re){Ja(),we.delete(S);let se=x.fetchers.get(S);dn(S,U1(ee,se),{flushSync:Q});let te=new AbortController,be=br(n.history,M,te.signal,ee);if(Z){let Re=await no($,new URL(be.url).pathname,be.signal,S);if(Re.type==="aborted")return;if(Re.type==="error"){un(S,P,Re.error,{flushSync:Q});return}else if(Re.matches)$=Re.matches;else{un(S,P,Ot(404,{pathname:M}),{flushSync:Q});return}}let ye=Vo($,M);if(!ye.route.action&&!ye.route.lazy){let Re=Ot(405,{method:ee.formMethod,pathname:M,routeId:P});un(S,P,Re,{flushSync:Q});return}z.set(S,te);let Ke=J,We=Or(s,o,be,$,ye,r,V),rt=await ni(be,We,V,S),Ce=rt[ye.route.id];if(!Ce){for(let Re of We)if(rt[Re.route.id]){Ce=rt[Re.route.id];break}}if(be.signal.aborted){z.get(S)===te&&z.delete(S);return}if(Ae.has(S)){if(er(Ce)||vt(Ce)){dn(S,pn(void 0));return}}else{if(er(Ce))if(z.delete(S),ie>Ke){dn(S,pn(void 0));return}else return fe.add(S),dn(S,oi(ee)),Wn(be,Ce,!1,{fetcherSubmission:ee,preventScrollReset:X});if(vt(Ce)){un(S,P,Ce.error);return}}let Ct=x.navigation.location||x.location,Un=br(n.history,Ct,te.signal),ri=l||a,wn=x.navigation.state!=="idle"?jn(ri,x.navigation.location,c):x.matches;ce(wn,"Didn't find any matches after fetcher action");let Kt=++J;le.set(S,Kt);let Xa=oi(ee,Ce.data);x.fetchers.set(S,Xa);let{dsMatches:ii,revalidatingFetchers:Kn}=Ld(Un,V,s,o,n.history,x,wn,ee,Ct,r,!1,q,de,Ae,we,fe,ri,c,n.patchRoutesOnNavigation!=null,[ye.route.id,Ce],re);Kn.filter(Re=>Re.key!==S).forEach(Re=>{let so=Re.key,Sd=x.fetchers.get(so),Oy=oi(void 0,Sd?Sd.data:void 0);x.fetchers.set(so,Oy),fn(so),Re.controller&&z.set(so,Re.controller)}),ve({fetchers:new Map(x.fetchers)});let ro=()=>Kn.forEach(Re=>fn(Re.key));te.signal.addEventListener("abort",ro);let{loaderResults:io,fetcherResults:ge}=await fd(ii,Kn,Un,V);if(te.signal.aborted)return;if(te.signal.removeEventListener("abort",ro),le.delete(S),z.delete(S),Kn.forEach(Re=>z.delete(Re.key)),x.fetchers.has(S)){let Re=pn(Ce.data);x.fetchers.set(S,Re)}let Xe=ao(io);if(Xe)return Wn(Un,Xe.result,!1,{preventScrollReset:X});if(Xe=ao(ge),Xe)return fe.add(Xe.key),Wn(Un,Xe.result,!1,{preventScrollReset:X});let{loaderData:pr,errors:Gn}=_d(x,wn,io,void 0,Kn,ge);bd(Kt),x.navigation.state==="loading"&&Kt>ie?(ce(T,"Expected pending action"),N&&N.abort(),gt(x.navigation.location,{matches:wn,loaderData:pr,errors:Gn,fetchers:new Map(x.fetchers)})):(ve({errors:Gn,loaderData:Hd(x.loaderData,pr,wn,Gn),fetchers:new Map(x.fetchers)}),q=!1)}async function yy(S,P,M,$,V,Z,Q,X,ee){let re=x.fetchers.get(S);dn(S,oi(ee,re?re.data:void 0),{flushSync:Q});let se=new AbortController,te=br(n.history,M,se.signal);if(Z){let Ce=await no($,new URL(te.url).pathname,te.signal,S);if(Ce.type==="aborted")return;if(Ce.type==="error"){un(S,P,Ce.error,{flushSync:Q});return}else if(Ce.matches)$=Ce.matches;else{un(S,P,Ot(404,{pathname:M}),{flushSync:Q});return}}let be=Vo($,M);z.set(S,se);let ye=J,Ke=Or(s,o,te,$,be,r,V),rt=(await ni(te,Ke,V,S))[be.route.id];if(z.get(S)===se&&z.delete(S),!te.signal.aborted){if(Ae.has(S)){dn(S,pn(void 0));return}if(er(rt))if(ie>ye){dn(S,pn(void 0));return}else{fe.add(S),await Wn(te,rt,!1,{preventScrollReset:X});return}if(vt(rt)){un(S,P,rt.error);return}dn(S,pn(rt.data))}}async function Wn(S,P,M,{submission:$,fetcherSubmission:V,preventScrollReset:Z,replace:Q}={}){M||(A?.resolve(),A=null),P.response.headers.has("X-Remix-Revalidate")&&(q=!0);let X=P.response.headers.get("Location");ce(X,"Expected a Location header on the redirect Response"),X=Vd(X,new URL(S.url),c);let ee=Ti(x.location,X,{_isRedirect:!0});if(t){let Ke=!1;if(P.response.headers.has("X-Remix-Reload-Document"))Ke=!0;else if(Na(X)){const We=im(X,!0);Ke=We.origin!==e.location.origin||Et(We.pathname,c)==null}if(Ke){Q?e.location.replace(X):e.location.assign(X);return}}N=null;let re=Q===!0||P.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:se,formAction:te,formEncType:be}=x.navigation;!$&&!V&&se&&te&&be&&($=Kd(x.navigation));let ye=$||V;if(v1.has(P.response.status)&&ye&&Ze(ye.formMethod))await oe(re,ee,{submission:{...ye,formAction:X},preventScrollReset:Z||R,enableViewTransition:M?L:void 0});else{let Ke=nl(ee,$);await oe(re,ee,{overrideNavigation:Ke,fetcherSubmission:V,preventScrollReset:Z||R,enableViewTransition:M?L:void 0})}}async function ni(S,P,M,$){let V,Z={};try{V=await M1(h,S,P,$,M,!1)}catch(Q){return P.filter(X=>X.shouldLoad).forEach(X=>{Z[X.route.id]={type:"error",error:Q}}),Z}if(S.signal.aborted)return Z;if(!Ze(S.method))for(let Q of P){if(V[Q.route.id]?.type==="error")break;!V.hasOwnProperty(Q.route.id)&&!x.loaderData.hasOwnProperty(Q.route.id)&&(!x.errors||!x.errors.hasOwnProperty(Q.route.id))&&Q.shouldCallHandler()&&(V[Q.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${Q.route.id}`)})}for(let[Q,X]of Object.entries(V))if(V1(X)){let ee=X.result;Z[Q]={type:"redirect",response:R1(ee,S,Q,P,c)}}else Z[Q]=await E1(X);return Z}async function fd(S,P,M,$){let V=ni(M,S,$,null),Z=Promise.all(P.map(async ee=>{if(ee.matches&&ee.match&&ee.request&&ee.controller){let se=(await ni(ee.request,ee.matches,$,ee.key))[ee.match.route.id];return{[ee.key]:se}}else return Promise.resolve({[ee.key]:{type:"error",error:Ot(404,{pathname:ee.path})}})})),Q=await V,X=(await Z).reduce((ee,re)=>Object.assign(ee,re),{});return{loaderResults:Q,fetcherResults:X}}function Ja(){q=!0,we.forEach((S,P)=>{z.has(P)&&de.add(P),fn(P)})}function dn(S,P,M={}){x.fetchers.set(S,P),ve({fetchers:new Map(x.fetchers)},{flushSync:(M&&M.flushSync)===!0})}function un(S,P,M,$={}){let V=On(x.matches,P);Ya(S),ve({errors:{[V.route.id]:M},fetchers:new Map(x.fetchers)},{flushSync:($&&$.flushSync)===!0})}function pd(S){return ke.set(S,(ke.get(S)||0)+1),Ae.has(S)&&Ae.delete(S),x.fetchers.get(S)||w1}function xy(S,P){fn(S,P?.reason),dn(S,pn(null))}function Ya(S){let P=x.fetchers.get(S);z.has(S)&&!(P&&P.state==="loading"&&le.has(S))&&fn(S),we.delete(S),le.delete(S),fe.delete(S),Ae.delete(S),de.delete(S),x.fetchers.delete(S)}function vy(S){let P=(ke.get(S)||0)-1;P<=0?(ke.delete(S),Ae.add(S)):ke.set(S,P),ve({fetchers:new Map(x.fetchers)})}function fn(S,P){let M=z.get(S);M&&(M.abort(P),z.delete(S))}function md(S){for(let P of S){let M=pd(P),$=pn(M.data);x.fetchers.set(P,$)}}function gd(){let S=[],P=!1;for(let M of fe){let $=x.fetchers.get(M);ce($,`Expected fetcher: ${M}`),$.state==="loading"&&(fe.delete(M),S.push(M),P=!0)}return md(S),P}function bd(S){let P=[];for(let[M,$]of le)if($<S){let V=x.fetchers.get(M);ce(V,`Expected fetcher: ${M}`),V.state==="loading"&&(fn(M),le.delete(M),P.push(M))}return md(P),P.length>0}function wy(S,P){let M=x.blockers.get(S)||si;return Qe.get(S)!==P&&Qe.set(S,P),M}function yd(S){x.blockers.delete(S),Qe.delete(S)}function eo(S,P){let M=x.blockers.get(S)||si;ce(M.state==="unblocked"&&P.state==="blocked"||M.state==="blocked"&&P.state==="blocked"||M.state==="blocked"&&P.state==="proceeding"||M.state==="blocked"&&P.state==="unblocked"||M.state==="proceeding"&&P.state==="unblocked",`Invalid blocker state transition: ${M.state} -> ${P.state}`);let $=new Map(x.blockers);$.set(S,P),ve({blockers:$})}function xd({currentLocation:S,nextLocation:P,historyAction:M}){if(Qe.size===0)return;Qe.size>1&&Ee(!1,"A router only supports one blocker at a time");let $=Array.from(Qe.entries()),[V,Z]=$[$.length-1],Q=x.blockers.get(V);if(!(Q&&Q.state==="proceeding")&&Z({currentLocation:S,nextLocation:P,historyAction:M}))return V}function Qa(S){let P=Ot(404,{pathname:S}),M=l||a,{matches:$,route:V}=oo(M);return{notFoundMatches:$,route:V,error:P}}function ky(S,P,M){if(m=S,y=P,b=M||null,!v&&x.navigation===tl){v=!0;let $=wd(x.location,x.matches);$!=null&&ve({restoreScrollPosition:$})}return()=>{m=null,y=null,b=null}}function vd(S,P){return b&&b(S,P.map($=>Gy($,x.loaderData)))||S.key}function Sy(S,P){if(m&&y){let M=vd(S,P);m[M]=y()}}function wd(S,P){if(m){let M=vd(S,P),$=m[M];if(typeof $=="number")return $}return null}function to(S,P,M){if(n.patchRoutesOnNavigation)if(S){if(Object.keys(S[0].params).length>0)return{active:!0,matches:bi(P,M,c,!0)}}else return{active:!0,matches:bi(P,M,c,!0)||[]};return{active:!1,matches:null}}async function no(S,P,M,$){if(!n.patchRoutesOnNavigation)return{type:"success",matches:S};let V=S;for(;;){let Z=l==null,Q=l||a,X=o;try{await n.patchRoutesOnNavigation({signal:M,path:P,matches:V,fetcherKey:$,patch:(se,te)=>{M.aborted||Id(se,te,Q,X,s,!1)}})}catch(se){return{type:"error",error:se,partialMatches:V}}finally{Z&&!M.aborted&&(a=[...a])}if(M.aborted)return{type:"aborted"};let ee=jn(Q,P,c),re=null;if(ee){if(Object.keys(ee[0].params).length===0)return{type:"success",matches:ee};if(re=bi(Q,P,c,!0),!(re&&V.length<re.length&&kd(V,re.slice(0,V.length))))return{type:"success",matches:ee}}if(re||(re=bi(Q,P,c,!0)),!re||kd(V,re))return{type:"success",matches:null};V=re}}function kd(S,P){return S.length===P.length&&S.every((M,$)=>M.route.id===P[$].route.id)}function Cy(S){o={},l=Di(S,s,void 0,o)}function jy(S,P,M=!1){let $=l==null;Id(S,P,l||a,o,s,M),$&&(a=[...a],ve({}))}return O={get basename(){return c},get future(){return u},get state(){return x},get routes(){return a},get window(){return e},initialize:Me,subscribe:Ie,enableScrollRestoration:ky,navigate:I,fetch:gy,revalidate:G,createHref:S=>n.history.createHref(S),encodeLocation:S=>n.history.encodeLocation(S),getFetcher:pd,resetFetcher:xy,deleteFetcher:vy,dispose:Se,getBlocker:wy,deleteBlocker:yd,patchRoutes:jy,_internalFetchControllers:z,_internalSetRoutes:Cy,_internalSetStateDoNotUseOrYouWillBreakYourApp(S){ve(S)}},n.unstable_instrumentations&&(O=u1(O,n.unstable_instrumentations.map(S=>S.router).filter(Boolean))),O}function C1(n){return n!=null&&("formData"in n&&n.formData!=null||"body"in n&&n.body!==void 0)}function lc(n,e,t,r,i,s){let o,a;if(i){o=[];for(let c of e)if(o.push(c),c.route.id===i){a=c;break}}else o=e,a=e[e.length-1];let l=Ma(r||".",Aa(o),Et(n.pathname,t)||n.pathname,s==="path");if(r==null&&(l.search=n.search,l.hash=n.hash),(r==null||r===""||r===".")&&a){let c=uh(l.search);if(a.route.index&&!c)l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index";else if(!a.route.index&&c){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 t!=="/"&&(l.pathname=o1({basename:t,pathname:l.pathname})),on(l)}function Rd(n,e,t){if(!t||!C1(t))return{path:e};if(t.formMethod&&!H1(t.formMethod))return{path:e,error:Ot(405,{method:t.formMethod})};let r=()=>({path:e,error:Ot(400,{type:"invalid-body"})}),s=(t.formMethod||"get").toUpperCase(),o=wm(e);if(t.body!==void 0){if(t.formEncType==="text/plain"){if(!Ze(s))return r();let u=typeof t.body=="string"?t.body:t.body instanceof FormData||t.body instanceof URLSearchParams?Array.from(t.body.entries()).reduce((f,[p,m])=>`${f}${p}=${m}
19
- `,""):String(t.body);return{path:e,submission:{formMethod:s,formAction:o,formEncType:t.formEncType,formData:void 0,json:void 0,text:u}}}else if(t.formEncType==="application/json"){if(!Ze(s))return r();try{let u=typeof t.body=="string"?JSON.parse(t.body):t.body;return{path:e,submission:{formMethod:s,formAction:o,formEncType:t.formEncType,formData:void 0,json:u,text:void 0}}}catch{return r()}}}ce(typeof FormData=="function","FormData is not available in this environment");let a,l;if(t.formData)a=dc(t.formData),l=t.formData;else if(t.body instanceof FormData)a=dc(t.body),l=t.body;else if(t.body instanceof URLSearchParams)a=t.body,l=zd(a);else if(t.body==null)a=new URLSearchParams,l=new FormData;else try{a=new URLSearchParams(t.body),l=zd(a)}catch{return r()}let c={formMethod:s,formAction:o,formEncType:t&&t.formEncType||"application/x-www-form-urlencoded",formData:l,json:void 0,text:void 0};if(Ze(c.formMethod))return{path:e,submission:c};let h=Vn(e);return n&&h.search&&uh(h.search)&&a.append("index",""),h.search=`?${a}`,{path:on(h),submission:c}}function Ld(n,e,t,r,i,s,o,a,l,c,h,u,f,p,m,b,y,v,w,C,j){let k=C?vt(C[1])?C[1].error:C[1].data:void 0,O=i.createURL(s.location),x=i.createURL(l),T;if(h&&s.errors){let B=Object.keys(s.errors)[0];T=o.findIndex(q=>q.route.id===B)}else if(C&&vt(C[1])){let B=C[0];T=o.findIndex(q=>q.route.id===B)-1}let A=C?C[1].statusCode:void 0,R=A&&A>=400,N={currentUrl:O,currentParams:s.matches[0]?.params||{},nextUrl:x,nextParams:o[0].params,...a,actionResult:k,actionStatus:A},L=$s(o),W=o.map((B,q)=>{let{route:de}=B,z=null;if(T!=null&&q>T?z=!1:de.lazy?z=!0:hh(de)?h?z=cc(de,s.loaderData,s.errors):j1(s.loaderData,s.matches[q],B)&&(z=!0):z=!1,z!==null)return hc(t,r,n,L,B,c,e,z);let J=!1;typeof j=="boolean"?J=j:R?J=!1:(u||O.pathname+O.search===x.pathname+x.search||O.search!==x.search||O1(s.matches[q],B))&&(J=!0);let ie={...N,defaultShouldRevalidate:J},le=ki(B,ie);return hc(t,r,n,L,B,c,e,le,ie,j)}),F=[];return m.forEach((B,q)=>{if(h||!o.some(ke=>ke.route.id===B.routeId)||p.has(q))return;let de=s.fetchers.get(q),z=de&&de.state!=="idle"&&de.data===void 0,J=jn(y,B.path,v);if(!J){if(w&&z)return;F.push({key:q,routeId:B.routeId,path:B.path,matches:null,match:null,request:null,controller:null});return}if(b.has(q))return;let ie=Vo(J,B.path),le=new AbortController,fe=br(i,B.path,le.signal),we=null;if(f.has(q))f.delete(q),we=Or(t,r,fe,J,ie,c,e);else if(z)u&&(we=Or(t,r,fe,J,ie,c,e));else{let ke;typeof j=="boolean"?ke=j:R?ke=!1:ke=u;let Ae={...N,defaultShouldRevalidate:ke};ki(ie,Ae)&&(we=Or(t,r,fe,J,ie,c,e,Ae))}we&&F.push({key:q,routeId:B.routeId,path:B.path,matches:we,match:ie,request:fe,controller:le})}),{dsMatches:W,revalidatingFetchers:F}}function hh(n){return n.loader!=null||n.middleware!=null&&n.middleware.length>0}function cc(n,e,t){if(n.lazy)return!0;if(!hh(n))return!1;let r=e!=null&&n.id in e,i=t!=null&&t[n.id]!==void 0;return!r&&i?!1:typeof n.loader=="function"&&n.loader.hydrate===!0?!0:!r&&!i}function j1(n,e,t){let r=!e||t.route.id!==e.route.id,i=!n.hasOwnProperty(t.route.id);return r||i}function O1(n,e){let t=n.route.path;return n.pathname!==e.pathname||t!=null&&t.endsWith("*")&&n.params["*"]!==e.params["*"]}function ki(n,e){if(n.route.shouldRevalidate){let t=n.route.shouldRevalidate(e);if(typeof t=="boolean")return t}return e.defaultShouldRevalidate}function Id(n,e,t,r,i,s){let o;if(n){let c=r[n];ce(c,`No route found to patch children into: routeId = ${n}`),c.children||(c.children=[]),o=c.children}else o=t;let a=[],l=[];if(e.forEach(c=>{let h=o.find(u=>gm(c,u));h?l.push({existingRoute:h,newRoute:c}):a.push(c)}),a.length>0){let c=Di(a,i,[n||"_","patch",String(o?.length||"0")],r);o.push(...c)}if(s&&l.length>0)for(let c=0;c<l.length;c++){let{existingRoute:h,newRoute:u}=l[c],f=h,[p]=Di([u],i,[],{},!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 gm(n,e){return"id"in n&&"id"in e&&n.id===e.id?!0:n.index===e.index&&n.path===e.path&&n.caseSensitive===e.caseSensitive?(!n.children||n.children.length===0)&&(!e.children||e.children.length===0)?!0:n.children.every((t,r)=>e.children?.some(i=>gm(t,i))):!1}var $d=new WeakMap,bm=({key:n,route:e,manifest:t,mapRouteProperties:r})=>{let i=t[e.id];if(ce(i,"No route found in manifest"),!i.lazy||typeof i.lazy!="object")return;let s=i.lazy[n];if(!s)return;let o=$d.get(i);o||(o={},$d.set(i,o));let a=o[n];if(a)return a;let l=(async()=>{let c=Hy(n),u=i[n]!==void 0&&n!=="hasErrorBoundary";if(c)Ee(!c,"Route property "+n+" is not a supported lazy route property. This property will be ignored."),o[n]=Promise.resolve();else if(u)Ee(!1,`Route "${i.id}" has a static property "${n}" defined. The lazy property will be ignored.`);else{let f=await s();f!=null&&(Object.assign(i,{[n]:f}),Object.assign(i,r(i)))}typeof i.lazy=="object"&&(i.lazy[n]=void 0,Object.values(i.lazy).every(f=>f===void 0)&&(i.lazy=void 0))})();return o[n]=l,l},Bd=new WeakMap;function P1(n,e,t,r,i){let s=t[n.id];if(ce(s,"No route found in manifest"),!n.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof n.lazy=="function"){let h=Bd.get(s);if(h)return{lazyRoutePromise:h,lazyHandlerPromise:h};let u=(async()=>{ce(typeof n.lazy=="function","No lazy route function found");let f=await n.lazy(),p={};for(let m in f){let b=f[m];if(b===void 0)continue;let y=Uy(m),w=s[m]!==void 0&&m!=="hasErrorBoundary";y?Ee(!y,"Route property "+m+" is not a supported property to be returned from a lazy route function. This property will be ignored."):w?Ee(!w,`Route "${s.id}" has a static property "${m}" defined but its lazy function is also returning a value for this property. The lazy route property "${m}" will be ignored.`):p[m]=b}Object.assign(s,p),Object.assign(s,{...r(s),lazy:void 0})})();return Bd.set(s,u),u.catch(()=>{}),{lazyRoutePromise:u,lazyHandlerPromise:u}}let o=Object.keys(n.lazy),a=[],l;for(let h of o){if(i&&i.includes(h))continue;let u=bm({key:h,route:n,manifest:t,mapRouteProperties:r});u&&(a.push(u),h===e&&(l=u))}let c=a.length>0?Promise.all(a).then(()=>{}):void 0;return c?.catch(()=>{}),l?.catch(()=>{}),{lazyRoutePromise:c,lazyHandlerPromise:l}}async function Fd(n){let e=n.matches.filter(i=>i.shouldLoad),t={};return(await Promise.all(e.map(i=>i.resolve()))).forEach((i,s)=>{t[e[s].route.id]=i}),t}async function N1(n){return n.matches.some(e=>e.route.middleware)?ym(n,()=>Fd(n)):Fd(n)}function ym(n,e){return A1(n,e,r=>{if(_1(r))throw r;return r},B1,t);function t(r,i,s){if(s)return Promise.resolve(Object.assign(s.value,{[i]:{type:"error",result:r}}));{let{matches:o}=n,a=Math.min(Math.max(o.findIndex(c=>c.route.id===i),0),Math.max(o.findIndex(c=>c.shouldCallHandler()),0)),l=On(o,o[a].route.id).route.id;return Promise.resolve({[l]:{type:"error",result:r}})}}}async function A1(n,e,t,r,i){let{matches:s,request:o,params:a,context:l,unstable_pattern:c}=n,h=s.flatMap(f=>f.route.middleware?f.route.middleware.map(p=>[f.route.id,p]):[]);return await xm({request:o,params:a,context:l,unstable_pattern:c},h,e,t,r,i)}async function xm(n,e,t,r,i,s,o=0){let{request:a}=n;if(a.signal.aborted)throw a.signal.reason??new Error(`Request aborted: ${a.method} ${a.url}`);let l=e[o];if(!l)return await t();let[c,h]=l,u,f=async()=>{if(u)throw new Error("You may only call `next()` once per middleware");try{return u={value:await xm(n,e,t,r,i,s,o+1)},u.value}catch(p){return u={value:await s(p,c,u)},u.value}};try{let p=await h(n,f),m=p!=null?r(p):void 0;return i(m)?m:u?m??u.value:(u={value:await f()},u.value)}catch(p){return await s(p,c,u)}}function vm(n,e,t,r,i){let s=bm({key:"middleware",route:r.route,manifest:e,mapRouteProperties:n}),o=P1(r.route,Ze(t.method)?"action":"loader",e,n,i);return{middleware:s,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function hc(n,e,t,r,i,s,o,a,l=null,c){let h=!1,u=vm(n,e,t,i,s);return{...i,_lazyPromises:u,shouldLoad:a,shouldRevalidateArgs:l,shouldCallHandler(f){return h=!0,l?typeof c=="boolean"?ki(i,{...l,defaultShouldRevalidate:c}):typeof f=="boolean"?ki(i,{...l,defaultShouldRevalidate:f}):ki(i,l):a},resolve(f){let{lazy:p,loader:m,middleware:b}=i.route,y=h||a||f&&!Ze(t.method)&&(p||m),v=b&&b.length>0&&!m&&!p;return y&&(Ze(t.method)||!v)?T1({request:t,unstable_pattern:r,match:i,lazyHandlerPromise:u?.handler,lazyRoutePromise:u?.route,handlerOverride:f,scopedContext:o}):Promise.resolve({type:"data",result:void 0})}}}function Or(n,e,t,r,i,s,o,a=null){return r.map(l=>l.route.id!==i.route.id?{...l,shouldLoad:!1,shouldRevalidateArgs:a,shouldCallHandler:()=>!1,_lazyPromises:vm(n,e,t,l,s),resolve:()=>Promise.resolve({type:"data",result:void 0})}:hc(n,e,t,$s(r),l,s,o,!0,a))}async function M1(n,e,t,r,i,s){t.some(c=>c._lazyPromises?.middleware)&&await Promise.all(t.map(c=>c._lazyPromises?.middleware));let o={request:e,unstable_pattern:$s(t),params:t[0].params,context:i,matches:t},l=await n({...o,fetcherKey:r,runClientMiddleware:c=>{let h=o;return ym(h,()=>c({...h,fetcherKey:r,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(t.flatMap(c=>[c._lazyPromises?.handler,c._lazyPromises?.route]))}catch{}return l}async function T1({request:n,unstable_pattern:e,match:t,lazyHandlerPromise:r,lazyRoutePromise:i,handlerOverride:s,scopedContext:o}){let a,l,c=Ze(n.method),h=c?"action":"loader",u=f=>{let p,m=new Promise((v,w)=>p=w);l=()=>p(),n.signal.addEventListener("abort",l);let b=v=>typeof f!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${h}" [routeId: ${t.route.id}]`)):f({request:n,unstable_pattern:e,params:t.params,context:o},...v!==void 0?[v]:[]),y=(async()=>{try{return{type:"data",result:await(s?s(w=>b(w)):b())}}catch(v){return{type:"error",result:v}}})();return Promise.race([y,m])};try{let f=c?t.route.action:t.route.loader;if(r||i)if(f){let p,[m]=await Promise.all([u(f).catch(b=>{p=b}),r,i]);if(p!==void 0)throw p;a=m}else{await r;let p=c?t.route.action:t.route.loader;if(p)[a]=await Promise.all([u(p),i]);else if(h==="action"){let m=new URL(n.url),b=m.pathname+m.search;throw Ot(405,{method:n.method,pathname:b,routeId:t.route.id})}else return{type:"data",result:void 0}}else if(f)a=await u(f);else{let p=new URL(n.url),m=p.pathname+p.search;throw Ot(404,{pathname:m})}}catch(f){return{type:"error",result:f}}finally{l&&n.signal.removeEventListener("abort",l)}return a}async function D1(n){let e=n.headers.get("Content-Type");return e&&/\bapplication\/json\b/.test(e)?n.body==null?null:n.json():n.text()}async function E1(n){let{result:e,type:t}=n;if(dh(e)){let r;try{r=await D1(e)}catch(i){return{type:"error",error:i}}return t==="error"?{type:"error",error:new Is(e.status,e.statusText,r),statusCode:e.status,headers:e.headers}:{type:"data",data:r,statusCode:e.status,headers:e.headers}}return t==="error"?Ud(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:$1(e),statusCode:Ei(e)?e.status:void 0,headers:e.init?.headers?new Headers(e.init.headers):void 0}:{type:"error",error:e,statusCode:Ei(e)?e.status:void 0}:Ud(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 R1(n,e,t,r,i){let s=n.headers.get("Location");if(ce(s,"Redirects returned/thrown from loaders/actions must have a Location header"),!Na(s)){let o=r.slice(0,r.findIndex(a=>a.route.id===t)+1);s=lc(new URL(e.url),o,i,s),n.headers.set("Location",s)}return n}function Vd(n,e,t){if(Na(n)){let r=n,i=r.startsWith("//")?new URL(e.protocol+r):new URL(r),s=Et(i.pathname,t)!=null;if(i.origin===e.origin&&s)return i.pathname+i.search+i.hash}return n}function br(n,e,t,r){let i=n.createURL(wm(e)).toString(),s={signal:t};if(r&&Ze(r.formMethod)){let{formMethod:o,formEncType:a}=r;s.method=o.toUpperCase(),a==="application/json"?(s.headers=new Headers({"Content-Type":a}),s.body=JSON.stringify(r.json)):a==="text/plain"?s.body=r.text:a==="application/x-www-form-urlencoded"&&r.formData?s.body=dc(r.formData):s.body=r.formData}return new Request(i,s)}function dc(n){let e=new URLSearchParams;for(let[t,r]of n.entries())e.append(t,typeof r=="string"?r:r.name);return e}function zd(n){let e=new FormData;for(let[t,r]of n.entries())e.append(t,r);return e}function L1(n,e,t,r=!1,i=!1){let s={},o=null,a,l=!1,c={},h=t&&vt(t[1])?t[1].error:void 0;return n.forEach(u=>{if(!(u.route.id in e))return;let f=u.route.id,p=e[f];if(ce(!er(p),"Cannot handle redirect results in processLoaderData"),vt(p)){let m=p.error;if(h!==void 0&&(m=h,h=void 0),o=o||{},i)o[f]=m;else{let b=On(n,f);o[b.route.id]==null&&(o[b.route.id]=m)}r||(s[f]=mm),l||(l=!0,a=Ei(p.error)?p.error.status:500),p.headers&&(c[f]=p.headers)}else s[f]=p.data,p.statusCode&&p.statusCode!==200&&!l&&(a=p.statusCode),p.headers&&(c[f]=p.headers)}),h!==void 0&&t&&(o={[t[0]]:h},t[2]&&(s[t[2]]=void 0)),{loaderData:s,errors:o,statusCode:a||200,loaderHeaders:c}}function _d(n,e,t,r,i,s){let{loaderData:o,errors:a}=L1(e,t,r);return i.filter(l=>!l.matches||l.matches.some(c=>c.shouldLoad)).forEach(l=>{let{key:c,match:h,controller:u}=l;if(u&&u.signal.aborted)return;let f=s[c];if(ce(f,"Did not find corresponding fetcher result"),vt(f)){let p=On(n.matches,h?.route.id);a&&a[p.route.id]||(a={...a,[p.route.id]:f.error}),n.fetchers.delete(c)}else if(er(f))ce(!1,"Unhandled fetcher revalidation redirect");else{let p=pn(f.data);n.fetchers.set(c,p)}}),{loaderData:o,errors:a}}function Hd(n,e,t,r){let i=Object.entries(e).filter(([,s])=>s!==mm).reduce((s,[o,a])=>(s[o]=a,s),{});for(let s of t){let o=s.route.id;if(!e.hasOwnProperty(o)&&n.hasOwnProperty(o)&&s.route.loader&&(i[o]=n[o]),r&&r.hasOwnProperty(o))break}return i}function Wd(n){return n?vt(n[1])?{actionData:{}}:{actionData:{[n[0]]:n[1].data}}:{}}function On(n,e){return(e?n.slice(0,n.findIndex(r=>r.route.id===e)+1):[...n]).reverse().find(r=>r.route.hasErrorBoundary===!0)||n[0]}function oo(n){let e=n.length===1?n[0]:n.find(t=>t.index||!t.path||t.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:e}],route:e}}function Ot(n,{pathname:e,routeId:t,method:r,type:i,message:s}={}){let o="Unknown Server Error",a="Unknown @remix-run/router error";return n===400?(o="Bad Request",r&&e&&t?a=`You made a ${r} request to "${e}" but did not provide a \`loader\` for route "${t}", so there is no way to handle the request.`:i==="invalid-body"&&(a="Unable to encode submission body")):n===403?(o="Forbidden",a=`Route "${t}" does not match URL "${e}"`):n===404?(o="Not Found",a=`No route matches URL "${e}"`):n===405&&(o="Method Not Allowed",r&&e&&t?a=`You made a ${r.toUpperCase()} request to "${e}" but did not provide an \`action\` for route "${t}", so there is no way to handle the request.`:r&&(a=`Invalid request method "${r.toUpperCase()}"`)),new Is(n||500,o,new Error(a),!0)}function ao(n){let e=Object.entries(n);for(let t=e.length-1;t>=0;t--){let[r,i]=e[t];if(er(i))return{key:r,result:i}}}function wm(n){let e=typeof n=="string"?Vn(n):n;return on({...e,hash:""})}function I1(n,e){return n.pathname!==e.pathname||n.search!==e.search?!1:n.hash===""?e.hash!=="":n.hash===e.hash?!0:e.hash!==""}function $1(n){return new Is(n.init?.status??500,n.init?.statusText??"Internal Server Error",n.data)}function B1(n){return n!=null&&typeof n=="object"&&Object.entries(n).every(([e,t])=>typeof e=="string"&&F1(t))}function F1(n){return n!=null&&typeof n=="object"&&"type"in n&&"result"in n&&(n.type==="data"||n.type==="error")}function V1(n){return dh(n.result)&&fm.has(n.result.status)}function vt(n){return n.type==="error"}function er(n){return(n&&n.type)==="redirect"}function Ud(n){return typeof n=="object"&&n!=null&&"type"in n&&"data"in n&&"init"in n&&n.type==="DataWithResponseInit"}function dh(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.headers=="object"&&typeof n.body<"u"}function z1(n){return fm.has(n)}function _1(n){return dh(n)&&z1(n.status)&&n.headers.has("Location")}function H1(n){return x1.has(n.toUpperCase())}function Ze(n){return b1.has(n.toUpperCase())}function uh(n){return new URLSearchParams(n).getAll("index").some(e=>e==="")}function Vo(n,e){let t=typeof e=="string"?Vn(e).search:e.search;if(n[n.length-1].route.index&&uh(t||""))return n[n.length-1];let r=lm(n);return r[r.length-1]}function Kd(n){let{formMethod:e,formAction:t,formEncType:r,text:i,formData:s,json:o}=n;if(!(!e||!t||!r)){if(i!=null)return{formMethod:e,formAction:t,formEncType:r,formData:void 0,json:void 0,text:i};if(s!=null)return{formMethod:e,formAction:t,formEncType:r,formData:s,json:void 0,text:void 0};if(o!==void 0)return{formMethod:e,formAction:t,formEncType:r,formData:void 0,json:o,text:void 0}}}function nl(n,e){return e?{state:"loading",location:n,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}:{state:"loading",location:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function W1(n,e){return{state:"submitting",location:n,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}}function oi(n,e){return n?{state:"loading",formMethod:n.formMethod,formAction:n.formAction,formEncType:n.formEncType,formData:n.formData,json:n.json,text:n.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 U1(n,e){return{state:"submitting",formMethod:n.formMethod,formAction:n.formAction,formEncType:n.formEncType,formData:n.formData,json:n.json,text:n.text,data:e?e.data:void 0}}function pn(n){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:n}}function K1(n,e){try{let t=n.sessionStorage.getItem(pm);if(t){let r=JSON.parse(t);for(let[i,s]of Object.entries(r||{}))s&&Array.isArray(s)&&e.set(i,new Set(s||[]))}}catch{}}function G1(n,e){if(e.size>0){let t={};for(let[r,i]of e)t[r]=[...i];try{n.sessionStorage.setItem(pm,JSON.stringify(t))}catch(r){Ee(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function Gd(){let n,e,t=new Promise((r,i)=>{n=async s=>{r(s);try{await t}catch{}},e=async s=>{i(s);try{await t}catch{}}});return{promise:t,resolve:n,reject:e}}var hr=g.createContext(null);hr.displayName="DataRouter";var Bs=g.createContext(null);Bs.displayName="DataRouterState";var km=g.createContext(!1);function q1(){return g.useContext(km)}var fh=g.createContext({isTransitioning:!1});fh.displayName="ViewTransition";var Sm=g.createContext(new Map);Sm.displayName="Fetchers";var J1=g.createContext(null);J1.displayName="Await";var kt=g.createContext(null);kt.displayName="Navigation";var Ta=g.createContext(null);Ta.displayName="Location";var Lt=g.createContext({outlet:null,matches:[],isDataRoute:!1});Lt.displayName="Route";var ph=g.createContext(null);ph.displayName="RouteError";var Cm="REACT_ROUTER_ERROR",Y1="REDIRECT",Q1="ROUTE_ERROR_RESPONSE";function X1(n){if(n.startsWith(`${Cm}:${Y1}:{`))try{let e=JSON.parse(n.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 Z1(n){if(n.startsWith(`${Cm}:${Q1}:{`))try{let e=JSON.parse(n.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new Is(e.status,e.statusText,e.data)}catch{}}function ex(n,{relative:e}={}){ce(Wr(),"useHref() may be used only in the context of a <Router> component.");let{basename:t,navigator:r}=g.useContext(kt),{hash:i,pathname:s,search:o}=Fs(n,{relative:e}),a=s;return t!=="/"&&(a=s==="/"?t:rn([t,s])),r.createHref({pathname:a,search:o,hash:i})}function Wr(){return g.useContext(Ta)!=null}function _t(){return ce(Wr(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(Ta).location}var jm="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Om(n){g.useContext(kt).static||g.useLayoutEffect(n)}function an(){let{isDataRoute:n}=g.useContext(Lt);return n?mx():tx()}function tx(){ce(Wr(),"useNavigate() may be used only in the context of a <Router> component.");let n=g.useContext(hr),{basename:e,navigator:t}=g.useContext(kt),{matches:r}=g.useContext(Lt),{pathname:i}=_t(),s=JSON.stringify(Aa(r)),o=g.useRef(!1);return Om(()=>{o.current=!0}),g.useCallback((l,c={})=>{if(Ee(o.current,jm),!o.current)return;if(typeof l=="number"){t.go(l);return}let h=Ma(l,JSON.parse(s),i,c.relative==="path");n==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:rn([e,h.pathname])),(c.replace?t.replace:t.push)(h,c.state,c)},[e,t,s,i,n])}var Pm=g.createContext(null);function nx(){return g.useContext(Pm)}function rx(n){let e=g.useContext(Lt).outlet;return g.useMemo(()=>e&&g.createElement(Pm.Provider,{value:n},e),[e,n])}function Nm(){let{matches:n}=g.useContext(Lt),e=n[n.length-1];return e?e.params:{}}function Fs(n,{relative:e}={}){let{matches:t}=g.useContext(Lt),{pathname:r}=_t(),i=JSON.stringify(Aa(t));return g.useMemo(()=>Ma(n,JSON.parse(i),r,e==="path"),[n,i,r,e])}function ix(n,e,t,r,i){ce(Wr(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=g.useContext(kt),{matches:o}=g.useContext(Lt),a=o[o.length-1],l=a?a.params:{},c=a?a.pathname:"/",h=a?a.pathnameBase:"/",u=a&&a.route;{let w=u&&u.path||"";Mm(c,!u||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (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.
18
+ */var sm=n=>{throw TypeError(n)},Bx=(n,e,t)=>e.has(n)||sm("Cannot "+t),Za=(n,e,t)=>(Bx(n,e,"read from private field"),t?t.call(n):e.get(n)),Fx=(n,e,t)=>e.has(n)?sm("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Pd="popstate";function Vx(n={}){function e(r,i){let{pathname:s,search:o,hash:a}=r.location;return Di("",{pathname:s,search:o,hash:a},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function t(r,i){return typeof i=="string"?i:on(i)}return _x(e,t,null,n)}function he(n,e){if(n===!1||n===null||typeof n>"u")throw new Error(e)}function Ee(n,e){if(!n){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function zx(){return Math.random().toString(36).substring(2,10)}function Nd(n,e){return{usr:n.state,key:n.key,idx:e}}function Di(n,e,t=null,r){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof e=="string"?Vn(e):e,state:t,key:e&&e.key||r||zx()}}function on({pathname:n="/",search:e="",hash:t=""}){return e&&e!=="?"&&(n+=e.charAt(0)==="?"?e:"?"+e),t&&t!=="#"&&(n+=t.charAt(0)==="#"?t:"#"+t),n}function Vn(n){let e={};if(n){let t=n.indexOf("#");t>=0&&(e.hash=n.substring(t),n=n.substring(0,t));let r=n.indexOf("?");r>=0&&(e.search=n.substring(r),n=n.substring(0,r)),n&&(e.pathname=n)}return e}function _x(n,e,t,r={}){let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,a="POP",l=null,c=d();c==null&&(c=0,o.replaceState({...o.state,idx:c},""));function d(){return(o.state||{idx:null}).idx}function u(){a="POP";let x=d(),w=x==null?null:x-c;c=x,l&&l({action:a,location:b.location,delta:w})}function f(x,w){a="PUSH";let v=Di(b.location,x,w);c=d()+1;let S=Nd(v,c),j=b.createHref(v);try{o.pushState(S,"",j)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;i.location.assign(j)}s&&l&&l({action:a,location:b.location,delta:1})}function p(x,w){a="REPLACE";let v=Di(b.location,x,w);c=d();let S=Nd(v,c),j=b.createHref(v);o.replaceState(S,"",j),s&&l&&l({action:a,location:b.location,delta:0})}function m(x){return om(x)}let b={get action(){return a},get location(){return n(i,o)},listen(x){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(Pd,u),l=x,()=>{i.removeEventListener(Pd,u),l=null}},createHref(x){return e(i,x)},createURL:m,encodeLocation(x){let w=m(x);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:f,replace:p,go(x){return o.go(x)}};return b}function om(n,e=!1){let t="http://localhost";typeof window<"u"&&(t=window.location.origin!=="null"?window.location.origin:window.location.href),he(t,"No window.location.(origin|href) available to create URL");let r=typeof n=="string"?n:on(n);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=t+r),new URL(r,t)}var gi,Ad=class{constructor(n){if(Fx(this,gi,new Map),n)for(let[e,t]of n)this.set(e,t)}get(n){if(Za(this,gi).has(n))return Za(this,gi).get(n);if(n.defaultValue!==void 0)return n.defaultValue;throw new Error("No value found for context")}set(n,e){Za(this,gi).set(n,e)}};gi=new WeakMap;var Hx=new Set(["lazy","caseSensitive","path","id","index","children"]);function Wx(n){return Hx.has(n)}var Ux=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function Kx(n){return Ux.has(n)}function Gx(n){return n.index===!0}function Ti(n,e,t=[],r={},i=!1){return n.map((s,o)=>{let a=[...t,String(o)],l=typeof s.id=="string"?s.id:a.join("-");if(he(s.index!==!0||!s.children,"Cannot specify children on an index route"),he(i||!r[l],`Found a route id collision on id "${l}". Route id's must be globally unique within Data Router usages`),Gx(s)){let c={...s,id:l};return r[l]=Md(c,e(c)),c}else{let c={...s,id:l,children:void 0};return r[l]=Md(c,e(c)),s.children&&(c.children=Ti(s.children,e,a,r,i)),c}})}function Md(n,e){return Object.assign(n,{...e,...typeof e.lazy=="object"&&e.lazy!=null?{lazy:{...n.lazy,...e.lazy}}:{}})}function jn(n,e,t="/"){return bi(n,e,t,!1)}function bi(n,e,t,r){let i=typeof e=="string"?Vn(e):e,s=Rt(i.pathname||"/",t);if(s==null)return null;let o=am(n);Jx(o);let a=null;for(let l=0;a==null&&l<o.length;++l){let c=oy(s);a=iy(o[l],c,r)}return a}function qx(n,e){let{route:t,pathname:r,params:i}=n;return{id:t.id,pathname:r,params:i,data:e[t.id],loaderData:e[t.id],handle:t.handle}}function am(n,e=[],t=[],r="",i=!1){let s=(o,a,l=i,c)=>{let d={relativePath:c===void 0?o.path||"":c,caseSensitive:o.caseSensitive===!0,childrenIndex:a,route:o};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(r)&&l)return;he(d.relativePath.startsWith(r),`Absolute route path "${d.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(r.length)}let u=rn([r,d.relativePath]),f=t.concat(d);o.children&&o.children.length>0&&(he(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),am(o.children,e,f,u,l)),!(o.path==null&&!o.index)&&e.push({path:u,score:ny(u,o.index),routesMeta:f})};return n.forEach((o,a)=>{if(o.path===""||!o.path?.includes("?"))s(o,a);else for(let l of lm(o.path))s(o,a,!0,l)}),e}function lm(n){let e=n.split("/");if(e.length===0)return[];let[t,...r]=e,i=t.endsWith("?"),s=t.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=lm(r.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&a.push(...o),a.map(l=>n.startsWith("/")&&l===""?"/":l)}function Jx(n){n.sort((e,t)=>e.score!==t.score?t.score-e.score:ry(e.routesMeta.map(r=>r.childrenIndex),t.routesMeta.map(r=>r.childrenIndex)))}var Yx=/^:[\w-]+$/,Qx=3,Xx=2,Zx=1,ey=10,ty=-2,Dd=n=>n==="*";function ny(n,e){let t=n.split("/"),r=t.length;return t.some(Dd)&&(r+=ty),e&&(r+=Xx),t.filter(i=>!Dd(i)).reduce((i,s)=>i+(Yx.test(s)?Qx:s===""?Zx:ey),r)}function ry(n,e){return n.length===e.length&&n.slice(0,-1).every((r,i)=>r===e[i])?n[n.length-1]-e[e.length-1]:0}function iy(n,e,t=!1){let{routesMeta:r}=n,i={},s="/",o=[];for(let a=0;a<r.length;++a){let l=r[a],c=a===r.length-1,d=s==="/"?e:e.slice(s.length)||"/",u=Zo({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},d),f=l.route;if(!u&&c&&t&&!r[r.length-1].route.index&&(u=Zo({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},d)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:rn([s,u.pathname]),pathnameBase:cy(rn([s,u.pathnameBase])),route:f}),u.pathnameBase!=="/"&&(s=rn([s,u.pathnameBase]))}return o}function Zo(n,e){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[t,r]=sy(n.path,n.caseSensitive,n.end),i=e.match(t);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),a=i.slice(1);return{params:r.reduce((c,{paramName:d,isOptional:u},f)=>{if(d==="*"){let m=a[f]||"";o=s.slice(0,s.length-m.length).replace(/(.)\/+$/,"$1")}const p=a[f];return u&&!p?c[d]=void 0:c[d]=(p||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:n}}function sy(n,e=!1,t=!0){Ee(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let r=[],i="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(r.push({paramName:"*"}),i+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):t?i+="\\/*$":n!==""&&n!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function oy(n){try{return n.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Ee(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),n}}function Rt(n,e){if(e==="/")return n;if(!n.toLowerCase().startsWith(e.toLowerCase()))return null;let t=e.endsWith("/")?e.length-1:e.length,r=n.charAt(t);return r&&r!=="/"?null:n.slice(t)||"/"}function ay({basename:n,pathname:e}){return e==="/"?n:rn([n,e])}var cm=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Na=n=>cm.test(n);function ly(n,e="/"){let{pathname:t,search:r="",hash:i=""}=typeof n=="string"?Vn(n):n,s;if(t)if(Na(t))s=t;else{if(t.includes("//")){let o=t;t=t.replace(/\/\/+/g,"/"),Ee(!1,`Pathnames cannot have embedded double slashes - normalizing ${o} -> ${t}`)}t.startsWith("/")?s=Td(t.substring(1),"/"):s=Td(t,e)}else s=e;return{pathname:s,search:hy(r),hash:dy(i)}}function Td(n,e){let t=e.replace(/\/+$/,"").split("/");return n.split("/").forEach(i=>{i===".."?t.length>1&&t.pop():i!=="."&&t.push(i)}),t.length>1?t.join("/"):"/"}function el(n,e,t,r){return`Cannot include a '${n}' character in a manually specified \`to.${e}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${t}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function hm(n){return n.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Aa(n){let e=hm(n);return e.map((t,r)=>r===e.length-1?t.pathname:t.pathnameBase)}function Ma(n,e,t,r=!1){let i;typeof n=="string"?i=Vn(n):(i={...n},he(!i.pathname||!i.pathname.includes("?"),el("?","pathname","search",i)),he(!i.pathname||!i.pathname.includes("#"),el("#","pathname","hash",i)),he(!i.search||!i.search.includes("#"),el("#","search","hash",i)));let s=n===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=t;else{let u=e.length-1;if(!r&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),u-=1;i.pathname=f.join("/")}a=u>=0?e[u]:"/"}let l=ly(i,a),c=o&&o!=="/"&&o.endsWith("/"),d=(s||o===".")&&t.endsWith("/");return!l.pathname.endsWith("/")&&(c||d)&&(l.pathname+="/"),l}var rn=n=>n.join("/").replace(/\/\/+/g,"/"),cy=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),hy=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,dy=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,Is=class{constructor(n,e,t,r=!1){this.status=n,this.statusText=e||"",this.internal=r,t instanceof Error?(this.data=t.toString(),this.error=t):this.data=t}};function Ei(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function $s(n){return n.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var dm=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function um(n,e){let t=n;if(typeof t!="string"||!cm.test(t))return{absoluteURL:void 0,isExternal:!1,to:t};let r=t,i=!1;if(dm)try{let s=new URL(window.location.href),o=t.startsWith("//")?new URL(s.protocol+t):new URL(t),a=Rt(o.pathname,e);o.origin===s.origin&&a!=null?t=a+o.search+o.hash:i=!0}catch{Ee(!1,`<Link to="${t}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:t}}var An=Symbol("Uninstrumented");function uy(n,e){let t={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};n.forEach(i=>i({id:e.id,index:e.index,path:e.path,instrument(s){let o=Object.keys(t);for(let a of o)s[a]&&t[a].push(s[a])}}));let r={};if(typeof e.lazy=="function"&&t.lazy.length>0){let i=vr(t.lazy,e.lazy,()=>{});i&&(r.lazy=i)}if(typeof e.lazy=="object"){let i=e.lazy;["middleware","loader","action"].forEach(s=>{let o=i[s],a=t[`lazy.${s}`];if(typeof o=="function"&&a.length>0){let l=vr(a,o,()=>{});l&&(r.lazy=Object.assign(r.lazy||{},{[s]:l}))}})}return["loader","action"].forEach(i=>{let s=e[i];if(typeof s=="function"&&t[i].length>0){let o=s[An]??s,a=vr(t[i],o,(...l)=>Ed(l[0]));a&&(a[An]=o,r[i]=a)}}),e.middleware&&e.middleware.length>0&&t.middleware.length>0&&(r.middleware=e.middleware.map(i=>{let s=i[An]??i,o=vr(t.middleware,s,(...a)=>Ed(a[0]));return o?(o[An]=s,o):i})),r}function fy(n,e){let t={navigate:[],fetch:[]};if(e.forEach(r=>r({instrument(i){let s=Object.keys(i);for(let o of s)i[o]&&t[o].push(i[o])}})),t.navigate.length>0){let r=n.navigate[An]??n.navigate,i=vr(t.navigate,r,(...s)=>{let[o,a]=s;return{to:typeof o=="number"||typeof o=="string"?o:o?on(o):".",...Rd(n,a??{})}});i&&(i[An]=r,n.navigate=i)}if(t.fetch.length>0){let r=n.fetch[An]??n.fetch,i=vr(t.fetch,r,(...s)=>{let[o,,a,l]=s;return{href:a??".",fetcherKey:o,...Rd(n,l??{})}});i&&(i[An]=r,n.fetch=i)}return n}function vr(n,e,t){return n.length===0?null:async(...r)=>{let i=await fm(n,t(...r),()=>e(...r),n.length-1);if(i.type==="error")throw i.value;return i.value}}async function fm(n,e,t,r){let i=n[r],s;if(i){let o,a=async()=>(o?console.error("You cannot call instrumented handlers more than once"):o=fm(n,e,t,r-1),s=await o,he(s,"Expected a result"),s.type==="error"&&s.value instanceof Error?{status:"error",error:s.value}:{status:"success",error:void 0});try{await i(a,e)}catch(l){console.error("An instrumentation function threw an error:",l)}o||await a(),await o}else try{s={type:"success",value:await t()}}catch(o){s={type:"error",value:o}}return s||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function Ed(n){let{request:e,context:t,params:r,unstable_pattern:i}=n;return{request:py(e),params:{...r},unstable_pattern:i,context:my(t)}}function Rd(n,e){return{currentUrl:on(n.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 py(n){return{method:n.method,url:n.url,headers:{get:(...e)=>n.headers.get(...e)}}}function my(n){if(by(n)){let e={...n};return Object.freeze(e),e}else return{get:e=>n.get(e)}}var gy=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function by(n){if(n===null||typeof n!="object")return!1;const e=Object.getPrototypeOf(n);return e===Object.prototype||e===null||Object.getOwnPropertyNames(e).sort().join("\0")===gy}var pm=["POST","PUT","PATCH","DELETE"],xy=new Set(pm),yy=["GET",...pm],vy=new Set(yy),mm=new Set([301,302,303,307,308]),wy=new Set([307,308]),tl={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ky={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},si={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Sy=n=>({hasErrorBoundary:!!n.hasErrorBoundary}),gm="remix-router-transitions",bm=Symbol("ResetLoaderData");function Cy(n){const e=n.window?n.window:typeof window<"u"?window:void 0,t=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u";he(n.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=n.hydrationRouteProperties||[],i=n.mapRouteProperties||Sy,s=i;if(n.unstable_instrumentations){let C=n.unstable_instrumentations;s=P=>({...i(P),...uy(C.map(M=>M.route).filter(Boolean),P)})}let o={},a=Ti(n.routes,s,void 0,o),l,c=n.basename||"/";c.startsWith("/")||(c=`/${c}`);let d=n.dataStrategy||Ay,u={...n.future},f=null,p=new Set,m=null,b=null,x=null,w=n.hydrationData!=null,v=jn(a,n.history.location,c),S=!1,j=null,k;if(v==null&&!n.patchRoutesOnNavigation){let C=Pt(404,{pathname:n.history.location.pathname}),{matches:P,route:M}=oo(a);k=!0,v=P,j={[M.id]:C}}else if(v&&!n.hydrationData&&to(v,a,n.history.location.pathname).active&&(v=null),v)if(v.some(C=>C.route.lazy))k=!1;else if(!v.some(C=>hh(C.route)))k=!0;else{let C=n.hydrationData?n.hydrationData.loaderData:null,P=n.hydrationData?n.hydrationData.errors:null;if(P){let M=v.findIndex($=>P[$.route.id]!==void 0);k=v.slice(0,M+1).every($=>!cc($.route,C,P))}else k=v.every(M=>!cc(M.route,C,P))}else{k=!1,v=[];let C=to(null,a,n.history.location.pathname);C.active&&C.matches&&(S=!0,v=C.matches)}let O,y={historyAction:n.history.action,location:n.history.location,matches:v,initialized:k,navigation:tl,restoreScrollPosition:n.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:n.hydrationData&&n.hydrationData.loaderData||{},actionData:n.hydrationData&&n.hydrationData.actionData||null,errors:n.hydrationData&&n.hydrationData.errors||j,fetchers:new Map,blockers:new Map},D="POP",A=null,R=!1,N,L=!1,W=new Map,F=null,B=!1,q=!1,de=new Set,z=new Map,J=0,ie=-1,le=new Map,fe=new Set,we=new Map,ke=new Map,Ae=new Set,Qe=new Map,mt,Y=null;function Me(){if(f=n.history.listen(({action:C,location:P,delta:M})=>{if(mt){mt(),mt=void 0;return}Ee(Qe.size===0||M!=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 $=vd({currentLocation:y.location,nextLocation:P,historyAction:C});if($&&M!=null){let V=new Promise(Z=>{mt=Z});n.history.go(M*-1),eo($,{state:"blocked",location:P,proceed(){eo($,{state:"proceeding",proceed:void 0,reset:void 0,location:P}),V.then(()=>n.history.go(M))},reset(){let Z=new Map(y.blockers);Z.set($,si),ve({blockers:Z})}}),A?.resolve(),A=null;return}return oe(C,P)}),t){Gy(e,W);let C=()=>qy(e,W);e.addEventListener("pagehide",C),F=()=>e.removeEventListener("pagehide",C)}return y.initialized||oe("POP",y.location,{initialHydration:!0}),O}function Se(){f&&f(),F&&F(),p.clear(),N&&N.abort(),y.fetchers.forEach((C,P)=>Ya(P)),y.blockers.forEach((C,P)=>yd(P))}function Ie(C){return p.add(C),()=>p.delete(C)}function ve(C,P={}){C.matches&&(C.matches=C.matches.map(V=>{let Z=o[V.route.id],Q=V.route;return Q.element!==Z.element||Q.errorElement!==Z.errorElement||Q.hydrateFallbackElement!==Z.hydrateFallbackElement?{...V,route:Z}:V})),y={...y,...C};let M=[],$=[];y.fetchers.forEach((V,Z)=>{V.state==="idle"&&(Ae.has(Z)?M.push(Z):$.push(Z))}),Ae.forEach(V=>{!y.fetchers.has(V)&&!z.has(V)&&M.push(V)}),[...p].forEach(V=>V(y,{deletedFetchers:M,newErrors:C.errors??null,viewTransitionOpts:P.viewTransitionOpts,flushSync:P.flushSync===!0})),M.forEach(V=>Ya(V)),$.forEach(V=>y.fetchers.delete(V))}function gt(C,P,{flushSync:M}={}){let $=y.actionData!=null&&y.navigation.formMethod!=null&&Ze(y.navigation.formMethod)&&y.navigation.state==="loading"&&C.state?._isRedirect!==!0,V;P.actionData?Object.keys(P.actionData).length>0?V=P.actionData:V=null:$?V=y.actionData:V=null;let Z=P.loaderData?Wd(y.loaderData,P.loaderData,P.matches||[],P.errors):y.loaderData,Q=y.blockers;Q.size>0&&(Q=new Map(Q),Q.forEach((se,te)=>Q.set(te,si)));let X=B?!1:kd(C,P.matches||y.matches),ee=R===!0||y.navigation.formMethod!=null&&Ze(y.navigation.formMethod)&&C.state?._isRedirect!==!0;l&&(a=l,l=void 0),B||D==="POP"||(D==="PUSH"?n.history.push(C,C.state):D==="REPLACE"&&n.history.replace(C,C.state));let re;if(D==="POP"){let se=W.get(y.location.pathname);se&&se.has(C.pathname)?re={currentLocation:y.location,nextLocation:C}:W.has(C.pathname)&&(re={currentLocation:C,nextLocation:y.location})}else if(L){let se=W.get(y.location.pathname);se?se.add(C.pathname):(se=new Set([C.pathname]),W.set(y.location.pathname,se)),re={currentLocation:y.location,nextLocation:C}}ve({...P,actionData:V,loaderData:Z,historyAction:D,location:C,initialized:!0,navigation:tl,revalidation:"idle",restoreScrollPosition:X,preventScrollReset:ee,blockers:Q},{viewTransitionOpts:re,flushSync:M===!0}),D="POP",R=!1,L=!1,B=!1,q=!1,A?.resolve(),A=null,Y?.resolve(),Y=null}async function I(C,P){if(A?.resolve(),A=null,typeof C=="number"){A||(A=qd());let xe=A.promise;return n.history.go(C),xe}let M=lc(y.location,y.matches,c,C,P?.fromRouteId,P?.relative),{path:$,submission:V,error:Z}=Ld(!1,M,P),Q=y.location,X=Di(y.location,$,P&&P.state);X={...X,...n.history.encodeLocation(X)};let ee=P&&P.replace!=null?P.replace:void 0,re="PUSH";ee===!0?re="REPLACE":ee===!1||V!=null&&Ze(V.formMethod)&&V.formAction===y.location.pathname+y.location.search&&(re="REPLACE");let se=P&&"preventScrollReset"in P?P.preventScrollReset===!0:void 0,te=(P&&P.flushSync)===!0,be=vd({currentLocation:Q,nextLocation:X,historyAction:re});if(be){eo(be,{state:"blocked",location:X,proceed(){eo(be,{state:"proceeding",proceed:void 0,reset:void 0,location:X}),I(C,P)},reset(){let xe=new Map(y.blockers);xe.set(be,si),ve({blockers:xe})}});return}await oe(re,X,{submission:V,pendingError:Z,preventScrollReset:se,replace:P&&P.replace,enableViewTransition:P&&P.viewTransition,flushSync:te,callSiteDefaultShouldRevalidate:P&&P.unstable_defaultShouldRevalidate})}function G(){Y||(Y=qd()),Ja(),ve({revalidation:"loading"});let C=Y.promise;return y.navigation.state==="submitting"?C:y.navigation.state==="idle"?(oe(y.historyAction,y.location,{startUninterruptedRevalidation:!0}),C):(oe(D||y.historyAction,y.navigation.location,{overrideNavigation:y.navigation,enableViewTransition:L===!0}),C)}async function oe(C,P,M){N&&N.abort(),N=null,D=C,B=(M&&M.startUninterruptedRevalidation)===!0,Cx(y.location,y.matches),R=(M&&M.preventScrollReset)===!0,L=(M&&M.enableViewTransition)===!0;let $=l||a,V=M&&M.overrideNavigation,Z=M?.initialHydration&&y.matches&&y.matches.length>0&&!S?y.matches:jn($,P,c),Q=(M&&M.flushSync)===!0;if(Z&&y.initialized&&!q&&$y(y.location,P)&&!(M&&M.submission&&Ze(M.submission.formMethod))){gt(P,{matches:Z},{flushSync:Q});return}let X=to(Z,$,P.pathname);if(X.active&&X.matches&&(Z=X.matches),!Z){let{error:We,notFoundMatches:it,route:Ce}=Qa(P.pathname);gt(P,{matches:it,loaderData:{},errors:{[Ce.id]:We}},{flushSync:Q});return}N=new AbortController;let ee=br(n.history,P,N.signal,M&&M.submission),re=n.getContext?await n.getContext():new Ad,se;if(M&&M.pendingError)se=[On(Z).route.id,{type:"error",error:M.pendingError}];else if(M&&M.submission&&Ze(M.submission.formMethod)){let We=await De(ee,P,M.submission,Z,re,X.active,M&&M.initialHydration===!0,{replace:M.replace,flushSync:Q});if(We.shortCircuited)return;if(We.pendingActionResult){let[it,Ce]=We.pendingActionResult;if(vt(Ce)&&Ei(Ce.error)&&Ce.error.status===404){N=null,gt(P,{matches:We.matches,loaderData:{},errors:{[it]:Ce.error}});return}}Z=We.matches||Z,se=We.pendingActionResult,V=nl(P,M.submission),Q=!1,X.active=!1,ee=br(n.history,ee.url,ee.signal)}let{shortCircuited:te,matches:be,loaderData:xe,errors:Ke}=await Ut(ee,P,Z,re,X.active,V,M&&M.submission,M&&M.fetcherSubmission,M&&M.replace,M&&M.initialHydration===!0,Q,se,M&&M.callSiteDefaultShouldRevalidate);te||(N=null,gt(P,{matches:be||Z,...Ud(se),loaderData:xe,errors:Ke}))}async function De(C,P,M,$,V,Z,Q,X={}){Ja();let ee=Uy(P,M);if(ve({navigation:ee},{flushSync:X.flushSync===!0}),Z){let te=await no($,P.pathname,C.signal);if(te.type==="aborted")return{shortCircuited:!0};if(te.type==="error"){if(te.partialMatches.length===0){let{matches:xe,route:Ke}=oo(a);return{matches:xe,pendingActionResult:[Ke.id,{type:"error",error:te.error}]}}let be=On(te.partialMatches).route.id;return{matches:te.partialMatches,pendingActionResult:[be,{type:"error",error:te.error}]}}else if(te.matches)$=te.matches;else{let{notFoundMatches:be,error:xe,route:Ke}=Qa(P.pathname);return{matches:be,pendingActionResult:[Ke.id,{type:"error",error:xe}]}}}let re,se=Vo($,P);if(!se.route.action&&!se.route.lazy)re={type:"error",error:Pt(405,{method:C.method,pathname:P.pathname,routeId:se.route.id})};else{let te=Or(s,o,C,$,se,Q?[]:r,V),be=await ni(C,te,V,null);if(re=be[se.route.id],!re){for(let xe of $)if(be[xe.route.id]){re=be[xe.route.id];break}}if(C.signal.aborted)return{shortCircuited:!0}}if(er(re)){let te;return X&&X.replace!=null?te=X.replace:te=zd(re.response.headers.get("Location"),new URL(C.url),c)===y.location.pathname+y.location.search,await Wn(C,re,!0,{submission:M,replace:te}),{shortCircuited:!0}}if(vt(re)){let te=On($,se.route.id);return(X&&X.replace)!==!0&&(D="PUSH"),{matches:$,pendingActionResult:[te.route.id,re,se.route.id]}}return{matches:$,pendingActionResult:[se.route.id,re]}}async function Ut(C,P,M,$,V,Z,Q,X,ee,re,se,te,be){let xe=Z||nl(P,Q),Ke=Q||X||Gd(xe),We=!B&&!re;if(V){if(We){let Xe=Zs(te);ve({navigation:xe,...Xe!==void 0?{actionData:Xe}:{}},{flushSync:se})}let ge=await no(M,P.pathname,C.signal);if(ge.type==="aborted")return{shortCircuited:!0};if(ge.type==="error"){if(ge.partialMatches.length===0){let{matches:pr,route:Gn}=oo(a);return{matches:pr,loaderData:{},errors:{[Gn.id]:ge.error}}}let Xe=On(ge.partialMatches).route.id;return{matches:ge.partialMatches,loaderData:{},errors:{[Xe]:ge.error}}}else if(ge.matches)M=ge.matches;else{let{error:Xe,notFoundMatches:pr,route:Gn}=Qa(P.pathname);return{matches:pr,loaderData:{},errors:{[Gn.id]:Xe}}}}let it=l||a,{dsMatches:Ce,revalidatingFetchers:jt}=Id(C,$,s,o,n.history,y,M,Ke,P,re?[]:r,re===!0,q,de,Ae,we,fe,it,c,n.patchRoutesOnNavigation!=null,te,be);if(ie=++J,!n.dataStrategy&&!Ce.some(ge=>ge.shouldLoad)&&!Ce.some(ge=>ge.route.middleware&&ge.route.middleware.length>0)&&jt.length===0){let ge=bd();return gt(P,{matches:M,loaderData:{},errors:te&&vt(te[1])?{[te[0]]:te[1].error}:null,...Ud(te),...ge?{fetchers:new Map(y.fetchers)}:{}},{flushSync:se}),{shortCircuited:!0}}if(We){let ge={};if(!V){ge.navigation=xe;let Xe=Zs(te);Xe!==void 0&&(ge.actionData=Xe)}jt.length>0&&(ge.fetchers=ti(jt)),ve(ge,{flushSync:se})}jt.forEach(ge=>{fn(ge.key),ge.controller&&z.set(ge.key,ge.controller)});let Un=()=>jt.forEach(ge=>fn(ge.key));N&&N.signal.addEventListener("abort",Un);let{loaderResults:ri,fetcherResults:wn}=await pd(Ce,jt,C,$);if(C.signal.aborted)return{shortCircuited:!0};N&&N.signal.removeEventListener("abort",Un),jt.forEach(ge=>z.delete(ge.key));let Kt=ao(ri);if(Kt)return await Wn(C,Kt.result,!0,{replace:ee}),{shortCircuited:!0};if(Kt=ao(wn),Kt)return fe.add(Kt.key),await Wn(C,Kt.result,!0,{replace:ee}),{shortCircuited:!0};let{loaderData:Xa,errors:ii}=Hd(y,M,ri,te,jt,wn);re&&y.errors&&(ii={...y.errors,...ii});let Kn=bd(),ro=xd(ie),io=Kn||ro||jt.length>0;return{matches:M,loaderData:Xa,errors:ii,...io?{fetchers:new Map(y.fetchers)}:{}}}function Zs(C){if(C&&!vt(C[1]))return{[C[0]]:C[1].data};if(y.actionData)return Object.keys(y.actionData).length===0?null:y.actionData}function ti(C){return C.forEach(P=>{let M=y.fetchers.get(P.key),$=oi(void 0,M?M.data:void 0);y.fetchers.set(P.key,$)}),new Map(y.fetchers)}async function bx(C,P,M,$){fn(C);let V=($&&$.flushSync)===!0,Z=l||a,Q=lc(y.location,y.matches,c,M,P,$?.relative),X=jn(Z,Q,c),ee=to(X,Z,Q);if(ee.active&&ee.matches&&(X=ee.matches),!X){un(C,P,Pt(404,{pathname:Q}),{flushSync:V});return}let{path:re,submission:se,error:te}=Ld(!0,Q,$);if(te){un(C,P,te,{flushSync:V});return}let be=n.getContext?await n.getContext():new Ad,xe=($&&$.preventScrollReset)===!0;if(se&&Ze(se.formMethod)){await xx(C,P,re,X,be,ee.active,V,xe,se,$&&$.unstable_defaultShouldRevalidate);return}we.set(C,{routeId:P,path:re}),await yx(C,P,re,X,be,ee.active,V,xe,se)}async function xx(C,P,M,$,V,Z,Q,X,ee,re){Ja(),we.delete(C);let se=y.fetchers.get(C);dn(C,Ky(ee,se),{flushSync:Q});let te=new AbortController,be=br(n.history,M,te.signal,ee);if(Z){let Re=await no($,new URL(be.url).pathname,be.signal,C);if(Re.type==="aborted")return;if(Re.type==="error"){un(C,P,Re.error,{flushSync:Q});return}else if(Re.matches)$=Re.matches;else{un(C,P,Pt(404,{pathname:M}),{flushSync:Q});return}}let xe=Vo($,M);if(!xe.route.action&&!xe.route.lazy){let Re=Pt(405,{method:ee.formMethod,pathname:M,routeId:P});un(C,P,Re,{flushSync:Q});return}z.set(C,te);let Ke=J,We=Or(s,o,be,$,xe,r,V),it=await ni(be,We,V,C),Ce=it[xe.route.id];if(!Ce){for(let Re of We)if(it[Re.route.id]){Ce=it[Re.route.id];break}}if(be.signal.aborted){z.get(C)===te&&z.delete(C);return}if(Ae.has(C)){if(er(Ce)||vt(Ce)){dn(C,pn(void 0));return}}else{if(er(Ce))if(z.delete(C),ie>Ke){dn(C,pn(void 0));return}else return fe.add(C),dn(C,oi(ee)),Wn(be,Ce,!1,{fetcherSubmission:ee,preventScrollReset:X});if(vt(Ce)){un(C,P,Ce.error);return}}let jt=y.navigation.location||y.location,Un=br(n.history,jt,te.signal),ri=l||a,wn=y.navigation.state!=="idle"?jn(ri,y.navigation.location,c):y.matches;he(wn,"Didn't find any matches after fetcher action");let Kt=++J;le.set(C,Kt);let Xa=oi(ee,Ce.data);y.fetchers.set(C,Xa);let{dsMatches:ii,revalidatingFetchers:Kn}=Id(Un,V,s,o,n.history,y,wn,ee,jt,r,!1,q,de,Ae,we,fe,ri,c,n.patchRoutesOnNavigation!=null,[xe.route.id,Ce],re);Kn.filter(Re=>Re.key!==C).forEach(Re=>{let so=Re.key,Cd=y.fetchers.get(so),Px=oi(void 0,Cd?Cd.data:void 0);y.fetchers.set(so,Px),fn(so),Re.controller&&z.set(so,Re.controller)}),ve({fetchers:new Map(y.fetchers)});let ro=()=>Kn.forEach(Re=>fn(Re.key));te.signal.addEventListener("abort",ro);let{loaderResults:io,fetcherResults:ge}=await pd(ii,Kn,Un,V);if(te.signal.aborted)return;if(te.signal.removeEventListener("abort",ro),le.delete(C),z.delete(C),Kn.forEach(Re=>z.delete(Re.key)),y.fetchers.has(C)){let Re=pn(Ce.data);y.fetchers.set(C,Re)}let Xe=ao(io);if(Xe)return Wn(Un,Xe.result,!1,{preventScrollReset:X});if(Xe=ao(ge),Xe)return fe.add(Xe.key),Wn(Un,Xe.result,!1,{preventScrollReset:X});let{loaderData:pr,errors:Gn}=Hd(y,wn,io,void 0,Kn,ge);xd(Kt),y.navigation.state==="loading"&&Kt>ie?(he(D,"Expected pending action"),N&&N.abort(),gt(y.navigation.location,{matches:wn,loaderData:pr,errors:Gn,fetchers:new Map(y.fetchers)})):(ve({errors:Gn,loaderData:Wd(y.loaderData,pr,wn,Gn),fetchers:new Map(y.fetchers)}),q=!1)}async function yx(C,P,M,$,V,Z,Q,X,ee){let re=y.fetchers.get(C);dn(C,oi(ee,re?re.data:void 0),{flushSync:Q});let se=new AbortController,te=br(n.history,M,se.signal);if(Z){let Ce=await no($,new URL(te.url).pathname,te.signal,C);if(Ce.type==="aborted")return;if(Ce.type==="error"){un(C,P,Ce.error,{flushSync:Q});return}else if(Ce.matches)$=Ce.matches;else{un(C,P,Pt(404,{pathname:M}),{flushSync:Q});return}}let be=Vo($,M);z.set(C,se);let xe=J,Ke=Or(s,o,te,$,be,r,V),it=(await ni(te,Ke,V,C))[be.route.id];if(z.get(C)===se&&z.delete(C),!te.signal.aborted){if(Ae.has(C)){dn(C,pn(void 0));return}if(er(it))if(ie>xe){dn(C,pn(void 0));return}else{fe.add(C),await Wn(te,it,!1,{preventScrollReset:X});return}if(vt(it)){un(C,P,it.error);return}dn(C,pn(it.data))}}async function Wn(C,P,M,{submission:$,fetcherSubmission:V,preventScrollReset:Z,replace:Q}={}){M||(A?.resolve(),A=null),P.response.headers.has("X-Remix-Revalidate")&&(q=!0);let X=P.response.headers.get("Location");he(X,"Expected a Location header on the redirect Response"),X=zd(X,new URL(C.url),c);let ee=Di(y.location,X,{_isRedirect:!0});if(t){let Ke=!1;if(P.response.headers.has("X-Remix-Reload-Document"))Ke=!0;else if(Na(X)){const We=om(X,!0);Ke=We.origin!==e.location.origin||Rt(We.pathname,c)==null}if(Ke){Q?e.location.replace(X):e.location.assign(X);return}}N=null;let re=Q===!0||P.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:se,formAction:te,formEncType:be}=y.navigation;!$&&!V&&se&&te&&be&&($=Gd(y.navigation));let xe=$||V;if(wy.has(P.response.status)&&xe&&Ze(xe.formMethod))await oe(re,ee,{submission:{...xe,formAction:X},preventScrollReset:Z||R,enableViewTransition:M?L:void 0});else{let Ke=nl(ee,$);await oe(re,ee,{overrideNavigation:Ke,fetcherSubmission:V,preventScrollReset:Z||R,enableViewTransition:M?L:void 0})}}async function ni(C,P,M,$){let V,Z={};try{V=await Dy(d,C,P,$,M,!1)}catch(Q){return P.filter(X=>X.shouldLoad).forEach(X=>{Z[X.route.id]={type:"error",error:Q}}),Z}if(C.signal.aborted)return Z;if(!Ze(C.method))for(let Q of P){if(V[Q.route.id]?.type==="error")break;!V.hasOwnProperty(Q.route.id)&&!y.loaderData.hasOwnProperty(Q.route.id)&&(!y.errors||!y.errors.hasOwnProperty(Q.route.id))&&Q.shouldCallHandler()&&(V[Q.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${Q.route.id}`)})}for(let[Q,X]of Object.entries(V))if(zy(X)){let ee=X.result;Z[Q]={type:"redirect",response:Ly(ee,C,Q,P,c)}}else Z[Q]=await Ry(X);return Z}async function pd(C,P,M,$){let V=ni(M,C,$,null),Z=Promise.all(P.map(async ee=>{if(ee.matches&&ee.match&&ee.request&&ee.controller){let se=(await ni(ee.request,ee.matches,$,ee.key))[ee.match.route.id];return{[ee.key]:se}}else return Promise.resolve({[ee.key]:{type:"error",error:Pt(404,{pathname:ee.path})}})})),Q=await V,X=(await Z).reduce((ee,re)=>Object.assign(ee,re),{});return{loaderResults:Q,fetcherResults:X}}function Ja(){q=!0,we.forEach((C,P)=>{z.has(P)&&de.add(P),fn(P)})}function dn(C,P,M={}){y.fetchers.set(C,P),ve({fetchers:new Map(y.fetchers)},{flushSync:(M&&M.flushSync)===!0})}function un(C,P,M,$={}){let V=On(y.matches,P);Ya(C),ve({errors:{[V.route.id]:M},fetchers:new Map(y.fetchers)},{flushSync:($&&$.flushSync)===!0})}function md(C){return ke.set(C,(ke.get(C)||0)+1),Ae.has(C)&&Ae.delete(C),y.fetchers.get(C)||ky}function vx(C,P){fn(C,P?.reason),dn(C,pn(null))}function Ya(C){let P=y.fetchers.get(C);z.has(C)&&!(P&&P.state==="loading"&&le.has(C))&&fn(C),we.delete(C),le.delete(C),fe.delete(C),Ae.delete(C),de.delete(C),y.fetchers.delete(C)}function wx(C){let P=(ke.get(C)||0)-1;P<=0?(ke.delete(C),Ae.add(C)):ke.set(C,P),ve({fetchers:new Map(y.fetchers)})}function fn(C,P){let M=z.get(C);M&&(M.abort(P),z.delete(C))}function gd(C){for(let P of C){let M=md(P),$=pn(M.data);y.fetchers.set(P,$)}}function bd(){let C=[],P=!1;for(let M of fe){let $=y.fetchers.get(M);he($,`Expected fetcher: ${M}`),$.state==="loading"&&(fe.delete(M),C.push(M),P=!0)}return gd(C),P}function xd(C){let P=[];for(let[M,$]of le)if($<C){let V=y.fetchers.get(M);he(V,`Expected fetcher: ${M}`),V.state==="loading"&&(fn(M),le.delete(M),P.push(M))}return gd(P),P.length>0}function kx(C,P){let M=y.blockers.get(C)||si;return Qe.get(C)!==P&&Qe.set(C,P),M}function yd(C){y.blockers.delete(C),Qe.delete(C)}function eo(C,P){let M=y.blockers.get(C)||si;he(M.state==="unblocked"&&P.state==="blocked"||M.state==="blocked"&&P.state==="blocked"||M.state==="blocked"&&P.state==="proceeding"||M.state==="blocked"&&P.state==="unblocked"||M.state==="proceeding"&&P.state==="unblocked",`Invalid blocker state transition: ${M.state} -> ${P.state}`);let $=new Map(y.blockers);$.set(C,P),ve({blockers:$})}function vd({currentLocation:C,nextLocation:P,historyAction:M}){if(Qe.size===0)return;Qe.size>1&&Ee(!1,"A router only supports one blocker at a time");let $=Array.from(Qe.entries()),[V,Z]=$[$.length-1],Q=y.blockers.get(V);if(!(Q&&Q.state==="proceeding")&&Z({currentLocation:C,nextLocation:P,historyAction:M}))return V}function Qa(C){let P=Pt(404,{pathname:C}),M=l||a,{matches:$,route:V}=oo(M);return{notFoundMatches:$,route:V,error:P}}function Sx(C,P,M){if(m=C,x=P,b=M||null,!w&&y.navigation===tl){w=!0;let $=kd(y.location,y.matches);$!=null&&ve({restoreScrollPosition:$})}return()=>{m=null,x=null,b=null}}function wd(C,P){return b&&b(C,P.map($=>qx($,y.loaderData)))||C.key}function Cx(C,P){if(m&&x){let M=wd(C,P);m[M]=x()}}function kd(C,P){if(m){let M=wd(C,P),$=m[M];if(typeof $=="number")return $}return null}function to(C,P,M){if(n.patchRoutesOnNavigation)if(C){if(Object.keys(C[0].params).length>0)return{active:!0,matches:bi(P,M,c,!0)}}else return{active:!0,matches:bi(P,M,c,!0)||[]};return{active:!1,matches:null}}async function no(C,P,M,$){if(!n.patchRoutesOnNavigation)return{type:"success",matches:C};let V=C;for(;;){let Z=l==null,Q=l||a,X=o;try{await n.patchRoutesOnNavigation({signal:M,path:P,matches:V,fetcherKey:$,patch:(se,te)=>{M.aborted||$d(se,te,Q,X,s,!1)}})}catch(se){return{type:"error",error:se,partialMatches:V}}finally{Z&&!M.aborted&&(a=[...a])}if(M.aborted)return{type:"aborted"};let ee=jn(Q,P,c),re=null;if(ee){if(Object.keys(ee[0].params).length===0)return{type:"success",matches:ee};if(re=bi(Q,P,c,!0),!(re&&V.length<re.length&&Sd(V,re.slice(0,V.length))))return{type:"success",matches:ee}}if(re||(re=bi(Q,P,c,!0)),!re||Sd(V,re))return{type:"success",matches:null};V=re}}function Sd(C,P){return C.length===P.length&&C.every((M,$)=>M.route.id===P[$].route.id)}function jx(C){o={},l=Ti(C,s,void 0,o)}function Ox(C,P,M=!1){let $=l==null;$d(C,P,l||a,o,s,M),$&&(a=[...a],ve({}))}return O={get basename(){return c},get future(){return u},get state(){return y},get routes(){return a},get window(){return e},initialize:Me,subscribe:Ie,enableScrollRestoration:Sx,navigate:I,fetch:bx,revalidate:G,createHref:C=>n.history.createHref(C),encodeLocation:C=>n.history.encodeLocation(C),getFetcher:md,resetFetcher:vx,deleteFetcher:wx,dispose:Se,getBlocker:kx,deleteBlocker:yd,patchRoutes:Ox,_internalFetchControllers:z,_internalSetRoutes:jx,_internalSetStateDoNotUseOrYouWillBreakYourApp(C){ve(C)}},n.unstable_instrumentations&&(O=fy(O,n.unstable_instrumentations.map(C=>C.router).filter(Boolean))),O}function jy(n){return n!=null&&("formData"in n&&n.formData!=null||"body"in n&&n.body!==void 0)}function lc(n,e,t,r,i,s){let o,a;if(i){o=[];for(let c of e)if(o.push(c),c.route.id===i){a=c;break}}else o=e,a=e[e.length-1];let l=Ma(r||".",Aa(o),Rt(n.pathname,t)||n.pathname,s==="path");if(r==null&&(l.search=n.search,l.hash=n.hash),(r==null||r===""||r===".")&&a){let c=uh(l.search);if(a.route.index&&!c)l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index";else if(!a.route.index&&c){let d=new URLSearchParams(l.search),u=d.getAll("index");d.delete("index"),u.filter(p=>p).forEach(p=>d.append("index",p));let f=d.toString();l.search=f?`?${f}`:""}}return t!=="/"&&(l.pathname=ay({basename:t,pathname:l.pathname})),on(l)}function Ld(n,e,t){if(!t||!jy(t))return{path:e};if(t.formMethod&&!Wy(t.formMethod))return{path:e,error:Pt(405,{method:t.formMethod})};let r=()=>({path:e,error:Pt(400,{type:"invalid-body"})}),s=(t.formMethod||"get").toUpperCase(),o=Sm(e);if(t.body!==void 0){if(t.formEncType==="text/plain"){if(!Ze(s))return r();let u=typeof t.body=="string"?t.body:t.body instanceof FormData||t.body instanceof URLSearchParams?Array.from(t.body.entries()).reduce((f,[p,m])=>`${f}${p}=${m}
19
+ `,""):String(t.body);return{path:e,submission:{formMethod:s,formAction:o,formEncType:t.formEncType,formData:void 0,json:void 0,text:u}}}else if(t.formEncType==="application/json"){if(!Ze(s))return r();try{let u=typeof t.body=="string"?JSON.parse(t.body):t.body;return{path:e,submission:{formMethod:s,formAction:o,formEncType:t.formEncType,formData:void 0,json:u,text:void 0}}}catch{return r()}}}he(typeof FormData=="function","FormData is not available in this environment");let a,l;if(t.formData)a=dc(t.formData),l=t.formData;else if(t.body instanceof FormData)a=dc(t.body),l=t.body;else if(t.body instanceof URLSearchParams)a=t.body,l=_d(a);else if(t.body==null)a=new URLSearchParams,l=new FormData;else try{a=new URLSearchParams(t.body),l=_d(a)}catch{return r()}let c={formMethod:s,formAction:o,formEncType:t&&t.formEncType||"application/x-www-form-urlencoded",formData:l,json:void 0,text:void 0};if(Ze(c.formMethod))return{path:e,submission:c};let d=Vn(e);return n&&d.search&&uh(d.search)&&a.append("index",""),d.search=`?${a}`,{path:on(d),submission:c}}function Id(n,e,t,r,i,s,o,a,l,c,d,u,f,p,m,b,x,w,v,S,j){let k=S?vt(S[1])?S[1].error:S[1].data:void 0,O=i.createURL(s.location),y=i.createURL(l),D;if(d&&s.errors){let B=Object.keys(s.errors)[0];D=o.findIndex(q=>q.route.id===B)}else if(S&&vt(S[1])){let B=S[0];D=o.findIndex(q=>q.route.id===B)-1}let A=S?S[1].statusCode:void 0,R=A&&A>=400,N={currentUrl:O,currentParams:s.matches[0]?.params||{},nextUrl:y,nextParams:o[0].params,...a,actionResult:k,actionStatus:A},L=$s(o),W=o.map((B,q)=>{let{route:de}=B,z=null;if(D!=null&&q>D?z=!1:de.lazy?z=!0:hh(de)?d?z=cc(de,s.loaderData,s.errors):Oy(s.loaderData,s.matches[q],B)&&(z=!0):z=!1,z!==null)return hc(t,r,n,L,B,c,e,z);let J=!1;typeof j=="boolean"?J=j:R?J=!1:(u||O.pathname+O.search===y.pathname+y.search||O.search!==y.search||Py(s.matches[q],B))&&(J=!0);let ie={...N,defaultShouldRevalidate:J},le=ki(B,ie);return hc(t,r,n,L,B,c,e,le,ie,j)}),F=[];return m.forEach((B,q)=>{if(d||!o.some(ke=>ke.route.id===B.routeId)||p.has(q))return;let de=s.fetchers.get(q),z=de&&de.state!=="idle"&&de.data===void 0,J=jn(x,B.path,w);if(!J){if(v&&z)return;F.push({key:q,routeId:B.routeId,path:B.path,matches:null,match:null,request:null,controller:null});return}if(b.has(q))return;let ie=Vo(J,B.path),le=new AbortController,fe=br(i,B.path,le.signal),we=null;if(f.has(q))f.delete(q),we=Or(t,r,fe,J,ie,c,e);else if(z)u&&(we=Or(t,r,fe,J,ie,c,e));else{let ke;typeof j=="boolean"?ke=j:R?ke=!1:ke=u;let Ae={...N,defaultShouldRevalidate:ke};ki(ie,Ae)&&(we=Or(t,r,fe,J,ie,c,e,Ae))}we&&F.push({key:q,routeId:B.routeId,path:B.path,matches:we,match:ie,request:fe,controller:le})}),{dsMatches:W,revalidatingFetchers:F}}function hh(n){return n.loader!=null||n.middleware!=null&&n.middleware.length>0}function cc(n,e,t){if(n.lazy)return!0;if(!hh(n))return!1;let r=e!=null&&n.id in e,i=t!=null&&t[n.id]!==void 0;return!r&&i?!1:typeof n.loader=="function"&&n.loader.hydrate===!0?!0:!r&&!i}function Oy(n,e,t){let r=!e||t.route.id!==e.route.id,i=!n.hasOwnProperty(t.route.id);return r||i}function Py(n,e){let t=n.route.path;return n.pathname!==e.pathname||t!=null&&t.endsWith("*")&&n.params["*"]!==e.params["*"]}function ki(n,e){if(n.route.shouldRevalidate){let t=n.route.shouldRevalidate(e);if(typeof t=="boolean")return t}return e.defaultShouldRevalidate}function $d(n,e,t,r,i,s){let o;if(n){let c=r[n];he(c,`No route found to patch children into: routeId = ${n}`),c.children||(c.children=[]),o=c.children}else o=t;let a=[],l=[];if(e.forEach(c=>{let d=o.find(u=>xm(c,u));d?l.push({existingRoute:d,newRoute:c}):a.push(c)}),a.length>0){let c=Ti(a,i,[n||"_","patch",String(o?.length||"0")],r);o.push(...c)}if(s&&l.length>0)for(let c=0;c<l.length;c++){let{existingRoute:d,newRoute:u}=l[c],f=d,[p]=Ti([u],i,[],{},!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 xm(n,e){return"id"in n&&"id"in e&&n.id===e.id?!0:n.index===e.index&&n.path===e.path&&n.caseSensitive===e.caseSensitive?(!n.children||n.children.length===0)&&(!e.children||e.children.length===0)?!0:n.children.every((t,r)=>e.children?.some(i=>xm(t,i))):!1}var Bd=new WeakMap,ym=({key:n,route:e,manifest:t,mapRouteProperties:r})=>{let i=t[e.id];if(he(i,"No route found in manifest"),!i.lazy||typeof i.lazy!="object")return;let s=i.lazy[n];if(!s)return;let o=Bd.get(i);o||(o={},Bd.set(i,o));let a=o[n];if(a)return a;let l=(async()=>{let c=Wx(n),u=i[n]!==void 0&&n!=="hasErrorBoundary";if(c)Ee(!c,"Route property "+n+" is not a supported lazy route property. This property will be ignored."),o[n]=Promise.resolve();else if(u)Ee(!1,`Route "${i.id}" has a static property "${n}" defined. The lazy property will be ignored.`);else{let f=await s();f!=null&&(Object.assign(i,{[n]:f}),Object.assign(i,r(i)))}typeof i.lazy=="object"&&(i.lazy[n]=void 0,Object.values(i.lazy).every(f=>f===void 0)&&(i.lazy=void 0))})();return o[n]=l,l},Fd=new WeakMap;function Ny(n,e,t,r,i){let s=t[n.id];if(he(s,"No route found in manifest"),!n.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof n.lazy=="function"){let d=Fd.get(s);if(d)return{lazyRoutePromise:d,lazyHandlerPromise:d};let u=(async()=>{he(typeof n.lazy=="function","No lazy route function found");let f=await n.lazy(),p={};for(let m in f){let b=f[m];if(b===void 0)continue;let x=Kx(m),v=s[m]!==void 0&&m!=="hasErrorBoundary";x?Ee(!x,"Route property "+m+" is not a supported property to be returned from a lazy route function. This property will be ignored."):v?Ee(!v,`Route "${s.id}" has a static property "${m}" defined but its lazy function is also returning a value for this property. The lazy route property "${m}" will be ignored.`):p[m]=b}Object.assign(s,p),Object.assign(s,{...r(s),lazy:void 0})})();return Fd.set(s,u),u.catch(()=>{}),{lazyRoutePromise:u,lazyHandlerPromise:u}}let o=Object.keys(n.lazy),a=[],l;for(let d of o){if(i&&i.includes(d))continue;let u=ym({key:d,route:n,manifest:t,mapRouteProperties:r});u&&(a.push(u),d===e&&(l=u))}let c=a.length>0?Promise.all(a).then(()=>{}):void 0;return c?.catch(()=>{}),l?.catch(()=>{}),{lazyRoutePromise:c,lazyHandlerPromise:l}}async function Vd(n){let e=n.matches.filter(i=>i.shouldLoad),t={};return(await Promise.all(e.map(i=>i.resolve()))).forEach((i,s)=>{t[e[s].route.id]=i}),t}async function Ay(n){return n.matches.some(e=>e.route.middleware)?vm(n,()=>Vd(n)):Vd(n)}function vm(n,e){return My(n,e,r=>{if(Hy(r))throw r;return r},Fy,t);function t(r,i,s){if(s)return Promise.resolve(Object.assign(s.value,{[i]:{type:"error",result:r}}));{let{matches:o}=n,a=Math.min(Math.max(o.findIndex(c=>c.route.id===i),0),Math.max(o.findIndex(c=>c.shouldCallHandler()),0)),l=On(o,o[a].route.id).route.id;return Promise.resolve({[l]:{type:"error",result:r}})}}}async function My(n,e,t,r,i){let{matches:s,request:o,params:a,context:l,unstable_pattern:c}=n,d=s.flatMap(f=>f.route.middleware?f.route.middleware.map(p=>[f.route.id,p]):[]);return await wm({request:o,params:a,context:l,unstable_pattern:c},d,e,t,r,i)}async function wm(n,e,t,r,i,s,o=0){let{request:a}=n;if(a.signal.aborted)throw a.signal.reason??new Error(`Request aborted: ${a.method} ${a.url}`);let l=e[o];if(!l)return await t();let[c,d]=l,u,f=async()=>{if(u)throw new Error("You may only call `next()` once per middleware");try{return u={value:await wm(n,e,t,r,i,s,o+1)},u.value}catch(p){return u={value:await s(p,c,u)},u.value}};try{let p=await d(n,f),m=p!=null?r(p):void 0;return i(m)?m:u?m??u.value:(u={value:await f()},u.value)}catch(p){return await s(p,c,u)}}function km(n,e,t,r,i){let s=ym({key:"middleware",route:r.route,manifest:e,mapRouteProperties:n}),o=Ny(r.route,Ze(t.method)?"action":"loader",e,n,i);return{middleware:s,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function hc(n,e,t,r,i,s,o,a,l=null,c){let d=!1,u=km(n,e,t,i,s);return{...i,_lazyPromises:u,shouldLoad:a,shouldRevalidateArgs:l,shouldCallHandler(f){return d=!0,l?typeof c=="boolean"?ki(i,{...l,defaultShouldRevalidate:c}):typeof f=="boolean"?ki(i,{...l,defaultShouldRevalidate:f}):ki(i,l):a},resolve(f){let{lazy:p,loader:m,middleware:b}=i.route,x=d||a||f&&!Ze(t.method)&&(p||m),w=b&&b.length>0&&!m&&!p;return x&&(Ze(t.method)||!w)?Ty({request:t,unstable_pattern:r,match:i,lazyHandlerPromise:u?.handler,lazyRoutePromise:u?.route,handlerOverride:f,scopedContext:o}):Promise.resolve({type:"data",result:void 0})}}}function Or(n,e,t,r,i,s,o,a=null){return r.map(l=>l.route.id!==i.route.id?{...l,shouldLoad:!1,shouldRevalidateArgs:a,shouldCallHandler:()=>!1,_lazyPromises:km(n,e,t,l,s),resolve:()=>Promise.resolve({type:"data",result:void 0})}:hc(n,e,t,$s(r),l,s,o,!0,a))}async function Dy(n,e,t,r,i,s){t.some(c=>c._lazyPromises?.middleware)&&await Promise.all(t.map(c=>c._lazyPromises?.middleware));let o={request:e,unstable_pattern:$s(t),params:t[0].params,context:i,matches:t},l=await n({...o,fetcherKey:r,runClientMiddleware:c=>{let d=o;return vm(d,()=>c({...d,fetcherKey:r,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(t.flatMap(c=>[c._lazyPromises?.handler,c._lazyPromises?.route]))}catch{}return l}async function Ty({request:n,unstable_pattern:e,match:t,lazyHandlerPromise:r,lazyRoutePromise:i,handlerOverride:s,scopedContext:o}){let a,l,c=Ze(n.method),d=c?"action":"loader",u=f=>{let p,m=new Promise((w,v)=>p=v);l=()=>p(),n.signal.addEventListener("abort",l);let b=w=>typeof f!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${d}" [routeId: ${t.route.id}]`)):f({request:n,unstable_pattern:e,params:t.params,context:o},...w!==void 0?[w]:[]),x=(async()=>{try{return{type:"data",result:await(s?s(v=>b(v)):b())}}catch(w){return{type:"error",result:w}}})();return Promise.race([x,m])};try{let f=c?t.route.action:t.route.loader;if(r||i)if(f){let p,[m]=await Promise.all([u(f).catch(b=>{p=b}),r,i]);if(p!==void 0)throw p;a=m}else{await r;let p=c?t.route.action:t.route.loader;if(p)[a]=await Promise.all([u(p),i]);else if(d==="action"){let m=new URL(n.url),b=m.pathname+m.search;throw Pt(405,{method:n.method,pathname:b,routeId:t.route.id})}else return{type:"data",result:void 0}}else if(f)a=await u(f);else{let p=new URL(n.url),m=p.pathname+p.search;throw Pt(404,{pathname:m})}}catch(f){return{type:"error",result:f}}finally{l&&n.signal.removeEventListener("abort",l)}return a}async function Ey(n){let e=n.headers.get("Content-Type");return e&&/\bapplication\/json\b/.test(e)?n.body==null?null:n.json():n.text()}async function Ry(n){let{result:e,type:t}=n;if(dh(e)){let r;try{r=await Ey(e)}catch(i){return{type:"error",error:i}}return t==="error"?{type:"error",error:new Is(e.status,e.statusText,r),statusCode:e.status,headers:e.headers}:{type:"data",data:r,statusCode:e.status,headers:e.headers}}return t==="error"?Kd(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:By(e),statusCode:Ei(e)?e.status:void 0,headers:e.init?.headers?new Headers(e.init.headers):void 0}:{type:"error",error:e,statusCode:Ei(e)?e.status:void 0}:Kd(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 Ly(n,e,t,r,i){let s=n.headers.get("Location");if(he(s,"Redirects returned/thrown from loaders/actions must have a Location header"),!Na(s)){let o=r.slice(0,r.findIndex(a=>a.route.id===t)+1);s=lc(new URL(e.url),o,i,s),n.headers.set("Location",s)}return n}function zd(n,e,t){if(Na(n)){let r=n,i=r.startsWith("//")?new URL(e.protocol+r):new URL(r),s=Rt(i.pathname,t)!=null;if(i.origin===e.origin&&s)return i.pathname+i.search+i.hash}return n}function br(n,e,t,r){let i=n.createURL(Sm(e)).toString(),s={signal:t};if(r&&Ze(r.formMethod)){let{formMethod:o,formEncType:a}=r;s.method=o.toUpperCase(),a==="application/json"?(s.headers=new Headers({"Content-Type":a}),s.body=JSON.stringify(r.json)):a==="text/plain"?s.body=r.text:a==="application/x-www-form-urlencoded"&&r.formData?s.body=dc(r.formData):s.body=r.formData}return new Request(i,s)}function dc(n){let e=new URLSearchParams;for(let[t,r]of n.entries())e.append(t,typeof r=="string"?r:r.name);return e}function _d(n){let e=new FormData;for(let[t,r]of n.entries())e.append(t,r);return e}function Iy(n,e,t,r=!1,i=!1){let s={},o=null,a,l=!1,c={},d=t&&vt(t[1])?t[1].error:void 0;return n.forEach(u=>{if(!(u.route.id in e))return;let f=u.route.id,p=e[f];if(he(!er(p),"Cannot handle redirect results in processLoaderData"),vt(p)){let m=p.error;if(d!==void 0&&(m=d,d=void 0),o=o||{},i)o[f]=m;else{let b=On(n,f);o[b.route.id]==null&&(o[b.route.id]=m)}r||(s[f]=bm),l||(l=!0,a=Ei(p.error)?p.error.status:500),p.headers&&(c[f]=p.headers)}else s[f]=p.data,p.statusCode&&p.statusCode!==200&&!l&&(a=p.statusCode),p.headers&&(c[f]=p.headers)}),d!==void 0&&t&&(o={[t[0]]:d},t[2]&&(s[t[2]]=void 0)),{loaderData:s,errors:o,statusCode:a||200,loaderHeaders:c}}function Hd(n,e,t,r,i,s){let{loaderData:o,errors:a}=Iy(e,t,r);return i.filter(l=>!l.matches||l.matches.some(c=>c.shouldLoad)).forEach(l=>{let{key:c,match:d,controller:u}=l;if(u&&u.signal.aborted)return;let f=s[c];if(he(f,"Did not find corresponding fetcher result"),vt(f)){let p=On(n.matches,d?.route.id);a&&a[p.route.id]||(a={...a,[p.route.id]:f.error}),n.fetchers.delete(c)}else if(er(f))he(!1,"Unhandled fetcher revalidation redirect");else{let p=pn(f.data);n.fetchers.set(c,p)}}),{loaderData:o,errors:a}}function Wd(n,e,t,r){let i=Object.entries(e).filter(([,s])=>s!==bm).reduce((s,[o,a])=>(s[o]=a,s),{});for(let s of t){let o=s.route.id;if(!e.hasOwnProperty(o)&&n.hasOwnProperty(o)&&s.route.loader&&(i[o]=n[o]),r&&r.hasOwnProperty(o))break}return i}function Ud(n){return n?vt(n[1])?{actionData:{}}:{actionData:{[n[0]]:n[1].data}}:{}}function On(n,e){return(e?n.slice(0,n.findIndex(r=>r.route.id===e)+1):[...n]).reverse().find(r=>r.route.hasErrorBoundary===!0)||n[0]}function oo(n){let e=n.length===1?n[0]:n.find(t=>t.index||!t.path||t.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:e}],route:e}}function Pt(n,{pathname:e,routeId:t,method:r,type:i,message:s}={}){let o="Unknown Server Error",a="Unknown @remix-run/router error";return n===400?(o="Bad Request",r&&e&&t?a=`You made a ${r} request to "${e}" but did not provide a \`loader\` for route "${t}", so there is no way to handle the request.`:i==="invalid-body"&&(a="Unable to encode submission body")):n===403?(o="Forbidden",a=`Route "${t}" does not match URL "${e}"`):n===404?(o="Not Found",a=`No route matches URL "${e}"`):n===405&&(o="Method Not Allowed",r&&e&&t?a=`You made a ${r.toUpperCase()} request to "${e}" but did not provide an \`action\` for route "${t}", so there is no way to handle the request.`:r&&(a=`Invalid request method "${r.toUpperCase()}"`)),new Is(n||500,o,new Error(a),!0)}function ao(n){let e=Object.entries(n);for(let t=e.length-1;t>=0;t--){let[r,i]=e[t];if(er(i))return{key:r,result:i}}}function Sm(n){let e=typeof n=="string"?Vn(n):n;return on({...e,hash:""})}function $y(n,e){return n.pathname!==e.pathname||n.search!==e.search?!1:n.hash===""?e.hash!=="":n.hash===e.hash?!0:e.hash!==""}function By(n){return new Is(n.init?.status??500,n.init?.statusText??"Internal Server Error",n.data)}function Fy(n){return n!=null&&typeof n=="object"&&Object.entries(n).every(([e,t])=>typeof e=="string"&&Vy(t))}function Vy(n){return n!=null&&typeof n=="object"&&"type"in n&&"result"in n&&(n.type==="data"||n.type==="error")}function zy(n){return dh(n.result)&&mm.has(n.result.status)}function vt(n){return n.type==="error"}function er(n){return(n&&n.type)==="redirect"}function Kd(n){return typeof n=="object"&&n!=null&&"type"in n&&"data"in n&&"init"in n&&n.type==="DataWithResponseInit"}function dh(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.headers=="object"&&typeof n.body<"u"}function _y(n){return mm.has(n)}function Hy(n){return dh(n)&&_y(n.status)&&n.headers.has("Location")}function Wy(n){return vy.has(n.toUpperCase())}function Ze(n){return xy.has(n.toUpperCase())}function uh(n){return new URLSearchParams(n).getAll("index").some(e=>e==="")}function Vo(n,e){let t=typeof e=="string"?Vn(e).search:e.search;if(n[n.length-1].route.index&&uh(t||""))return n[n.length-1];let r=hm(n);return r[r.length-1]}function Gd(n){let{formMethod:e,formAction:t,formEncType:r,text:i,formData:s,json:o}=n;if(!(!e||!t||!r)){if(i!=null)return{formMethod:e,formAction:t,formEncType:r,formData:void 0,json:void 0,text:i};if(s!=null)return{formMethod:e,formAction:t,formEncType:r,formData:s,json:void 0,text:void 0};if(o!==void 0)return{formMethod:e,formAction:t,formEncType:r,formData:void 0,json:o,text:void 0}}}function nl(n,e){return e?{state:"loading",location:n,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}:{state:"loading",location:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Uy(n,e){return{state:"submitting",location:n,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}}function oi(n,e){return n?{state:"loading",formMethod:n.formMethod,formAction:n.formAction,formEncType:n.formEncType,formData:n.formData,json:n.json,text:n.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 Ky(n,e){return{state:"submitting",formMethod:n.formMethod,formAction:n.formAction,formEncType:n.formEncType,formData:n.formData,json:n.json,text:n.text,data:e?e.data:void 0}}function pn(n){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:n}}function Gy(n,e){try{let t=n.sessionStorage.getItem(gm);if(t){let r=JSON.parse(t);for(let[i,s]of Object.entries(r||{}))s&&Array.isArray(s)&&e.set(i,new Set(s||[]))}}catch{}}function qy(n,e){if(e.size>0){let t={};for(let[r,i]of e)t[r]=[...i];try{n.sessionStorage.setItem(gm,JSON.stringify(t))}catch(r){Ee(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function qd(){let n,e,t=new Promise((r,i)=>{n=async s=>{r(s);try{await t}catch{}},e=async s=>{i(s);try{await t}catch{}}});return{promise:t,resolve:n,reject:e}}var hr=g.createContext(null);hr.displayName="DataRouter";var Bs=g.createContext(null);Bs.displayName="DataRouterState";var Cm=g.createContext(!1);function Jy(){return g.useContext(Cm)}var fh=g.createContext({isTransitioning:!1});fh.displayName="ViewTransition";var jm=g.createContext(new Map);jm.displayName="Fetchers";var Yy=g.createContext(null);Yy.displayName="Await";var kt=g.createContext(null);kt.displayName="Navigation";var Da=g.createContext(null);Da.displayName="Location";var It=g.createContext({outlet:null,matches:[],isDataRoute:!1});It.displayName="Route";var ph=g.createContext(null);ph.displayName="RouteError";var Om="REACT_ROUTER_ERROR",Qy="REDIRECT",Xy="ROUTE_ERROR_RESPONSE";function Zy(n){if(n.startsWith(`${Om}:${Qy}:{`))try{let e=JSON.parse(n.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 e1(n){if(n.startsWith(`${Om}:${Xy}:{`))try{let e=JSON.parse(n.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new Is(e.status,e.statusText,e.data)}catch{}}function t1(n,{relative:e}={}){he(Wr(),"useHref() may be used only in the context of a <Router> component.");let{basename:t,navigator:r}=g.useContext(kt),{hash:i,pathname:s,search:o}=Fs(n,{relative:e}),a=s;return t!=="/"&&(a=s==="/"?t:rn([t,s])),r.createHref({pathname:a,search:o,hash:i})}function Wr(){return g.useContext(Da)!=null}function _t(){return he(Wr(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(Da).location}var Pm="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Nm(n){g.useContext(kt).static||g.useLayoutEffect(n)}function an(){let{isDataRoute:n}=g.useContext(It);return n?g1():n1()}function n1(){he(Wr(),"useNavigate() may be used only in the context of a <Router> component.");let n=g.useContext(hr),{basename:e,navigator:t}=g.useContext(kt),{matches:r}=g.useContext(It),{pathname:i}=_t(),s=JSON.stringify(Aa(r)),o=g.useRef(!1);return Nm(()=>{o.current=!0}),g.useCallback((l,c={})=>{if(Ee(o.current,Pm),!o.current)return;if(typeof l=="number"){t.go(l);return}let d=Ma(l,JSON.parse(s),i,c.relative==="path");n==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:rn([e,d.pathname])),(c.replace?t.replace:t.push)(d,c.state,c)},[e,t,s,i,n])}var Am=g.createContext(null);function r1(){return g.useContext(Am)}function i1(n){let e=g.useContext(It).outlet;return g.useMemo(()=>e&&g.createElement(Am.Provider,{value:n},e),[e,n])}function Mm(){let{matches:n}=g.useContext(It),e=n[n.length-1];return e?e.params:{}}function Fs(n,{relative:e}={}){let{matches:t}=g.useContext(It),{pathname:r}=_t(),i=JSON.stringify(Aa(t));return g.useMemo(()=>Ma(n,JSON.parse(i),r,e==="path"),[n,i,r,e])}function s1(n,e,t,r,i){he(Wr(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=g.useContext(kt),{matches:o}=g.useContext(It),a=o[o.length-1],l=a?a.params:{},c=a?a.pathname:"/",d=a?a.pathnameBase:"/",u=a&&a.route;{let v=u&&u.path||"";Tm(c,!u||v.endsWith("*")||v.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${v}">) 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.
20
20
 
21
- Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let f=_t(),p;p=f;let m=p.pathname||"/",b=m;if(h!=="/"){let w=h.replace(/^\//,"").split("/");b="/"+m.replace(/^\//,"").split("/").slice(w.length).join("/")}let y=jn(n,{pathname:b});return Ee(u||y!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),Ee(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.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.`),cx(y&&y.map(w=>Object.assign({},w,{params:Object.assign({},l,w.params),pathname:rn([h,s.encodeLocation?s.encodeLocation(w.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?h:rn([h,s.encodeLocation?s.encodeLocation(w.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),o,t,r,i)}function sx(){let n=px(),e=Ei(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),t=n instanceof Error?n.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},s={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",n),o=g.createElement(g.Fragment,null,g.createElement("p",null,"💿 Hey developer 👋"),g.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",g.createElement("code",{style:s},"ErrorBoundary")," or"," ",g.createElement("code",{style:s},"errorElement")," prop on your route.")),g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},e),t?g.createElement("pre",{style:i},t):null,o)}var ox=g.createElement(sx,null),Am=class extends g.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,e){return e.location!==n.location||e.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:e.error,location:e.location,revalidation:n.revalidation||e.revalidation}}componentDidCatch(n,e){this.props.onError?this.props.onError(n,e):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const t=Z1(n.digest);t&&(n=t)}let e=n!==void 0?g.createElement(Lt.Provider,{value:this.props.routeContext},g.createElement(ph.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?g.createElement(ax,{error:n},e):e}};Am.contextType=km;var rl=new WeakMap;function ax({children:n,error:e}){let{basename:t}=g.useContext(kt);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=X1(e.digest);if(r){let i=rl.get(e);if(i)throw i;let s=hm(r.location,t);if(cm&&!rl.get(e))if(s.isExternal||r.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:r.replace}));throw rl.set(e,o),o}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return n}function lx({routeContext:n,match:e,children:t}){let r=g.useContext(hr);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),g.createElement(Lt.Provider,{value:n},t)}function cx(n,e=[],t=null,r=null,i=null){if(n==null){if(!t)return null;if(t.errors)n=t.matches;else if(e.length===0&&!t.initialized&&t.matches.length>0)n=t.matches;else return null}let s=n,o=t?.errors;if(o!=null){let h=s.findIndex(u=>u.route.id&&o?.[u.route.id]!==void 0);ce(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,h+1))}let a=!1,l=-1;if(t)for(let h=0;h<s.length;h++){let u=s[h];if((u.route.HydrateFallback||u.route.hydrateFallbackElement)&&(l=h),u.route.id){let{loaderData:f,errors:p}=t,m=u.route.loader&&!f.hasOwnProperty(u.route.id)&&(!p||p[u.route.id]===void 0);if(u.route.lazy||m){a=!0,l>=0?s=s.slice(0,l+1):s=[s[0]];break}}}let c=t&&r?(h,u)=>{r(h,{location:t.location,params:t.matches?.[0]?.params??{},unstable_pattern:$s(t.matches),errorInfo:u})}:void 0;return s.reduceRight((h,u,f)=>{let p,m=!1,b=null,y=null;t&&(p=o&&u.route.id?o[u.route.id]:void 0,b=u.route.errorElement||ox,a&&(l<0&&f===0?(Mm("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),m=!0,y=null):l===f&&(m=!0,y=u.route.hydrateFallbackElement||null)));let v=e.concat(s.slice(0,f+1)),w=()=>{let C;return p?C=b:m?C=y:u.route.Component?C=g.createElement(u.route.Component,null):u.route.element?C=u.route.element:C=h,g.createElement(lx,{match:u,routeContext:{outlet:h,matches:v,isDataRoute:t!=null},children:C})};return t&&(u.route.ErrorBoundary||u.route.errorElement||f===0)?g.createElement(Am,{location:t.location,revalidation:t.revalidation,component:b,error:p,children:w(),routeContext:{outlet:null,matches:v,isDataRoute:!0},onError:c}):w()},null)}function mh(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function hx(n){let e=g.useContext(hr);return ce(e,mh(n)),e}function dx(n){let e=g.useContext(Bs);return ce(e,mh(n)),e}function ux(n){let e=g.useContext(Lt);return ce(e,mh(n)),e}function gh(n){let e=ux(n),t=e.matches[e.matches.length-1];return ce(t.route.id,`${n} can only be used on routes that contain a unique "id"`),t.route.id}function fx(){return gh("useRouteId")}function px(){let n=g.useContext(ph),e=dx("useRouteError"),t=gh("useRouteError");return n!==void 0?n:e.errors?.[t]}function mx(){let{router:n}=hx("useNavigate"),e=gh("useNavigate"),t=g.useRef(!1);return Om(()=>{t.current=!0}),g.useCallback(async(i,s={})=>{Ee(t.current,jm),t.current&&(typeof i=="number"?await n.navigate(i):await n.navigate(i,{fromRouteId:e,...s}))},[n,e])}var qd={};function Mm(n,e,t){!e&&!qd[n]&&(qd[n]=!0,Ee(!1,t))}var Jd={};function Yd(n,e){!n&&!Jd[e]&&(Jd[e]=!0,console.warn(e))}var gx="useOptimistic",Qd=Ay[gx],bx=()=>{};function yx(n){return Qd?Qd(n):[n,bx]}function xx(n){let e={hasErrorBoundary:n.hasErrorBoundary||n.ErrorBoundary!=null||n.errorElement!=null};return n.Component&&(n.element&&Ee(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(e,{element:g.createElement(n.Component),Component:void 0})),n.HydrateFallback&&(n.hydrateFallbackElement&&Ee(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(e,{hydrateFallbackElement:g.createElement(n.HydrateFallback),HydrateFallback:void 0})),n.ErrorBoundary&&(n.errorElement&&Ee(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(e,{errorElement:g.createElement(n.ErrorBoundary),ErrorBoundary:void 0})),e}var vx=["HydrateFallback","hydrateFallbackElement"],wx=class{constructor(){this.status="pending",this.promise=new Promise((n,e)=>{this.resolve=t=>{this.status==="pending"&&(this.status="resolved",n(t))},this.reject=t=>{this.status==="pending"&&(this.status="rejected",e(t))}})}};function kx({router:n,flushSync:e,onError:t,unstable_useTransitions:r}){r=q1()||r;let[s,o]=g.useState(n.state),[a,l]=yx(s),[c,h]=g.useState(),[u,f]=g.useState({isTransitioning:!1}),[p,m]=g.useState(),[b,y]=g.useState(),[v,w]=g.useState(),C=g.useRef(new Map),j=g.useCallback((T,{deletedFetchers:A,newErrors:R,flushSync:N,viewTransitionOpts:L})=>{R&&t&&Object.values(R).forEach(F=>t(F,{location:T.location,params:T.matches[0]?.params??{},unstable_pattern:$s(T.matches)})),T.fetchers.forEach((F,B)=>{F.data!==void 0&&C.current.set(B,F.data)}),A.forEach(F=>C.current.delete(F)),Yd(N===!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 W=n.window!=null&&n.window.document!=null&&typeof n.window.document.startViewTransition=="function";if(Yd(L==null||W,"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."),!L||!W){e&&N?e(()=>o(T)):r===!1?o(T):g.startTransition(()=>{r===!0&&l(F=>Xd(F,T)),o(T)});return}if(e&&N){e(()=>{b&&(p?.resolve(),b.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:L.currentLocation,nextLocation:L.nextLocation})});let F=n.window.document.startViewTransition(()=>{e(()=>o(T))});F.finished.finally(()=>{e(()=>{m(void 0),y(void 0),h(void 0),f({isTransitioning:!1})})}),e(()=>y(F));return}b?(p?.resolve(),b.skipTransition(),w({state:T,currentLocation:L.currentLocation,nextLocation:L.nextLocation})):(h(T),f({isTransitioning:!0,flushSync:!1,currentLocation:L.currentLocation,nextLocation:L.nextLocation}))},[n.window,e,b,p,r,l,t]);g.useLayoutEffect(()=>n.subscribe(j),[n,j]),g.useEffect(()=>{u.isTransitioning&&!u.flushSync&&m(new wx)},[u]),g.useEffect(()=>{if(p&&c&&n.window){let T=c,A=p.promise,R=n.window.document.startViewTransition(async()=>{r===!1?o(T):g.startTransition(()=>{r===!0&&l(N=>Xd(N,T)),o(T)}),await A});R.finished.finally(()=>{m(void 0),y(void 0),h(void 0),f({isTransitioning:!1})}),y(R)}},[c,p,n.window,r,l]),g.useEffect(()=>{p&&c&&a.location.key===c.location.key&&p.resolve()},[p,b,a.location,c]),g.useEffect(()=>{!u.isTransitioning&&v&&(h(v.state),f({isTransitioning:!0,flushSync:!1,currentLocation:v.currentLocation,nextLocation:v.nextLocation}),w(void 0))},[u.isTransitioning,v]);let k=g.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:T=>n.navigate(T),push:(T,A,R)=>n.navigate(T,{state:A,preventScrollReset:R?.preventScrollReset}),replace:(T,A,R)=>n.navigate(T,{replace:!0,state:A,preventScrollReset:R?.preventScrollReset})}),[n]),O=n.basename||"/",x=g.useMemo(()=>({router:n,navigator:k,static:!1,basename:O,onError:t}),[n,k,O,t]);return g.createElement(g.Fragment,null,g.createElement(hr.Provider,{value:x},g.createElement(Bs.Provider,{value:a},g.createElement(Sm.Provider,{value:C.current},g.createElement(fh.Provider,{value:u},g.createElement(Ox,{basename:O,location:a.location,navigationType:a.historyAction,navigator:k,unstable_useTransitions:r},g.createElement(Sx,{routes:n.routes,future:n.future,state:a,onError:t})))))),null)}function Xd(n,e){return{...n,navigation:e.navigation.state!=="idle"?e.navigation:n.navigation,revalidation:e.revalidation!=="idle"?e.revalidation:n.revalidation,actionData:e.navigation.state!=="submitting"?e.actionData:n.actionData,fetchers:e.fetchers}}var Sx=g.memo(Cx);function Cx({routes:n,future:e,state:t,onError:r}){return ix(n,void 0,t,r,e)}function il({to:n,replace:e,state:t,relative:r}){ce(Wr(),"<Navigate> may be used only in the context of a <Router> component.");let{static:i}=g.useContext(kt);Ee(!i,"<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:s}=g.useContext(Lt),{pathname:o}=_t(),a=an(),l=Ma(n,Aa(s),o,r==="path"),c=JSON.stringify(l);return g.useEffect(()=>{a(JSON.parse(c),{replace:e,state:t,relative:r})},[a,c,r,e,t]),null}function jx(n){return rx(n.context)}function Ox({basename:n="/",children:e=null,location:t,navigationType:r="POP",navigator:i,static:s=!1,unstable_useTransitions:o}){ce(!Wr(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let a=n.replace(/^\/*/,"/"),l=g.useMemo(()=>({basename:a,navigator:i,static:s,unstable_useTransitions:o,future:{}}),[a,i,s,o]);typeof t=="string"&&(t=Vn(t));let{pathname:c="/",search:h="",hash:u="",state:f=null,key:p="default"}=t,m=g.useMemo(()=>{let b=Et(c,a);return b==null?null:{location:{pathname:b,search:h,hash:u,state:f,key:p},navigationType:r}},[a,c,h,u,f,p,r]);return Ee(m!=null,`<Router basename="${a}"> is not able to match the URL "${c}${h}${u}" because it does not start with the basename, so the <Router> won't render anything.`),m==null?null:g.createElement(kt.Provider,{value:l},g.createElement(Ta.Provider,{children:e,value:m}))}var zo="get",_o="application/x-www-form-urlencoded";function Da(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function Px(n){return Da(n)&&n.tagName.toLowerCase()==="button"}function Nx(n){return Da(n)&&n.tagName.toLowerCase()==="form"}function Ax(n){return Da(n)&&n.tagName.toLowerCase()==="input"}function Mx(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function Tx(n,e){return n.button===0&&(!e||e==="_self")&&!Mx(n)}function uc(n=""){return new URLSearchParams(typeof n=="string"||Array.isArray(n)||n instanceof URLSearchParams?n:Object.keys(n).reduce((e,t)=>{let r=n[t];return e.concat(Array.isArray(r)?r.map(i=>[t,i]):[[t,r]])},[]))}function Dx(n,e){let t=uc(n);return e&&e.forEach((r,i)=>{t.has(i)||e.getAll(i).forEach(s=>{t.append(i,s)})}),t}var lo=null;function Ex(){if(lo===null)try{new FormData(document.createElement("form"),0),lo=!1}catch{lo=!0}return lo}var Rx=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function sl(n){return n!=null&&!Rx.has(n)?(Ee(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${_o}"`),null):n}function Lx(n,e){let t,r,i,s,o;if(Nx(n)){let a=n.getAttribute("action");r=a?Et(a,e):null,t=n.getAttribute("method")||zo,i=sl(n.getAttribute("enctype"))||_o,s=new FormData(n)}else if(Px(n)||Ax(n)&&(n.type==="submit"||n.type==="image")){let a=n.form;if(a==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=n.getAttribute("formaction")||a.getAttribute("action");if(r=l?Et(l,e):null,t=n.getAttribute("formmethod")||a.getAttribute("method")||zo,i=sl(n.getAttribute("formenctype"))||sl(a.getAttribute("enctype"))||_o,s=new FormData(a,n),!Ex()){let{name:c,type:h,value:u}=n;if(h==="image"){let f=c?`${c}.`:"";s.append(`${f}x`,"0"),s.append(`${f}y`,"0")}else c&&s.append(c,u)}}else{if(Da(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');t=zo,r=null,i=_o,o=n}return s&&i==="text/plain"&&(o=s,s=void 0),{action:r,method:t.toLowerCase(),encType:i,formData:s,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function bh(n,e){if(n===!1||n===null||typeof n>"u")throw new Error(e)}function Ix(n,e,t){let r=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return r.pathname==="/"?r.pathname=`_root.${t}`:e&&Et(r.pathname,e)==="/"?r.pathname=`${e.replace(/\/$/,"")}/_root.${t}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${t}`,r}async function $x(n,e){if(n.id in e)return e[n.id];try{let t=await import(n.module);return e[n.id]=t,t}catch(t){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Bx(n){return n==null?!1:n.href==null?n.rel==="preload"&&typeof n.imageSrcSet=="string"&&typeof n.imageSizes=="string":typeof n.rel=="string"&&typeof n.href=="string"}async function Fx(n,e,t){let r=await Promise.all(n.map(async i=>{let s=e.routes[i.route.id];if(s){let o=await $x(s,t);return o.links?o.links():[]}return[]}));return Hx(r.flat(1).filter(Bx).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function Zd(n,e,t,r,i,s){let o=(l,c)=>t[c]?l.route.id!==t[c].route.id:!0,a=(l,c)=>t[c].pathname!==l.pathname||t[c].route.path?.endsWith("*")&&t[c].params["*"]!==l.params["*"];return s==="assets"?e.filter((l,c)=>o(l,c)||a(l,c)):s==="data"?e.filter((l,c)=>{let h=r.routes[l.route.id];if(!h||!h.hasLoader)return!1;if(o(l,c)||a(l,c))return!0;if(l.route.shouldRevalidate){let u=l.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:t[0]?.params||{},nextUrl:new URL(n,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof u=="boolean")return u}return!0}):[]}function Vx(n,e,{includeHydrateFallback:t}={}){return zx(n.map(r=>{let i=e.routes[r.route.id];if(!i)return[];let s=[i.module];return i.clientActionModule&&(s=s.concat(i.clientActionModule)),i.clientLoaderModule&&(s=s.concat(i.clientLoaderModule)),t&&i.hydrateFallbackModule&&(s=s.concat(i.hydrateFallbackModule)),i.imports&&(s=s.concat(i.imports)),s}).flat(1))}function zx(n){return[...new Set(n)]}function _x(n){let e={},t=Object.keys(n).sort();for(let r of t)e[r]=n[r];return e}function Hx(n,e){let t=new Set;return new Set(e),n.reduce((r,i)=>{let s=JSON.stringify(_x(i));return t.has(s)||(t.add(s),r.push({key:s,link:i})),r},[])}function Tm(){let n=g.useContext(hr);return bh(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function Wx(){let n=g.useContext(Bs);return bh(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var yh=g.createContext(void 0);yh.displayName="FrameworkContext";function Dm(){let n=g.useContext(yh);return bh(n,"You must render this element inside a <HydratedRouter> element"),n}function Ux(n,e){let t=g.useContext(yh),[r,i]=g.useState(!1),[s,o]=g.useState(!1),{onFocus:a,onBlur:l,onMouseEnter:c,onMouseLeave:h,onTouchStart:u}=e,f=g.useRef(null);g.useEffect(()=>{if(n==="render"&&o(!0),n==="viewport"){let b=v=>{v.forEach(w=>{o(w.isIntersecting)})},y=new IntersectionObserver(b,{threshold:.5});return f.current&&y.observe(f.current),()=>{y.disconnect()}}},[n]),g.useEffect(()=>{if(r){let b=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(b)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return t?n!=="intent"?[s,f,{}]:[s,f,{onFocus:ai(a,p),onBlur:ai(l,m),onMouseEnter:ai(c,p),onMouseLeave:ai(h,m),onTouchStart:ai(u,p)}]:[!1,f,{}]}function ai(n,e){return t=>{n&&n(t),t.defaultPrevented||e(t)}}function Kx({page:n,...e}){let{router:t}=Tm(),r=g.useMemo(()=>jn(t.routes,n,t.basename),[t.routes,n,t.basename]);return r?g.createElement(qx,{page:n,matches:r,...e}):null}function Gx(n){let{manifest:e,routeModules:t}=Dm(),[r,i]=g.useState([]);return g.useEffect(()=>{let s=!1;return Fx(n,e,t).then(o=>{s||i(o)}),()=>{s=!0}},[n,e,t]),r}function qx({page:n,matches:e,...t}){let r=_t(),{manifest:i,routeModules:s}=Dm(),{basename:o}=Tm(),{loaderData:a,matches:l}=Wx(),c=g.useMemo(()=>Zd(n,e,l,i,r,"data"),[n,e,l,i,r]),h=g.useMemo(()=>Zd(n,e,l,i,r,"assets"),[n,e,l,i,r]),u=g.useMemo(()=>{if(n===r.pathname+r.search+r.hash)return[];let m=new Set,b=!1;if(e.forEach(v=>{let w=i.routes[v.route.id];!w||!w.hasLoader||(!c.some(C=>C.route.id===v.route.id)&&v.route.id in a&&s[v.route.id]?.shouldRevalidate||w.hasClientLoader?b=!0:m.add(v.route.id))}),m.size===0)return[];let y=Ix(n,o,"data");return b&&m.size>0&&y.searchParams.set("_routes",e.filter(v=>m.has(v.route.id)).map(v=>v.route.id).join(",")),[y.pathname+y.search]},[o,a,r,i,c,e,n,s]),f=g.useMemo(()=>Vx(h,i),[h,i]),p=Gx(h);return g.createElement(g.Fragment,null,u.map(m=>g.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...t})),f.map(m=>g.createElement("link",{key:m,rel:"modulepreload",href:m,...t})),p.map(({key:m,link:b})=>g.createElement("link",{key:m,nonce:t.nonce,...b})))}function Jx(...n){return e=>{n.forEach(t=>{typeof t=="function"?t(e):t!=null&&(t.current=e)})}}var Yx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Yx&&(window.__reactRouterVersion="7.11.0")}catch{}function Qx(n,e){return S1({basename:e?.basename,getContext:e?.getContext,future:e?.future,history:Fy({window:e?.window}),hydrationData:Xx(),routes:n,mapRouteProperties:xx,hydrationRouteProperties:vx,dataStrategy:e?.dataStrategy,patchRoutesOnNavigation:e?.patchRoutesOnNavigation,window:e?.window,unstable_instrumentations:e?.unstable_instrumentations}).initialize()}function Xx(){let n=window?.__staticRouterHydrationData;return n&&n.errors&&(n={...n,errors:Zx(n.errors)}),n}function Zx(n){if(!n)return null;let e=Object.entries(n),t={};for(let[r,i]of e)if(i&&i.__type==="RouteErrorResponse")t[r]=new Is(i.status,i.statusText,i.data,i.internal===!0);else if(i&&i.__type==="Error"){if(i.__subType){let s=window[i.__subType];if(typeof s=="function")try{let o=new s(i.message);o.stack="",t[r]=o}catch{}}if(t[r]==null){let s=new Error(i.message);s.stack="",t[r]=s}}else t[r]=i;return t}var Em=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Rm=g.forwardRef(function({onClick:e,discover:t="render",prefetch:r="none",relative:i,reloadDocument:s,replace:o,state:a,target:l,to:c,preventScrollReset:h,viewTransition:u,unstable_defaultShouldRevalidate:f,...p},m){let{basename:b,unstable_useTransitions:y}=g.useContext(kt),v=typeof c=="string"&&Em.test(c),w=hm(c,b);c=w.to;let C=ex(c,{relative:i}),[j,k,O]=Ux(r,p),x=rv(c,{replace:o,state:a,target:l,preventScrollReset:h,relative:i,viewTransition:u,unstable_defaultShouldRevalidate:f,unstable_useTransitions:y});function T(R){e&&e(R),R.defaultPrevented||x(R)}let A=g.createElement("a",{...p,...O,href:w.absoluteURL||C,onClick:w.isExternal||s?e:T,ref:Jx(m,k),target:l,"data-discover":!v&&t==="render"?"true":void 0});return j&&!v?g.createElement(g.Fragment,null,A,g.createElement(Kx,{page:C})):A});Rm.displayName="Link";var ev=g.forwardRef(function({"aria-current":e="page",caseSensitive:t=!1,className:r="",end:i=!1,style:s,to:o,viewTransition:a,children:l,...c},h){let u=Fs(o,{relative:c.relative}),f=_t(),p=g.useContext(Bs),{navigator:m,basename:b}=g.useContext(kt),y=p!=null&&cv(u)&&a===!0,v=m.encodeLocation?m.encodeLocation(u).pathname:u.pathname,w=f.pathname,C=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(w=w.toLowerCase(),C=C?C.toLowerCase():null,v=v.toLowerCase()),C&&b&&(C=Et(C,b)||C);const j=v!=="/"&&v.endsWith("/")?v.length-1:v.length;let k=w===v||!i&&w.startsWith(v)&&w.charAt(j)==="/",O=C!=null&&(C===v||!i&&C.startsWith(v)&&C.charAt(v.length)==="/"),x={isActive:k,isPending:O,isTransitioning:y},T=k?e:void 0,A;typeof r=="function"?A=r(x):A=[r,k?"active":null,O?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let R=typeof s=="function"?s(x):s;return g.createElement(Rm,{...c,"aria-current":T,className:A,ref:h,style:R,to:o,viewTransition:a},typeof l=="function"?l(x):l)});ev.displayName="NavLink";var tv=g.forwardRef(({discover:n="render",fetcherKey:e,navigate:t,reloadDocument:r,replace:i,state:s,method:o=zo,action:a,onSubmit:l,relative:c,preventScrollReset:h,viewTransition:u,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:b}=g.useContext(kt),y=av(),v=lv(a,{relative:c}),w=o.toLowerCase()==="get"?"get":"post",C=typeof a=="string"&&Em.test(a),j=k=>{if(l&&l(k),k.defaultPrevented)return;k.preventDefault();let O=k.nativeEvent.submitter,x=O?.getAttribute("formmethod")||o,T=()=>y(O||k.currentTarget,{fetcherKey:e,method:x,navigate:t,replace:i,state:s,relative:c,preventScrollReset:h,viewTransition:u,unstable_defaultShouldRevalidate:f});b&&t!==!1?g.startTransition(()=>T()):T()};return g.createElement("form",{ref:m,method:w,action:v,onSubmit:r?l:j,...p,"data-discover":!C&&n==="render"?"true":void 0})});tv.displayName="Form";function nv(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Lm(n){let e=g.useContext(hr);return ce(e,nv(n)),e}function rv(n,{target:e,replace:t,state:r,preventScrollReset:i,relative:s,viewTransition:o,unstable_defaultShouldRevalidate:a,unstable_useTransitions:l}={}){let c=an(),h=_t(),u=Fs(n,{relative:s});return g.useCallback(f=>{if(Tx(f,e)){f.preventDefault();let p=t!==void 0?t:on(h)===on(u),m=()=>c(n,{replace:p,state:r,preventScrollReset:i,relative:s,viewTransition:o,unstable_defaultShouldRevalidate:a});l?g.startTransition(()=>m()):m()}},[h,c,u,t,r,e,n,i,s,o,a,l])}function iv(n){Ee(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=g.useRef(uc(n)),t=g.useRef(!1),r=_t(),i=g.useMemo(()=>Dx(r.search,t.current?null:e.current),[r.search]),s=an(),o=g.useCallback((a,l)=>{const c=uc(typeof a=="function"?a(new URLSearchParams(i)):a);t.current=!0,s("?"+c,l)},[s,i]);return[i,o]}var sv=0,ov=()=>`__${String(++sv)}__`;function av(){let{router:n}=Lm("useSubmit"),{basename:e}=g.useContext(kt),t=fx(),r=n.fetch,i=n.navigate;return g.useCallback(async(s,o={})=>{let{action:a,method:l,encType:c,formData:h,body:u}=Lx(s,e);if(o.navigate===!1){let f=o.fetcherKey||ov();await r(f,t,o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:h,body:u,formMethod:o.method||l,formEncType:o.encType||c,flushSync:o.flushSync})}else await i(o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:h,body:u,formMethod:o.method||l,formEncType:o.encType||c,replace:o.replace,state:o.state,fromRouteId:t,flushSync:o.flushSync,viewTransition:o.viewTransition})},[r,i,e,t])}function lv(n,{relative:e}={}){let{basename:t}=g.useContext(kt),r=g.useContext(Lt);ce(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),s={...Fs(n||".",{relative:e})},o=_t();if(n==null){s.search=o.search;let a=new URLSearchParams(s.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();s.search=h?`?${h}`:""}}return(!n||n===".")&&i.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),t!=="/"&&(s.pathname=s.pathname==="/"?t:rn([t,s.pathname])),on(s)}function cv(n,{relative:e}={}){let t=g.useContext(fh);ce(t!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Lm("useViewTransitionState"),i=Fs(n,{relative:e});if(!t.isTransitioning)return!1;let s=Et(t.currentLocation.pathname,r)||t.currentLocation.pathname,o=Et(t.nextLocation.pathname,r)||t.nextLocation.pathname;return Zo(i.pathname,o)!=null||Zo(i.pathname,s)!=null}function hv(n){return g.createElement(kx,{flushSync:em.flushSync,...n})}const dv={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",configEditor:"Config Editor",projects:"Projects",addProject:"Add Project",global:"Global",skills:"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",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",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",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",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 Context Awareness",fieldHookUsageContextAwarenessDesc:"Usage limits awareness",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",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"},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",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",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",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",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",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",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 ngữ cảnh sử dụng",fieldHookUsageContextAwarenessDesc:"Nhận thức giới hạn sử dụng",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",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"}},xh=g.createContext(null),Im="ck-dashboard-lang";function uv(){const n=localStorage.getItem(Im);return n==="en"||n==="vi"?n:navigator.language.startsWith("vi")?"vi":"en"}function fv({children:n}){const[e,t]=g.useState(uv),r=g.useCallback(o=>{localStorage.setItem(Im,o),t(o)},[]),i=g.useCallback(o=>dv[e][o],[e]),s=g.useMemo(()=>({lang:e,setLang:r,t:i}),[e,r,i]);return d.jsx(xh.Provider,{value:s,children:n})}function he(){const n=g.useContext(xh);if(!n)throw new Error("useI18n must be used within I18nProvider");return n}class pv extends g.Component{constructor(){super(...arguments);Cd(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,r){console.error("App error:",t,r.componentStack)}render(){if(this.state.hasError){const t=this.state.error?.name==="ServerUnavailableError";return d.jsx(xh.Consumer,{children:r=>d.jsx("div",{className:"flex h-screen items-center justify-center bg-dash-bg",children:d.jsx("div",{className:"text-center space-y-4 max-w-md px-6",children:t?d.jsxs(d.Fragment,{children:[d.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:"🔌"}),d.jsx("h1",{className:"text-2xl font-bold text-orange-500",children:r?.t("serverNotRunning")??"Server Not Running"}),d.jsx("p",{className:"text-dash-text-secondary",children:r?.t("startServerMessage")??"The Config UI requires the backend server to be running."}),d.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-lg p-4",children:[d.jsx("p",{className:"text-xs text-dash-text-muted uppercase tracking-widest mb-2 font-bold",children:r?.t("runThisCommand")??"Run this command"}),d.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"})]}),d.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"})]}):d.jsxs(d.Fragment,{children:[d.jsx("h1",{className:"text-2xl font-bold text-red-500",children:r?.t("somethingWentWrong")??"Something went wrong"}),d.jsx("p",{className:"text-dash-text-muted",children:this.state.error?.message}),d.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 Pr=({direction:n="horizontal",isDragging:e=!1,onMouseDown:t})=>{const r=n==="horizontal";return d.jsx("div",{onMouseDown:t,className:`
21
+ Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}/*`}">.`)}let f=_t(),p;p=f;let m=p.pathname||"/",b=m;if(d!=="/"){let v=d.replace(/^\//,"").split("/");b="/"+m.replace(/^\//,"").split("/").slice(v.length).join("/")}let x=jn(n,{pathname:b});return Ee(u||x!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),Ee(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.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.`),h1(x&&x.map(v=>Object.assign({},v,{params:Object.assign({},l,v.params),pathname:rn([d,s.encodeLocation?s.encodeLocation(v.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?d:rn([d,s.encodeLocation?s.encodeLocation(v.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:v.pathnameBase])})),o,t,r,i)}function o1(){let n=m1(),e=Ei(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),t=n instanceof Error?n.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},s={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",n),o=g.createElement(g.Fragment,null,g.createElement("p",null,"💿 Hey developer 👋"),g.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",g.createElement("code",{style:s},"ErrorBoundary")," or"," ",g.createElement("code",{style:s},"errorElement")," prop on your route.")),g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},e),t?g.createElement("pre",{style:i},t):null,o)}var a1=g.createElement(o1,null),Dm=class extends g.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,e){return e.location!==n.location||e.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:e.error,location:e.location,revalidation:n.revalidation||e.revalidation}}componentDidCatch(n,e){this.props.onError?this.props.onError(n,e):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const t=e1(n.digest);t&&(n=t)}let e=n!==void 0?g.createElement(It.Provider,{value:this.props.routeContext},g.createElement(ph.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?g.createElement(l1,{error:n},e):e}};Dm.contextType=Cm;var rl=new WeakMap;function l1({children:n,error:e}){let{basename:t}=g.useContext(kt);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=Zy(e.digest);if(r){let i=rl.get(e);if(i)throw i;let s=um(r.location,t);if(dm&&!rl.get(e))if(s.isExternal||r.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:r.replace}));throw rl.set(e,o),o}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return n}function c1({routeContext:n,match:e,children:t}){let r=g.useContext(hr);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),g.createElement(It.Provider,{value:n},t)}function h1(n,e=[],t=null,r=null,i=null){if(n==null){if(!t)return null;if(t.errors)n=t.matches;else if(e.length===0&&!t.initialized&&t.matches.length>0)n=t.matches;else return null}let s=n,o=t?.errors;if(o!=null){let d=s.findIndex(u=>u.route.id&&o?.[u.route.id]!==void 0);he(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,d+1))}let a=!1,l=-1;if(t)for(let d=0;d<s.length;d++){let u=s[d];if((u.route.HydrateFallback||u.route.hydrateFallbackElement)&&(l=d),u.route.id){let{loaderData:f,errors:p}=t,m=u.route.loader&&!f.hasOwnProperty(u.route.id)&&(!p||p[u.route.id]===void 0);if(u.route.lazy||m){a=!0,l>=0?s=s.slice(0,l+1):s=[s[0]];break}}}let c=t&&r?(d,u)=>{r(d,{location:t.location,params:t.matches?.[0]?.params??{},unstable_pattern:$s(t.matches),errorInfo:u})}:void 0;return s.reduceRight((d,u,f)=>{let p,m=!1,b=null,x=null;t&&(p=o&&u.route.id?o[u.route.id]:void 0,b=u.route.errorElement||a1,a&&(l<0&&f===0?(Tm("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),m=!0,x=null):l===f&&(m=!0,x=u.route.hydrateFallbackElement||null)));let w=e.concat(s.slice(0,f+1)),v=()=>{let S;return p?S=b:m?S=x:u.route.Component?S=g.createElement(u.route.Component,null):u.route.element?S=u.route.element:S=d,g.createElement(c1,{match:u,routeContext:{outlet:d,matches:w,isDataRoute:t!=null},children:S})};return t&&(u.route.ErrorBoundary||u.route.errorElement||f===0)?g.createElement(Dm,{location:t.location,revalidation:t.revalidation,component:b,error:p,children:v(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:c}):v()},null)}function mh(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function d1(n){let e=g.useContext(hr);return he(e,mh(n)),e}function u1(n){let e=g.useContext(Bs);return he(e,mh(n)),e}function f1(n){let e=g.useContext(It);return he(e,mh(n)),e}function gh(n){let e=f1(n),t=e.matches[e.matches.length-1];return he(t.route.id,`${n} can only be used on routes that contain a unique "id"`),t.route.id}function p1(){return gh("useRouteId")}function m1(){let n=g.useContext(ph),e=u1("useRouteError"),t=gh("useRouteError");return n!==void 0?n:e.errors?.[t]}function g1(){let{router:n}=d1("useNavigate"),e=gh("useNavigate"),t=g.useRef(!1);return Nm(()=>{t.current=!0}),g.useCallback(async(i,s={})=>{Ee(t.current,Pm),t.current&&(typeof i=="number"?await n.navigate(i):await n.navigate(i,{fromRouteId:e,...s}))},[n,e])}var Jd={};function Tm(n,e,t){!e&&!Jd[n]&&(Jd[n]=!0,Ee(!1,t))}var Yd={};function Qd(n,e){!n&&!Yd[e]&&(Yd[e]=!0,console.warn(e))}var b1="useOptimistic",Xd=Mx[b1],x1=()=>{};function y1(n){return Xd?Xd(n):[n,x1]}function v1(n){let e={hasErrorBoundary:n.hasErrorBoundary||n.ErrorBoundary!=null||n.errorElement!=null};return n.Component&&(n.element&&Ee(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(e,{element:g.createElement(n.Component),Component:void 0})),n.HydrateFallback&&(n.hydrateFallbackElement&&Ee(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(e,{hydrateFallbackElement:g.createElement(n.HydrateFallback),HydrateFallback:void 0})),n.ErrorBoundary&&(n.errorElement&&Ee(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(e,{errorElement:g.createElement(n.ErrorBoundary),ErrorBoundary:void 0})),e}var w1=["HydrateFallback","hydrateFallbackElement"],k1=class{constructor(){this.status="pending",this.promise=new Promise((n,e)=>{this.resolve=t=>{this.status==="pending"&&(this.status="resolved",n(t))},this.reject=t=>{this.status==="pending"&&(this.status="rejected",e(t))}})}};function S1({router:n,flushSync:e,onError:t,unstable_useTransitions:r}){r=Jy()||r;let[s,o]=g.useState(n.state),[a,l]=y1(s),[c,d]=g.useState(),[u,f]=g.useState({isTransitioning:!1}),[p,m]=g.useState(),[b,x]=g.useState(),[w,v]=g.useState(),S=g.useRef(new Map),j=g.useCallback((D,{deletedFetchers:A,newErrors:R,flushSync:N,viewTransitionOpts:L})=>{R&&t&&Object.values(R).forEach(F=>t(F,{location:D.location,params:D.matches[0]?.params??{},unstable_pattern:$s(D.matches)})),D.fetchers.forEach((F,B)=>{F.data!==void 0&&S.current.set(B,F.data)}),A.forEach(F=>S.current.delete(F)),Qd(N===!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 W=n.window!=null&&n.window.document!=null&&typeof n.window.document.startViewTransition=="function";if(Qd(L==null||W,"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."),!L||!W){e&&N?e(()=>o(D)):r===!1?o(D):g.startTransition(()=>{r===!0&&l(F=>Zd(F,D)),o(D)});return}if(e&&N){e(()=>{b&&(p?.resolve(),b.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:L.currentLocation,nextLocation:L.nextLocation})});let F=n.window.document.startViewTransition(()=>{e(()=>o(D))});F.finished.finally(()=>{e(()=>{m(void 0),x(void 0),d(void 0),f({isTransitioning:!1})})}),e(()=>x(F));return}b?(p?.resolve(),b.skipTransition(),v({state:D,currentLocation:L.currentLocation,nextLocation:L.nextLocation})):(d(D),f({isTransitioning:!0,flushSync:!1,currentLocation:L.currentLocation,nextLocation:L.nextLocation}))},[n.window,e,b,p,r,l,t]);g.useLayoutEffect(()=>n.subscribe(j),[n,j]),g.useEffect(()=>{u.isTransitioning&&!u.flushSync&&m(new k1)},[u]),g.useEffect(()=>{if(p&&c&&n.window){let D=c,A=p.promise,R=n.window.document.startViewTransition(async()=>{r===!1?o(D):g.startTransition(()=>{r===!0&&l(N=>Zd(N,D)),o(D)}),await A});R.finished.finally(()=>{m(void 0),x(void 0),d(void 0),f({isTransitioning:!1})}),x(R)}},[c,p,n.window,r,l]),g.useEffect(()=>{p&&c&&a.location.key===c.location.key&&p.resolve()},[p,b,a.location,c]),g.useEffect(()=>{!u.isTransitioning&&w&&(d(w.state),f({isTransitioning:!0,flushSync:!1,currentLocation:w.currentLocation,nextLocation:w.nextLocation}),v(void 0))},[u.isTransitioning,w]);let k=g.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:D=>n.navigate(D),push:(D,A,R)=>n.navigate(D,{state:A,preventScrollReset:R?.preventScrollReset}),replace:(D,A,R)=>n.navigate(D,{replace:!0,state:A,preventScrollReset:R?.preventScrollReset})}),[n]),O=n.basename||"/",y=g.useMemo(()=>({router:n,navigator:k,static:!1,basename:O,onError:t}),[n,k,O,t]);return g.createElement(g.Fragment,null,g.createElement(hr.Provider,{value:y},g.createElement(Bs.Provider,{value:a},g.createElement(jm.Provider,{value:S.current},g.createElement(fh.Provider,{value:u},g.createElement(P1,{basename:O,location:a.location,navigationType:a.historyAction,navigator:k,unstable_useTransitions:r},g.createElement(C1,{routes:n.routes,future:n.future,state:a,onError:t})))))),null)}function Zd(n,e){return{...n,navigation:e.navigation.state!=="idle"?e.navigation:n.navigation,revalidation:e.revalidation!=="idle"?e.revalidation:n.revalidation,actionData:e.navigation.state!=="submitting"?e.actionData:n.actionData,fetchers:e.fetchers}}var C1=g.memo(j1);function j1({routes:n,future:e,state:t,onError:r}){return s1(n,void 0,t,r,e)}function il({to:n,replace:e,state:t,relative:r}){he(Wr(),"<Navigate> may be used only in the context of a <Router> component.");let{static:i}=g.useContext(kt);Ee(!i,"<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:s}=g.useContext(It),{pathname:o}=_t(),a=an(),l=Ma(n,Aa(s),o,r==="path"),c=JSON.stringify(l);return g.useEffect(()=>{a(JSON.parse(c),{replace:e,state:t,relative:r})},[a,c,r,e,t]),null}function O1(n){return i1(n.context)}function P1({basename:n="/",children:e=null,location:t,navigationType:r="POP",navigator:i,static:s=!1,unstable_useTransitions:o}){he(!Wr(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let a=n.replace(/^\/*/,"/"),l=g.useMemo(()=>({basename:a,navigator:i,static:s,unstable_useTransitions:o,future:{}}),[a,i,s,o]);typeof t=="string"&&(t=Vn(t));let{pathname:c="/",search:d="",hash:u="",state:f=null,key:p="default"}=t,m=g.useMemo(()=>{let b=Rt(c,a);return b==null?null:{location:{pathname:b,search:d,hash:u,state:f,key:p},navigationType:r}},[a,c,d,u,f,p,r]);return Ee(m!=null,`<Router basename="${a}"> is not able to match the URL "${c}${d}${u}" because it does not start with the basename, so the <Router> won't render anything.`),m==null?null:g.createElement(kt.Provider,{value:l},g.createElement(Da.Provider,{children:e,value:m}))}var zo="get",_o="application/x-www-form-urlencoded";function Ta(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function N1(n){return Ta(n)&&n.tagName.toLowerCase()==="button"}function A1(n){return Ta(n)&&n.tagName.toLowerCase()==="form"}function M1(n){return Ta(n)&&n.tagName.toLowerCase()==="input"}function D1(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function T1(n,e){return n.button===0&&(!e||e==="_self")&&!D1(n)}function uc(n=""){return new URLSearchParams(typeof n=="string"||Array.isArray(n)||n instanceof URLSearchParams?n:Object.keys(n).reduce((e,t)=>{let r=n[t];return e.concat(Array.isArray(r)?r.map(i=>[t,i]):[[t,r]])},[]))}function E1(n,e){let t=uc(n);return e&&e.forEach((r,i)=>{t.has(i)||e.getAll(i).forEach(s=>{t.append(i,s)})}),t}var lo=null;function R1(){if(lo===null)try{new FormData(document.createElement("form"),0),lo=!1}catch{lo=!0}return lo}var L1=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function sl(n){return n!=null&&!L1.has(n)?(Ee(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${_o}"`),null):n}function I1(n,e){let t,r,i,s,o;if(A1(n)){let a=n.getAttribute("action");r=a?Rt(a,e):null,t=n.getAttribute("method")||zo,i=sl(n.getAttribute("enctype"))||_o,s=new FormData(n)}else if(N1(n)||M1(n)&&(n.type==="submit"||n.type==="image")){let a=n.form;if(a==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=n.getAttribute("formaction")||a.getAttribute("action");if(r=l?Rt(l,e):null,t=n.getAttribute("formmethod")||a.getAttribute("method")||zo,i=sl(n.getAttribute("formenctype"))||sl(a.getAttribute("enctype"))||_o,s=new FormData(a,n),!R1()){let{name:c,type:d,value:u}=n;if(d==="image"){let f=c?`${c}.`:"";s.append(`${f}x`,"0"),s.append(`${f}y`,"0")}else c&&s.append(c,u)}}else{if(Ta(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');t=zo,r=null,i=_o,o=n}return s&&i==="text/plain"&&(o=s,s=void 0),{action:r,method:t.toLowerCase(),encType:i,formData:s,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function bh(n,e){if(n===!1||n===null||typeof n>"u")throw new Error(e)}function $1(n,e,t){let r=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return r.pathname==="/"?r.pathname=`_root.${t}`:e&&Rt(r.pathname,e)==="/"?r.pathname=`${e.replace(/\/$/,"")}/_root.${t}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${t}`,r}async function B1(n,e){if(n.id in e)return e[n.id];try{let t=await import(n.module);return e[n.id]=t,t}catch(t){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function F1(n){return n==null?!1:n.href==null?n.rel==="preload"&&typeof n.imageSrcSet=="string"&&typeof n.imageSizes=="string":typeof n.rel=="string"&&typeof n.href=="string"}async function V1(n,e,t){let r=await Promise.all(n.map(async i=>{let s=e.routes[i.route.id];if(s){let o=await B1(s,t);return o.links?o.links():[]}return[]}));return W1(r.flat(1).filter(F1).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function eu(n,e,t,r,i,s){let o=(l,c)=>t[c]?l.route.id!==t[c].route.id:!0,a=(l,c)=>t[c].pathname!==l.pathname||t[c].route.path?.endsWith("*")&&t[c].params["*"]!==l.params["*"];return s==="assets"?e.filter((l,c)=>o(l,c)||a(l,c)):s==="data"?e.filter((l,c)=>{let d=r.routes[l.route.id];if(!d||!d.hasLoader)return!1;if(o(l,c)||a(l,c))return!0;if(l.route.shouldRevalidate){let u=l.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:t[0]?.params||{},nextUrl:new URL(n,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof u=="boolean")return u}return!0}):[]}function z1(n,e,{includeHydrateFallback:t}={}){return _1(n.map(r=>{let i=e.routes[r.route.id];if(!i)return[];let s=[i.module];return i.clientActionModule&&(s=s.concat(i.clientActionModule)),i.clientLoaderModule&&(s=s.concat(i.clientLoaderModule)),t&&i.hydrateFallbackModule&&(s=s.concat(i.hydrateFallbackModule)),i.imports&&(s=s.concat(i.imports)),s}).flat(1))}function _1(n){return[...new Set(n)]}function H1(n){let e={},t=Object.keys(n).sort();for(let r of t)e[r]=n[r];return e}function W1(n,e){let t=new Set;return new Set(e),n.reduce((r,i)=>{let s=JSON.stringify(H1(i));return t.has(s)||(t.add(s),r.push({key:s,link:i})),r},[])}function Em(){let n=g.useContext(hr);return bh(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function U1(){let n=g.useContext(Bs);return bh(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var xh=g.createContext(void 0);xh.displayName="FrameworkContext";function Rm(){let n=g.useContext(xh);return bh(n,"You must render this element inside a <HydratedRouter> element"),n}function K1(n,e){let t=g.useContext(xh),[r,i]=g.useState(!1),[s,o]=g.useState(!1),{onFocus:a,onBlur:l,onMouseEnter:c,onMouseLeave:d,onTouchStart:u}=e,f=g.useRef(null);g.useEffect(()=>{if(n==="render"&&o(!0),n==="viewport"){let b=w=>{w.forEach(v=>{o(v.isIntersecting)})},x=new IntersectionObserver(b,{threshold:.5});return f.current&&x.observe(f.current),()=>{x.disconnect()}}},[n]),g.useEffect(()=>{if(r){let b=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(b)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return t?n!=="intent"?[s,f,{}]:[s,f,{onFocus:ai(a,p),onBlur:ai(l,m),onMouseEnter:ai(c,p),onMouseLeave:ai(d,m),onTouchStart:ai(u,p)}]:[!1,f,{}]}function ai(n,e){return t=>{n&&n(t),t.defaultPrevented||e(t)}}function G1({page:n,...e}){let{router:t}=Em(),r=g.useMemo(()=>jn(t.routes,n,t.basename),[t.routes,n,t.basename]);return r?g.createElement(J1,{page:n,matches:r,...e}):null}function q1(n){let{manifest:e,routeModules:t}=Rm(),[r,i]=g.useState([]);return g.useEffect(()=>{let s=!1;return V1(n,e,t).then(o=>{s||i(o)}),()=>{s=!0}},[n,e,t]),r}function J1({page:n,matches:e,...t}){let r=_t(),{manifest:i,routeModules:s}=Rm(),{basename:o}=Em(),{loaderData:a,matches:l}=U1(),c=g.useMemo(()=>eu(n,e,l,i,r,"data"),[n,e,l,i,r]),d=g.useMemo(()=>eu(n,e,l,i,r,"assets"),[n,e,l,i,r]),u=g.useMemo(()=>{if(n===r.pathname+r.search+r.hash)return[];let m=new Set,b=!1;if(e.forEach(w=>{let v=i.routes[w.route.id];!v||!v.hasLoader||(!c.some(S=>S.route.id===w.route.id)&&w.route.id in a&&s[w.route.id]?.shouldRevalidate||v.hasClientLoader?b=!0:m.add(w.route.id))}),m.size===0)return[];let x=$1(n,o,"data");return b&&m.size>0&&x.searchParams.set("_routes",e.filter(w=>m.has(w.route.id)).map(w=>w.route.id).join(",")),[x.pathname+x.search]},[o,a,r,i,c,e,n,s]),f=g.useMemo(()=>z1(d,i),[d,i]),p=q1(d);return g.createElement(g.Fragment,null,u.map(m=>g.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...t})),f.map(m=>g.createElement("link",{key:m,rel:"modulepreload",href:m,...t})),p.map(({key:m,link:b})=>g.createElement("link",{key:m,nonce:t.nonce,...b})))}function Y1(...n){return e=>{n.forEach(t=>{typeof t=="function"?t(e):t!=null&&(t.current=e)})}}var Q1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Q1&&(window.__reactRouterVersion="7.11.0")}catch{}function X1(n,e){return Cy({basename:e?.basename,getContext:e?.getContext,future:e?.future,history:Vx({window:e?.window}),hydrationData:Z1(),routes:n,mapRouteProperties:v1,hydrationRouteProperties:w1,dataStrategy:e?.dataStrategy,patchRoutesOnNavigation:e?.patchRoutesOnNavigation,window:e?.window,unstable_instrumentations:e?.unstable_instrumentations}).initialize()}function Z1(){let n=window?.__staticRouterHydrationData;return n&&n.errors&&(n={...n,errors:ev(n.errors)}),n}function ev(n){if(!n)return null;let e=Object.entries(n),t={};for(let[r,i]of e)if(i&&i.__type==="RouteErrorResponse")t[r]=new Is(i.status,i.statusText,i.data,i.internal===!0);else if(i&&i.__type==="Error"){if(i.__subType){let s=window[i.__subType];if(typeof s=="function")try{let o=new s(i.message);o.stack="",t[r]=o}catch{}}if(t[r]==null){let s=new Error(i.message);s.stack="",t[r]=s}}else t[r]=i;return t}var Lm=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Im=g.forwardRef(function({onClick:e,discover:t="render",prefetch:r="none",relative:i,reloadDocument:s,replace:o,state:a,target:l,to:c,preventScrollReset:d,viewTransition:u,unstable_defaultShouldRevalidate:f,...p},m){let{basename:b,unstable_useTransitions:x}=g.useContext(kt),w=typeof c=="string"&&Lm.test(c),v=um(c,b);c=v.to;let S=t1(c,{relative:i}),[j,k,O]=K1(r,p),y=iv(c,{replace:o,state:a,target:l,preventScrollReset:d,relative:i,viewTransition:u,unstable_defaultShouldRevalidate:f,unstable_useTransitions:x});function D(R){e&&e(R),R.defaultPrevented||y(R)}let A=g.createElement("a",{...p,...O,href:v.absoluteURL||S,onClick:v.isExternal||s?e:D,ref:Y1(m,k),target:l,"data-discover":!w&&t==="render"?"true":void 0});return j&&!w?g.createElement(g.Fragment,null,A,g.createElement(G1,{page:S})):A});Im.displayName="Link";var tv=g.forwardRef(function({"aria-current":e="page",caseSensitive:t=!1,className:r="",end:i=!1,style:s,to:o,viewTransition:a,children:l,...c},d){let u=Fs(o,{relative:c.relative}),f=_t(),p=g.useContext(Bs),{navigator:m,basename:b}=g.useContext(kt),x=p!=null&&hv(u)&&a===!0,w=m.encodeLocation?m.encodeLocation(u).pathname:u.pathname,v=f.pathname,S=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(v=v.toLowerCase(),S=S?S.toLowerCase():null,w=w.toLowerCase()),S&&b&&(S=Rt(S,b)||S);const j=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let k=v===w||!i&&v.startsWith(w)&&v.charAt(j)==="/",O=S!=null&&(S===w||!i&&S.startsWith(w)&&S.charAt(w.length)==="/"),y={isActive:k,isPending:O,isTransitioning:x},D=k?e:void 0,A;typeof r=="function"?A=r(y):A=[r,k?"active":null,O?"pending":null,x?"transitioning":null].filter(Boolean).join(" ");let R=typeof s=="function"?s(y):s;return g.createElement(Im,{...c,"aria-current":D,className:A,ref:d,style:R,to:o,viewTransition:a},typeof l=="function"?l(y):l)});tv.displayName="NavLink";var nv=g.forwardRef(({discover:n="render",fetcherKey:e,navigate:t,reloadDocument:r,replace:i,state:s,method:o=zo,action:a,onSubmit:l,relative:c,preventScrollReset:d,viewTransition:u,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:b}=g.useContext(kt),x=lv(),w=cv(a,{relative:c}),v=o.toLowerCase()==="get"?"get":"post",S=typeof a=="string"&&Lm.test(a),j=k=>{if(l&&l(k),k.defaultPrevented)return;k.preventDefault();let O=k.nativeEvent.submitter,y=O?.getAttribute("formmethod")||o,D=()=>x(O||k.currentTarget,{fetcherKey:e,method:y,navigate:t,replace:i,state:s,relative:c,preventScrollReset:d,viewTransition:u,unstable_defaultShouldRevalidate:f});b&&t!==!1?g.startTransition(()=>D()):D()};return g.createElement("form",{ref:m,method:v,action:w,onSubmit:r?l:j,...p,"data-discover":!S&&n==="render"?"true":void 0})});nv.displayName="Form";function rv(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function $m(n){let e=g.useContext(hr);return he(e,rv(n)),e}function iv(n,{target:e,replace:t,state:r,preventScrollReset:i,relative:s,viewTransition:o,unstable_defaultShouldRevalidate:a,unstable_useTransitions:l}={}){let c=an(),d=_t(),u=Fs(n,{relative:s});return g.useCallback(f=>{if(T1(f,e)){f.preventDefault();let p=t!==void 0?t:on(d)===on(u),m=()=>c(n,{replace:p,state:r,preventScrollReset:i,relative:s,viewTransition:o,unstable_defaultShouldRevalidate:a});l?g.startTransition(()=>m()):m()}},[d,c,u,t,r,e,n,i,s,o,a,l])}function sv(n){Ee(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=g.useRef(uc(n)),t=g.useRef(!1),r=_t(),i=g.useMemo(()=>E1(r.search,t.current?null:e.current),[r.search]),s=an(),o=g.useCallback((a,l)=>{const c=uc(typeof a=="function"?a(new URLSearchParams(i)):a);t.current=!0,s("?"+c,l)},[s,i]);return[i,o]}var ov=0,av=()=>`__${String(++ov)}__`;function lv(){let{router:n}=$m("useSubmit"),{basename:e}=g.useContext(kt),t=p1(),r=n.fetch,i=n.navigate;return g.useCallback(async(s,o={})=>{let{action:a,method:l,encType:c,formData:d,body:u}=I1(s,e);if(o.navigate===!1){let f=o.fetcherKey||av();await r(f,t,o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:u,formMethod:o.method||l,formEncType:o.encType||c,flushSync:o.flushSync})}else await i(o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:u,formMethod:o.method||l,formEncType:o.encType||c,replace:o.replace,state:o.state,fromRouteId:t,flushSync:o.flushSync,viewTransition:o.viewTransition})},[r,i,e,t])}function cv(n,{relative:e}={}){let{basename:t}=g.useContext(kt),r=g.useContext(It);he(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),s={...Fs(n||".",{relative:e})},o=_t();if(n==null){s.search=o.search;let a=new URLSearchParams(s.search),l=a.getAll("index");if(l.some(d=>d==="")){a.delete("index"),l.filter(u=>u).forEach(u=>a.append("index",u));let d=a.toString();s.search=d?`?${d}`:""}}return(!n||n===".")&&i.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),t!=="/"&&(s.pathname=s.pathname==="/"?t:rn([t,s.pathname])),on(s)}function hv(n,{relative:e}={}){let t=g.useContext(fh);he(t!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=$m("useViewTransitionState"),i=Fs(n,{relative:e});if(!t.isTransitioning)return!1;let s=Rt(t.currentLocation.pathname,r)||t.currentLocation.pathname,o=Rt(t.nextLocation.pathname,r)||t.nextLocation.pathname;return Zo(i.pathname,o)!=null||Zo(i.pathname,s)!=null}function dv(n){return g.createElement(S1,{flushSync:nm.flushSync,...n})}const uv={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",configEditor:"Config Editor",projects:"Projects",addProject:"Add Project",global:"Global",skills:"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",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",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",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",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 Context Awareness",fieldHookUsageContextAwarenessDesc:"Usage limits awareness",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",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"},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",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",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",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õ",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",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",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 ngữ cảnh sử dụng",fieldHookUsageContextAwarenessDesc:"Nhận thức giới hạn sử dụng",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",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"}},yh=g.createContext(null),Bm="ck-dashboard-lang";function fv(){const n=localStorage.getItem(Bm);return n==="en"||n==="vi"?n:navigator.language.startsWith("vi")?"vi":"en"}function pv({children:n}){const[e,t]=g.useState(fv),r=g.useCallback(o=>{localStorage.setItem(Bm,o),t(o)},[]),i=g.useCallback(o=>uv[e][o],[e]),s=g.useMemo(()=>({lang:e,setLang:r,t:i}),[e,r,i]);return h.jsx(yh.Provider,{value:s,children:n})}function ce(){const n=g.useContext(yh);if(!n)throw new Error("useI18n must be used within I18nProvider");return n}class mv extends g.Component{constructor(){super(...arguments);jd(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,r){console.error("App error:",t,r.componentStack)}render(){if(this.state.hasError){const t=this.state.error?.name==="ServerUnavailableError";return h.jsx(yh.Consumer,{children:r=>h.jsx("div",{className:"flex h-screen items-center justify-center bg-dash-bg",children:h.jsx("div",{className:"text-center space-y-4 max-w-md px-6",children:t?h.jsxs(h.Fragment,{children:[h.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:"🔌"}),h.jsx("h1",{className:"text-2xl font-bold text-orange-500",children:r?.t("serverNotRunning")??"Server Not Running"}),h.jsx("p",{className:"text-dash-text-secondary",children:r?.t("startServerMessage")??"The Config UI requires the backend server to be running."}),h.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-lg p-4",children:[h.jsx("p",{className:"text-xs text-dash-text-muted uppercase tracking-widest mb-2 font-bold",children:r?.t("runThisCommand")??"Run this command"}),h.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"})]}),h.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"})]}):h.jsxs(h.Fragment,{children:[h.jsx("h1",{className:"text-2xl font-bold text-red-500",children:r?.t("somethingWentWrong")??"Something went wrong"}),h.jsx("p",{className:"text-dash-text-muted",children:this.state.error?.message}),h.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 Pr=({direction:n="horizontal",isDragging:e=!1,onMouseDown:t})=>{const r=n==="horizontal";return h.jsx("div",{onMouseDown:t,className:`
22
22
  group flex items-center justify-center shrink-0
23
23
  ${r?"w-2 cursor-col-resize":"h-2 cursor-row-resize"}
24
24
  ${e?"bg-dash-accent/20":"hover:bg-dash-surface-hover/50"}
25
25
  transition-colors
26
- `,children:d.jsx("div",{className:`
26
+ `,children:h.jsx("div",{className:`
27
27
  rounded-full transition-all
28
28
  ${r?"w-0.5 h-8":"h-0.5 w-8"}
29
29
  ${e?"bg-dash-accent":"bg-dash-border group-hover:bg-dash-text-muted"}
30
- `})})};var Pn=(n=>(n.HEALTHY="healthy",n.WARNING="warning",n.ERROR="error",n.LOADING="loading",n.UNKNOWN="unknown",n))(Pn||{}),Qt=(n=>(n.ENGINEER="engineer",n.MARKETING="marketing",n.ARCHITECT="architect",n.RESEARCHER="researcher",n.DEVOP="devops",n))(Qt||{});const mv=({isOpen:n,onClose:e,onAdd:t})=>{const{t:r}=he(),[i,s]=g.useState(""),[o,a]=g.useState(""),[l,c]=g.useState(!1),[h,u]=g.useState(null);g.useEffect(()=>{n||(s(""),a(""),u(null),c(!1))},[n]),g.useEffect(()=>{if(!n)return;const p=m=>{m.key==="Escape"&&e()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[n]),g.useEffect(()=>{if(!n)return;const p=document.activeElement;return document.querySelector("#project-path")?.focus(),()=>{p?.focus()}},[n]);const f=async p=>{if(p.preventDefault(),!i.trim()){u(r("pathRequired"));return}try{c(!0),u(null);const m={path:i.trim(),...o.trim()&&{alias:o.trim()}};await t(m),e()}catch(m){u(m instanceof Error?m.message:r("failedToAdd"))}finally{c(!1)}};return n?d.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:e,children:d.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:[d.jsxs("div",{className:"px-6 py-4 border-b border-dash-border",children:[d.jsx("h2",{className:"text-lg font-bold text-dash-text",children:r("addProjectTitle")}),d.jsx("p",{className:"text-sm text-dash-text-muted mt-1",children:r("addProjectDescription")})]}),d.jsxs("form",{onSubmit:f,className:"p-6 space-y-4",children:[d.jsxs("div",{children:[d.jsxs("label",{htmlFor:"project-path",className:"block text-sm font-medium text-dash-text mb-2",children:[r("projectPath")," ",d.jsx("span",{className:"text-red-500",children:"*"})]}),d.jsx("input",{id:"project-path",type:"text",value:i,onChange:p=>s(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"})]}),d.jsxs("div",{children:[d.jsxs("label",{htmlFor:"project-alias",className:"block text-sm font-medium text-dash-text mb-2",children:[r("alias")," ",r("aliasOptional")]}),d.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"}),d.jsx("p",{className:"text-xs text-dash-text-muted mt-1",children:r("aliasDescription")})]}),h&&d.jsx("div",{className:"px-3 py-2 bg-red-500/10 border border-red-500/20 rounded-md",children:d.jsx("p",{className:"text-sm text-red-500",children:h})}),d.jsxs("div",{className:"flex gap-3 pt-2",children:[d.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")}),d.jsx("button",{type:"submit",disabled:l||!i.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},gv=({vertical:n=!1})=>{const{lang:e,setLang:t}=he();return d.jsxs("div",{className:`flex ${n?"flex-col":""} items-center rounded-lg border border-dash-border overflow-hidden`,children:[d.jsx("button",{onClick:()=>t("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"}),d.jsx("button",{onClick:()=>t("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"})]})},bv=({projects:n,currentProjectId:e,isCollapsed:t,width:r,isConnected:i,theme:s,onSwitchProject:o,onToggle:a,onAddProject:l,onToggleTheme:c})=>{const{t:h}=he(),u=an(),f=_t(),[p,m]=g.useState(!1),b=f.pathname==="/config/global",y=f.pathname==="/migrate"||f.pathname==="/skills",v=[...n].filter(k=>!k.path.endsWith("/.claude")&&k.path!=="~/.claude").sort((k,O)=>k.pinned&&!O.pinned?-1:!k.pinned&&O.pinned?1:k.name.localeCompare(O.name)),w=r?{width:`${r}px`}:void 0,C=r?"":t?"w-14":"w-72",j=r?r>=160:!t;return d.jsxs("aside",{style:w,className:`${C} 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:[d.jsxs("div",{className:`flex items-center ${j?"p-6 gap-3":"p-2 justify-center"}`,children:[d.jsx("img",{src:"/images/logo-transparent-32.png",alt:"ClaudeKit",className:"w-8 h-8 shrink-0"}),j&&d.jsxs("div",{className:"overflow-hidden",children:[d.jsx("h1",{className:"text-sm font-bold truncate tracking-tight text-dash-text",children:"ClaudeKit"}),d.jsx("p",{className:"text-[10px] text-dash-text-muted font-medium uppercase tracking-wider",children:h("controlCenter")})]})]}),d.jsxs("div",{className:`${j?"px-4":"px-2"} py-2 space-y-1`,children:[j&&d.jsx("p",{className:"px-2 pb-2 text-[10px] font-bold text-dash-text-muted uppercase tracking-widest",children:h("settingsSection")}),d.jsx(eu,{icon:d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[d.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"}),d.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:!j,active:b,onClick:()=>u("/config/global")}),d.jsx(eu,{icon:d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.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:!j,active:y,onClick:()=>u("/migrate")})]}),d.jsxs("div",{className:`flex-1 overflow-y-auto overflow-x-hidden ${j?"px-4":"px-2"} py-2 space-y-1 border-t border-dash-border`,children:[j&&d.jsx("p",{className:"px-2 pb-2 pt-2 text-[10px] font-bold text-dash-text-muted uppercase tracking-widest",children:h("projects")}),v.map(k=>{const O=f.pathname.endsWith("/config"),x=e===k.id&&!b&&!O&&!y;return d.jsxs("button",{onClick:()=>o(k.id),className:`w-full group relative flex items-center ${j?"gap-3 p-2.5":"justify-center p-2"} rounded-md transition-colors ${x?"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:[d.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${k.health===Pn.HEALTHY?"bg-dash-accent":k.health===Pn.WARNING?"bg-orange-400":"bg-red-500"} ${x?"animate-pulse":""}`}),j&&d.jsxs(d.Fragment,{children:[k.pinned&&d.jsx("span",{className:"text-xs",children:"📌"}),d.jsx("span",{className:"text-sm font-medium truncate",children:k.name})]}),!j&&d.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:[k.pinned&&"📌 ",k.name]})]},k.id)}),d.jsxs("button",{onClick:()=>m(!0),className:`w-full flex items-center ${j?"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:[d.jsx("div",{className:`${j?"w-5 h-5":""} flex items-center justify-center`,children:d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}),j&&d.jsx("span",{className:"text-sm font-medium",children:h("addProject")})]})]}),d.jsx(mv,{isOpen:p,onClose:()=>m(!1),onAdd:l}),d.jsx("div",{className:"border-t border-dash-border",children:d.jsxs("div",{className:`py-3 flex items-center ${j?"px-3 justify-between":"justify-center flex-col gap-2"}`,children:[d.jsxs("div",{className:"flex items-center gap-2",title:h(i?"sync":"offline"),children:[d.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${i?"bg-dash-accent shadow-[0_0_8px_var(--dash-accent-glow)]":"bg-red-500"}`}),j&&d.jsx("span",{className:"text-[10px] font-bold text-dash-text-muted uppercase tracking-widest",children:h(i?"sync":"offline")})]}),d.jsxs("div",{className:`flex items-center gap-1 ${j?"":"flex-col"}`,children:[d.jsx(gv,{vertical:!j}),d.jsx("button",{onClick:c,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(s==="dark"?"switchToLight":"switchToDark"),children:s==="dark"?d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.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"})}):d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.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"})})}),d.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(t?"expand":"collapse"),children:t?d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M5 5l7 7-7 7"})}):d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 19l-7-7 7-7m8 14l-7-7 7-7"})})})]})]})})]})},eu=({icon:n,label:e,badge:t,badgeColor:r="bg-dash-accent-subtle text-dash-accent",isCollapsed:i,active:s,onClick:o,disabled:a})=>d.jsxs("button",{onClick:o,disabled:a,className:`w-full group relative flex items-center ${i?"justify-center p-2":"gap-3 p-2"} rounded-md transition-colors ${a?"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:[d.jsx("div",{className:`${i?"":"w-5 h-5"} flex items-center justify-center`,children:n}),!i&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-sm font-medium flex-1 text-left",children:e}),t&&d.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded ${r}`,children:t})]}),i&&d.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})]}),at="/api";class ol extends Error{constructor(){super("Backend server is not running. Start it with: ck config"),this.name="ServerUnavailableError"}}async function It(){try{if(!(await fetch(`${at}/health`,{method:"GET"})).ok)throw new ol}catch(n){throw n instanceof ol?n:new ol}}function vh(n){return{id:n.id,name:n.name,path:n.path,health:n.health,kitType:n.kitType||"engineer",model:n.model,activeHooks:n.activeHooks,mcpServers:n.mcpServers,skills:n.skills,pinned:n.pinned,tags:n.tags,addedAt:n.addedAt,lastOpened:n.lastOpened,preferences:n.preferences}}async function $m(){await It();const n=await fetch(`${at}/projects`);if(!n.ok)throw new Error("Failed to fetch projects");return(await n.json()).map(vh)}async function yv(){await It();const n=await fetch(`${at}/skills`);if(!n.ok)throw new Error("Failed to fetch skills");return n.json()}async function xv(n,e){try{await It();const t=e!==void 0?`?limit=${e}`:"",r=await fetch(`${at}/sessions/${encodeURIComponent(n)}${t}`);return r.ok?r.json():[]}catch{return[]}}async function vv(n,e){await It();const t=new URLSearchParams;n&&t.set("projectId",n);const r=await fetch(`${at}/actions/options?${t.toString()}`,{signal:e});if(!r.ok)throw new Error("Failed to fetch action options");return r.json()}async function wv(n,e,t,r){await It();const i=await fetch(`${at}/actions/open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:n,path:e,appId:t,projectId:r})});if(!i.ok){const s=await i.json().catch(()=>({error:"Action failed"}));throw new Error(s.error||"Action failed")}}async function kv(){await It();try{const r=await fetch(`${at}/settings/raw`);if(r.ok)return r.json()}catch{}const n=await fetch(`${at}/settings`);if(!n.ok)throw new Error("Failed to fetch settings file");const e=await n.json(),t=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:t}}async function Sv(n){await It();const e=await fetch(`${at}/settings/raw`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:n})});if(!e.ok){const t=await e.json().catch(()=>({error:"Failed to save settings file"}));throw new Error(t.error||"Failed to save settings file")}return e.json()}async function Cv(n){await It();const e=await fetch(`${at}/projects`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok){const r=await e.text();throw new Error(r||"Failed to add project")}const t=await e.json();return vh(t)}async function jv(n){await It();const e=await fetch(`${at}/projects/${encodeURIComponent(n)}`,{method:"DELETE"});if(!e.ok){const t=await e.text();throw new Error(t||"Failed to remove project")}}async function Bm(n,e){await It();const t=await fetch(`${at}/projects/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const i=await t.text();throw new Error(i||"Failed to update project")}const r=await t.json();return vh(r)}async function Ov(){const n=await fetch(`${at}/metadata/global`);return n.ok?n.json():(console.error("Failed to fetch global metadata"),{})}async function Pv(){await It();const n=await fetch(`${at}/migrate/providers`);if(!n.ok)throw new Error("Failed to fetch migration providers");return n.json()}async function tu(){await It();const n=await fetch(`${at}/migrate/discovery`);if(!n.ok)throw new Error("Failed to discover migration items");return n.json()}function Nv(){const[n,e]=g.useState([]),[t,r]=g.useState(!0),[i,s]=g.useState(null),o=g.useCallback(async()=>{try{r(!0),s(null);const a=await yv();e(a)}catch(a){s(a instanceof Error?a.message:"Failed to load skills")}finally{r(!1)}},[]);return g.useEffect(()=>{o()},[o]),{skills:n,loading:t,error:i,reload:o}}function Av(n){const[e,t]=g.useState([]),[r,i]=g.useState(!1),[s,o]=g.useState(null),a=g.useCallback(async()=>{if(!n){t([]);return}try{i(!0),o(null);const l=await xv(n,999);t(l)}catch(l){o(l instanceof Error?l.message:"Failed to load sessions")}finally{i(!1)}},[n]);return g.useEffect(()=>{a()},[a]),{sessions:e,loading:r,error:s,reload:a}}function Mv(){const[n,e]=g.useState([]),[t,r]=g.useState(!0),[i,s]=g.useState(null),o=g.useCallback(async()=>{try{r(!0),s(null);const h=await $m();e(h)}catch(h){s(h instanceof Error?h.message:"Failed to load projects")}finally{r(!1)}},[]),a=g.useCallback(async h=>{const u=await Cv(h);return await o(),u},[o]),l=g.useCallback(async h=>{await jv(h),await o()},[o]),c=g.useCallback(async(h,u)=>{const f=await Bm(h,u);return await o(),f},[o]);return g.useEffect(()=>{o()},[o]),{projects:n,loading:t,error:i,reload:o,addProject:a,removeProject:l,updateProject:c}}function Tv({storageKey:n,defaultSize:e,minSize:t,maxSize:r,direction:i="horizontal"}){const[s,o]=g.useState(()=>{if(typeof window>"u")return e;const f=localStorage.getItem(n);if(f){const p=Number.parseInt(f,10);if(!Number.isNaN(p)&&p>=t&&p<=r)return p}return e}),[a,l]=g.useState(!1);g.useEffect(()=>{localStorage.setItem(n,String(s))},[s,n]);const c=g.useCallback(f=>{f.preventDefault(),l(!0);const p=i==="horizontal"?f.clientX:f.clientY,m=s,b=v=>{const C=(i==="horizontal"?v.clientX:v.clientY)-p,j=Math.max(t,Math.min(r,m+C));o(j)},y=()=>{l(!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=i==="horizontal"?"col-resize":"row-resize",document.body.style.userSelect="none"},[s,t,r,i]),h=g.useCallback(()=>{o(e)},[e]),u=g.useCallback(f=>{o(Math.max(t,Math.min(r,f)))},[t,r]);return{size:s,isDragging:a,startDrag:c,setSize:u,reset:h}}const Dv=()=>{const{t:n}=he(),e=an(),t=_t(),{projectId:r}=Nm(),[i,s]=g.useState(null);g.useEffect(()=>{r&&s(r)},[r]);const[o,a]=g.useState(()=>typeof window<"u"&&localStorage.getItem("claudekit-theme")||"dark"),[l]=g.useState(!0),{size:c,isDragging:h,startDrag:u,setSize:f}=Tv({storageKey:"claudekit-sidebar-width",defaultSize:288,minSize:56,maxSize:400}),p=c<=56,{projects:m,loading:b,error:y,addProject:v}=Mv(),w=async x=>{await v(x)};g.useEffect(()=>{const x=t.pathname.startsWith("/project/");m.length===0||r||!x||e(`/project/${m[0].id}`,{replace:!0})},[m,r,e,t.pathname]),g.useEffect(()=>{const x=window.document.documentElement;o==="dark"?(x.classList.add("dark"),x.setAttribute("data-theme","dark")):(x.classList.remove("dark"),x.setAttribute("data-theme","light")),localStorage.setItem("claudekit-theme",o)},[o]);const C=()=>a(x=>x==="light"?"dark":"light"),j=g.useMemo(()=>m.find(x=>x.id===i)||null,[m,i]),k=x=>{e(`/project/${x}`)},O=()=>{f(p?288:56)};return b?d.jsx("div",{className:"flex h-screen w-full bg-dash-bg text-dash-text items-center justify-center",children:d.jsx("div",{className:"animate-pulse text-dash-text-muted",children:n("loading")})}):y?d.jsx("div",{className:"flex h-screen w-full bg-dash-bg text-dash-text items-center justify-center",children:d.jsxs("div",{className:"text-red-500",children:[n("error"),": ",y]})}):d.jsxs("div",{className:"flex h-screen w-full bg-dash-bg text-dash-text overflow-hidden font-sans transition-colors duration-300",children:[d.jsx(bv,{projects:m,currentProjectId:i,isCollapsed:p,width:c,isConnected:l,theme:o,onSwitchProject:k,onToggle:O,onAddProject:w,onToggleTheme:C}),d.jsx(Pr,{direction:"horizontal",isDragging:h,onMouseDown:u}),d.jsx("div",{className:"flex-1 flex flex-col min-w-0 h-full relative",children:d.jsx("main",{className:"flex-1 flex flex-col overflow-hidden p-4 md:p-6",children:d.jsx(jx,{context:{project:j,isConnected:l,theme:o,onToggleTheme:C}})})})]})},Fm=({title:n,filePath:e,onBack:t,onSave:r,onReset:i,saveStatus:s,syntaxError:o,showResetConfirm:a,setShowResetConfirm:l,badge:c,showActions:h=!0,showFilePath:u=!0})=>{const{t:f}=he();return d.jsxs("div",{className:"flex items-center justify-between mb-3 shrink-0",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("button",{onClick:t,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:d.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:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),d.jsx("h1",{className:"text-xl font-bold tracking-tight text-dash-text",children:n}),c,u&&d.jsx("span",{className:"text-xs text-dash-text-muted mono",children:e})]}),h&&d.jsxs("div",{className:"flex items-center gap-2 relative",children:[a?d.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:[d.jsx("span",{className:"text-xs text-red-500 font-medium",children:f("confirmReset")}),d.jsx("button",{onClick:i,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")}),d.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")})]}):d.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")}),d.jsx("button",{onClick:r,disabled:!!o||s==="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":s==="saved"?"bg-green-500 text-white shadow-lg shadow-green-500/20":s==="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(s==="saving"?"saving":s==="saved"?"saved":s==="error"?"saveFailed":"saveChanges")})]})]})};function Ev(n,e,t){const r={...n},i=e.split(".");let s=r;for(let o=0;o<i.length-1;o++){const a=i[o];!(a in s)||typeof s[a]!="object"||s[a]===null?s[a]={}:s[a]={...s[a]},s=s[a]}return s[i[i.length-1]]=t,r}function fc(n,e){const t=e.split(".");let r=n;for(const i of t){if(r==null||typeof r!="object")return;r=r[i]}return r}function Rv(n,e){const t=e.split(".");let r=n;for(const i of t){if(!r.properties)return{};const s=r.properties;if(!s[i])return{};r=s[i]}return r}const Lv=({value:n,onChange:e,disabled:t})=>d.jsx("input",{type:"text",value:n??"",onChange:r=>e(r.target.value||null),disabled:t,className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
30
+ `})})};var Pn=(n=>(n.HEALTHY="healthy",n.WARNING="warning",n.ERROR="error",n.LOADING="loading",n.UNKNOWN="unknown",n))(Pn||{}),Qt=(n=>(n.ENGINEER="engineer",n.MARKETING="marketing",n.ARCHITECT="architect",n.RESEARCHER="researcher",n.DEVOP="devops",n))(Qt||{});const gv=({isOpen:n,onClose:e,onAdd:t})=>{const{t:r}=ce(),[i,s]=g.useState(""),[o,a]=g.useState(""),[l,c]=g.useState(!1),[d,u]=g.useState(null);g.useEffect(()=>{n||(s(""),a(""),u(null),c(!1))},[n]),g.useEffect(()=>{if(!n)return;const p=m=>{m.key==="Escape"&&e()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[n]),g.useEffect(()=>{if(!n)return;const p=document.activeElement;return document.querySelector("#project-path")?.focus(),()=>{p?.focus()}},[n]);const f=async p=>{if(p.preventDefault(),!i.trim()){u(r("pathRequired"));return}try{c(!0),u(null);const m={path:i.trim(),...o.trim()&&{alias:o.trim()}};await t(m),e()}catch(m){u(m instanceof Error?m.message:r("failedToAdd"))}finally{c(!1)}};return n?h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:e,children:h.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:[h.jsxs("div",{className:"px-6 py-4 border-b border-dash-border",children:[h.jsx("h2",{className:"text-lg font-bold text-dash-text",children:r("addProjectTitle")}),h.jsx("p",{className:"text-sm text-dash-text-muted mt-1",children:r("addProjectDescription")})]}),h.jsxs("form",{onSubmit:f,className:"p-6 space-y-4",children:[h.jsxs("div",{children:[h.jsxs("label",{htmlFor:"project-path",className:"block text-sm font-medium text-dash-text mb-2",children:[r("projectPath")," ",h.jsx("span",{className:"text-red-500",children:"*"})]}),h.jsx("input",{id:"project-path",type:"text",value:i,onChange:p=>s(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"})]}),h.jsxs("div",{children:[h.jsxs("label",{htmlFor:"project-alias",className:"block text-sm font-medium text-dash-text mb-2",children:[r("alias")," ",r("aliasOptional")]}),h.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"}),h.jsx("p",{className:"text-xs text-dash-text-muted mt-1",children:r("aliasDescription")})]}),d&&h.jsx("div",{className:"px-3 py-2 bg-red-500/10 border border-red-500/20 rounded-md",children:h.jsx("p",{className:"text-sm text-red-500",children:d})}),h.jsxs("div",{className:"flex gap-3 pt-2",children:[h.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")}),h.jsx("button",{type:"submit",disabled:l||!i.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},bv=({vertical:n=!1})=>{const{lang:e,setLang:t}=ce();return h.jsxs("div",{className:`flex ${n?"flex-col":""} items-center rounded-lg border border-dash-border overflow-hidden`,children:[h.jsx("button",{onClick:()=>t("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"}),h.jsx("button",{onClick:()=>t("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"})]})},xv=({projects:n,currentProjectId:e,isCollapsed:t,width:r,isConnected:i,theme:s,onSwitchProject:o,onToggle:a,onAddProject:l,onToggleTheme:c})=>{const{t:d}=ce(),u=an(),f=_t(),[p,m]=g.useState(!1),b=f.pathname==="/config/global",x=f.pathname==="/migrate"||f.pathname==="/skills",w=[...n].filter(k=>!k.path.endsWith("/.claude")&&k.path!=="~/.claude").sort((k,O)=>k.pinned&&!O.pinned?-1:!k.pinned&&O.pinned?1:k.name.localeCompare(O.name)),v=r?{width:`${r}px`}:void 0,S=r?"":t?"w-14":"w-72",j=r?r>=160:!t;return h.jsxs("aside",{style:v,className:`${S} 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:[h.jsxs("div",{className:`flex items-center ${j?"p-6 gap-3":"p-2 justify-center"}`,children:[h.jsx("img",{src:"/images/logo-transparent-32.png",alt:"ClaudeKit",className:"w-8 h-8 shrink-0"}),j&&h.jsxs("div",{className:"overflow-hidden",children:[h.jsx("h1",{className:"text-sm font-bold truncate tracking-tight text-dash-text",children:"ClaudeKit"}),h.jsx("p",{className:"text-[10px] text-dash-text-muted font-medium uppercase tracking-wider",children:d("controlCenter")})]})]}),h.jsxs("div",{className:`${j?"px-4":"px-2"} py-2 space-y-1`,children:[j&&h.jsx("p",{className:"px-2 pb-2 text-[10px] font-bold text-dash-text-muted uppercase tracking-widest",children:d("settingsSection")}),h.jsx(tu,{icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[h.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"}),h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),label:d("configEditor"),isCollapsed:!j,active:b,onClick:()=>u("/config/global")}),h.jsx(tu,{icon:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:h.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:d("migrate"),isCollapsed:!j,active:x,onClick:()=>u("/migrate")})]}),h.jsxs("div",{className:`flex-1 overflow-y-auto overflow-x-hidden ${j?"px-4":"px-2"} py-2 space-y-1 border-t border-dash-border`,children:[j&&h.jsx("p",{className:"px-2 pb-2 pt-2 text-[10px] font-bold text-dash-text-muted uppercase tracking-widest",children:d("projects")}),w.map(k=>{const O=f.pathname.endsWith("/config"),y=e===k.id&&!b&&!O&&!x;return h.jsxs("button",{onClick:()=>o(k.id),className:`w-full group relative flex items-center ${j?"gap-3 p-2.5":"justify-center p-2"} rounded-md transition-colors ${y?"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:[h.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${k.health===Pn.HEALTHY?"bg-dash-accent":k.health===Pn.WARNING?"bg-orange-400":"bg-red-500"} ${y?"animate-pulse":""}`}),j&&h.jsxs(h.Fragment,{children:[k.pinned&&h.jsx("span",{className:"text-xs",children:"📌"}),h.jsx("span",{className:"text-sm font-medium truncate",children:k.name})]}),!j&&h.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:[k.pinned&&"📌 ",k.name]})]},k.id)}),h.jsxs("button",{onClick:()=>m(!0),className:`w-full flex items-center ${j?"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:[h.jsx("div",{className:`${j?"w-5 h-5":""} flex items-center justify-center`,children:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}),j&&h.jsx("span",{className:"text-sm font-medium",children:d("addProject")})]})]}),h.jsx(gv,{isOpen:p,onClose:()=>m(!1),onAdd:l}),h.jsx("div",{className:"border-t border-dash-border",children:h.jsxs("div",{className:`py-3 flex items-center ${j?"px-3 justify-between":"justify-center flex-col gap-2"}`,children:[h.jsxs("div",{className:"flex items-center gap-2",title:d(i?"sync":"offline"),children:[h.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${i?"bg-dash-accent shadow-[0_0_8px_var(--dash-accent-glow)]":"bg-red-500"}`}),j&&h.jsx("span",{className:"text-[10px] font-bold text-dash-text-muted uppercase tracking-widest",children:d(i?"sync":"offline")})]}),h.jsxs("div",{className:`flex items-center gap-1 ${j?"":"flex-col"}`,children:[h.jsx(bv,{vertical:!j}),h.jsx("button",{onClick:c,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:d(s==="dark"?"switchToLight":"switchToDark"),children:s==="dark"?h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:h.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"})}):h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:h.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"})})}),h.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:d(t?"expand":"collapse"),children:t?h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M5 5l7 7-7 7"})}):h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 19l-7-7 7-7m8 14l-7-7 7-7"})})})]})]})})]})},tu=({icon:n,label:e,badge:t,badgeColor:r="bg-dash-accent-subtle text-dash-accent",isCollapsed:i,active:s,onClick:o,disabled:a})=>h.jsxs("button",{onClick:o,disabled:a,className:`w-full group relative flex items-center ${i?"justify-center p-2":"gap-3 p-2"} rounded-md transition-colors ${a?"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:[h.jsx("div",{className:`${i?"":"w-5 h-5"} flex items-center justify-center`,children:n}),!i&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-sm font-medium flex-1 text-left",children:e}),t&&h.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded ${r}`,children:t})]}),i&&h.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})]}),tt="/api";class ol extends Error{constructor(){super("Backend server is not running. Start it with: ck config"),this.name="ServerUnavailableError"}}async function St(){try{if(!(await fetch(`${tt}/health`,{method:"GET"})).ok)throw new ol}catch(n){throw n instanceof ol?n:new ol}}function vh(n){return{id:n.id,name:n.name,path:n.path,health:n.health,kitType:n.kitType||"engineer",model:n.model,activeHooks:n.activeHooks,mcpServers:n.mcpServers,skills:n.skills,pinned:n.pinned,tags:n.tags,addedAt:n.addedAt,lastOpened:n.lastOpened,preferences:n.preferences}}async function wh(){await St();const n=await fetch(`${tt}/projects`);if(!n.ok)throw new Error("Failed to fetch projects");return(await n.json()).map(vh)}async function yv(){await St();const n=await fetch(`${tt}/skills`);if(!n.ok)throw new Error("Failed to fetch skills");return n.json()}async function vv(n,e){try{await St();const t=e!==void 0?`?limit=${e}`:"",r=await fetch(`${tt}/sessions/${encodeURIComponent(n)}${t}`);return r.ok?r.json():[]}catch{return[]}}async function wv(n,e){await St();const t=new URLSearchParams;n&&t.set("projectId",n);const r=await fetch(`${tt}/actions/options?${t.toString()}`,{signal:e});if(!r.ok)throw new Error("Failed to fetch action options");return r.json()}async function kv(n,e,t,r){await St();const i=await fetch(`${tt}/actions/open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:n,path:e,appId:t,projectId:r})});if(!i.ok){const s=await i.json().catch(()=>({error:"Action failed"}));throw new Error(s.error||"Action failed")}}async function Sv(){await St();try{const r=await fetch(`${tt}/settings/raw`);if(r.ok)return r.json()}catch{}const n=await fetch(`${tt}/settings`);if(!n.ok)throw new Error("Failed to fetch settings file");const e=await n.json(),t=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:t}}async function Cv(n){await St();const e=await fetch(`${tt}/settings/raw`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:n})});if(!e.ok){const t=await e.json().catch(()=>({error:"Failed to save settings file"}));throw new Error(t.error||"Failed to save settings file")}return e.json()}async function jv(n){await St();const e=new URLSearchParams;n?.scope&&e.set("scope",n.scope),n?.projectId&&e.set("projectId",n.projectId),e.set("limit",String(n.limit));const t=e.toString(),r=await fetch(`${tt}/system/hook-diagnostics${t?`?${t}`:""}`,{signal:n?.signal});if(!r.ok){const i=await r.json().catch(()=>({error:"Failed to fetch hook diagnostics"}));throw new Error(i.error||"Failed to fetch hook diagnostics")}return r.json()}async function Ov(n){await St();const e=await fetch(`${tt}/projects`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok){const r=await e.text();throw new Error(r||"Failed to add project")}const t=await e.json();return vh(t)}async function Pv(n){await St();const e=await fetch(`${tt}/projects/${encodeURIComponent(n)}`,{method:"DELETE"});if(!e.ok){const t=await e.text();throw new Error(t||"Failed to remove project")}}async function Fm(n,e){await St();const t=await fetch(`${tt}/projects/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const i=await t.text();throw new Error(i||"Failed to update project")}const r=await t.json();return vh(r)}async function Nv(){const n=await fetch(`${tt}/metadata/global`);return n.ok?n.json():(console.error("Failed to fetch global metadata"),{})}async function Av(){await St();const n=await fetch(`${tt}/migrate/providers`);if(!n.ok)throw new Error("Failed to fetch migration providers");return n.json()}async function nu(){await St();const n=await fetch(`${tt}/migrate/discovery`);if(!n.ok)throw new Error("Failed to discover migration items");return n.json()}function Mv(){const[n,e]=g.useState([]),[t,r]=g.useState(!0),[i,s]=g.useState(null),o=g.useCallback(async()=>{try{r(!0),s(null);const a=await yv();e(a)}catch(a){s(a instanceof Error?a.message:"Failed to load skills")}finally{r(!1)}},[]);return g.useEffect(()=>{o()},[o]),{skills:n,loading:t,error:i,reload:o}}function Dv(n){const[e,t]=g.useState([]),[r,i]=g.useState(!1),[s,o]=g.useState(null),a=g.useCallback(async()=>{if(!n){t([]);return}try{i(!0),o(null);const l=await vv(n,999);t(l)}catch(l){o(l instanceof Error?l.message:"Failed to load sessions")}finally{i(!1)}},[n]);return g.useEffect(()=>{a()},[a]),{sessions:e,loading:r,error:s,reload:a}}function Tv(){const[n,e]=g.useState([]),[t,r]=g.useState(!0),[i,s]=g.useState(null),o=g.useCallback(async()=>{try{r(!0),s(null);const d=await wh();e(d)}catch(d){s(d instanceof Error?d.message:"Failed to load projects")}finally{r(!1)}},[]),a=g.useCallback(async d=>{const u=await Ov(d);return await o(),u},[o]),l=g.useCallback(async d=>{await Pv(d),await o()},[o]),c=g.useCallback(async(d,u)=>{const f=await Fm(d,u);return await o(),f},[o]);return g.useEffect(()=>{o()},[o]),{projects:n,loading:t,error:i,reload:o,addProject:a,removeProject:l,updateProject:c}}function Ev({storageKey:n,defaultSize:e,minSize:t,maxSize:r,direction:i="horizontal"}){const[s,o]=g.useState(()=>{if(typeof window>"u")return e;const f=localStorage.getItem(n);if(f){const p=Number.parseInt(f,10);if(!Number.isNaN(p)&&p>=t&&p<=r)return p}return e}),[a,l]=g.useState(!1);g.useEffect(()=>{localStorage.setItem(n,String(s))},[s,n]);const c=g.useCallback(f=>{f.preventDefault(),l(!0);const p=i==="horizontal"?f.clientX:f.clientY,m=s,b=w=>{const S=(i==="horizontal"?w.clientX:w.clientY)-p,j=Math.max(t,Math.min(r,m+S));o(j)},x=()=>{l(!1),document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",x),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",b),document.addEventListener("mouseup",x),document.body.style.cursor=i==="horizontal"?"col-resize":"row-resize",document.body.style.userSelect="none"},[s,t,r,i]),d=g.useCallback(()=>{o(e)},[e]),u=g.useCallback(f=>{o(Math.max(t,Math.min(r,f)))},[t,r]);return{size:s,isDragging:a,startDrag:c,setSize:u,reset:d}}const Rv=()=>{const{t:n}=ce(),e=an(),t=_t(),{projectId:r}=Mm(),[i,s]=g.useState(null);g.useEffect(()=>{r&&s(r)},[r]);const[o,a]=g.useState(()=>typeof window<"u"&&localStorage.getItem("claudekit-theme")||"dark"),[l]=g.useState(!0),{size:c,isDragging:d,startDrag:u,setSize:f}=Ev({storageKey:"claudekit-sidebar-width",defaultSize:288,minSize:56,maxSize:400}),p=c<=56,{projects:m,loading:b,error:x,addProject:w}=Tv(),v=async y=>{await w(y)};g.useEffect(()=>{const y=t.pathname.startsWith("/project/");m.length===0||r||!y||e(`/project/${m[0].id}`,{replace:!0})},[m,r,e,t.pathname]),g.useEffect(()=>{const y=window.document.documentElement;o==="dark"?(y.classList.add("dark"),y.setAttribute("data-theme","dark")):(y.classList.remove("dark"),y.setAttribute("data-theme","light")),localStorage.setItem("claudekit-theme",o)},[o]);const S=()=>a(y=>y==="light"?"dark":"light"),j=g.useMemo(()=>m.find(y=>y.id===i)||null,[m,i]),k=y=>{e(`/project/${y}`)},O=()=>{f(p?288:56)};return b?h.jsx("div",{className:"flex h-screen w-full bg-dash-bg text-dash-text items-center justify-center",children:h.jsx("div",{className:"animate-pulse text-dash-text-muted",children:n("loading")})}):x?h.jsx("div",{className:"flex h-screen w-full bg-dash-bg text-dash-text items-center justify-center",children:h.jsxs("div",{className:"text-red-500",children:[n("error"),": ",x]})}):h.jsxs("div",{className:"flex h-screen w-full bg-dash-bg text-dash-text overflow-hidden font-sans transition-colors duration-300",children:[h.jsx(xv,{projects:m,currentProjectId:i,isCollapsed:p,width:c,isConnected:l,theme:o,onSwitchProject:k,onToggle:O,onAddProject:v,onToggleTheme:S}),h.jsx(Pr,{direction:"horizontal",isDragging:d,onMouseDown:u}),h.jsx("div",{className:"flex-1 flex flex-col min-w-0 h-full relative",children:h.jsx("main",{className:"flex-1 flex flex-col overflow-hidden p-4 md:p-6",children:h.jsx(O1,{context:{project:j,isConnected:l,theme:o,onToggleTheme:S}})})})]})},Vm=({title:n,filePath:e,onBack:t,onSave:r,onReset:i,saveStatus:s,syntaxError:o,showResetConfirm:a,setShowResetConfirm:l,badge:c,showActions:d=!0,showFilePath:u=!0})=>{const{t:f}=ce();return h.jsxs("div",{className:"flex items-center justify-between mb-3 shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("button",{onClick:t,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:h.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:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),h.jsx("h1",{className:"text-xl font-bold tracking-tight text-dash-text",children:n}),c,u&&h.jsx("span",{className:"text-xs text-dash-text-muted mono",children:e})]}),d&&h.jsxs("div",{className:"flex items-center gap-2 relative",children:[a?h.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:[h.jsx("span",{className:"text-xs text-red-500 font-medium",children:f("confirmReset")}),h.jsx("button",{onClick:i,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")}),h.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")})]}):h.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")}),h.jsx("button",{onClick:r,disabled:!!o||s==="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":s==="saved"?"bg-green-500 text-white shadow-lg shadow-green-500/20":s==="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(s==="saving"?"saving":s==="saved"?"saved":s==="error"?"saveFailed":"saveChanges")})]})]})};function Lv(n,e,t){const r={...n},i=e.split(".");let s=r;for(let o=0;o<i.length-1;o++){const a=i[o];!(a in s)||typeof s[a]!="object"||s[a]===null?s[a]={}:s[a]={...s[a]},s=s[a]}return s[i[i.length-1]]=t,r}function fc(n,e){const t=e.split(".");let r=n;for(const i of t){if(r==null||typeof r!="object")return;r=r[i]}return r}function Iv(n,e){const t=e.split(".");let r=n;for(const i of t){if(!r.properties)return{};const s=r.properties;if(!s[i])return{};r=s[i]}return r}const $v=({value:n,onChange:e,disabled:t})=>h.jsx("input",{type:"text",value:n??"",onChange:r=>e(r.target.value||null),disabled:t,className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
31
31
  text-dash-text placeholder-dash-text-muted
32
32
  focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
33
33
  disabled:opacity-50 disabled:cursor-not-allowed
34
- transition-colors`,placeholder:"Enter value..."}),Iv=({value:n,onChange:e,schema:t,disabled:r})=>d.jsx("input",{type:"number",value:n!=null?String(n):"",onChange:i=>{const s=i.target.value;if(s==="")e(null);else{const o=t.type==="integer"?Number.parseInt(s,10):Number.parseFloat(s);Number.isNaN(o)||e(o)}},min:t.minimum,max:t.maximum,disabled:r,className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
34
+ transition-colors`,placeholder:"Enter value..."}),Bv=({value:n,onChange:e,schema:t,disabled:r})=>h.jsx("input",{type:"number",value:n!=null?String(n):"",onChange:i=>{const s=i.target.value;if(s==="")e(null);else{const o=t.type==="integer"?Number.parseInt(s,10):Number.parseFloat(s);Number.isNaN(o)||e(o)}},min:t.minimum,max:t.maximum,disabled:r,className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
35
35
  text-dash-text placeholder-dash-text-muted
36
36
  focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
37
37
  disabled:opacity-50 disabled:cursor-not-allowed
38
- transition-colors`}),$v=({value:n,onChange:e,disabled:t})=>{const r=n===!0;return d.jsx("button",{type:"button",role:"switch","aria-checked":r,onClick:()=>e(!r),disabled:t,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors
38
+ transition-colors`}),Fv=({value:n,onChange:e,disabled:t})=>{const r=n===!0;return h.jsx("button",{type:"button",role:"switch","aria-checked":r,onClick:()=>e(!r),disabled:t,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors
39
39
  focus:outline-none focus:ring-2 focus:ring-dash-accent/50
40
40
  disabled:opacity-50 disabled:cursor-not-allowed
41
- ${r?"bg-dash-accent":"bg-dash-border"}`,children:d.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-sm transition-transform
42
- ${r?"translate-x-6":"translate-x-1"}`})})},Bv=({value:n,onChange:e,schema:t,disabled:r})=>{const i=t.enum||[];return d.jsxs("select",{value:n!=null?String(n):"",onChange:s=>{const o=s.target.value;o===""?e(null):i.includes(Number(o))?e(Number(o)):e(o)},disabled:r,className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
41
+ ${r?"bg-dash-accent":"bg-dash-border"}`,children:h.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-sm transition-transform
42
+ ${r?"translate-x-6":"translate-x-1"}`})})},Vv=({value:n,onChange:e,schema:t,disabled:r})=>{const i=t.enum||[];return h.jsxs("select",{value:n!=null?String(n):"",onChange:s=>{const o=s.target.value;o===""?e(null):i.includes(Number(o))?e(Number(o)):e(o)},disabled:r,className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
43
43
  text-dash-text
44
44
  focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
45
45
  disabled:opacity-50 disabled:cursor-not-allowed
46
- transition-colors appearance-none cursor-pointer`,children:[d.jsx("option",{value:"",children:"-- Select --"}),i.map(s=>d.jsx("option",{value:String(s),children:String(s)},String(s)))]})},Fv=({value:n,onChange:e,disabled:t})=>{const r=Array.isArray(n)?n:[],[i,s]=g.useState(""),o=()=>{i.trim()&&(e([...r,i.trim()]),s(""))},a=l=>{const c=r.filter((h,u)=>u!==l);e(c.length>0?c:[])};return d.jsxs("div",{className:"space-y-2",children:[d.jsx("div",{className:"flex flex-wrap gap-1.5",children:r.map((l,c)=>d.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(l),!t&&d.jsx("button",{type:"button",onClick:()=>a(c),className:"text-dash-text-muted hover:text-red-500 transition-colors",children:d.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},c))}),!t&&d.jsxs("div",{className:"flex gap-2",children:[d.jsx("input",{type:"text",value:i,onChange:l=>s(l.target.value),onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),o())},placeholder:"Add item...",className:`flex-1 px-2 py-1 text-xs bg-dash-bg border border-dash-border rounded
46
+ transition-colors appearance-none cursor-pointer`,children:[h.jsx("option",{value:"",children:"-- Select --"}),i.map(s=>h.jsx("option",{value:String(s),children:String(s)},String(s)))]})},zv=({value:n,onChange:e,disabled:t})=>{const r=Array.isArray(n)?n:[],[i,s]=g.useState(""),o=()=>{i.trim()&&(e([...r,i.trim()]),s(""))},a=l=>{const c=r.filter((d,u)=>u!==l);e(c.length>0?c:[])};return h.jsxs("div",{className:"space-y-2",children:[h.jsx("div",{className:"flex flex-wrap gap-1.5",children:r.map((l,c)=>h.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(l),!t&&h.jsx("button",{type:"button",onClick:()=>a(c),className:"text-dash-text-muted hover:text-red-500 transition-colors",children:h.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},c))}),!t&&h.jsxs("div",{className:"flex gap-2",children:[h.jsx("input",{type:"text",value:i,onChange:l=>s(l.target.value),onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),o())},placeholder:"Add item...",className:`flex-1 px-2 py-1 text-xs bg-dash-bg border border-dash-border rounded
47
47
  text-dash-text placeholder-dash-text-muted
48
- focus:outline-none focus:ring-1 focus:ring-dash-accent/50`}),d.jsx("button",{type:"button",onClick:o,className:"px-2 py-1 text-xs bg-dash-accent text-white rounded hover:bg-dash-accent-hover transition-colors",children:"+"})]})]})},Vv=({value:n,onChange:e,disabled:t})=>{const[r,i]=g.useState(!1);return d.jsxs("div",{className:"relative",children:[d.jsx("input",{type:r?"text":"password",value:n??"",onChange:s=>e(s.target.value||null),disabled:t,className:`w-full px-3 py-2 pr-10 text-sm bg-dash-bg border border-dash-border rounded-lg
48
+ focus:outline-none focus:ring-1 focus:ring-dash-accent/50`}),h.jsx("button",{type:"button",onClick:o,className:"px-2 py-1 text-xs bg-dash-accent text-white rounded hover:bg-dash-accent-hover transition-colors",children:"+"})]})]})},_v=({value:n,onChange:e,disabled:t})=>{const[r,i]=g.useState(!1);return h.jsxs("div",{className:"relative",children:[h.jsx("input",{type:r?"text":"password",value:n??"",onChange:s=>e(s.target.value||null),disabled:t,className:`w-full px-3 py-2 pr-10 text-sm bg-dash-bg border border-dash-border rounded-lg
49
49
  text-dash-text placeholder-dash-text-muted
50
50
  focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
51
51
  disabled:opacity-50 disabled:cursor-not-allowed
52
- transition-colors`,placeholder:"Enter passphrase..."}),d.jsx("button",{type:"button",onClick:()=>i(!r),className:"absolute right-2 top-1/2 -translate-y-1/2 text-dash-text-muted hover:text-dash-text transition-colors",children:r?d.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.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"})}):d.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),d.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"})]})})]})},zv={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"},_v=({source:n})=>{const{t:e}=he(),t=()=>{switch(n){case"default":return e("default");case"project":return e("scopeProject");case"global":return e("scopeGlobal")}};return d.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded font-bold uppercase tracking-wider ${zv[n]}`,children:t()})};function Hv(n,e){if(e.includes("passphrase")||e.includes("password"))return"password";if(n.enum&&n.enum.length>0)return"enum";switch(Array.isArray(n.type)?n.type.find(r=>r!=="null")||"string":n.type||"string"){case"boolean":return"boolean";case"integer":case"number":return"number";case"array":return"array";case"object":return"object";default:return"string"}}const Wv=({fieldPath:n,label:e,description:t,schema:r,value:i,source:s,onChange:o,disabled:a})=>{const l=Hv(r,n),c=()=>{const h={value:i,onChange:o,schema:r,disabled:a};switch(l){case"boolean":return d.jsx($v,{...h});case"number":return d.jsx(Iv,{...h});case"enum":return d.jsx(Bv,{...h});case"array":return d.jsx(Fv,{...h});case"password":return d.jsx(Vv,{...h});case"object":return null;default:return d.jsx(Lv,{...h})}};return l==="object"?null:d.jsx("div",{className:"py-3 border-b border-dash-border/50 last:border-b-0",children:d.jsxs("div",{className:"flex items-start justify-between gap-4",children:[d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[d.jsx("span",{className:"text-sm font-medium text-dash-text",children:e}),d.jsx(_v,{source:s})]}),t&&d.jsx("p",{className:"text-xs text-dash-text-muted mb-2 leading-relaxed",children:t}),d.jsx("p",{className:"text-[10px] text-dash-text-muted/50 font-mono mb-2",children:n})]}),d.jsx("div",{className:l==="boolean"?"shrink-0":"w-1/2 max-w-xs",children:c()})]})})},Uv=({id:n,title:e,defaultCollapsed:t=!1,children:r})=>{const[i,s]=g.useState(t);return d.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-lg overflow-hidden",children:[d.jsxs("button",{type:"button",onClick:()=>s(!i),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":!i,"aria-controls":`section-${n}`,children:[d.jsx("h3",{className:"text-sm font-bold text-dash-text uppercase tracking-wider",children:e}),d.jsx("svg",{className:`w-4 h-4 text-dash-text-muted transition-transform duration-200 ${i?"":"rotate-180"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),d.jsx("div",{id:`section-${n}`,className:`transition-all duration-200 ease-in-out ${i?"max-h-0 overflow-hidden":"max-h-[2000px]"}`,children:d.jsx("div",{className:"px-4 py-2",children:r})})]})},Kv=({schema:n,value:e,sources:t,sections:r,onChange:i,disabled:s})=>d.jsx("div",{className:"space-y-4",children:r.map((o,a)=>d.jsx(Uv,{id:o.id,title:o.title,defaultCollapsed:o.defaultCollapsed??a>1,children:o.fields.map(l=>{const c=Rv(n,l.path),h=fc(e,l.path),u=t[l.path]||"default";return d.jsx(Wv,{fieldPath:l.path,label:l.label,description:l.description||c.description,schema:c,value:h,source:u,onChange:f=>i(l.path,f),disabled:s},l.path)})},o.id))}),Vm=({width:n,isLoading:e,schema:t,config:r,sources:i,sections:s,onChange:o})=>{const{t:a}=he();return d.jsxs("div",{style:{width:`${n}%`},className:"bg-dash-surface border border-dash-border rounded-xl overflow-hidden flex flex-col shadow-sm min-w-0",children:[d.jsx("div",{className:"p-3 border-b border-dash-border bg-dash-surface-hover/50 shrink-0",children:d.jsx("h3",{className:"text-xs font-bold text-dash-text-secondary uppercase tracking-widest",children:a("formTab")})}),d.jsx("div",{className:"flex-1 overflow-auto p-4",children:e?d.jsx("div",{className:"h-full flex items-center justify-center",children:d.jsx("div",{className:"animate-pulse text-dash-text-muted text-sm",children:a("loading")})}):t?d.jsx(Kv,{schema:t,value:r,sources:i,sections:s,onChange:o}):null})]})},zm=1024;let Gv=0,al=class{constructor(e,t){this.from=e,this.to=t}};class ue{constructor(e={}){this.id=Gv++,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=pt.match(e)),t=>{let r=e(t);return r===void 0?null:[this,r]}}}ue.closedBy=new ue({deserialize:n=>n.split(" ")});ue.openedBy=new ue({deserialize:n=>n.split(" ")});ue.group=new ue({deserialize:n=>n.split(" ")});ue.isolate=new ue({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});ue.contextHash=new ue({perNode:!0});ue.lookAhead=new ue({perNode:!0});ue.mounted=new ue({perNode:!0});class Si{constructor(e,t,r,i=!1){this.tree=e,this.overlay=t,this.parser=r,this.bracketed=i}static get(e){return e&&e.props&&e.props[ue.mounted.id]}}const qv=Object.create(null);class pt{constructor(e,t,r,i=0){this.name=e,this.props=t,this.id=r,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):qv,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new pt(e.name||"",t,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return i}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 t=this.prop(ue.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let i of r.split(" "))t[i]=e[r];return r=>{for(let i=r.prop(ue.group),s=-1;s<(i?i.length:0);s++){let o=t[s<0?r.name:i[s]];if(o)return o}}}}pt.none=new pt("",Object.create(null),0,8);class wh{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let r of this.types){let i=null;for(let s of e){let o=s(r);if(o){i||(i=Object.assign({},r.props));let a=o[1],l=o[0];l.combine&&l.id in i&&(a=l.combine(i[l.id],a)),i[l.id]=a}}t.push(i?new pt(r.name,i,r.id,r.flags):r)}return new wh(t)}}const co=new WeakMap,nu=new WeakMap;var Le;(function(n){n[n.ExcludeBuffers=1]="ExcludeBuffers",n[n.IncludeAnonymous=2]="IncludeAnonymous",n[n.IgnoreMounts=4]="IgnoreMounts",n[n.IgnoreOverlays=8]="IgnoreOverlays",n[n.EnterBracketed=16]="EnterBracketed"})(Le||(Le={}));class Be{constructor(e,t,r,i,s){if(this.type=e,this.children=t,this.positions=r,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,a]of s)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=Si.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let r of this.children){let i=r.toString();i&&(t&&(t+=","),t+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new mc(this.topNode,e)}cursorAt(e,t=0,r=0){let i=co.get(this)||this.topNode,s=new mc(i);return s.moveTo(e,t),co.set(this,s._tree),s}get topNode(){return new Dt(this,0,0,null)}resolve(e,t=0){let r=Ri(co.get(this)||this.topNode,e,t,!1);return co.set(this,r),r}resolveInner(e,t=0){let r=Ri(nu.get(this)||this.topNode,e,t,!0);return nu.set(this,r),r}resolveStack(e,t=0){return Qv(this,e,t)}iterate(e){let{enter:t,leave:r,from:i=0,to:s=this.length}=e,o=e.mode||0,a=(o&Le.IncludeAnonymous)>0;for(let l=this.cursor(o|Le.IncludeAnonymous);;){let c=!1;if(l.from<=s&&l.to>=i&&(!a&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!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 t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Ch(pt.none,this.children,this.positions,0,this.children.length,0,this.length,(t,r,i)=>new Be(this.type,t,r,i,this.propValues),e.makeTree||((t,r,i)=>new Be(pt.none,t,r,i)))}static build(e){return Xv(e)}}Be.empty=new Be(pt.none,[],[],0);class kh{constructor(e,t){this.buffer=e,this.index=t}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 Rn{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return pt.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],r=this.buffer[e+3],i=this.set.types[t],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,r==e)return s;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,r,i,s){let{buffer:o}=this,a=-1;for(let l=e;l!=t&&!(_m(s,i,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,t,r){let i=this.buffer,s=new Uint16Array(t-e),o=0;for(let a=e,l=0;a<t;){s[l++]=i[a++],s[l++]=i[a++]-r;let c=s[l++]=i[a++]-r;s[l++]=i[a++]-e,o=Math.max(o,c)}return new Rn(s,o,this.set)}}function _m(n,e,t,r){switch(n){case-2:return t<e;case-1:return r>=e&&t<e;case 0:return t<e&&r>e;case 1:return t<=e&&r>e;case 2:return r>e;case 4:return!0}}function Ri(n,e,t,r){for(var i;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to<e);){let o=!r&&n instanceof Dt&&n.index<0?null:n.parent;if(!o)return n;n=o}let s=r?0:Le.IgnoreOverlays;if(r)for(let o=n,a=o.parent;a;o=a,a=o.parent)o instanceof Dt&&o.index<0&&((i=a.enter(e,t,s))===null||i===void 0?void 0:i.from)!=o.from&&(n=a);for(;;){let o=n.enter(e,t,s);if(!o)return n;n=o}}class Hm{cursor(e=0){return new mc(this,e)}getChild(e,t=null,r=null){let i=ru(this,e,t,r);return i.length?i[0]:null}getChildren(e,t=null,r=null){return ru(this,e,t,r)}resolve(e,t=0){return Ri(this,e,t,!1)}resolveInner(e,t=0){return Ri(this,e,t,!0)}matchContext(e){return pc(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),r=this;for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(r=t,t=i.prevSibling):t=i}return r}get node(){return this}get next(){return this.parent}}class Dt extends Hm{constructor(e,t,r,i){super(),this._tree=e,this.from=t,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,i,s=0){var o;for(let a=this;;){for(let{children:l,positions:c}=a._tree,h=t>0?l.length:-1;e!=h;e+=t){let u=l[e],f=c[e]+a.from;if(!(!(s&Le.EnterBracketed&&u instanceof Be&&((o=Si.get(u))===null||o===void 0?void 0:o.overlay)===null&&(f>=r||f+u.length<=r))&&!_m(i,r,f,f+u.length))){if(u instanceof Rn){if(s&Le.ExcludeBuffers)continue;let p=u.findChild(0,u.buffer.length,t,r-f,i);if(p>-1)return new Mn(new Jv(a,u,e,f),null,p)}else if(s&Le.IncludeAnonymous||!u.type.isAnonymous||Sh(u)){let p;if(!(s&Le.IgnoreMounts)&&(p=Si.get(u))&&!p.overlay)return new Dt(p.tree,f,e,a);let m=new Dt(u,f,e,a);return s&Le.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(t<0?u.children.length-1:0,t,r,i,s)}}}if(s&Le.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+t:e=t<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,t,r=0){let i;if(!(r&Le.IgnoreOverlays)&&(i=Si.get(this._tree))&&i.overlay){let s=e-this.from,o=r&Le.EnterBracketed&&i.bracketed;for(let{from:a,to:l}of i.overlay)if((t>0||o?a<=s:a<s)&&(t<0||o?l>=s:l>s))return new Dt(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,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 ru(n,e,t,r){let i=n.cursor(),s=[];if(!i.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=i.type.is(t),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function pc(n,e,t=e.length-1){for(let r=n;t>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[t]&&e[t]!=r.name)return!1;t--}}return!0}class Jv{constructor(e,t,r,i){this.parent=e,this.buffer=t,this.index=r,this.start=i}}class Mn extends Hm{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,t,r){super(),this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,r);return s<0?null:new Mn(this.context,this,s)}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,t,r=0){if(r&Le.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new Mn(this.context,this,s)}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,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Mn(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Mn(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let o=r.buffer[this.index+1];e.push(r.slice(i,s,o)),t.push(0)}return new Be(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Wm(n){if(!n.length)return null;let e=0,t=n[0];for(let s=1;s<n.length;s++){let o=n[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let r=t instanceof Dt&&t.index<0?null:t.parent,i=n.slice();return r?i[e]=r:i.splice(e,1),new Yv(i,t)}class Yv{constructor(e,t){this.heads=e,this.node=t}get next(){return Wm(this.heads)}}function Qv(n,e,t){let r=n.resolveInner(e,t),i=null;for(let s=r instanceof Dt?r:r.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[r])).push(o.resolve(e,t)),s=o}else{let o=Si.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Dt(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(Ri(a,e,t,!1))}}return i?Wm(i):r}class mc{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~Le.EnterBracketed,e instanceof Dt)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,t){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof Dt?(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,t,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}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,t,r=this.mode){return this.buffer?r&Le.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Le.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Le.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:t}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(t.findChild(i,this.index,-1,0,4))}else{let i=t.buffer[this.index+3];if(i<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(i)}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 t,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:r}=i)}else({index:t,_parent:r}=this._tree);for(;r;{index:t,_parent:r}=r)if(t>-1)for(let s=t+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let a=r._tree.children[s];if(this.mode&Le.IncludeAnonymous||a instanceof Rn||!a.type.isAnonymous||Sh(a))return!1}return!0}move(e,t){if(t&&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,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;t=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)t=new Mn(this.buffer,t,this.stack[i]);return this.bufferNode=new Mn(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&t&&t(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return pc(this.node.parent,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return pc(this._tree,e,i);let o=r[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function Sh(n){return n.children.some(e=>e instanceof Rn||!e.type.isAnonymous||Sh(e))}function Xv(n){var e;let{buffer:t,nodeSet:r,maxBufferLength:i=zm,reused:s=[],minRepeatType:o=r.types.length}=n,a=Array.isArray(t)?new kh(t,t.length):t,l=r.types,c=0,h=0;function u(k,O,x,T,A,R){let{id:N,start:L,end:W,size:F}=a,B=h,q=c;if(F<0)if(a.next(),F==-1){let le=s[N];x.push(le),T.push(L-k);return}else if(F==-3){c=N;return}else if(F==-4){h=N;return}else throw new RangeError(`Unrecognized record size: ${F}`);let de=l[N],z,J,ie=L-k;if(W-L<=i&&(J=y(a.pos-O,A))){let le=new Uint16Array(J.size-J.skip),fe=a.pos-J.size,we=le.length;for(;a.pos>fe;)we=v(J.start,le,we);z=new Rn(le,W-J.start,r),ie=J.start-k}else{let le=a.pos-F;a.next();let fe=[],we=[],ke=N>=o?N:-1,Ae=0,Qe=W;for(;a.pos>le;)ke>=0&&a.id==ke&&a.size>=0?(a.end<=Qe-i&&(m(fe,we,L,Ae,a.end,Qe,ke,B,q),Ae=fe.length,Qe=a.end),a.next()):R>2500?f(L,le,fe,we):u(L,le,fe,we,ke,R+1);if(ke>=0&&Ae>0&&Ae<fe.length&&m(fe,we,L,Ae,L,Qe,ke,B,q),fe.reverse(),we.reverse(),ke>-1&&Ae>0){let mt=p(de,q);z=Ch(de,fe,we,0,fe.length,0,W-L,mt,mt)}else z=b(de,fe,we,W-L,B-W,q)}x.push(z),T.push(ie)}function f(k,O,x,T){let A=[],R=0,N=-1;for(;a.pos>O;){let{id:L,start:W,end:F,size:B}=a;if(B>4)a.next();else{if(N>-1&&W<N)break;N<0&&(N=F-i),A.push(L,W,F),R++,a.next()}}if(R){let L=new Uint16Array(R*4),W=A[A.length-2];for(let F=A.length-3,B=0;F>=0;F-=3)L[B++]=A[F],L[B++]=A[F+1]-W,L[B++]=A[F+2]-W,L[B++]=B;x.push(new Rn(L,A[2]-W,r)),T.push(W-k)}}function p(k,O){return(x,T,A)=>{let R=0,N=x.length-1,L,W;if(N>=0&&(L=x[N])instanceof Be){if(!N&&L.type==k&&L.length==A)return L;(W=L.prop(ue.lookAhead))&&(R=T[N]+L.length+W)}return b(k,x,T,A,R,O)}}function m(k,O,x,T,A,R,N,L,W){let F=[],B=[];for(;k.length>T;)F.push(k.pop()),B.push(O.pop()+x-A);k.push(b(r.types[N],F,B,R-A,L-R,W)),O.push(A-x)}function b(k,O,x,T,A,R,N){if(R){let L=[ue.contextHash,R];N=N?[L].concat(N):[L]}if(A>25){let L=[ue.lookAhead,A];N=N?[L].concat(N):[L]}return new Be(k,O,x,T,N)}function y(k,O){let x=a.fork(),T=0,A=0,R=0,N=x.end-i,L={size:0,start:0,skip:0};e:for(let W=x.pos-k;x.pos>W;){let F=x.size;if(x.id==O&&F>=0){L.size=T,L.start=A,L.skip=R,R+=4,T+=4,x.next();continue}let B=x.pos-F;if(F<0||B<W||x.start<N)break;let q=x.id>=o?4:0,de=x.start;for(x.next();x.pos>B;){if(x.size<0)if(x.size==-3||x.size==-4)q+=4;else break e;else x.id>=o&&(q+=4);x.next()}A=de,T+=F,R+=q}return(O<0||T==k)&&(L.size=T,L.start=A,L.skip=R),L.size>4?L:void 0}function v(k,O,x){let{id:T,start:A,end:R,size:N}=a;if(a.next(),N>=0&&T<o){let L=x;if(N>4){let W=a.pos-(N-4);for(;a.pos>W;)x=v(k,O,x)}O[--x]=L,O[--x]=R-k,O[--x]=A-k,O[--x]=T}else N==-3?c=T:N==-4&&(h=T);return x}let w=[],C=[];for(;a.pos>0;)u(n.start||0,n.bufferStart||0,w,C,-1,0);let j=(e=n.length)!==null&&e!==void 0?e:w.length?C[0]+w[0].length:0;return new Be(l[n.topID],w.reverse(),C.reverse(),j)}const iu=new WeakMap;function Ho(n,e){if(!n.isAnonymous||e instanceof Rn||e.type!=n)return 1;let t=iu.get(e);if(t==null){t=1;for(let r of e.children){if(r.type!=n||!(r instanceof Be)){t=1;break}t+=Ho(n,r)}iu.set(e,t)}return t}function Ch(n,e,t,r,i,s,o,a,l){let c=0;for(let m=r;m<i;m++)c+=Ho(n,e[m]);let h=Math.ceil(c*1.5/8),u=[],f=[];function p(m,b,y,v,w){for(let C=y;C<v;){let j=C,k=b[C],O=Ho(n,m[C]);for(C++;C<v;C++){let x=Ho(n,m[C]);if(O+x>=h)break;O+=x}if(C==j+1){if(O>h){let x=m[j];p(x.children,x.positions,0,x.children.length,b[j]+w);continue}u.push(m[j])}else{let x=b[C-1]+m[C-1].length-k;u.push(Ch(n,m,b,j,C,k,x,null,l))}f.push(k+w-s)}}return p(e,t,r,i,0),(a||l)(u,f,o)}class ir{constructor(e,t,r,i,s=!1,o=!1){this.from=e,this.to=t,this.tree=r,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],r=!1){let i=[new ir(0,e.length,e,0,!1,r)];for(let s of t)s.to>e.length&&i.push(s);return i}static applyChanges(e,t,r=128){if(!t.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let h=a<t.length?t[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||c){let p=Math.max(f.from,l)-c,m=Math.min(f.to,u)-c;f=p>=m?null:new ir(p,m,f.tree,f.offset+c,a>0,!!h)}if(f&&i.push(f),o.to>u)break;o=s<e.length?e[s++]:null}if(!h)break;l=h.toA,c=h.toA-h.toB}return i}}class Um{startParse(e,t,r){return typeof e=="string"&&(e=new Zv(e)),r=r?r.length?r.map(i=>new al(i.from,i.to)):[new al(0,0)]:[new al(0,e.length)],this.createParse(e,t||[],r)}parse(e,t,r){let i=this.startParse(e,t,r);for(;;){let s=i.advance();if(s)return s}}}class Zv{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new ue({perNode:!0});var su={};class ea{constructor(e,t,r,i,s,o,a,l,c,h=0,u){this.p=e,this.stack=t,this.state=r,this.reducePos=i,this.pos=s,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=h,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,r=0){let i=e.parser.context;return new ea(e,[],t,r,r,0,[],0,i?new ou(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let r=e>>19,i=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=s.dynamicPrecedence(i);if(a&&(this.score+=a),r==0){this.pushState(s.getGoto(this.state,i,!0),this.reducePos),i<s.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(i,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from,h=this.reducePos-c;h>=2e3&&!(!((t=this.p.parser.nodeSet.types[i])===null||t===void 0)&&t.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSize<h&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=h));let u=l?this.stack[l-1]:0,f=this.bufferBase+this.buffer.length-u;if(i<s.minRepeatTerm||e&131072){let p=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,c,p,f+4,!0)}if(e&262144)this.state=this.stack[l];else{let p=this.stack[l-3];this.state=s.getGoto(p,i,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(i,c)}storeNode(e,t,r,i=4,s=!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(t==r)return;if(o.buffer[a-2]>=t){o.buffer[a-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,t,r,i);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,i>4&&(i-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=r,this.buffer[o+3]=i}}shift(e,t,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=i,this.shiftContext(t,r),t<=this.p.parser.maxNode&&this.buffer.push(t,r,i,4);else{let s=e,{parser:o}=this.p;(i>this.pos||t<=o.maxNode)&&(this.pos=i,o.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,r),this.shiftContext(t,r),t<=o.maxNode&&this.buffer.push(t,r,i,4)}}apply(e,t,r,i){e&65536?this.reduce(e):this.shift(e,t,r,i)}useNode(e,t){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(t,i),this.buffer.push(r,i,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,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let r=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new ea(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,r?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new e2(this);;){let r=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(r==0)return!1;if(!(r&65536))return!0;t.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let i=[];for(let s=0,o;s<t.length;s+=2)(o=t[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&i.push(t[s],o);if(this.stack.length<120)for(let s=0;i.length<8&&s<t.length;s+=2){let o=t[s+1];i.some((a,l)=>l&1&&a==o)||i.push(t[s],o)}t=i}let r=[];for(let i=0;i<t.length&&r.length<4;i+=2){let s=t[i+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[i],this.pos),o.reducePos=this.pos,o.score-=200,r.push(o)}return r}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let r=t>>19,i=t&65535,s=this.stack.length-r*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],r=(i,s)=>{if(!t.includes(i))return t.push(i),e.allActions(i,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-s;if(a>1){let l=o&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(o,s+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 t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}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 t=new ou(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}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 ou{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class e2{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=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 i=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=i}}class ta{constructor(e,t,r){this.stack=e,this.pos=t,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new ta(e,t,t-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 ta(this.stack,this.pos,this.index)}}function ho(n,e=Uint16Array){if(typeof n!="string")return n;let t=null;for(let r=0,i=0;r<n.length;){let s=0;for(;;){let o=n.charCodeAt(r++),a=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),s+=l,a)break;s*=46}t?t[i++]=s:t=new e(s)}return t}class Wo{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const au=new Wo;class t2{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=au,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let r=this.range,i=this.rangeIndex,s=this.pos+e;for(;s<r.from;){if(!i)return null;let o=this.ranges[--i];s-=r.from-o.to,r=o}for(;t<0?s>r.to:s>=r.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-r.to,r=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,r,i;if(t>=0&&t<this.chunk.length)r=this.pos+e,i=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(r=s,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)i=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)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(e,t=0){let r=t?this.resolveOffset(t,-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,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>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,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=au,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,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let r="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return r}}class Nr{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:r}=t.p;n2(this.data,e,t,this.id,r.data,r.tokenPrecTable)}}Nr.prototype.contextual=Nr.prototype.fallback=Nr.prototype.extend=!1;Nr.prototype.fallback=Nr.prototype.extend=!1;function n2(n,e,t,r,i,s){let o=0,a=1<<r,{dialect:l}=t.p.parser;e:for(;a&n[o];){let c=n[o+1];for(let p=o+3;p<c;p+=2)if((n[p+1]&a)>0){let m=n[p];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||r2(m,e.token.value,i,s))){e.acceptToken(m);break}}let h=e.next,u=0,f=n[o+2];if(e.next<0&&f>u&&n[c+f*3-3]==65535){o=n[c+f*3-1];continue e}for(;u<f;){let p=u+f>>1,m=c+p+(p<<1),b=n[m],y=n[m+1]||65536;if(h<b)f=p;else if(h>=y)u=p+1;else{o=n[m+2],e.advance();continue e}}break}}function lu(n,e,t){for(let r=e,i;(i=n[r])!=65535;r++)if(i==t)return r-e;return-1}function r2(n,e,t,r){let i=lu(t,r,e);return i<0||lu(t,r,n)<i}const bt=typeof process<"u"&&su&&/\bparse\b/.test(su.LOG);let ll=null;function cu(n,e,t){let r=n.cursor(Le.IncludeAnonymous);for(r.moveTo(e);;)if(!(t<0?r.childBefore(e):r.childAfter(e)))for(;;){if((t<0?r.to<e:r.from>e)&&!r.type.isError)return t<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(n.length,Math.max(r.from+1,e+25));if(t<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return t<0?0:n.length}}class i2{constructor(e,t){this.fragments=e,this.nodeSet=t,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?cu(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?cu(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 t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let r=this.trees[t],i=this.index[t];if(i==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=r.children[i],o=this.start[t]+r.positions[i];if(o>e)return this.nextStart=o,null;if(s instanceof Be){if(o==e){if(o<this.safeFrom)return null;let a=o+s.length;if(a<=this.safeTo){let l=s.prop(ue.lookAhead);if(!l||a+l<this.fragment.to)return s}}this.index[t]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}}class s2{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Wo)}getActions(e){let t=0,r=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<s.length;c++){if(!(1<<c&o))continue;let h=s[c],u=this.tokens[c];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=t;if(u.extended>-1&&(t=this.addActions(e,u.extended,u.end,t)),t=this.addActions(e,u.value,u.end,t),!h.extend&&(r=u,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new Wo,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,t=this.addActions(e,r.value,r.end,t)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Wo,{pos:r,p:i}=e;return t.start=r,t.end=Math.min(r+1,i.stream.end),t.value=r==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,r){let i=this.stream.clipPos(r.pos);if(t.token(this.stream.reset(i,e),r),e.value>-1){let{parser:s}=r.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let a=s.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(i+1)}putAction(e,t,r,i){for(let s=0;s<i;s+=3)if(this.actions[s]==e)return i;return this.actions[i++]=e,this.actions[i++]=t,this.actions[i++]=r,i}addActions(e,t,r,i){let{state:s}=e,{parser:o}=e.p,{data:a}=o;for(let l=0;l<2;l++)for(let c=o.stateSlot(s,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=mn(a,c+2);else{i==0&&a[c+1]==2&&(i=this.putAction(mn(a,c+2),t,r,i));break}a[c]==t&&(i=this.putAction(mn(a,c+1),t,r,i))}return i}}class o2{constructor(e,t,r,i){this.parser=e,this.input=t,this.ranges=i,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 t2(t,i),this.tokens=new s2(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[ea.start(this,e.top[0],s)],this.fragments=r.length&&this.stream.end-s>e.bufferLength*4?new i2(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,r=this.stacks=[],i,s;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>t)r.push(a);else{if(this.advanceStack(a,r,e))continue;{i||(i=[],s=[]),i.push(a);let l=this.tokens.getMainToken(a);s.push(l.value,l.end)}}break}}if(!r.length){let o=i&&l2(i);if(o)return bt&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw bt&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,r);if(o)return bt&&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>t)&&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 c=r[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.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,t,r){let i=e.pos,{parser:s}=this,o=bt?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,h=c?e.curContext.hash:0;for(let u=this.fragments.nodeAt(i);u;){let f=this.parser.nodeSet.types[u.type.id]==u.type?s.getGoto(e.state,u.type.id):-1;if(f>-1&&u.length&&(!c||(u.prop(ue.contextHash)||0)==h))return e.useNode(u,f),bt&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(u.type.id)})`),!0;if(!(u instanceof Be)||u.children.length==0||u.positions[0]>0)break;let p=u.children[0];if(p instanceof Be&&u.positions[0]==0)u=p;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),bt&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let h=l[c++],u=l[c++],f=l[c++],p=c==l.length||!r,m=p?e:e.split(),b=this.tokens.mainToken;if(m.apply(h,u,b?b.start:m.pos,f),bt&&console.log(o+this.stackID(m)+` (via ${h&65536?`reduce of ${s.getName(h&65535)}`:"shift"} for ${s.getName(u)} @ ${i}${m==e?"":", split"})`),p)return!0;m.pos>i?t.push(m):r.push(m)}return!1}advanceFully(e,t){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return hu(e,t),!0}}runRecovery(e,t,r){let i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o],l=t[o<<1],c=t[(o<<1)+1],h=bt?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),bt&&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()&&(bt&&console.log(f+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,r));p++)bt&&(f=this.stackID(u)+" -> ");for(let p of a.recoverByInsert(l))bt&&console.log(h+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,r);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),bt&&console.log(h+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),hu(a,r)):(!i||i.score<a.score)&&(i=a)}return i}stackToTree(e){return e.close(),Be.build({buffer:ta.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 t=(ll||(ll=new WeakMap)).get(e);return t||ll.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function hu(n,e){for(let t=0;t<e.length;t++){let r=e[t];if(r.pos==n.pos&&r.sameState(n)){e[t].score<n.score&&(e[t]=n);return}}e.push(n)}class a2{constructor(e,t,r){this.source=e,this.flags=t,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}class na extends Um{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let a=0;a<e.repeatNodeCount;a++)t.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),i=[];for(let a=0;a<t.length;a++)i.push([]);function s(a,l,c){i[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=ue[l]);for(let c=1;c<a.length;){let h=a[c++];if(h>=0)s(h,l,a[c++]);else{let u=a[c+-h];for(let f=-h;f>0;f--)s(a[c++],l,u);c++}}}this.nodeSet=new wh(t.map((a,l)=>pt.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:i[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=zm;let o=ho(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(du),this.states=ho(e.states,Uint32Array),this.data=ho(e.stateData),this.goto=ho(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new Nr(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,t,r){let i=new o2(this,e,t,r);for(let s of this.wrappers)i=s(i,e,t,r);return i}getGoto(e,t,r=!1){let i=this.goto;if(t>=i[0])return-1;for(let s=i[t+1];;){let o=i[s++],a=o&1,l=i[s++];if(a&&r)return l;for(let c=s+(o>>1);s<c;s++)if(i[s]==e)return l;if(a)return-1}}hasAction(e,t){let r=this.data;for(let i=0;i<2;i++)for(let s=this.stateSlot(e,i?2:1),o;;s+=3){if((o=r[s])==65535)if(r[s+1]==1)o=r[s=mn(r,s+2)];else{if(r[s+1]==2)return mn(r,s+2);break}if(o==t||o==0)return mn(r,s+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,r=>r==t?!0:null)}allActions(e,t){let r=this.stateSlot(e,4),i=r?t(r):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=mn(this.data,s+2);else break;i=t(mn(this.data,s+1))}return i}nextStates(e){let t=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=mn(this.data,r+2);else break;if(!(this.data[r+2]&1)){let i=this.data[r+1];t.some((s,o)=>o&1&&s==i)||t.push(this.data[r],i)}}return t}configure(e){let t=Object.assign(Object.create(na.prototype),this);if(e.props&&(t.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}`);t.top=r}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(s=>s.from==r);return i?i.to:r})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((r,i)=>{let s=e.specializers.find(a=>a.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return t.specializers[i]=du(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}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 t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),r=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(r[o]=!0)}let i=null;for(let s=0;s<t.length;s++)if(!r[s])for(let o=this.dialects[t[s]],a;(a=this.data[o++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new a2(e,r,i)}static deserialize(e){return new na(e)}}function mn(n,e){return n[e]|n[e+1]<<16}function l2(n){let e=null;for(let t of n){let r=t.p.stoppedAt;(t.pos==t.p.stream.end||r!=null&&t.pos>r)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function du(n){if(n.external){let e=n.extend?1:0;return(t,r)=>n.external(t,r)<<1|e}return n.get}let c2=0;class Nt{constructor(e,t,r,i){this.name=e,this.set=t,this.base=r,this.modified=i,this.id=c2++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let r=typeof e=="string"?e:"?";if(e instanceof Nt&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let i=new Nt(r,[],null,[]);if(i.set.push(i),t)for(let s of t.set)i.set.push(s);return i}static defineModifier(e){let t=new ra(e);return r=>r.modified.indexOf(t)>-1?r:ra.get(r.base||r,r.modified.concat(t).sort((i,s)=>i.id-s.id))}}let h2=0;class ra{constructor(e){this.name=e,this.instances=[],this.id=h2++}static get(e,t){if(!t.length)return e;let r=t[0].instances.find(a=>a.base==e&&d2(t,a.modified));if(r)return r;let i=[],s=new Nt(e.name,i,e,t);for(let a of t)a.instances.push(s);let o=u2(t);for(let a of e.set)if(!a.modified.length)for(let l of o)i.push(ra.get(a,l));return s}}function d2(n,e){return n.length==e.length&&n.every((t,r)=>t==e[r])}function u2(n){let e=[[]];for(let t=0;t<n.length;t++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(n[t]));return e.sort((t,r)=>r.length-t.length)}function Km(n){let e=Object.create(null);for(let t in n){let r=n[t];Array.isArray(r)||(r=[r]);for(let i of t.split(" "))if(i){let s=[],o=2,a=i;for(let u=0;;){if(a=="..."&&u>0&&u+3==i.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+i);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),u+=f[0].length,u==i.length)break;let p=i[u++];if(u==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);a=i.slice(u)}let l=s.length-1,c=s[l];if(!c)throw new RangeError("Invalid path: "+i);let h=new Li(r,o,l>0?s.slice(0,l):null);e[c]=h.sort(e[c])}}return Gm.add(e)}const Gm=new ue({combine(n,e){let t,r,i;for(;n||e;){if(!n||e&&n.depth>=e.depth?(i=e,e=e.next):(i=n,n=n.next),t&&t.mode==i.mode&&!i.context&&!t.context)continue;let s=new Li(i.tags,i.mode,i.context);t?t.next=s:r=s,t=s}return r}});class Li{constructor(e,t,r,i){this.tags=e,this.mode=t,this.context=r,this.next=i}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}}Li.empty=new Li([],2,null);function qm(n,e){let t=Object.create(null);for(let s of n)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let o of s.tag)t[o.id]=s.class;let{scope:r,all:i=null}=e||{};return{style:s=>{let o=i;for(let a of s)for(let l of a.set){let c=t[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function f2(n,e){let t=null;for(let r of n){let i=r.style(e);i&&(t=t?t+" "+i:i)}return t}function p2(n,e,t,r=0,i=n.length){let s=new m2(r,Array.isArray(e)?e:[e],t);s.highlightRange(n.cursor(),r,i,"",s.highlighters),s.flush(i)}class m2{constructor(e,t,r){this.at=e,this.highlighters=t,this.span=r,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,r,i,s){let{type:o,from:a,to:l}=e;if(a>=r||l<=t)return;o.isTop&&(s=this.highlighters.filter(p=>!p.scope||p.scope(o)));let c=i,h=g2(e)||Li.empty,u=f2(s,h.tags);if(u&&(c&&(c+=" "),c+=u,h.mode==1&&(i+=(i?" ":"")+u)),this.startSpan(Math.max(t,a),c),h.opaque)return;let f=e.tree&&e.tree.prop(ue.mounted);if(f&&f.overlay){let p=e.node.enter(f.overlay[0].from+a,1),m=this.highlighters.filter(y=>!y.scope||y.scope(f.tree.type)),b=e.firstChild();for(let y=0,v=a;;y++){let w=y<f.overlay.length?f.overlay[y]:null,C=w?w.from+a:l,j=Math.max(t,v),k=Math.min(r,C);if(j<k&&b)for(;e.from<k&&(this.highlightRange(e,j,k,i,s),this.startSpan(Math.min(k,e.to),c),!(e.to>=C||!e.nextSibling())););if(!w||C>r)break;v=w.to+a,v>t&&(this.highlightRange(p.cursor(),Math.max(t,w.from+a),Math.min(r,v),"",m),this.startSpan(Math.min(r,v),c))}b&&e.parent()}else if(e.firstChild()){f&&(i="");do if(!(e.to<=t)){if(e.from>=r)break;this.highlightRange(e,t,r,i,s),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function g2(n){let e=n.type.prop(Gm);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const _=Nt.define,uo=_(),Sn=_(),uu=_(Sn),fu=_(Sn),Cn=_(),fo=_(Cn),cl=_(Cn),Yt=_(),qn=_(Yt),Gt=_(),qt=_(),gc=_(),li=_(gc),po=_(),D={comment:uo,lineComment:_(uo),blockComment:_(uo),docComment:_(uo),name:Sn,variableName:_(Sn),typeName:uu,tagName:_(uu),propertyName:fu,attributeName:_(fu),className:_(Sn),labelName:_(Sn),namespace:_(Sn),macroName:_(Sn),literal:Cn,string:fo,docString:_(fo),character:_(fo),attributeValue:_(fo),number:cl,integer:_(cl),float:_(cl),bool:_(Cn),regexp:_(Cn),escape:_(Cn),color:_(Cn),url:_(Cn),keyword:Gt,self:_(Gt),null:_(Gt),atom:_(Gt),unit:_(Gt),modifier:_(Gt),operatorKeyword:_(Gt),controlKeyword:_(Gt),definitionKeyword:_(Gt),moduleKeyword:_(Gt),operator:qt,derefOperator:_(qt),arithmeticOperator:_(qt),logicOperator:_(qt),bitwiseOperator:_(qt),compareOperator:_(qt),updateOperator:_(qt),definitionOperator:_(qt),typeOperator:_(qt),controlOperator:_(qt),punctuation:gc,separator:_(gc),bracket:li,angleBracket:_(li),squareBracket:_(li),paren:_(li),brace:_(li),content:Yt,heading:qn,heading1:_(qn),heading2:_(qn),heading3:_(qn),heading4:_(qn),heading5:_(qn),heading6:_(qn),contentSeparator:_(Yt),list:_(Yt),quote:_(Yt),emphasis:_(Yt),strong:_(Yt),link:_(Yt),monospace:_(Yt),strikethrough:_(Yt),inserted:_(),deleted:_(),changed:_(),invalid:_(),meta:po,documentMeta:_(po),annotation:_(po),processingInstruction:_(po),definition:Nt.defineModifier("definition"),constant:Nt.defineModifier("constant"),function:Nt.defineModifier("function"),standard:Nt.defineModifier("standard"),local:Nt.defineModifier("local"),special:Nt.defineModifier("special")};for(let n in D){let e=D[n];e instanceof Nt&&(e.name=n)}qm([{tag:D.link,class:"tok-link"},{tag:D.heading,class:"tok-heading"},{tag:D.emphasis,class:"tok-emphasis"},{tag:D.strong,class:"tok-strong"},{tag:D.keyword,class:"tok-keyword"},{tag:D.atom,class:"tok-atom"},{tag:D.bool,class:"tok-bool"},{tag:D.url,class:"tok-url"},{tag:D.labelName,class:"tok-labelName"},{tag:D.inserted,class:"tok-inserted"},{tag:D.deleted,class:"tok-deleted"},{tag:D.literal,class:"tok-literal"},{tag:D.string,class:"tok-string"},{tag:D.number,class:"tok-number"},{tag:[D.regexp,D.escape,D.special(D.string)],class:"tok-string2"},{tag:D.variableName,class:"tok-variableName"},{tag:D.local(D.variableName),class:"tok-variableName tok-local"},{tag:D.definition(D.variableName),class:"tok-variableName tok-definition"},{tag:D.special(D.variableName),class:"tok-variableName2"},{tag:D.definition(D.propertyName),class:"tok-propertyName tok-definition"},{tag:D.typeName,class:"tok-typeName"},{tag:D.namespace,class:"tok-namespace"},{tag:D.className,class:"tok-className"},{tag:D.macroName,class:"tok-macroName"},{tag:D.propertyName,class:"tok-propertyName"},{tag:D.operator,class:"tok-operator"},{tag:D.comment,class:"tok-comment"},{tag:D.meta,class:"tok-meta"},{tag:D.invalid,class:"tok-invalid"},{tag:D.punctuation,class:"tok-punctuation"}]);const b2=Km({String:D.string,Number:D.number,"True False":D.bool,PropertyName:D.propertyName,Null:D.null,", :":D.separator,"[ ]":D.squareBracket,"{ }":D.brace}),y2=na.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:[b2],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 bc=[],Jm=[];(()=>{let n="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,t=0;e<n.length;e++)(e%2?Jm:bc).push(t=t+n[e])})();function x2(n){if(n<768)return!1;for(let e=0,t=bc.length;;){let r=e+t>>1;if(n<bc[r])t=r;else if(n>=Jm[r])e=r+1;else return!0;if(e==t)return!1}}function pu(n){return n>=127462&&n<=127487}const mu=8205;function v2(n,e,t=!0,r=!0){return(t?Ym:w2)(n,e,r)}function Ym(n,e,t){if(e==n.length)return e;e&&Qm(n.charCodeAt(e))&&Xm(n.charCodeAt(e-1))&&e--;let r=hl(n,e);for(e+=gu(r);e<n.length;){let i=hl(n,e);if(r==mu||i==mu||t&&x2(i))e+=gu(i),r=i;else if(pu(i)){let s=0,o=e-2;for(;o>=0&&pu(hl(n,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function w2(n,e,t){for(;e>0;){let r=Ym(n,e-2,t);if(r<e)return r;e--}return 0}function hl(n,e){let t=n.charCodeAt(e);if(!Xm(t)||e+1==n.length)return t;let r=n.charCodeAt(e+1);return Qm(r)?(t-55296<<10)+(r-56320)+65536:t}function Qm(n){return n>=56320&&n<57344}function Xm(n){return n>=55296&&n<56320}function gu(n){return n<65536?1:2}class xe{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,t,r){[e,t]=Ir(this,e,t);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(t,this.length,i,1),Xt.from(i,this.length-(t-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Ir(this,e,t);let r=[];return this.decompose(e,t,r,0),Xt.from(r,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new Ci(this),s=new Ci(e);for(let o=t,a=t;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(a+=i.value.length,i.done||a>=r)return!0}}iter(e=1){return new Ci(this,e)}iterRange(e,t=this.length){return new Zm(this,e,t)}iterLines(e,t){let r;if(e==null)r=this.iter();else{t==null&&(t=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new eg(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]?xe.empty:e.length<=32?new $e(e):Xt.from($e.split(e,[]))}}class $e extends xe{constructor(e,t=k2(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,r,i){for(let s=0;;s++){let o=this.text[s],a=i+o.length;if((t?r:a)>=e)return new S2(i,a,r,o);i=a+1,r++}}decompose(e,t,r,i){let s=e<=0&&t>=this.length?this:new $e(bu(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),a=Uo(s.text,o.text.slice(),0,s.length);if(a.length<=32)r.push(new $e(a,o.length+s.length));else{let l=a.length>>1;r.push(new $e(a.slice(0,l)),new $e(a.slice(l)))}}else r.push(s)}replace(e,t,r){if(!(r instanceof $e))return super.replace(e,t,r);[e,t]=Ir(this,e,t);let i=Uo(this.text,Uo(r.text,bu(this.text,0,e)),t),s=this.length+r.length-(t-e);return i.length<=32?new $e(i,s):Xt.from($e.split(i,[]),s)}sliceString(e,t=this.length,r=`
53
- `){[e,t]=Ir(this,e,t);let i="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let a=this.text[o],l=s+a.length;s>e&&o&&(i+=r),e<l&&t>s&&(i+=a.slice(Math.max(0,e-s),t-s)),s=l+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(t.push(new $e(r,i)),r=[],i=-1);return i>-1&&t.push(new $e(r,i)),t}}class Xt extends xe{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,t,r,i){for(let s=0;;s++){let o=this.children[s],a=i+o.length,l=r+o.lines-1;if((t?l:a)>=e)return o.lineInner(e,t,r,i);i=a+1,r=l+1}}decompose(e,t,r,i){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let a=this.children[s],l=o+a.length;if(e<=l&&t>=o){let c=i&((o<=e?1:0)|(l>=t?2:0));o>=e&&l<=t&&!c?r.push(a):a.decompose(e-o,t-o,r,c)}o=l+1}}replace(e,t,r){if([e,t]=Ir(this,e,t),r.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let o=this.children[i],a=s+o.length;if(e>=s&&t<=a){let l=o.replace(e-s,t-s,r),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let h=this.children.slice();return h[i]=l,new Xt(h,this.length-(t-e)+r.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,t,r)}sliceString(e,t=this.length,r=`
54
- `){[e,t]=Ir(this,e,t);let i="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let a=this.children[s],l=o+a.length;o>e&&s&&(i+=r),e<l&&t>o&&(i+=a.sliceString(e-o,t-o,r)),o=l+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Xt))return 0;let r=0,[i,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,s+=t){if(i==o||s==a)return r;let l=this.children[i],c=e.children[s];if(l!=c)return r+l.scanIdentical(c,t);r+=l.length+1}}static from(e,t=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let p of e)r+=p.lines;if(r<32){let p=[];for(let m of e)m.flatten(p);return new $e(p,t)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,a=[],l=0,c=-1,h=[];function u(p){let m;if(p.lines>s&&p instanceof Xt)for(let b of p.children)u(b);else p.lines>o&&(l>o||!l)?(f(),a.push(p)):p instanceof $e&&l&&(m=h[h.length-1])instanceof $e&&p.lines+m.lines<=32?(l+=p.lines,c+=p.length+1,h[h.length-1]=new $e(m.text.concat(p.text),m.length+1+p.length)):(l+p.lines>i&&f(),l+=p.lines,c+=p.length+1,h.push(p))}function f(){l!=0&&(a.push(h.length==1?h[0]:Xt.from(h,c)),c=-1,l=h.length=0)}for(let p of e)u(p);return f(),a.length==1?a[0]:new Xt(a,t)}}xe.empty=new $e([""],0);function k2(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Uo(n,e,t=0,r=1e9){for(let i=0,s=0,o=!0;s<n.length&&i<=r;s++){let a=n[s],l=i+a.length;l>=t&&(l>r&&(a=a.slice(0,r-i)),i<t&&(a=a.slice(t-i)),o?(e[e.length-1]+=a,o=!1):e.push(a)),i=l+1}return e}function bu(n,e,t){return Uo(n,[""],e,t)}class Ci{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof $e?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,a=i instanceof $e?i.text.length:i.children.length;if(o==(t>0?a:0)){if(r==0)return this.done=!0,this.value="",this;t>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[r]+=t,e==0)return this.lineBreak=!0,this.value=`
55
- `,this;e--}else if(i instanceof $e){let l=i.text[o+(t<0?-1:0)];if(this.offsets[r]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=t):(t<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof $e?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 Zm{constructor(e,t,r){this.value="",this.done=!1,this.cursor=new Ci(e,t>r?-1:1),this.pos=t>r?e.length:0,this.from=Math.min(t,r),this.to=Math.max(t,r)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let r=t<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=r?i:t<0?i.slice(i.length-r):i.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 eg{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:r,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(xe.prototype[Symbol.iterator]=function(){return this.iter()},Ci.prototype[Symbol.iterator]=Zm.prototype[Symbol.iterator]=eg.prototype[Symbol.iterator]=function(){return this});class S2{constructor(e,t,r,i){this.from=e,this.to=t,this.number=r,this.text=i}get length(){return this.to-this.from}}function Ir(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function _e(n,e,t=!0,r=!0){return v2(n,e,t,r)}function C2(n){return n>=56320&&n<57344}function j2(n){return n>=55296&&n<56320}function ct(n,e){let t=n.charCodeAt(e);if(!j2(t)||e+1==n.length)return t;let r=n.charCodeAt(e+1);return C2(r)?(t-55296<<10)+(r-56320)+65536:t}function jh(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Zt(n){return n<65536?1:2}const yc=/\r\n?|\n/;var st=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(st||(st={}));class sn{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t+1];e+=r<0?this.sections[t]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,r=0,i=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(r,i,s),i+=s):i+=o,r+=s}}iterChangedRanges(e,t=!1){xc(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let r=this.sections[t++],i=this.sections[t++];i<0?e.push(r,i):e.push(i,r)}return new sn(e)}composeDesc(e){return this.empty?e:e.empty?this:tg(this,e)}mapDesc(e,t=!1){return e.empty?this:vc(this,e,t)}mapPos(e,t=-1,r=st.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=i+a;if(l<0){if(c>e)return s+(e-i);s+=a}else{if(r!=st.Simple&&c>=e&&(r==st.TrackDel&&i<e&&c>e||r==st.TrackBefore&&i<e||r==st.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!a)return e==i||t<0?s:s+l;s+=l}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,t=e){for(let r=0,i=0;r<this.sections.length&&i<=t;){let s=this.sections[r++],o=this.sections[r++],a=i+s;if(o>=0&&i<=t&&a>=e)return i<e&&a>t?"cover":!0;i=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let r=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new sn(e)}static create(e){return new sn(e)}}class ze extends sn{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return xc(this,(t,r,i,s,o)=>e=e.replace(i,i+(r-t),o),!1),e}mapDesc(e,t=!1){return vc(this,e,t,!0)}invert(e){let t=this.sections.slice(),r=[];for(let i=0,s=0;i<t.length;i+=2){let o=t[i],a=t[i+1];if(a>=0){t[i]=a,t[i+1]=o;let l=i>>1;for(;r.length<l;)r.push(xe.empty);r.push(o?e.slice(s,s+o):xe.empty)}s+=o}return new ze(t,r)}compose(e){return this.empty?e:e.empty?this:tg(this,e,!0)}map(e,t=!1){return e.empty?this:vc(this,e,t,!0)}iterChanges(e,t=!1){xc(this,e,t)}get desc(){return sn.create(this.sections)}filter(e){let t=[],r=[],i=[],s=new Ii(this);e:for(let o=0,a=0;;){let l=o==e.length?1e9:e[o++];for(;a<l||a==l&&s.len==0;){if(s.done)break e;let h=Math.min(s.len,l-a);et(i,h,-1);let u=s.ins==-1?-1:s.off==0?s.ins:0;et(t,h,u),u>0&&Tn(r,t,s.text),s.forward(h),a+=h}let c=e[o++];for(;a<c;){if(s.done)break e;let h=Math.min(s.len,c-a);et(t,h,-1),et(i,h,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(h),a+=h}}return{changes:new ze(t,r),filtered:sn.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t],i=this.sections[t+1];i<0?e.push(r):i==0?e.push([r]):e.push([r].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,r){let i=[],s=[],o=0,a=null;function l(h=!1){if(!h&&!i.length)return;o<t&&et(i,t-o,-1);let u=new ze(i,s);a=a?a.compose(u.map(a)):u,i=[],s=[],o=0}function c(h){if(Array.isArray(h))for(let u of h)c(u);else if(h instanceof ze){if(h.length!=t)throw new RangeError(`Mismatched change set length (got ${h.length}, expected ${t})`);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>t)throw new RangeError(`Invalid change range ${u} to ${f} (in doc of length ${t})`);let m=p?typeof p=="string"?xe.of(p.split(r||yc)):p:xe.empty,b=m.length;if(u==f&&b==0)return;u<o&&l(),u>o&&et(i,u-o,-1),et(i,f-u,b),Tn(s,i,m),o=f}}return c(e),l(!a),a}static empty(e){return new ze(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],r=[];for(let i=0;i<e.length;i++){let s=e[i];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;r.length<i;)r.push(xe.empty);r[i]=xe.of(s.slice(1)),t.push(s[0],r[i].length)}}}return new ze(t,r)}static createSet(e,t){return new ze(e,t)}}function et(n,e,t,r=!1){if(e==0&&t<=0)return;let i=n.length-2;i>=0&&t<=0&&t==n[i+1]?n[i]+=e:i>=0&&e==0&&n[i]==0?n[i+1]+=t:r?(n[i]+=e,n[i+1]+=t):n.push(e,t)}function Tn(n,e,t){if(t.length==0)return;let r=e.length-2>>1;if(r<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<r;)n.push(xe.empty);n.push(t)}}function xc(n,e,t){let r=n.inserted;for(let i=0,s=0,o=0;o<n.sections.length;){let a=n.sections[o++],l=n.sections[o++];if(l<0)i+=a,s+=a;else{let c=i,h=s,u=xe.empty;for(;c+=a,h+=l,l&&r&&(u=u.append(r[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)a=n.sections[o++],l=n.sections[o++];e(i,c,s,h,u),i=c,s=h}}}function vc(n,e,t,r=!1){let i=[],s=r?[]:null,o=new Ii(n),a=new Ii(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 c=Math.min(o.len,a.len);et(i,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!t))){let c=a.len;for(et(i,a.ins,-1);c;){let h=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=h&&(et(i,0,o.ins),s&&Tn(s,i,o.text),l=o.i),o.forward(h),c-=h}a.next()}else if(o.ins>=0){let c=0,h=o.len;for(;h;)if(a.ins==-1){let u=Math.min(h,a.len);c+=u,h-=u,a.forward(u)}else if(a.ins==0&&a.len<h)h-=a.len,a.next();else break;et(i,c,l<o.i?o.ins:0),s&&l<o.i&&Tn(s,i,o.text),l=o.i,o.forward(o.len-h)}else{if(o.done&&a.done)return s?ze.createSet(i,s):sn.create(i);throw new Error("Mismatched change set lengths")}}}function tg(n,e,t=!1){let r=[],i=t?[]:null,s=new Ii(n),o=new Ii(e);for(let a=!1;;){if(s.done&&o.done)return i?ze.createSet(r,i):sn.create(r);if(s.ins==0)et(r,s.len,0,a),s.next();else if(o.len==0&&!o.done)et(r,0,o.ins,a),i&&Tn(i,r,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(s.len2,o.len),c=r.length;if(s.ins==-1){let h=o.ins==-1?-1:o.off?0:o.ins;et(r,l,h,a),i&&h&&Tn(i,r,o.text)}else o.ins==-1?(et(r,s.off?0:s.len,l,a),i&&Tn(i,r,s.textBit(l))):(et(r,s.off?0:s.len,o.off?0:o.ins,a),i&&!o.off&&Tn(i,r,o.text));a=(s.ins>l||o.ins>=0&&o.len>l)&&(a||r.length>c),s.forward2(l),o.forward(l)}}}}class Ii{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,t=this.i-2>>1;return t>=e.length?xe.empty:e[t]}textBit(e){let{inserted:t}=this.set,r=this.i-2>>1;return r>=t.length&&!e?xe.empty:t[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 tr{constructor(e,t,r){this.from=e,this.to=t,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,t=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,t):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new tr(r,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return E.range(e,t);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return E.range(this.anchor,r)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!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 E.range(e.anchor,e.head)}static create(e,t,r){return new tr(e,t,r)}}class E{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:E.create(this.ranges.map(r=>r.map(e,t)),this.mainIndex)}eq(e,t=!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],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new E([this.main],0)}addRange(e,t=!0){return E.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let r=this.ranges.slice();return r[t]=e,E.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 E(e.ranges.map(t=>tr.fromJSON(t)),e.main)}static single(e,t=e){return new E([E.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;i<e.length;i++){let s=e[i];if(s.empty?s.from<=r:s.from<r)return E.normalized(e.slice(),t);r=s.to}return new E(e,t)}static cursor(e,t=0,r,i){return tr.create(e,e,(t==0?0:t<0?8:16)|(r==null?7:Math.min(6,r))|(i??16777215)<<6)}static range(e,t,r,i){let s=(r??16777215)<<6|(i==null?7:Math.min(6,i));return t<e?tr.create(t,e,48|s):tr.create(e,t,(t>e?8:0)|s)}static normalized(e,t=0){let r=e[t];e.sort((i,s)=>i.from-s.from),t=e.indexOf(r);for(let i=1;i<e.length;i++){let s=e[i],o=e[i-1];if(s.empty?s.from<=o.to:s.from<o.to){let a=o.from,l=Math.max(s.to,o.to);i<=t&&t--,e.splice(--i,2,s.anchor>s.head?E.range(l,a):E.range(a,l))}}return new E(e,t)}}function ng(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Oh=0;class K{constructor(e,t,r,i,s){this.combine=e,this.compareInput=t,this.compare=r,this.isStatic=i,this.id=Oh++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new K(e.combine||(t=>t),e.compareInput||((t,r)=>t===r),e.compare||(e.combine?(t,r)=>t===r:Ph),!!e.static,e.enables)}of(e){return new Ko([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ko(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ko(e,this,2,t)}from(e,t){return t||(t=r=>r),this.compute([e],r=>t(r.field(e)))}}function Ph(n,e){return n==e||n.length==e.length&&n.every((t,r)=>t===e[r])}class Ko{constructor(e,t,r,i){this.dependencies=e,this.facet=t,this.type=r,this.value=i,this.id=Oh++}dynamicSlot(e){var t;let r=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,a=this.type==2,l=!1,c=!1,h=[];for(let u of this.dependencies)u=="doc"?l=!0:u=="selection"?c=!0:((t=e[u.id])!==null&&t!==void 0?t:1)&1||h.push(e[u.id]);return{create(u){return u.values[o]=r(u),1},update(u,f){if(l&&f.docChanged||c&&(f.docChanged||f.selection)||wc(u,h)){let p=r(u);if(a?!yu(p,u.values[o],i):!i(p,u.values[o]))return u.values[o]=p,1}return 0},reconfigure:(u,f)=>{let p,m=f.config.address[s];if(m!=null){let b=sa(f,m);if(this.dependencies.every(y=>y instanceof K?f.facet(y)===u.facet(y):y instanceof Ye?f.field(y,!1)==u.field(y,!1):!0)||(a?yu(p=r(u),b,i):i(p=r(u),b)))return u.values[o]=b,0}else p=r(u);return u.values[o]=p,1}}}}function yu(n,e,t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!t(n[r],e[r]))return!1;return!0}function wc(n,e){let t=!1;for(let r of e)ji(n,r)&1&&(t=!0);return t}function O2(n,e,t){let r=t.map(l=>n[l.id]),i=t.map(l=>l.type),s=r.filter(l=>!(l&1)),o=n[e.id]>>1;function a(l){let c=[];for(let h=0;h<r.length;h++){let u=sa(l,r[h]);if(i[h]==2)for(let f of u)c.push(f);else c.push(u)}return e.combine(c)}return{create(l){for(let c of r)ji(l,c);return l.values[o]=a(l),1},update(l,c){if(!wc(l,s))return 0;let h=a(l);return e.compare(h,l.values[o])?0:(l.values[o]=h,1)},reconfigure(l,c){let h=wc(l,r),u=c.config.facets[e.id],f=c.facet(e);if(u&&!h&&Ph(t,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 mo=K.define({static:!0});class Ye{constructor(e,t,r,i,s){this.id=e,this.createF=t,this.updateF=r,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let t=new Ye(Oh++,e.create,e.update,e.compare||((r,i)=>r===i),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(mo).find(r=>r.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:r=>(r.values[t]=this.create(r),1),update:(r,i)=>{let s=r.values[t],o=this.updateF(s,i);return this.compareF(s,o)?0:(r.values[t]=o,1)},reconfigure:(r,i)=>{let s=r.facet(mo),o=i.facet(mo),a;return(a=s.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(r.values[t]=a.create(r),1):i.config.address[this.id]!=null?(r.values[t]=i.field(this),0):(r.values[t]=this.create(r),1)}}}init(e){return[this,mo.of({field:this,create:e})]}get extension(){return this}}const Yn={lowest:4,low:3,default:2,high:1,highest:0};function ci(n){return e=>new rg(e,n)}const dr={highest:ci(Yn.highest),high:ci(Yn.high),default:ci(Yn.default),low:ci(Yn.low),lowest:ci(Yn.lowest)};class rg{constructor(e,t){this.inner=e,this.prec=t}}class Ea{of(e){return new kc(this,e)}reconfigure(e){return Ea.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class kc{constructor(e,t){this.compartment=e,this.inner=t}}class ia{constructor(e,t,r,i,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,r){let i=[],s=Object.create(null),o=new Map;for(let f of P2(e,t,o))f instanceof Ye?i.push(f):(s[f.facet.id]||(s[f.facet.id]=[])).push(f);let a=Object.create(null),l=[],c=[];for(let f of i)a[f.id]=c.length<<1,c.push(p=>f.slot(p));let h=r?.config.facets;for(let f in s){let p=s[f],m=p[0].facet,b=h&&h[f]||[];if(p.every(y=>y.type==0))if(a[m.id]=l.length<<1|1,Ph(b,p))l.push(r.facet(m));else{let y=m.combine(p.map(v=>v.value));l.push(r&&m.compare(y,r.facet(m))?r.facet(m):y)}else{for(let y of p)y.type==0?(a[y.id]=l.length<<1|1,l.push(y.value)):(a[y.id]=c.length<<1,c.push(v=>y.dynamicSlot(v)));a[m.id]=c.length<<1,c.push(y=>O2(y,m,p))}}let u=c.map(f=>f(a));return new ia(e,o,u,a,l,s)}}function P2(n,e,t){let r=[[],[],[],[],[]],i=new Map;function s(o,a){let l=i.get(o);if(l!=null){if(l<=a)return;let c=r[l].indexOf(o);c>-1&&r[l].splice(c,1),o instanceof kc&&t.delete(o.compartment)}if(i.set(o,a),Array.isArray(o))for(let c of o)s(c,a);else if(o instanceof kc){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;t.set(o.compartment,c),s(c,a)}else if(o instanceof rg)s(o.inner,o.prec);else if(o instanceof Ye)r[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof Ko)r[a].push(o),o.facet.extensions&&s(o.facet.extensions,Yn.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(c,a)}}return s(n,Yn.default),r.reduce((o,a)=>o.concat(a))}function ji(n,e){if(e&1)return 2;let t=e>>1,r=n.status[t];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;n.status[t]=4;let i=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|i}function sa(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const ig=K.define(),Sc=K.define({combine:n=>n.some(e=>e),static:!0}),sg=K.define({combine:n=>n.length?n[0]:void 0,static:!0}),og=K.define(),ag=K.define(),lg=K.define(),cg=K.define({combine:n=>n.length?n[0]:!1});class ln{constructor(e,t){this.type=e,this.value=t}static define(){return new N2}}class N2{of(e){return new ln(this,e)}}class A2{constructor(e){this.map=e}of(e){return new ae(this,e)}}class ae{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new ae(this.type,t)}is(e){return this.type==e}static define(e={}){return new A2(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let r=[];for(let i of e){let s=i.map(t);s&&r.push(s)}return r}}ae.reconfigure=ae.define();ae.appendConfig=ae.define();class He{constructor(e,t,r,i,s,o){this.startState=e,this.changes=t,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&ng(r,t.newLength),s.some(a=>a.type==He.time)||(this.annotations=s.concat(He.time.of(Date.now())))}static create(e,t,r,i,s,o){return new He(e,t,r,i,s,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 t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(He.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}He.time=ln.define();He.userEvent=ln.define();He.addToHistory=ln.define();He.remote=ln.define();function M2(n,e){let t=[];for(let r=0,i=0;;){let s,o;if(r<n.length&&(i==e.length||e[i]>=n[r]))s=n[r++],o=n[r++];else if(i<e.length)s=e[i++],o=e[i++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function hg(n,e,t){var r;let i,s,o;return t?(i=e.changes,s=ze.empty(e.changes.length),o=n.changes.compose(e.changes)):(i=e.changes.map(n.changes),s=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(i)),{changes:o,selection:e.selection?e.selection.map(s):(r=n.selection)===null||r===void 0?void 0:r.map(i),effects:ae.mapEffects(n.effects,i).concat(ae.mapEffects(e.effects,s)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function Cc(n,e,t){let r=e.selection,i=Ar(e.annotations);return e.userEvent&&(i=i.concat(He.userEvent.of(e.userEvent))),{changes:e.changes instanceof ze?e.changes:ze.of(e.changes||[],t,n.facet(sg)),selection:r&&(r instanceof E?r:E.single(r.anchor,r.head)),effects:Ar(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function dg(n,e,t){let r=Cc(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;r=hg(r,Cc(n,e[s],o?r.changes.newLength:n.doc.length),o)}let i=He.create(n,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return D2(t?T2(i):i)}function T2(n){let e=n.startState,t=!0;for(let i of e.facet(og)){let s=i(n);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:M2(t,s))}if(t!==!0){let i,s;if(t===!1)s=n.changes.invertedDesc,i=ze.empty(e.doc.length);else{let o=n.changes.filter(t);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}n=He.create(e,i,n.selection&&n.selection.map(s),ae.mapEffects(n.effects,s),n.annotations,n.scrollIntoView)}let r=e.facet(ag);for(let i=r.length-1;i>=0;i--){let s=r[i](n);s instanceof He?n=s:Array.isArray(s)&&s.length==1&&s[0]instanceof He?n=s[0]:n=dg(e,Ar(s),!1)}return n}function D2(n){let e=n.startState,t=e.facet(lg),r=n;for(let i=t.length-1;i>=0;i--){let s=t[i](n);s&&Object.keys(s).length&&(r=hg(r,Cc(e,s,n.changes.newLength),!0))}return r==n?n:He.create(e,n.changes,n.selection,r.effects,r.annotations,r.scrollIntoView)}const E2=[];function Ar(n){return n==null?E2:Array.isArray(n)?n:[n]}var De=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(De||(De={}));const R2=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let jc;try{jc=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function L2(n){if(jc)return jc.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||R2.test(t)))return!0}return!1}function I2(n){return e=>{if(!/\S/.test(e))return De.Space;if(L2(e))return De.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return De.Word;return De.Other}}class me{constructor(e,t,r,i,s,o){this.config=e,this.doc=t,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)ji(this,a<<1);this.computeSlot=null}field(e,t=!0){let r=this.config.address[e.id];if(r==null){if(t)throw new RangeError("Field is not present in this state");return}return ji(this,r),sa(this,r)}update(...e){return dg(this,e,!0)}applyTransaction(e){let t=this.config,{base:r,compartments:i}=t;for(let a of e.effects)a.is(Ea.reconfigure)?(t&&(i=new Map,t.compartments.forEach((l,c)=>i.set(c,l)),t=null),i.set(a.value.compartment,a.value.extension)):a.is(ae.reconfigure)?(t=null,r=a.value):a.is(ae.appendConfig)&&(t=null,r=Ar(r).concat(a.value));let s;t?s=e.startState.values.slice():(t=ia.resolve(r,i,this),s=new me(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=e.startState.facet(Sc)?e.newSelection:e.newSelection.asSingle();new me(t,e.newDoc,o,s,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:E.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,r=e(t.ranges[0]),i=this.changes(r.changes),s=[r.range],o=Ar(r.effects);for(let a=1;a<t.ranges.length;a++){let l=e(t.ranges[a]),c=this.changes(l.changes),h=c.map(i);for(let f=0;f<a;f++)s[f]=s[f].map(h);let u=i.mapDesc(c,!0);s.push(l.range.map(u)),i=i.compose(h),o=ae.mapEffects(o,h).concat(ae.mapEffects(Ar(l.effects),u))}return{changes:i,selection:E.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof ze?e:ze.of(e,this.doc.length,this.facet(me.lineSeparator))}toText(e){return xe.of(e.split(this.facet(me.lineSeparator)||yc))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(ji(this,t),sa(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let i=e[r];i instanceof Ye&&this.config.address[i.id]!=null&&(t[r]=i.spec.toJSON(this.field(e[r]),this))}return t}static fromJSON(e,t={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(r){for(let s in r)if(Object.prototype.hasOwnProperty.call(e,s)){let o=r[s],a=e[s];i.push(o.init(l=>o.spec.fromJSON(a,l)))}}return me.create({doc:e.doc,selection:E.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=ia.resolve(e.extensions||[],new Map),r=e.doc instanceof xe?e.doc:xe.of((e.doc||"").split(t.staticFacet(me.lineSeparator)||yc)),i=e.selection?e.selection instanceof E?e.selection:E.single(e.selection.anchor,e.selection.head):E.single(0);return ng(i,r.length),t.staticFacet(Sc)||(i=i.asSingle()),new me(t,r,i,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(me.tabSize)}get lineBreak(){return this.facet(me.lineSeparator)||`
56
- `}get readOnly(){return this.facet(cg)}phrase(e,...t){for(let r of this.facet(me.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>t.length?r:t[s-1]})),e}languageDataAt(e,t,r=-1){let i=[];for(let s of this.facet(ig))for(let o of s(this,t,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return I2(t.length?t[0]:"")}wordAt(e){let{text:t,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let l=_e(t,o,!1);if(s(t.slice(l,o))!=De.Word)break;o=l}for(;a<i;){let l=_e(t,a);if(s(t.slice(a,l))!=De.Word)break;a=l}return o==a?null:E.range(o+r,a+r)}}me.allowMultipleSelections=Sc;me.tabSize=K.define({combine:n=>n.length?n[0]:4});me.lineSeparator=sg;me.readOnly=cg;me.phrases=K.define({compare(n,e){let t=Object.keys(n),r=Object.keys(e);return t.length==r.length&&t.every(i=>n[i]==e[i])}});me.languageData=ig;me.changeFilter=og;me.transactionFilter=ag;me.transactionExtender=lg;Ea.reconfigure=ae.define();function cn(n,e,t={}){let r={};for(let i of n)for(let s of Object.keys(i)){let o=i[s],a=r[s];if(a===void 0)r[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,s))r[s]=t[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)r[i]===void 0&&(r[i]=e[i]);return r}class Ln{eq(e){return this==e}range(e,t=e){return $i.create(e,t,this)}}Ln.prototype.startSide=Ln.prototype.endSide=0;Ln.prototype.point=!1;Ln.prototype.mapMode=st.TrackDel;function Nh(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}class $i{constructor(e,t,r){this.from=e,this.to=t,this.value=r}static create(e,t,r){return new $i(e,t,r)}}function Oc(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class Ah{constructor(e,t,r,i){this.from=e,this.to=t,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,r,i=0){let s=r?this.to:this.from;for(let o=i,a=s.length;;){if(o==a)return o;let l=o+a>>1,c=s[l]-e||(r?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,t,r,i){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(r,1e9,!1,s);s<o;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let r=[],i=[],s=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],h=this.from[l]+e,u=this.to[l]+e,f,p;if(h==u){let m=t.mapPos(h,c.startSide,c.mapMode);if(m==null||(f=p=m,c.startSide!=c.endSide&&(p=t.mapPos(h,c.endSide),p<f)))continue}else if(f=t.mapPos(h,c.startSide),p=t.mapPos(u,c.endSide),f>p||f==p&&c.startSide>0&&c.endSide<=0)continue;(p-f||c.endSide-c.startSide)<0||(o<0&&(o=f),c.point&&(a=Math.max(a,p-f)),r.push(c),i.push(f-o),s.push(p-o))}return{mapped:r.length?new Ah(i,s,r,a):null,pos:o}}}class pe{constructor(e,t,r,i){this.chunkPos=e,this.chunk=t,this.nextLayer=r,this.maxPoint=i}static create(e,t,r,i){return new pe(e,t,r,i)}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 t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(r&&(t=t.slice().sort(Oc)),this.isEmpty)return t.length?pe.of(t):this;let a=new ug(this,null,-1).goto(0),l=0,c=[],h=new yn;for(;a.value||l<t.length;)if(l<t.length&&(a.from-t[l].from||a.startSide-t[l].value.startSide)>=0){let u=t[l++];h.addInner(u.from,u.to,u.value)||c.push(u)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(a.chunkIndex)<t[l].from)&&(!o||i>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&h.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||i>a.to||s<a.from||o(a.from,a.to,a.value))&&(h.addInner(a.from,a.to,a.value)||c.push($i.create(a.from,a.to,a.value))),a.next());return h.finishInner(this.nextLayer.isEmpty&&!c.length?pe.empty:this.nextLayer.update({add:c,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],r=[],i=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=e.touchesRange(a,a+l.length);if(c===!1)i=Math.max(i,l.maxPoint),t.push(l),r.push(e.mapPos(a));else if(c===!0){let{mapped:h,pos:u}=l.map(a,e);h&&(i=Math.max(i,h.maxPoint),t.push(h),r.push(u))}}let s=this.nextLayer.map(e);return t.length==0?s:new pe(r,t,s||pe.empty,i)}between(e,t,r){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,r)===!1)return}this.nextLayer.between(e,t,r)}}iter(e=0){return Bi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Bi.from(e).goto(t)}static compare(e,t,r,i,s=-1){let o=e.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=s),a=t.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=s),l=xu(o,a,r),c=new hi(o,l,s),h=new hi(a,l,s);r.iterGaps((u,f,p)=>vu(c,u,h,f,p,i)),r.empty&&r.length==0&&vu(c,0,h,0,0,i)}static eq(e,t,r=0,i){i==null&&(i=999999999);let s=e.filter(h=>!h.isEmpty&&t.indexOf(h)<0),o=t.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let a=xu(s,o),l=new hi(s,a,0).goto(r),c=new hi(o,a,0).goto(r);for(;;){if(l.to!=c.to||!Pc(l.active,c.active)||l.point&&(!c.point||!Nh(l.point,c.point)))return!1;if(l.to>i)return!0;l.next(),c.next()}}static spans(e,t,r,i,s=-1){let o=new hi(e,null,s).goto(t),a=t,l=o.openStart;for(;;){let c=Math.min(o.to,r);if(o.point){let h=o.activeForPoint(o.to),u=o.pointFrom<t?h.length+1:o.point.startSide<0?h.length:Math.min(h.length,l);i.point(a,c,o.point,h,u,o.pointRank),l=Math.min(o.openEnd(c),h.length)}else c>a&&(i.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>r)return l+(o.point&&o.to>r?1:0);a=o.to,o.next()}}static of(e,t=!1){let r=new yn;for(let i of e instanceof $i?[e]:t?$2(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return pe.empty;let t=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=pe.empty;i=i.nextLayer)t=new pe(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}pe.empty=new pe([],[],null,-1);function $2(n){if(n.length>1)for(let e=n[0],t=1;t<n.length;t++){let r=n[t];if(Oc(e,r)>0)return n.slice().sort(Oc);e=r}return n}pe.empty.nextLayer=pe.empty;class yn{finishChunk(e){this.chunks.push(new Ah(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,t,r){this.addInner(e,t,r)||(this.nextLayer||(this.nextLayer=new yn)).add(e,t,r)}addInner(e,t,r){let i=e-this.lastTo||r.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=t,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let r=t.value.length-1;return this.last=t.value[r],this.lastFrom=t.from[r]+e,this.lastTo=t.to[r]+e,!0}finish(){return this.finishInner(pe.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=pe.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function xu(n,e,t){let r=new Map;for(let s of n)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&r.set(s.chunk[o],s.chunkPos[o]);let i=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let a=r.get(s.chunk[o]);a!=null&&(t?t.mapPos(a):a)==s.chunkPos[o]&&!t?.touchesRange(a,a+s.chunk[o].length)&&i.add(s.chunk[o])}return i}class ug{constructor(e,t,r,i=0){this.layer=e,this.skip=t,this.minPoint=r,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,r){for(;this.chunkIndex<this.layer.chunk.length;){let i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<e||i.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!r||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!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],t=this.layer.chunk[this.chunkIndex],r=e+t.from[this.rangeIndex];if(this.from=r,this.to=e+t.to[this.rangeIndex],this.value=t.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 Bi{constructor(e){this.heap=e}static from(e,t=null,r=-1){let i=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&i.push(new ug(o,t,r,s));return i.length==1?i[0]:new Bi(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let r of this.heap)r.goto(e,t);for(let r=this.heap.length>>1;r>=0;r--)dl(this.heap,r);return this.next(),this}forward(e,t){for(let r of this.heap)r.forward(e,t);for(let r=this.heap.length>>1;r>=0;r--)dl(this.heap,r);(this.to-e||this.value.endSide-t)<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(),dl(this.heap,0)}}}function dl(n,e){for(let t=n[e];;){let r=(e<<1)+1;if(r>=n.length)break;let i=n[r];if(r+1<n.length&&i.compare(n[r+1])>=0&&(i=n[r+1],r++),t.compare(i)<0)break;n[r]=t,n[e]=i,e=r}}class hi{constructor(e,t,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=Bi.from(e,t,r)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){go(this.active,e),go(this.activeTo,e),go(this.activeRank,e),this.minActive=wu(this.active,this.activeTo)}addActive(e){let t=0,{value:r,to:i,rank:s}=this.cursor;for(;t<this.activeRank.length&&(s-this.activeRank[t]||i-this.activeTo[t])>0;)t++;bo(this.active,t,r),bo(this.activeTo,t,i),bo(this.activeRank,t,s),e&&bo(e,t,this.cursor.from),this.minActive=wu(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),r&&go(r,i)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.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 i=r.length-1;i>=0&&r[i]<e;i--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];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)&&t.push(this.active[r]);return t.reverse()}openEnd(e){let t=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)t++;return t}}function vu(n,e,t,r,i,s){n.goto(e),t.goto(r);let o=r+i,a=r,l=r-e,c=!!s.boundChange;for(let h=!1;;){let u=n.to+l-t.to,f=u||n.endSide-t.endSide,p=f<0?n.to+l:t.to,m=Math.min(p,o);if(n.point||t.point?(n.point&&t.point&&Nh(n.point,t.point)&&Pc(n.activeForPoint(n.to),t.activeForPoint(t.to))||s.comparePoint(a,m,n.point,t.point),h=!1):(h&&s.boundChange(a),m>a&&!Pc(n.active,t.active)&&s.compareRange(a,m,n.active,t.active),c&&m<o&&(u||n.openEnd(p)!=t.openEnd(p))&&(h=!0)),p>o)break;a=p,f<=0&&n.next(),f>=0&&t.next()}}function Pc(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!=e[t]&&!Nh(n[t],e[t]))return!1;return!0}function go(n,e){for(let t=e,r=n.length-1;t<r;t++)n[t]=n[t+1];n.pop()}function bo(n,e,t){for(let r=n.length-1;r>=e;r--)n[r+1]=n[r];n[e]=t}function wu(n,e){let t=-1,r=1e9;for(let i=0;i<e.length;i++)(e[i]-r||n[i].endSide-n[t].endSide)<0&&(t=i,r=e[i]);return t}function Ur(n,e,t=n.length){let r=0;for(let i=0;i<t&&i<n.length;)n.charCodeAt(i)==9?(r+=e-r%e,i++):(r++,i=_e(n,i));return r}function Nc(n,e,t,r){for(let i=0,s=0;;){if(s>=e)return i;if(i==n.length)break;s+=n.charCodeAt(i)==9?t-s%t:1,i=_e(n,i)}return r===!0?-1:n.length}const Ac="ͼ",ku=typeof Symbol>"u"?"__"+Ac:Symbol.for(Ac),Mc=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Su=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class In{constructor(e,t){this.rules=[];let{finish:r}=t||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,a,l,c){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 m=a[p];if(/&/.test(p))s(p.split(/,\s*/).map(b=>o.map(y=>b.replace(/&/,y))).reduce((b,y)=>b.concat(y)),m,l);else if(m&&typeof m=="object"){if(!u)throw new RangeError("The value of a property ("+p+") should be a primitive value.");s(i(p),m,h,f)}else m!=null&&h.push(p.replace(/_.*/,"").replace(/[A-Z]/g,b=>"-"+b.toLowerCase())+": "+m+";")}(h.length||f)&&l.push((r&&!u&&!c?o.map(r):o).join(", ")+" {"+h.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
57
- `)}static newName(){let e=Su[ku]||1;return Su[ku]=e+1,Ac+e.toString(36)}static mount(e,t,r){let i=e[Mc],s=r&&r.nonce;i?s&&i.setNonce(s):i=new B2(e,s),i.mount(Array.isArray(t)?t:[t],e)}}let Cu=new Map;class B2{constructor(e,t){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=Cu.get(r);if(s)return e[Mc]=s;this.sheet=new i.CSSStyleSheet,Cu.set(r,this)}else this.styleTag=r.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Mc]=this}mount(e,t){let r=this.sheet,i=0,s=0;for(let o=0;o<e.length;o++){let a=e[o],l=this.modules.indexOf(a);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,a),r)for(let c=0;c<a.rules.length;c++)r.insertRule(a.rules[c],i++)}else{for(;s<l;)i+=this.modules[s++].rules.length;i+=a.rules.length,s++}}if(r)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
58
- `;this.styleTag.textContent=o;let a=t.head||t;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 $n={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:"'"},Fi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},F2=typeof navigator<"u"&&/Mac/.test(navigator.platform),V2=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var qe=0;qe<10;qe++)$n[48+qe]=$n[96+qe]=String(qe);for(var qe=1;qe<=24;qe++)$n[qe+111]="F"+qe;for(var qe=65;qe<=90;qe++)$n[qe]=String.fromCharCode(qe+32),Fi[qe]=String.fromCharCode(qe);for(var ul in $n)Fi.hasOwnProperty(ul)||(Fi[ul]=$n[ul]);function z2(n){var e=F2&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||V2&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Fi:$n)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function je(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=t[r];typeof i=="string"?n.setAttribute(r,i):i!=null&&(n[r]=i)}e++}for(;e<arguments.length;e++)fg(n,arguments[e]);return n}function fg(n,e){if(typeof e=="string")n.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)n.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)fg(n,e[t]);else throw new RangeError("Unsupported child node: "+e)}let it=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Tc=typeof document<"u"?document:{documentElement:{style:{}}};const Dc=/Edge\/(\d+)/.exec(it.userAgent),pg=/MSIE \d/.test(it.userAgent),Ec=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(it.userAgent),Ra=!!(pg||Ec||Dc),ju=!Ra&&/gecko\/(\d+)/i.test(it.userAgent),fl=!Ra&&/Chrome\/(\d+)/.exec(it.userAgent),_2="webkitFontSmoothing"in Tc.documentElement.style,Rc=!Ra&&/Apple Computer/.test(it.vendor),Ou=Rc&&(/Mobile\/\w+/.test(it.userAgent)||it.maxTouchPoints>2);var U={mac:Ou||/Mac/.test(it.platform),windows:/Win/.test(it.platform),linux:/Linux|X11/.test(it.platform),ie:Ra,ie_version:pg?Tc.documentMode||6:Ec?+Ec[1]:Dc?+Dc[1]:0,gecko:ju,gecko_version:ju?+(/Firefox\/(\d+)/.exec(it.userAgent)||[0,0])[1]:0,chrome:!!fl,chrome_version:fl?+fl[1]:0,ios:Ou,android:/Android\b/.test(it.userAgent),webkit_version:_2?+(/\bAppleWebKit\/(\d+)/.exec(it.userAgent)||[0,0])[1]:0,safari:Rc,safari_version:Rc?+(/\bVersion\/(\d+(\.\d+)?)/.exec(it.userAgent)||[0,0])[1]:0,tabSize:Tc.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Mh(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}const oa=Object.create(null);function Th(n,e,t){if(n==e)return!0;n||(n=oa),e||(e=oa);let r=Object.keys(n),i=Object.keys(e);if(r.length-0!=i.length-0)return!1;for(let s of r)if(s!=t&&(i.indexOf(s)==-1||n[s]!==e[s]))return!1;return!0}function H2(n,e){for(let t=n.attributes.length-1;t>=0;t--){let r=n.attributes[t].name;e[r]==null&&n.removeAttribute(r)}for(let t in e){let r=e[t];t=="style"?n.style.cssText=r:n.getAttribute(t)!=r&&n.setAttribute(t,r)}}function Pu(n,e,t){let r=!1;if(e)for(let i in e)t&&i in t||(r=!0,i=="style"?n.style.cssText="":n.removeAttribute(i));if(t)for(let i in t)e&&e[i]==t[i]||(r=!0,i=="style"?n.style.cssText=t[i]:n.setAttribute(i,t[i]));return r}function W2(n){let e=Object.create(null);for(let t=0;t<n.attributes.length;t++){let r=n.attributes[t];e[r.name]=r.value}return e}class hn{eq(e){return!1}updateDOM(e,t){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,t,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Je=function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n}(Je||(Je={}));class ne extends Ln{constructor(e,t,r,i){super(),this.startSide=e,this.endSide=t,this.widget=r,this.spec=i}get heightRelevant(){return!1}static mark(e){return new Vs(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return t+=r&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new or(e,t,t,r,e.widget||null,!1)}static replace(e){let t=!!e.block,r,i;if(e.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:o}=mg(e,t);r=(s?t?-3e8:-1:5e8)-1,i=(o?t?2e8:1:-6e8)+1}return new or(e,r,i,t,e.widget||null,!0)}static line(e){return new zs(e)}static set(e,t=!1){return pe.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ne.none=pe.empty;class Vs extends ne{constructor(e){let{start:t,end:r}=mg(e);super(t?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Mh(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||oa}eq(e){return this==e||e instanceof Vs&&this.tagName==e.tagName&&Th(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}Vs.prototype.point=!1;class zs extends ne{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof zs&&this.spec.class==e.spec.class&&Th(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}zs.prototype.mapMode=st.TrackBefore;zs.prototype.point=!0;class or extends ne{constructor(e,t,r,i,s,o){super(t,r,s,e),this.block=i,this.isReplace=o,this.mapMode=i?t<=0?st.TrackBefore:st.TrackAfter:st.TrackDel}get type(){return this.startSide!=this.endSide?Je.WidgetRange:this.startSide<=0?Je.WidgetBefore:Je.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof or&&U2(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}or.prototype.point=!0;function mg(n,e=!1){let{inclusiveStart:t,inclusiveEnd:r}=n;return t==null&&(t=n.inclusive),r==null&&(r=n.inclusive),{start:t??e,end:r??e}}function U2(n,e){return n==e||!!(n&&e&&n.compare(e))}function Mr(n,e,t,r=0){let i=t.length-1;i>=0&&t[i]+r>=n?t[i]=Math.max(t[i],e):t.push(n,e)}class Vi extends Ln{constructor(e,t){super(),this.tagName=e,this.attributes=t}eq(e){return e==this||e instanceof Vi&&this.tagName==e.tagName&&Th(this.attributes,e.attributes)}static create(e){return new Vi(e.tagName,e.attributes||oa)}static set(e,t=!1){return pe.of(e,t)}}Vi.prototype.startSide=Vi.prototype.endSide=-1;function zi(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function Lc(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function Go(n,e){if(!e.anchorNode)return!1;try{return Lc(n,e.anchorNode)}catch{return!1}}function Oi(n){return n.nodeType==3?Hi(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function Pi(n,e,t,r){return t?Nu(n,e,t,r,-1)||Nu(n,e,t,r,1):!1}function Bn(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function aa(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function Nu(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:xn(n))){if(n.nodeName=="DIV")return!1;let s=n.parentNode;if(!s||s.nodeType!=1)return!1;e=Bn(n)+(i<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=i<0?xn(n):0}else return!1}}function xn(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function _i(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function K2(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function gg(n,e){let t=e.width/n.offsetWidth,r=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-n.offsetHeight)<1)&&(r=1),{scaleX:t,scaleY:r}}function G2(n,e,t,r,i,s,o,a){let l=n.ownerDocument,c=l.defaultView||window;for(let h=n,u=!1;h&&!u;)if(h.nodeType==1){let f,p=h==l.body,m=1,b=1;if(p)f=K2(c);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:m,scaleY:b}=gg(h,w)),f={left:w.left,right:w.left+h.clientWidth*m,top:w.top,bottom:w.top+h.clientHeight*b}}let y=0,v=0;if(i=="nearest")e.top<f.top?(v=e.top-(f.top+o),t>0&&e.bottom>f.bottom+v&&(v=e.bottom-f.bottom+o)):e.bottom>f.bottom&&(v=e.bottom-f.bottom+o,t<0&&e.top-v<f.top&&(v=e.top-(f.top+o)));else{let w=e.bottom-e.top,C=f.bottom-f.top;v=(i=="center"&&w<=C?e.top+w/2-C/2:i=="start"||i=="center"&&t<0?e.top-o:e.bottom-C+o)-f.top}if(r=="nearest"?e.left<f.left?(y=e.left-(f.left+s),t>0&&e.right>f.right+y&&(y=e.right-f.right+s)):e.right>f.right&&(y=e.right-f.right+s,t<0&&e.left<f.left+y&&(y=e.left-(f.left+s))):y=(r=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:r=="start"==a?e.left-s:e.right-(f.right-f.left)+s)-f.left,y||v)if(p)c.scrollBy(y,v);else{let w=0,C=0;if(v){let j=h.scrollTop;h.scrollTop+=v/b,C=(h.scrollTop-j)*b}if(y){let j=h.scrollLeft;h.scrollLeft+=y/m,w=(h.scrollLeft-j)*m}e={left:e.left-w,top:e.top-C,right:e.right-w,bottom:e.bottom-C},w&&Math.abs(w-y)<1&&(r="nearest"),C&&Math.abs(C-v)<1&&(i="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 q2(n){let e=n.ownerDocument,t,r;for(let i=n.parentNode;i&&!(i==e.body||t&&r);)if(i.nodeType==1)!r&&i.scrollHeight>i.clientHeight&&(r=i),!t&&i.scrollWidth>i.clientWidth&&(t=i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;return{x:t,y:r}}class J2{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:t,focusNode:r}=e;this.set(t,Math.min(e.anchorOffset,t?xn(t):0),r,Math.min(e.focusOffset,r?xn(r):0))}set(e,t,r,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=r,this.focusOffset=i}}let Jn=null;U.safari&&U.safari_version>=26&&(Jn=!1);function bg(n){if(n.setActive)return n.setActive();if(Jn)return n.focus(Jn);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(Jn==null?{get preventScroll(){return Jn={preventScroll:!0},!0}}:void 0),!Jn){Jn=!1;for(let t=0;t<e.length;){let r=e[t++],i=e[t++],s=e[t++];r.scrollTop!=i&&(r.scrollTop=i),r.scrollLeft!=s&&(r.scrollLeft=s)}}}let Au;function Hi(n,e,t=e){let r=Au||(Au=document.createRange());return r.setEnd(n,t),r.setStart(n,e),r}function Tr(n,e,t,r){let i={key:e,code:e,keyCode:t,which:t,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let s=new KeyboardEvent("keydown",i);s.synthetic=!0,n.dispatchEvent(s);let o=new KeyboardEvent("keyup",i);return o.synthetic=!0,n.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function Y2(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function Q2(n,e){let t=e.focusNode,r=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=r)return!1;for(r=Math.min(r,xn(t));;)if(r){if(t.nodeType!=1)return!1;let i=t.childNodes[r-1];i.contentEditable=="false"?r--:(t=i,r=xn(t))}else{if(t==n)return!0;r=Bn(t),t=t.parentNode}}function yg(n){return n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function xg(n,e){for(let t=n,r=e;;){if(t.nodeType==3&&r>0)return{node:t,offset:r};if(t.nodeType==1&&r>0){if(t.contentEditable=="false")return null;t=t.childNodes[r-1],r=xn(t)}else if(t.parentNode&&!aa(t))r=Bn(t),t=t.parentNode;else return null}}function vg(n,e){for(let t=n,r=e;;){if(t.nodeType==3&&r<t.nodeValue.length)return{node:t,offset:r};if(t.nodeType==1&&r<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[r],r=0}else if(t.parentNode&&!aa(t))r=Bn(t)+1,t=t.parentNode;else return null}}class Ft{constructor(e,t,r=!0){this.node=e,this.offset=t,this.precise=r}static before(e,t){return new Ft(e.parentNode,Bn(e),t)}static after(e,t){return new Ft(e.parentNode,Bn(e)+1,t)}}var Pe=function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n}(Pe||(Pe={}));const ar=Pe.LTR,Dh=Pe.RTL;function wg(n){let e=[];for(let t=0;t<n.length;t++)e.push(1<<+n[t]);return e}const X2=wg("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Z2=wg("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Ic=Object.create(null),Jt=[];for(let n of["()","[]","{}"]){let e=n.charCodeAt(0),t=n.charCodeAt(1);Ic[e]=t,Ic[t]=-e}function kg(n){return n<=247?X2[n]:1424<=n&&n<=1524?2:1536<=n&&n<=1785?Z2[n-1536]:1774<=n&&n<=2220?4:8192<=n&&n<=8204?256:64336<=n&&n<=65023?4:1}const ew=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class bn{get dir(){return this.level%2?Dh:ar}constructor(e,t,r){this.from=e,this.to=t,this.level=r}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,r,i){let s=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=t&&a.to>=t){if(a.level==r)return o;(s<0||(i!=0?i<0?a.from<t:a.to>t:e[s].level>a.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function Sg(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++){let r=n[t],i=e[t];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!Sg(r.inner,i.inner))return!1}return!0}const Oe=[];function tw(n,e,t,r,i){for(let s=0;s<=r.length;s++){let o=s?r[s-1].to:e,a=s<r.length?r[s].from:t,l=s?256:i;for(let c=o,h=l,u=l;c<a;c++){let f=kg(n.charCodeAt(c));f==512?f=h:f==8&&u==4&&(f=16),Oe[c]=f==4?2:f,f&7&&(u=f),h=f}for(let c=o,h=l,u=l;c<a;c++){let f=Oe[c];if(f==128)c<a-1&&h==Oe[c+1]&&h&24?f=Oe[c]=h:Oe[c]=256;else if(f==64){let p=c+1;for(;p<a&&Oe[p]==64;)p++;let m=c&&h==8||p<t&&Oe[p]==8?u==1?1:8:256;for(let b=c;b<p;b++)Oe[b]=m;c=p-1}else f==8&&u==1&&(Oe[c]=1);h=f,f&7&&(u=f)}}}function nw(n,e,t,r,i){let s=i==1?2:1;for(let o=0,a=0,l=0;o<=r.length;o++){let c=o?r[o-1].to:e,h=o<r.length?r[o].from:t;for(let u=c,f,p,m;u<h;u++)if(p=Ic[f=n.charCodeAt(u)])if(p<0){for(let b=a-3;b>=0;b-=3)if(Jt[b+1]==-p){let y=Jt[b+2],v=y&2?i:y&4?y&1?s:i:0;v&&(Oe[u]=Oe[Jt[b]]=v),a=b;break}}else{if(Jt.length==189)break;Jt[a++]=u,Jt[a++]=f,Jt[a++]=l}else if((m=Oe[u])==2||m==1){let b=m==i;l=b?0:1;for(let y=a-3;y>=0;y-=3){let v=Jt[y+2];if(v&2)break;if(b)Jt[y+2]|=2;else{if(v&4)break;Jt[y+2]|=4}}}}}function rw(n,e,t,r){for(let i=0,s=r;i<=t.length;i++){let o=i?t[i-1].to:n,a=i<t.length?t[i].from:e;for(let l=o;l<a;){let c=Oe[l];if(c==256){let h=l+1;for(;;)if(h==a){if(i==t.length)break;h=t[i++].to,a=i<t.length?t[i].from:e}else if(Oe[h]==256)h++;else break;let u=s==1,f=(h<e?Oe[h]:r)==1,p=u==f?u?1:2:r;for(let m=h,b=i,y=b?t[b-1].to:n;m>l;)m==y&&(m=t[--b].from,y=b?t[b-1].to:n),Oe[--m]=p;l=h}else s=c,l++}}}function $c(n,e,t,r,i,s,o){let a=r%2?2:1;if(r%2==i%2)for(let l=e,c=0;l<t;){let h=!0,u=!1;if(c==s.length||l<s[c].from){let b=Oe[l];b!=a&&(h=!1,u=b==16)}let f=!h&&a==1?[]:null,p=h?r:r+1,m=l;e:for(;;)if(c<s.length&&m==s[c].from){if(u)break e;let b=s[c];if(!h)for(let y=b.to,v=c+1;;){if(y==t)break e;if(v<s.length&&s[v].from==y)y=s[v++].to;else{if(Oe[y]==a)break e;break}}if(c++,f)f.push(b);else{b.from>l&&o.push(new bn(l,b.from,p));let y=b.direction==ar!=!(p%2);Bc(n,y?r+1:r,i,b.inner,b.from,b.to,o),l=b.to}m=b.to}else{if(m==t||(h?Oe[m]!=a:Oe[m]==a))break;m++}f?$c(n,l,m,r+1,i,f,o):l<m&&o.push(new bn(l,m,p)),l=m}else for(let l=t,c=s.length;l>e;){let h=!0,u=!1;if(!c||l>s[c-1].to){let b=Oe[l-1];b!=a&&(h=!1,u=b==16)}let f=!h&&a==1?[]:null,p=h?r:r+1,m=l;e:for(;;)if(c&&m==s[c-1].to){if(u)break e;let b=s[--c];if(!h)for(let y=b.from,v=c;;){if(y==e)break e;if(v&&s[v-1].to==y)y=s[--v].from;else{if(Oe[y-1]==a)break e;break}}if(f)f.push(b);else{b.to<l&&o.push(new bn(b.to,l,p));let y=b.direction==ar!=!(p%2);Bc(n,y?r+1:r,i,b.inner,b.from,b.to,o),l=b.from}m=b.from}else{if(m==e||(h?Oe[m-1]!=a:Oe[m-1]==a))break;m--}f?$c(n,m,l,r+1,i,f,o):m<l&&o.push(new bn(m,l,p)),l=m}}function Bc(n,e,t,r,i,s,o){let a=e%2?2:1;tw(n,i,s,r,a),nw(n,i,s,r,a),rw(i,s,r,a),$c(n,i,s,e,t,r,o)}function iw(n,e,t){if(!n)return[new bn(0,0,e==Dh?1:0)];if(e==ar&&!t.length&&!ew.test(n))return Cg(n.length);if(t.length)for(;n.length>Oe.length;)Oe[Oe.length]=256;let r=[],i=e==ar?0:1;return Bc(n,i,i,t,0,n.length,r),r}function Cg(n){return[new bn(0,n,0)]}let jg="";function sw(n,e,t,r,i){var s;let o=r.head-n.from,a=bn.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),l=e[a],c=l.side(i,t);if(o==c){let f=a+=i?1:-1;if(f<0||f>=e.length)return null;l=e[a=f],o=l.side(!i,t),c=l.side(i,t)}let h=_e(n.text,o,l.forward(i,t));(h<l.from||h>l.to)&&(h=c),jg=n.text.slice(Math.min(o,h),Math.max(o,h));let u=a==(i?e.length-1:0)?null:e[a+(i?1:-1)];return u&&h==c&&u.level+(i?0:1)<l.level?E.cursor(u.side(!i,t)+n.from,u.forward(i,t)?1:-1,u.level):E.cursor(h+n.from,l.forward(i,t)?-1:1,l.level)}function ow(n,e,t){for(let r=e;r<t;r++){let i=kg(n.charCodeAt(r));if(i==1)return ar;if(i==2||i==4)return Dh}return ar}const Og=K.define(),Pg=K.define(),Ng=K.define(),Ag=K.define(),Fc=K.define(),Mg=K.define(),Tg=K.define(),Eh=K.define(),Rh=K.define(),Dg=K.define({combine:n=>n.some(e=>e)}),Eg=K.define({combine:n=>n.some(e=>e)}),Rg=K.define();class Dr{constructor(e,t="nearest",r="nearest",i=5,s=5,o=!1){this.range=e,this.y=t,this.x=r,this.yMargin=i,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new Dr(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 Dr(E.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const yo=ae.define({map:(n,e)=>n.map(e)}),Lg=ae.define();function ut(n,e,t){let r=n.facet(Ag);r.length?r[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const gn=K.define({combine:n=>n.length?n[0]:!0});let aw=0;const wr=K.define({combine(n){return n.filter((e,t)=>{for(let r=0;r<t;r++)if(n[r].plugin==e.plugin)return!1;return!0})}});class Fe{constructor(e,t,r,i,s){this.id=e,this.create=t,this.domEventHandlers=r,this.domEventObservers=i,this.baseExtensions=s(this),this.extension=this.baseExtensions.concat(wr.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(wr.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:r,eventObservers:i,provide:s,decorations:o}=t||{};return new Fe(aw++,e,r,i,a=>{let l=[];return o&&l.push(Wi.of(c=>{let h=c.plugin(a);return h?o(h):ne.none})),s&&l.push(s(a)),l})}static fromClass(e,t){return Fe.define((r,i)=>new e(r,i),t)}}class pl{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 t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(r){if(ut(t.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(t){ut(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(r){ut(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Ig=K.define(),Lh=K.define(),Wi=K.define(),$g=K.define(),Bg=K.define(),_s=K.define(),Fg=K.define();function Mu(n,e){let t=n.state.facet(Fg);if(!t.length)return t;let r=t.map(s=>s instanceof Function?s(n):s),i=[];return pe.spans(r,e.from,e.to,{point(){},span(s,o,a,l){let c=s-e.from,h=o-e.from,u=i;for(let f=a.length-1;f>=0;f--,l--){let p=a[f].spec.bidiIsolate,m;if(p==null&&(p=ow(e.text,c,h)),l>0&&u.length&&(m=u[u.length-1]).to==c&&m.direction==p)m.to=h,u=m.inner;else{let b={from:c,to:h,direction:p,inner:[]};u.push(b),u=b.inner}}}}),i}const Vg=K.define();function Ih(n){let e=0,t=0,r=0,i=0;for(let s of n.state.facet(Vg)){let o=s(n);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:t,top:r,bottom:i}}const yi=K.define();class At{constructor(e,t,r,i){this.fromA=e,this.toA=t,this.fromB=r,this.toB=i}join(e){return new At(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 t=e.length,r=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>r.toA)){if(i.toA<r.fromA)break;r=r.join(i),e.splice(t-1,1)}}return e.splice(t,0,r),e}static extendWithRanges(e,t){if(t.length==0)return e;let r=[];for(let i=0,s=0,o=0;;){let a=i<e.length?e[i].fromB:1e9,l=s<t.length?t[s]:1e9,c=Math.min(a,l);if(c==1e9)break;let h=c+o,u=c,f=h;for(;;)if(s<t.length&&t[s]<=u){let p=t[s+1];s+=2,u=Math.max(u,p);for(let m=i;m<e.length&&e[m].fromB<=u;m++)o=e[m].toA-e[m].toB;f=Math.max(f,p+o)}else if(i<e.length&&e[i].fromB<=u){let p=e[i++];u=Math.max(u,p.toB),f=Math.max(f,p.toA),o=p.toA-p.toB}else break;r.push(new At(h,f,c,u))}return r}}class la{constructor(e,t,r){this.view=e,this.state=t,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=ze.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,o,a,l)=>i.push(new At(s,o,a,l))),this.changedRanges=i}static create(e,t,r){return new la(e,t,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 lw=[];class Ve{constructor(e,t,r=0){this.dom=e,this.length=t,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return lw}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 t=this.domAttrs;t&&H2(this.dom,t)}}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,t=this.posAtStart){let r=t;for(let i of this.children){if(i==e)return r;r+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let r=Bn(this.dom),i=this.length?e>0:t>0;return new Ft(this.parent.dom,r+(i?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 Ia)return e;return null}static get(e){return e.cmTile}}class La extends Ve{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 t=this.dom,r=null,i,s=e?.node==t?e:null,o=0;for(let a of this.children){if(a.sync(e),o+=a.length+a.breakAfter,i=r?r.nextSibling:t.firstChild,s&&i!=a.dom&&(s.written=!0),a.dom.parentNode==t)for(;i&&i!=a.dom;)i=Tu(i);else t.insertBefore(a.dom,i);r=a.dom}for(i=r?r.nextSibling:t.firstChild,s&&i&&(s.written=!0);i;)i=Tu(i);this.length=o}}function Tu(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Ia extends La{constructor(e,t){super(t),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 t=Ve.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],r=this,i=0,s=0;;)if(i==r.children.length){if(!t.length)return;r=r.parent,r.breakAfter&&s++,i=t.pop()}else{let o=r.children[i++];if(o instanceof Dn)t.push(i),r=o,i=0;else{let a=s+o.length,l=e(o,s);if(l!==void 0)return l;s=a+o.breakAfter}}}resolveBlock(e,t){let r,i=-1,s,o=-1;if(this.blockTiles((a,l)=>{let c=l+a.length;if(e>=l&&e<=c){if(a.isWidget()&&t>=-1&&t<=1){if(a.flags&32)return!0;a.flags&16&&(r=void 0)}(l<e||e==c&&(t<-1?a.length:a.covers(1)))&&(!r||!a.isWidget()&&r.isWidget())&&(r=a,i=e-l),(c>e||e==l&&(t>1?a.length:a.covers(-1)))&&(!s||!a.isWidget()&&s.isWidget())&&(s=a,o=e-l)}}),!r&&!s)throw new Error("No tile at position "+e);return r&&t<0||!s?{tile:r,offset:i}:{tile:s,offset:o}}}class Dn extends La{constructor(e,t){super(e),this.wrapper=t}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,t){let r=new Dn(t||document.createElement(e.tagName),e);return t||(r.flags|=4),r}}class $r extends La{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,r){let i=new $r(t||document.createElement("div"),e);return(!t||!r)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,t,r){let i=null,s=-1,o=null,a=-1;function l(h,u){for(let f=0,p=0;f<h.children.length&&p<=u;f++){let m=h.children[f],b=p+m.length;b>=u&&(m.isComposite()?l(m,u-p):(!o||o.isHidden&&(t>0||r&&hw(o,m)))&&(b>u||m.flags&32)?(o=m,a=u-p):(p<u||m.flags&16&&!m.isHidden)&&(i=m,s=u-p)),p=b}}l(this,e);let c=(t<0?i:o)||i||o;return c?{tile:c,offset:c==i?s:a}:null}coordsIn(e,t){let r=this.resolveInline(e,t,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),t):cw(this)}domIn(e,t){let r=this.resolveInline(e,t);if(r){let{tile:i,offset:s}=r;if(this.dom.contains(i.dom))return i.isText()?new Ft(i.dom,Math.min(i.dom.nodeValue.length,s)):i.domPosFor(s,i.flags&16?1:i.flags&32?-1:t);let o=r.tile.parent,a=!1;for(let l of o.children){if(a)return new Ft(l.dom,0);l==r.tile&&(a=!0)}}return new Ft(this.dom,0)}}function cw(n){let e=n.dom.lastChild;if(!e)return n.dom.getBoundingClientRect();let t=Oi(e);return t[t.length-1]||null}function hw(n,e){let t=n.coordsIn(0,1),r=e.coordsIn(0,1);return t&&r&&r.top<t.bottom}class dt extends La{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let r=new dt(t||document.createElement(e.tagName),e);return t||(r.flags|=4),r}}class nr extends Ve{constructor(e,t){super(e,t.length),this.text=t}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,t){let r=this.dom.nodeValue.length;e>r&&(e=r);let i=e,s=e,o=0;e==0&&t<0||e==r&&t>=0?U.chrome||U.gecko||(e?(i--,o=1):s<r&&(s++,o=-1)):t<0?i--:s<r&&s++;let a=Hi(this.dom,i,s).getClientRects();if(!a.length)return null;let l=a[(o?o<0:t>=0)?0:a.length-1];return U.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?_i(l,o<0):l||null}static of(e,t){let r=new nr(t||document.createTextNode(e),e);return t||(r.flags|=2),r}}class Br extends Ve{constructor(e,t,r,i){super(e,t,i),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,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,r){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;if(r)return _i(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let s=this.dom.getClientRects(),o=null;if(!s.length)return null;let a=this.flags&16?!0:this.flags&32?!1:e>0;for(let l=a?s.length-1:0;o=s[l],!(e>0?l==0:l==s.length-1||o.top<o.bottom);l+=a?-1:1);return _i(o,!a)}}get overrideDOMText(){if(!this.length)return xe.empty;let{root:e}=this;if(!e)return xe.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,r,i,s){return s||(s=e.toDOM(t),e.editable||(s.contentEditable="false")),new Br(s,r,e,i)}}class ca extends Ve{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!1}get overrideDOMText(){return xe.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class dw{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,r){let{tile:i,index:s,beforeBreak:o,parents:a}=this;for(;e||t>0;)if(i.isComposite())if(o){if(!e)break;r&&r.break(),e--,o=!1}else if(s==i.children.length){if(!e&&!a.length)break;r&&r.leave(i),o=!!i.breakAfter,{tile:i,index:s}=a.pop(),s++}else{let l=i.children[s],c=l.breakAfter;(t>0?l.length<=e:l.length<e)&&(!r||r.skip(l,0,l.length)!==!1||!l.isComposite)?(o=!!c,s++,e-=l.length):(a.push({tile:i,index:s}),i=l,s=0,r&&l.isComposite()&&r.enter(l))}else if(s==i.length)o=!!i.breakAfter,{tile:i,index:s}=a.pop(),s++;else if(e){let l=Math.min(e,i.length-s);r&&r.skip(i,s,s+l),e-=l,s+=l}else break;return this.tile=i,this.index=s,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class uw{constructor(e,t,r,i){this.from=e,this.to=t,this.wrapper=r,this.rank=i}}class fw{constructor(e,t,r){this.cache=e,this.root=t,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,r,i){var s;this.flushBuffer();let o=this.ensureMarks(t,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 nr(a.dom,a.text+e);l.parent=o}else o.append(i||nr.of(e,(s=this.cache.find(nr))===null||s===void 0?void 0:s.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let r=this.curLine;r.dom!=t.line.dom&&(r.setDOM(this.cache.reused.has(t.line)?ml(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let i=r;for(let a=t.marks.length-1;a>=0;a--){let l=t.marks[a],c=i.lastChild;if(c instanceof dt&&c.mark.eq(l.mark))c.dom!=l.dom&&c.setDOM(ml(l.dom)),i=c;else{if(this.cache.reused.get(l)){let u=Ve.get(l.dom);u&&u.setDOM(ml(l.dom))}let h=dt.of(l.mark,l.dom);i.append(h),i=h}this.cache.reused.set(l,2)}let s=Ve.get(e.text);s&&this.cache.reused.set(s,2);let o=new nr(e.text,e.text.nodeValue);o.flags|=8,i.append(o)}addInlineWidget(e,t,r){let i=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);i||this.flushBuffer();let s=this.ensureMarks(t,r);!i&&!(e.flags&16)&&s.append(this.getBuffer(1)),s.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,r){this.flushBuffer(),this.ensureMarks(t,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 t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var r;e||(e=zg);let i=$r.start(e,t||((r=this.cache.find($r))===null||r===void 0?void 0:r.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=i)}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,t){var r;let i=this.curLine;for(let s=e.length-1;s>=0;s--){let o=e[s],a;if(t>0&&(a=i.lastChild)&&a instanceof dt&&a.mark.eq(o))i=a,t--;else{let l=dt.of(o,(r=this.cache.find(dt,c=>c.mark.eq(o)))===null||r===void 0?void 0:r.dom);i.append(l),i=l,t=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!Du(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(U.ios&&Du(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(gl,0,32)||new Br(gl.toDOM(),0,gl,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 t=new uw(e.from,e.to,e.value,e.rank),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-t.rank||this.wrappers[r-1].to-t.to)<0;)r--;this.wrappers.splice(r,0,t)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let r of this.wrappers){let i=t.lastChild;if(r.from<this.pos&&i instanceof Dn&&i.wrapper.eq(r.wrapper))t=i;else{let s=Dn.of(r.wrapper,(e=this.cache.find(Dn,o=>o.wrapper.eq(r.wrapper)))===null||e===void 0?void 0:e.dom);t.append(s),t=s}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),r=this.cache.find(ca,void 0,1);return r&&(r.flags=t),r||new ca(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class pw{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:i,lineBreak:s,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=i;let a=this.textOff=Math.min(e,i.length);return s?null:i.slice(0,a)}let t=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,t);return this.textOff=t,r}}const ha=[Br,$r,nr,dt,ca,Dn,Ia];for(let n=0;n<ha.length;n++)ha[n].bucket=n;class mw{constructor(e){this.view=e,this.buckets=ha.map(()=>[]),this.index=ha.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,r=this.buckets[t];r.length<6?r.push(e):r[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,r=2){let i=e.bucket,s=this.buckets[i],o=this.index[i];for(let a=s.length-1;a>=0;a--){let l=(a+o)%s.length,c=s[l];if((!t||t(c))&&!this.reused.has(c))return s.splice(l,1),l<o&&this.index[i]--,this.reused.set(c,r),c}return null}findWidget(e,t,r){let i=this.buckets[0];if(i.length)for(let s=0,o=0;;s++){if(s==i.length){if(o)return null;o=1,s=0}let a=i[s];if(!this.reused.has(a)&&(o==0?a.widget.compare(e):a.widget.constructor==e.constructor&&e.updateDOM(a.dom,this.view)))return i.splice(s,1),s<this.index[0]&&this.index[0]--,this.reused.set(a,1),a.length=t,a.flags=a.flags&-498|r,a}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}}class gw{constructor(e,t,r,i,s){this.view=e,this.decorations=i,this.disallowBlockEffectsFor=s,this.openWidget=!1,this.openMarks=0,this.cache=new mw(e),this.text=new pw(e.state.doc),this.builder=new fw(this.cache,new Ia(e,e.contentDOM),pe.iter(r)),this.cache.reused.set(t,2),this.old=new dw(t),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,t){let r=t&&this.getCompositionContext(t.text);for(let i=0,s=0,o=0;;){let a=o<e.length?e[o++]:null,l=a?a.fromA:this.old.root.length;if(l>i){let c=l-i;this.preserve(c,!o,!a),i=l,s+=c}if(!a)break;this.forward(a.fromA,a.toA),t&&a.fromA<=t.range.fromA&&a.toA>=t.range.toA?(this.emit(s,t.range.fromB),this.builder.addComposition(t,r),this.text.skip(t.range.toB-t.range.fromB),this.emit(t.range.toB,a.toB)):this.emit(s,a.toB),s=a.toB,i=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,r){let i=xw(this.old),s=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 c=l>0||a<o.length?Br.of(o.widget,this.view,l-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);c.flags&256?(c.flags&=-2,this.builder.addBlockWidget(c)):(this.builder.ensureLine(null),this.builder.addInlineWidget(c,i,s),s=i.length)}else if(o.isText())this.builder.ensureLine(null),!a&&l==o.length?this.builder.addText(o.text,i,s,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,l),i,s)),s=i.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof ca)this.cache.add(o);else if(o instanceof dt)this.builder.ensureLine(null),this.builder.addMark(o,i,s),this.cache.reused.set(o,1),s=i.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 dt&&i.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?i.length&&(i.length=s=0):o instanceof dt&&(i.shift(),s=Math.min(s,i.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let r=null,i=this.builder,s=0,o=pe.spans(this.decorations,e,t,{point:(a,l,c,h,u,f)=>{if(c instanceof or){if(this.disallowBlockEffectsFor[f]){if(c.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(s=h.length,u>h.length)i.continueWidget(l-a);else{let p=c.widget||(c.block?Fr.block:Fr.inline),m=bw(c),b=this.cache.findWidget(p,l-a,m)||Br.of(p,this.view,l-a,m);c.block?(c.startSide>0&&i.addLineStartIfNotCovered(r),i.addBlockWidget(b)):(i.ensureLine(r),i.addInlineWidget(b,h,u))}r=null}else r=yw(r,c);l>a&&this.text.skip(l-a)},span:(a,l,c,h)=>{for(let u=a;u<l;){let f=this.text.next(Math.min(512,l-u));f==null?(i.addLineStartIfNotCovered(r),i.addBreak(),u++):(i.ensureLine(r),i.addText(f,c,h),u+=f.length),r=null}}});i.addLineStartIfNotCovered(r),this.openWidget=o>s,this.openMarks=o}forward(e,t){t-e<=10?this.old.advance(t-e,1,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,1,this.reuseWalker))}getCompositionContext(e){let t=[],r=null;for(let i=e.parentNode;;i=i.parentNode){let s=Ve.get(i);if(i==this.view.contentDOM)break;s instanceof dt?t.push(s):s?.isLine()?r=s:i.nodeName=="DIV"&&!r&&i!=this.view.contentDOM?r=new $r(i,zg):t.push(dt.of(new Vs({tagName:i.nodeName.toLowerCase(),attributes:W2(i)}),i))}return{line:r,marks:t}}}function Du(n,e){let t=r=>{for(let i of r.children)if((e?i.isText():i.length)||t(i))return!0;return!1};return t(n)}function bw(n){let e=n.isReplace?(n.startSide<0?64:0)|(n.endSide>0?128:0):n.startSide>0?32:16;return n.block&&(e|=256),e}const zg={class:"cm-line"};function yw(n,e){let t=e.spec.attributes,r=e.spec.class;return!t&&!r||(n||(n={class:"cm-line"}),t&&Mh(t,n),r&&(n.class+=" "+r)),n}function xw(n){let e=[];for(let t=n.parents.length;t>1;t--){let r=t==n.parents.length?n.tile:n.parents[t].tile;r instanceof dt&&e.push(r.mark)}return e}function ml(n){let e=Ve.get(n);return e&&e.setDOM(n.cloneNode()),n}class Fr extends hn{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}}Fr.inline=new Fr("span");Fr.block=new Fr("div");const gl=new class extends hn{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Eu{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=ne.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 Ia(e,e.contentDOM),this.updateInner([new At(0,0,0,e.state.doc.length)],null)}update(e){var t;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 i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?i=this.domChanged.newSel.head:!Nw(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?ww(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:h,to:u}=this.hasComposition;r=new At(h,u,e.changes.mapPos(h,-1),e.changes.mapPos(u,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(U.ie||U.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let l=Cw(o,this.decorations,e.changes);l.length&&(r=At.extendWithRanges(r,l));let c=Ow(a,this.blockWrappers,e.changes);return c.length&&(r=At.extendWithRanges(r,c)),s&&!r.some(h=>h.fromA<=s.range.fromA&&h.toA>=s.range.toA)&&(r=s.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(t||e.length){let o=this.tile,a=new gw(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=a.run(e,t),Vc(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 s=U.chrome||U.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||r.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let i=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let s of this.tile.children)s.isWidget()&&s.widget instanceof bl&&i.push(s.dom);r.updateGaps(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let r of t.effects)r.is(Lg)&&(this.editContextFormatting=r.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,i=this.view.root.activeElement,s=i==r,o=!s&&!(this.view.state.facet(gn)||r.tabIndex>-1)&&Go(r,this.view.observer.selectionRange)&&!(i&&r.contains(i));if(!(s||t||o))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c,h;if(l.empty?h=c=this.inlineDOMNearPos(l.anchor,l.assoc||1):(h=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),c=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),U.gecko&&l.empty&&!this.hasComposition&&vw(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=h=new Ft(f,0),a=!0}let u=this.view.observer.selectionRange;(a||!u.focusNode||(!Pi(c.node,c.offset,u.anchorNode,u.anchorOffset)||!Pi(h.node,h.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,l))&&(this.view.observer.ignore(()=>{U.android&&U.chrome&&r.contains(u.focusNode)&&Pw(u.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let f=zi(this.view.root);if(f)if(l.empty){if(U.gecko){let p=kw(c.node,c.offset);if(p&&p!=3){let m=(p==1?xg:vg)(c.node,c.offset);m&&(c=new Ft(m.node,m.offset))}}f.collapse(c.node,c.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=l.bidiLevel)}else if(f.extend){f.collapse(c.node,c.offset);try{f.extend(h.node,h.offset)}catch{}}else{let p=document.createRange();l.anchor>l.head&&([c,h]=[h,c]),p.setEnd(h.node,h.offset),p.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(p)}o&&this.view.root.activeElement==r&&(r.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(c,h)),this.impreciseAnchor=c.precise?null:new Ft(u.anchorNode,u.anchorOffset),this.impreciseHead=h.precise?null:new Ft(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Pi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,r=zi(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!t.empty||!t.assoc||!r.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let a=o.posAtStart;if(t.head==a||t.head==a+o.length)return;let l=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!l||!c||l.bottom>c.top)return;let h=this.domAtPos(t.head+t.assoc,t.assoc);r.collapse(h.node,h.offset),r.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&r.collapse(i,s)}posFromDOM(e,t){let r=this.tile.nearest(e);if(!r)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let i=r.posAtStart;if(r.isComposite()){let s;if(e==r.dom)s=r.dom.childNodes[t];else{let o=xn(e)==0?0:t==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?s=e:s=e.nextSibling}if(s==r.dom.firstChild)return i;for(;s&&!Ve.get(s);)s=s.nextSibling;if(!s)return i+r.length;for(let o=0,a=i;;o++){let l=r.children[o];if(l.dom==s)return a;a+=l.length+l.breakAfter}}else return r.isText()?e==r.dom?i+t:i+(t?r.length:0):i}domAtPos(e,t){let{tile:r,offset:i}=this.tile.resolveBlock(e,t);return r.isWidget()?r.domPosFor(e,t):r.domIn(i,t)}inlineDOMNearPos(e,t){let r,i=-1,s=!1,o,a=-1,l=!1;return this.tile.blockTiles((c,h)=>{if(c.isWidget()){if(c.flags&32&&h>=e)return!0;c.flags&16&&(s=!0)}else{let u=h+c.length;if(h<=e&&(r=c,i=e-h,s=u<e),u>=e&&!o&&(o=c,a=e-h,l=h>e),h>e&&o)return!0}}),!r&&!o?this.domAtPos(e,t):(s&&o?r=null:l&&r&&(o=null),r&&t<0||!o?r.domIn(i,t):o.domIn(a,t))}coordsAt(e,t){let{tile:r,offset:i}=this.tile.resolveBlock(e,t);return r.isWidget()?r.widget instanceof bl?null:r.coordsInWidget(i,t,!0):r.coordsIn(i,t)}lineAt(e,t){let{tile:r}=this.tile.resolveBlock(e,t);return r.isLine()?r:null}coordsForChar(e){let{tile:t,offset:r}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function i(s,o){if(s.isComposite())for(let a of s.children){if(a.length>=o){let l=i(a,o);if(l)return l}if(o-=a.length,o<0)break}else if(s.isText()&&o<s.length){let a=_e(s.text,o);if(a==o)return null;let l=Hi(s.dom,o,a).getClientRects();for(let c=0;c<l.length;c++){let h=l[c];if(c==l.length-1||h.top<h.bottom&&h.left<h.right)return h}}return null}return i(t,r)}measureVisibleLineHeights(e){let t=[],{from:r,to:i}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==Pe.LTR,c=0,h=(u,f,p)=>{for(let m=0;m<u.children.length&&!(f>i);m++){let b=u.children[m],y=f+b.length,v=b.dom.getBoundingClientRect(),{height:w}=v;if(p&&!m&&(c+=v.top-p.top),b instanceof Dn)y>r&&h(b,f,v);else if(f>=r&&(c>0&&t.push(-c),t.push(w+c),c=0,o)){let C=b.dom.lastChild,j=C?Oi(C):[];if(j.length){let k=j[j.length-1],O=l?k.right-v.left:v.right-k.left;O>a&&(a=O,this.minWidth=s,this.minWidthFrom=f,this.minWidthTo=y)}}p&&m==u.children.length-1&&(c+=p.bottom-v.bottom),f=y+b.breakAfter}};return h(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?Pe.RTL:Pe.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,l;for(let c of o.children){if(!c.isText()||/[^ -~]/.test(c.text))return;let h=Oi(c.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 t=document.createElement("div"),r,i,s;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=Oi(t.firstChild)[0];r=t.getBoundingClientRect().height,i=o&&o.width?o.width/27:7,s=o&&o.height?o.height:r,t.remove()}),{lineHeight:r,charWidth:i,textHeight:s}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let r=0,i=0;;i++){let s=i==t.viewports.length?null:t.viewports[i],o=s?s.from-1:this.view.state.doc.length;if(o>r){let a=(t.lineBlockAt(o).bottom-t.lineBlockAt(r).top)/this.view.scaleY;e.push(ne.replace({widget:new bl(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return ne.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Wi).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(Bg).map((s,o)=>{let a=typeof s=="function";return a&&(r=!0),a?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[e++]=r,t.push(pe.join(i))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet($g).map(s=>typeof s=="function"?s(this.view):s)}scrollIntoView(e){if(e.isSnapshot){let c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let c of this.view.state.facet(Rg))try{if(c(this.view,e.range,e))return!0}catch(h){ut(this.view.state,h,"scroll handler")}let{range:t}=e,r=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),i;if(!r)return;!t.empty&&(i=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let s=Ih(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;G2(this.view.scrollDOM,o,t.head<t.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==Pe.LTR)}lineHasWidget(e){let t=r=>r.isWidget()||r.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){Vc(this.tile)}}function Vc(n,e){let t=e?.get(n);if(t!=1){t==null&&n.destroy();for(let r of n.children)Vc(r,e)}}function vw(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function _g(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let r=xg(t.focusNode,t.focusOffset),i=vg(t.focusNode,t.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let a=Ve.get(i.node);if(!a||a.isText()&&a.text!=i.node.nodeValue)s=i;else if(n.docView.lastCompositionAfterCursor){let l=Ve.get(r.node);!l||l.isText()&&l.text!=r.node.nodeValue||(s=i)}}if(n.docView.lastCompositionAfterCursor=s!=r,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function ww(n,e,t){let r=_g(n,t);if(!r)return null;let{node:i,from:s,to:o}=r,a=i.nodeValue;if(/[\n\r]/.test(a)||n.state.doc.sliceString(r.from,r.to)!=a)return null;let l=e.invertedDesc;return{range:new At(l.mapPos(s),l.mapPos(o),s,o),text:i}}function kw(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e<n.childNodes.length&&n.childNodes[e].contentEditable=="false"?2:0)}let Sw=class{constructor(){this.changes=[]}compareRange(e,t){Mr(e,t,this.changes)}comparePoint(e,t){Mr(e,t,this.changes)}boundChange(e){Mr(e,e,this.changes)}};function Cw(n,e,t){let r=new Sw;return pe.compare(n,e,t,r),r.changes}class jw{constructor(){this.changes=[]}compareRange(e,t){Mr(e,t,this.changes)}comparePoint(){}boundChange(e){Mr(e,e,this.changes)}}function Ow(n,e,t){let r=new jw;return pe.compare(n,e,t,r),r.changes}function Pw(n,e){for(let t=n;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function Nw(n,e){let t=!1;return e&&n.iterChangedRanges((r,i)=>{r<e.to&&i>e.from&&(t=!0)}),t}class bl extends hn{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 Aw(n,e,t=1){let r=n.charCategorizer(e),i=n.doc.lineAt(e),s=e-i.from;if(i.length==0)return E.cursor(e);s==0?t=1:s==i.length&&(t=-1);let o=s,a=s;t<0?o=_e(i.text,s,!1):a=_e(i.text,s);let l=r(i.text.slice(o,a));for(;o>0;){let c=_e(i.text,o,!1);if(r(i.text.slice(c,o))!=l)break;o=c}for(;a<i.length;){let c=_e(i.text,a);if(r(i.text.slice(a,c))!=l)break;a=c}return E.range(o+i.from,a+i.from)}function Mw(n,e,t,r,i){let s=Math.round((r-e.left)*n.defaultCharacterWidth);if(n.lineWrapping&&t.height>n.defaultLineHeight*1.5){let a=n.viewState.heightOracle.textHeight,l=Math.floor((i-t.top-(n.defaultLineHeight-a)*.5)/a);s+=l*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+Nc(o,s,n.state.tabSize)}function zc(n,e,t){let r=n.lineBlockAt(e);if(Array.isArray(r.type)){let i;for(let s of r.type){if(s.from>e)break;if(!(s.to<e)){if(s.from<e&&s.to>e)return s;(!i||s.type==Je.Text&&(i.type!=s.type||(t<0?s.from<e:s.to>e)))&&(i=s)}}return i||r}return r}function Tw(n,e,t,r){let i=zc(n,e.head,e.assoc||-1),s=!r||i.type!=Je.Text||!(n.lineWrapping||i.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=n.dom.getBoundingClientRect(),a=n.textDirectionAt(i.from),l=n.posAtCoords({x:t==(a==Pe.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(l!=null)return E.cursor(l,t?-1:1)}return E.cursor(t?i.to:i.from,t?-1:1)}function Ru(n,e,t,r){let i=n.state.doc.lineAt(e.head),s=n.bidiSpans(i),o=n.textDirectionAt(i.from);for(let a=e,l=null;;){let c=sw(i,s,o,a,t),h=jg;if(!c){if(i.number==(t?n.state.doc.lines:1))return a;h=`
59
- `,i=n.state.doc.line(i.number+(t?1:-1)),s=n.bidiSpans(i),c=n.visualLineSide(i,!t)}if(l){if(!l(h))return a}else{if(!r)return c;l=r(h)}a=c}}function Dw(n,e,t){let r=n.state.charCategorizer(e),i=r(t);return s=>{let o=r(s);return i==De.Space&&(i=o),i==o}}function Ew(n,e,t,r){let i=e.head,s=t?1:-1;if(i==(t?n.state.doc.length:0))return E.cursor(i,e.assoc);let o=e.goalColumn,a,l=n.contentDOM.getBoundingClientRect(),c=n.coordsAtPos(i,e.assoc||-1),h=n.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let p=n.viewState.lineBlockAt(i);o==null&&(o=Math.min(l.right-l.left,n.defaultCharacterWidth*(i-p.from))),a=(s<0?p.top:p.bottom)+h}let u=l.left+o,f=r??n.viewState.heightOracle.textHeight>>1;for(let p=0;;p+=10){let m=a+(f+p)*s,b=_c(n,{x:u,y:m},!1,s);return E.cursor(b.pos,b.assoc,void 0,o)}}function Ni(n,e,t){for(;;){let r=0;for(let i of n)i.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=r||t||(e-s<o-e?-1:1);e=l<0?s:o,r=l}});if(!r)return e}}function Hg(n,e){let t=null;for(let r=0;r<e.ranges.length;r++){let i=e.ranges[r],s=null;if(i.empty){let o=Ni(n,i.from,0);o!=i.from&&(s=E.cursor(o,-1))}else{let o=Ni(n,i.from,-1),a=Ni(n,i.to,1);(o!=i.from||a!=i.to)&&(s=E.range(i.from==i.anchor?o:a,i.from==i.head?o:a))}s&&(t||(t=e.ranges.slice()),t[r]=s)}return t?E.create(t,e.mainIndex):e}function yl(n,e,t){let r=Ni(n.state.facet(_s).map(i=>i(n)),t.from,e.head>t.from?-1:1);return r==t.from?t:E.cursor(r,r<t.from?1:-1)}class en{constructor(e,t){this.pos=e,this.assoc=t}}function _c(n,e,t,r){let i=n.contentDOM.getBoundingClientRect(),s=i.top+n.viewState.paddingTop,{x:o,y:a}=e,l=a-s,c;for(;;){if(l<0)return new en(0,1);if(l>n.viewState.docHeight)return new en(n.state.doc.length,-1);if(c=n.elementAtHeight(l),r==null)break;if(c.type==Je.Text){let f=n.docView.coordsAt(r<0?c.from:c.to,r);if(f&&(r<0?f.top<=l+s:f.bottom>=l+s))break}let u=n.viewState.heightOracle.textHeight/2;l=r>0?c.bottom+u:c.top-u}if(n.viewport.from>=c.to||n.viewport.to<=c.from){if(t)return null;if(c.type==Je.Text){let u=Mw(n,i,c,o,a);return new en(u,u==c.from?1:-1)}}if(c.type!=Je.Text)return l<(c.top+c.bottom)/2?new en(c.from,1):new en(c.to,-1);let h=n.docView.lineAt(c.from,2);return(!h||h.length!=c.length)&&(h=n.docView.lineAt(c.from,-2)),Wg(n,h,c.from,o,a)}function Wg(n,e,t,r,i){let s=-1,o=null,a=1e9,l=1e9,c=i,h=i,u=(f,p)=>{for(let m=0;m<f.length;m++){let b=f[m];if(b.top==b.bottom)continue;let y=b.left>r?b.left-r:b.right<r?r-b.right:0,v=b.top>i?b.top-i:b.bottom<i?i-b.bottom:0;b.top<=h&&b.bottom>=c&&(c=Math.min(b.top,c),h=Math.max(b.bottom,h),v=0),(s<0||(v-l||y-a)<0)&&(s>=0&&l&&a<y&&o.top<=h-2&&o.bottom>=c+2?l=0:(s=p,a=y,l=v,o=b))}};if(e.isText()){for(let p=0;p<e.length;){let m=_e(e.text,p);if(u(Hi(e.dom,p,m).getClientRects(),p),!a&&!l)break;p=m}return r>(o.left+o.right)/2==(Lu(n,s+t)==Pe.LTR)?new en(t+_e(e.text,s),-1):new en(t+s,1)}else{if(!e.length)return new en(t,1);for(let b=0;b<e.children.length;b++){let y=e.children[b];if(y.flags&48)continue;let v=(y.dom.nodeType==1?y.dom:Hi(y.dom,0,y.length)).getClientRects();if(u(v,b),!a&&!l)break}let f=e.children[s],p=e.posBefore(f,t);return f.isComposite()||f.isText()?Wg(n,f,p,Math.max(o.left,Math.min(o.right,r)),i):r>(o.left+o.right)/2==(Lu(n,s+t)==Pe.LTR)?new en(p+f.length,-1):new en(p,1)}}function Lu(n,e){let t=n.state.doc.lineAt(e);return n.bidiSpans(t)[bn.find(n.bidiSpans(t),e-t.from,-1,1)].dir}const xi="￿";class Rw{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(me.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=xi}readRange(e,t){if(!e)return this;let r=e.parentNode;for(let i=e;;){this.findPointBefore(r,i);let s=this.text.length;this.readNode(i);let o=Ve.get(i),a=i.nextSibling;if(a==t){o?.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=Ve.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:aa(i))||aa(a)&&(i.nodeName!="BR"||o?.isWidget())&&this.text.length>s)&&!Iw(a,t)&&this.lineBreak(),i=a}return this.findPointBefore(r,t),this}readTextNode(e){let t=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,t.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,a;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=i.exec(t))&&(s=a.index,o=a[0].length),this.append(t.slice(r,s<0?t.length:s)),s<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=s+o}}readNode(e){let t=Ve.get(e),r=t&&t.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let i=r.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.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,t){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==t&&(r.pos=this.text.length)}findPointInside(e,t){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(Lw(e,r.node,r.offset)?t:0))}}function Lw(n,e,t){for(;;){if(!e||t<xn(e))return!1;if(e==n)return!0;t=Bn(e)+1,e=e.parentNode}}function Iw(n,e){let t;for(;!(n==e||!n);n=n.nextSibling){let r=Ve.get(n);if(!r?.isWidget())return!1;r&&(t||(t=[])).push(r)}if(t)for(let r of t){let i=r.overrideDOMText;if(i?.length)return!1}return!0}class Iu{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class $w{constructor(e,t,r,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=Ug(e.docView.tile,t,r,0))){let a=s||o?[]:Fw(e),l=new Rw(a,e);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=Vw(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!Lc(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!Lc(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),h=e.viewport;if((U.ios||U.chrome)&&e.state.selection.main.empty&&l!=c&&(h.from>0||h.to<e.state.doc.length)){let u=Math.min(l,c),f=Math.max(l,c),p=h.from-u,m=h.to-f;(p==0||p==1||u==0)&&(m==0||m==-1||f==e.state.doc.length)&&(l=0,c=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(E.range(c,l)):this.newSel=E.single(c,l)}}}function Ug(n,e,t,r){if(n.isComposite()){let i=-1,s=-1,o=-1,a=-1;for(let l=0,c=r,h=r;l<n.children.length;l++){let u=n.children[l],f=c+u.length;if(c<e&&f>t)return Ug(u,e,t,c);if(f>=e&&i==-1&&(i=l,s=c),c>t&&u.dom.parentNode==n.dom){o=l,a=h;break}h=f,c=f+u.breakAfter}return{from:s,to:a<0?r+n.length:a,startDOM:(i?n.children[i-1].dom.nextSibling:null)||n.dom.firstChild,endDOM:o<n.children.length&&o>=0?n.children[o].dom:null}}else return n.isText()?{from:r,to:r+n.length,startDOM:n.dom,endDOM:n.dom.nextSibling}:null}function Kg(n,e){let t,{newSel:r}=e,i=n.state.selection.main,s=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,l=i.from,c=null;(s===8||U.android&&e.text.length<a-o)&&(l=i.to,c="end");let h=Gg(n.state.doc.sliceString(o,a,xi),e.text,l-o,c);h&&(U.chrome&&s==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==xi+xi&&h.toB--,t={from:o+h.from,to:o+h.toA,insert:xe.of(e.text.slice(h.from,h.toB).split(xi))})}else r&&(!n.hasFocus&&n.state.facet(gn)||r.main.eq(i))&&(r=null);if(!t&&!r)return!1;if(!t&&e.typeOver&&!i.empty&&r&&r.main.empty?t={from:i.from,to:i.to,insert:n.state.doc.slice(i.from,i.to)}:(U.mac||U.android)&&t&&t.from==t.to&&t.from==i.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(r&&t.insert.length==2&&(r=E.single(r.main.anchor-1,r.main.head-1)),t={from:t.from,to:t.to,insert:xe.of([t.insert.toString().replace("."," ")])}):t&&t.from>=i.from&&t.to<=i.to&&(t.from!=i.from||t.to!=i.to)&&i.to-i.from-(t.to-t.from)<=4?t={from:i.from,to:i.to,insert:n.state.doc.slice(i.from,t.from).append(t.insert).append(n.state.doc.slice(t.to,i.to))}:n.state.doc.lineAt(i.from).to<i.to&&n.docView.lineHasWidget(i.to)&&n.inputState.insertingTextAt>Date.now()-50?t={from:i.from,to:i.to,insert:n.state.toText(n.inputState.insertingText)}:U.chrome&&t&&t.from==t.to&&t.from==i.head&&t.insert.toString()==`
60
- `&&n.lineWrapping&&(r&&(r=E.single(r.main.anchor-1,r.main.head-1)),t={from:i.from,to:i.to,insert:xe.of([" "])}),t)return $h(n,t,r,s);if(r&&!r.main.eq(i)){let o=!1,a="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(o=!0),a=n.inputState.lastSelectionOrigin,a=="select.pointer"&&(r=Hg(n.state.facet(_s).map(l=>l(n)),r))),n.dispatch({selection:r,scrollIntoView:o,userEvent:a}),!0}else return!1}function $h(n,e,t,r=-1){if(U.ios&&n.inputState.flushIOSKey(e))return!0;let i=n.state.selection.main;if(U.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&n.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Tr(n.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>i.head)&&Tr(n.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&Tr(n.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,a=()=>o||(o=Bw(n,e,t));return n.state.facet(Mg).some(l=>l(n,e.from,e.to,s,a))||n.dispatch(a()),!0}function Bw(n,e,t){let r,i=n.state,s=i.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let l=e.from<s.from?-1:1,c=l<0?s.from:s.to,h=Ni(i.facet(_s).map(u=>u(n)),c,l);e.from==h&&(o=h)}if(o>-1)r={changes:e,selection:E.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let l=s.from<e.from?i.sliceDoc(s.from,e.from):"",c=s.to>e.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(n.state.toText(l+e.insert.sliceString(0,void 0,n.state.lineBreak)+c))}else{let l=i.changes(e),c=t&&t.main.to<=l.newLength?t.main:void 0;if(i.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let h=n.state.sliceDoc(e.from,e.to),u,f=t&&_g(n,t.main.head);if(f){let m=e.insert.length-(e.to-e.from);u={from:f.from,to:f.to-m}}else u=n.state.doc.lineAt(s.head);let p=s.to-e.to;r=i.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:l,range:c||m.map(l)};let b=m.to-p,y=b-h.length;if(n.state.sliceDoc(y,b)!=h||b>=u.from&&y<=u.to)return{range:m};let v=i.changes({from:y,to:b,insert:e.insert}),w=m.to-s.to;return{changes:v,range:c?E.range(Math.max(0,c.anchor+w),Math.max(0,c.head+w)):m.map(v)}})}else r={changes:l,selection:c&&i.selection.replaceRange(c)}}let a="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,a+=".compose",n.inputState.compositionFirstChange&&(a+=".start",n.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:a,scrollIntoView:!0})}function Gg(n,e,t,r){let i=Math.min(n.length,e.length),s=0;for(;s<i&&n.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&n.length==e.length)return null;let o=n.length,a=e.length;for(;o>0&&a>0&&n.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,s-Math.min(o,a));t-=o+l-s}if(o<s&&n.length<e.length){let l=t<=s&&t>=o?s-t:0;s-=l,a=s+(a-o),o=s}else if(a<s){let l=t<=s&&t>=a?s-t:0;s-=l,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function Fw(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}=n.observer.selectionRange;return t&&(e.push(new Iu(t,r)),(i!=t||s!=r)&&e.push(new Iu(i,s))),e}function Vw(n,e){if(n.length==0)return null;let t=n[0].pos,r=n.length==2?n[1].pos:t;return t>-1&&r>-1?E.single(t+e,r+e):null}class zw{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,U.safari&&e.contentDOM.addEventListener("input",()=>null),U.gecko&&nk(e.contentDOM.ownerDocument)}handleEvent(e){!Jw(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,t){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,t);for(let i of r.handlers){if(t.defaultPrevented)break;if(i(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=_w(e),r=this.handlers,i=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,a=r[s];a&&o!=!a.handlers.length&&(i.removeEventListener(s,this.handleEvent),a=null),a||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!="scroll"&&!t[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=t}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&&Jg.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),U.android&&U.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return U.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=qg.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||Hw.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Tr(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:U.safari&&!U.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 $u(n,e){return(t,r)=>{try{return e.call(n,r,t)}catch(i){ut(t.state,i)}}}function _w(n){let e=Object.create(null);function t(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of n){let i=r.spec,s=i&&i.plugin.domEventHandlers,o=i&&i.plugin.domEventObservers;if(s)for(let a in s){let l=s[a];l&&t(a).handlers.push($u(r.value,l))}if(o)for(let a in o){let l=o[a];l&&t(a).observers.push($u(r.value,l))}}for(let r in zt)t(r).handlers.push(zt[r]);for(let r in Rt)t(r).observers.push(Rt[r]);return e}const qg=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Hw="dthko",Jg=[16,17,18,20,91,92,224,225],xo=6;function vo(n){return Math.max(0,n)*.7+8}function Ww(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class Uw{constructor(e,t,r,i){this.view=e,this.startEvent=t,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=q2(e.contentDOM),this.atoms=e.state.facet(_s).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(me.allowMultipleSelections)&&Kw(e,t),this.dragging=qw(e,t)&&Xg(t)==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&&Ww(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,r=0,i=0,s=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=Ih(this.view);e.clientX-l.left<=i+xo?t=-vo(i-e.clientX):e.clientX+l.right>=o-xo&&(t=vo(e.clientX-o)),e.clientY-l.top<=s+xo?r=-vo(s-e.clientY):e.clientY+l.bottom>=a-xo&&(r=vo(e.clientY-a)),this.setScrollSpeed(t,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,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,r=Hg(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Kw(n,e){let t=n.state.facet(Og);return t.length?t[0](e):U.mac?e.metaKey:e.ctrlKey}function Gw(n,e){let t=n.state.facet(Pg);return t.length?t[0](e):U.mac?!e.altKey:!e.ctrlKey}function qw(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let r=zi(n.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let s=0;s<i.length;s++){let o=i[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function Jw(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,r;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(r=Ve.get(t))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const zt=Object.create(null),Rt=Object.create(null),Yg=U.ie&&U.ie_version<15||U.ios&&U.webkit_version<604;function Yw(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),Qg(n,t.value)},50)}function $a(n,e,t){for(let r of n.facet(e))t=r(t,n);return t}function Qg(n,e){e=$a(n.state,Eh,e);let{state:t}=n,r,i=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(Hc!=null&&t.selection.ranges.every(l=>l.empty)&&Hc==s.toString()){let l=-1;r=t.changeByRange(c=>{let h=t.doc.lineAt(c.from);if(h.from==l)return{range:c};l=h.from;let u=t.toText((o?s.line(i++).text:e)+t.lineBreak);return{changes:{from:h.from,insert:u},range:E.cursor(c.from+u.length)}})}else o?r=t.changeByRange(l=>{let c=s.line(i++);return{changes:{from:l.from,to:l.to,insert:c.text},range:E.cursor(l.from+c.length)}}):r=t.replaceSelection(s);n.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Rt.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop,n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};zt.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);Rt.touchstart=(n,e)=>{n.inputState.lastTouchTime=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};Rt.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};zt.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let r of n.state.facet(Ng))if(t=r(n,e),t)break;if(!t&&e.button==0&&(t=Xw(n,e)),t){let r=!n.hasFocus;n.inputState.startMouseSelection(new Uw(n,e,t,r)),r&&n.observer.ignore(()=>{bg(n.contentDOM);let s=n.root.activeElement;s&&!s.contains(n.contentDOM)&&s.blur()});let i=n.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function Bu(n,e,t,r){if(r==1)return E.cursor(e,t);if(r==2)return Aw(n.state,e,t);{let i=n.docView.lineAt(e,t),s=n.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,a=i?i.posAtEnd:s.to;return a<n.state.doc.length&&a==s.to&&a++,E.range(o,a)}}const Qw=U.ie&&U.ie_version<=11;let Fu=null,Vu=0,zu=0;function Xg(n){if(!Qw)return n.detail;let e=Fu,t=zu;return Fu=n,zu=Date.now(),Vu=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(Vu+1)%3:1}function Xw(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=Xg(e),i=n.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),i=i.map(s.changes))},get(s,o,a){let l=n.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),c,h=Bu(n,l.pos,l.assoc,r);if(t.pos!=l.pos&&!o){let u=Bu(n,t.pos,t.assoc,r),f=Math.min(u.from,h.from),p=Math.max(u.to,h.to);h=f<h.from?E.range(f,p):E.range(p,f)}return o?i.replaceRange(i.main.extend(h.from,h.to)):a&&r==1&&i.ranges.length>1&&(c=Zw(i,l.pos))?c:a?i.addRange(h):E.create([h])}}}function Zw(n,e){for(let t=0;t<n.ranges.length;t++){let{from:r,to:i}=n.ranges[t];if(r<=e&&i>=e)return E.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}zt.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let i=n.docView.tile.nearest(e.target);if(i&&i.isWidget()){let s=i.posAtStart,o=s+i.length;(s>=t.to||o<=t.from)&&(t=E.range(s,o))}}let{inputState:r}=n;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",$a(n.state,Rh,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};zt.dragend=n=>(n.inputState.draggedContent=null,!1);function _u(n,e,t,r){if(t=$a(n.state,Eh,t),!t)return;let i=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=n.inputState,o=r&&s&&Gw(n,e)?{from:s.from,to:s.to}:null,a={from:i,insert:t},l=n.state.changes(o?[o,a]:a);n.focus(),n.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}zt.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let r=Array(t.length),i=0,s=()=>{++i==t.length&&_u(n,e,r.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let a=new FileReader;a.onerror=s,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[o]=a.result),s()},a.readAsText(t[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return _u(n,e,r,!0),!0}return!1};zt.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=Yg?null:e.clipboardData;return t?(Qg(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(Yw(n),!1)};function ek(n,e){let t=n.dom.parentNode;if(!t)return;let r=t.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(),n.focus()},50)}function tk(n){let e=[],t=[],r=!1;for(let i of n.selection.ranges)i.empty||(e.push(n.sliceDoc(i.from,i.to)),t.push(i));if(!e.length){let i=-1;for(let{from:s}of n.selection.ranges){let o=n.doc.lineAt(s);o.number>i&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),i=o.number}r=!0}return{text:$a(n,Rh,e.join(n.lineBreak)),ranges:t,linewise:r}}let Hc=null;zt.copy=zt.cut=(n,e)=>{let{text:t,ranges:r,linewise:i}=tk(n.state);if(!t&&!i)return!1;Hc=i?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=Yg?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(ek(n,t),!1)};const Zg=ln.define();function e0(n,e){let t=[];for(let r of n.facet(Tg)){let i=r(n,e);i&&t.push(i)}return t.length?n.update({effects:t,annotations:Zg.of(!0)}):null}function t0(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=e0(n.state,e);t?n.dispatch(t):n.update([])}},10)}Rt.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),t0(n)};Rt.blur=n=>{n.observer.clearSelectionRange(),t0(n)};Rt.compositionstart=Rt.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};Rt.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,U.chrome&&U.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};Rt.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};zt.beforeinput=(n,e)=>{var t,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let s=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let a=o[0],l=n.posAtDOM(a.startContainer,a.startOffset),c=n.posAtDOM(a.endContainer,a.endOffset);return $h(n,{from:l,to:c,insert:n.state.toText(s)},null),!0}}let i;if(U.chrome&&U.android&&(i=qg.find(s=>s.inputType==e.inputType))&&(n.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((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)>s+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return U.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),U.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>Rt.compositionend(n,e),20),!1};const Hu=new Set;function nk(n){Hu.has(n)||(Hu.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const Wu=["pre-wrap","normal","pre-line","break-spaces"];let Vr=!1;function Uu(){Vr=!1}class rk{constructor(e){this.lineWrapping=e,this.doc=xe.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let r=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((t-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 Wu.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let r=0;r<e.length;r++){let i=e[r];i<0?r++:this.heightSamples[Math.floor(i*10)]||(t=!0,this.heightSamples[Math.floor(i*10)]=!0)}return t}refresh(e,t,r,i,s,o){let a=Wu.indexOf(e)>-1,l=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=t,this.charWidth=r,this.textHeight=i,this.lineLength=s,l){this.heightSamples={};for(let c=0;c<o.length;c++){let h=o[c];h<0?c++:this.heightSamples[Math.floor(h*10)]=!0}}return l}}class ik{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class Bt{constructor(e,t,r,i,s){this.from=e,this.length=t,this.top=r,this.height=i,this._content=s}get type(){return typeof this._content=="number"?Je.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 or?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Bt(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Ne=function(n){return n[n.ByPos=0]="ByPos",n[n.ByHeight=1]="ByHeight",n[n.ByPosNoHeight=2]="ByPosNoHeight",n}(Ne||(Ne={}));const qo=.001;class ot{constructor(e,t,r=2){this.length=e,this.height=t,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)>qo&&(Vr=!0),this.height=e)}replace(e,t,r){return ot.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,r,i){let s=this,o=r.doc;for(let a=i.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:h,toB:u}=i[a],f=s.lineAt(l,Ne.ByPosNoHeight,r.setDoc(t),0,0),p=f.to>=c?f:s.lineAt(c,Ne.ByPosNoHeight,r,0,0);for(u+=p.to-c,c=p.to;a>0&&f.from<=i[a-1].toA;)l=i[a-1].fromA,h=i[a-1].fromB,a--,l<f.from&&(f=s.lineAt(l,Ne.ByPosNoHeight,r,0,0));h+=f.from-l,l=f.from;let m=Bh.build(r.setDoc(o),e,h,u);s=da(s,s.replace(l,c,m))}return s.updateHeight(r,0)}static empty(){return new xt(0,0,0)}static of(e){if(e.length==1)return e[0];let t=0,r=e.length,i=0,s=0;for(;;)if(t==r)if(i>s*2){let a=e[t-1];a.break?e.splice(--t,1,a.left,null,a.right):e.splice(--t,1,a.left,a.right),r+=1+a.break,i-=a.size}else if(s>i*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,s-=a.size}else break;else if(i<s){let a=e[t++];a&&(i+=a.size)}else{let a=e[--r];a&&(s+=a.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,r++),new ok(ot.of(e.slice(0,t)),o,ot.of(e.slice(r)))}}function da(n,e){return n==e?n:(n.constructor!=e.constructor&&(Vr=!0),e)}ot.prototype.size=1;const sk=ne.replace({});class n0 extends ot{constructor(e,t,r){super(e,t),this.deco=r,this.spaceAbove=0}mainBlock(e,t){return new Bt(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,r,i){return this.spaceAbove&&e<r+this.spaceAbove?new Bt(i,0,r,this.spaceAbove,sk):this.mainBlock(r,i)}lineAt(e,t,r,i,s){let o=this.mainBlock(i,s);return this.spaceAbove?this.blockAt(0,r,i,s).join(o):o}forEachLine(e,t,r,i,s,o){e<=s+this.length&&t>=s&&o(this.lineAt(0,Ne.ByPos,r,i,s))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,r=!1,i){return i&&i.from<=t&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class xt extends n0{constructor(e,t,r){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,t){return new Bt(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,r){let i=r[0];return r.length==1&&(i instanceof xt||i instanceof Ge&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Ge?i=new xt(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):ot.of(r)}updateHeight(e,t=0,r=!1,i){return i&&i.from<=t&&i.more?this.setMeasuredHeight(i):(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 Ge extends ot{constructor(e){super(e,0)}heightMetrics(e,t){let r=e.doc.lineAt(t).number,i=e.doc.lineAt(t+this.length).number,s=i-r+1,o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*s);o=l/s,this.length>s+1&&(a=(this.height-l)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:i,perLine:o,perChar:a}}blockAt(e,t,r,i){let{firstLine:s,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(t,i);if(t.lineWrapping){let c=i+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),h=t.doc.lineAt(c),u=a+h.length*l,f=Math.max(r,e-u/2);return new Bt(h.from,h.length,f,u,0)}else{let c=Math.max(0,Math.min(o-s,Math.floor((e-r)/a))),{from:h,length:u}=t.doc.line(s+c);return new Bt(h,u,r+a*c,a,0)}}lineAt(e,t,r,i,s){if(t==Ne.ByHeight)return this.blockAt(e,r,i,s);if(t==Ne.ByPosNoHeight){let{from:p,to:m}=r.doc.lineAt(e);return new Bt(p,m-p,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(r,s),c=r.doc.lineAt(e),h=a+c.length*l,u=c.number-o,f=i+a*u+l*(c.from-s-u);return new Bt(c.from,c.length,Math.max(i,Math.min(f,i+this.height-h)),h,0)}forEachLine(e,t,r,i,s,o){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(r,s);for(let h=e,u=i;h<=t;){let f=r.doc.lineAt(h);if(h==e){let m=f.number-a;u+=l*m+c*(e-s-m)}let p=l+c*f.length;o(new Bt(f.from,f.length,u,p,0)),u+=p,h=f.to+1}}replace(e,t,r){let i=this.length-t;if(i>0){let s=r[r.length-1];s instanceof Ge?r[r.length-1]=new Ge(s.length+i):r.push(null,new Ge(i-1))}if(e>0){let s=r[0];s instanceof Ge?r[0]=new Ge(e+s.length):r.unshift(new Ge(e-1),null)}return ot.of(r)}decomposeLeft(e,t){t.push(new Ge(e-1),null)}decomposeRight(e,t){t.push(null,new Ge(this.length-e-1))}updateHeight(e,t=0,r=!1,i){let s=t+this.length;if(i&&i.from<=t+this.length&&i.more){let o=[],a=Math.max(t,i.from),l=-1;for(i.from>t&&o.push(new Ge(i.from-t-1).updateHeight(e,t));a<=s&&i.more;){let h=e.doc.lineAt(a).length;o.length&&o.push(null);let u=i.heights[i.index++],f=0;u<0&&(f=-u,u=i.heights[i.index++]),l==-1?l=u:Math.abs(u-l)>=qo&&(l=-2);let p=new xt(h,u,f);p.outdated=!1,o.push(p),a+=h+1}a<=s&&o.push(null,new Ge(s-a).updateHeight(e,a));let c=ot.of(o);return(l<0||Math.abs(c.height-this.height)>=qo||Math.abs(l-this.heightMetrics(e,t).perLine)>=qo)&&(Vr=!0),da(this,c)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class ok extends ot{constructor(e,t,r){super(e.length+t+r.length,e.height+r.height,t|(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,t,r,i){let s=r+this.left.height;return e<s?this.left.blockAt(e,t,r,i):this.right.blockAt(e,t,s,i+this.left.length+this.break)}lineAt(e,t,r,i,s){let o=i+this.left.height,a=s+this.left.length+this.break,l=t==Ne.ByHeight?e<o:e<a,c=l?this.left.lineAt(e,t,r,i,s):this.right.lineAt(e,t,r,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let h=t==Ne.ByPosNoHeight?Ne.ByPosNoHeight:Ne.ByPos;return l?c.join(this.right.lineAt(a,h,r,o,a)):this.left.lineAt(a,h,r,i,s).join(c)}forEachLine(e,t,r,i,s,o){let a=i+this.left.height,l=s+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,t,r,i,s,o),t>=l&&this.right.forEachLine(e,t,r,a,l,o);else{let c=this.lineAt(l,Ne.ByPos,r,i,s);e<c.from&&this.left.forEachLine(e,c.from-1,r,i,s,o),c.to>=e&&c.from<=t&&o(c),t>c.to&&this.right.forEachLine(c.to+1,t,r,a,l,o)}}replace(e,t,r){let i=this.left.length+this.break;if(t<i)return this.balanced(this.left.replace(e,t,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,r));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let a of r)s.push(a);if(e>0&&Ku(s,o-1),t<this.length){let a=s.length;this.decomposeRight(t,s),Ku(s,a)}return ot.of(s)}decomposeLeft(e,t){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(r++,e>=r&&t.push(null)),e>r&&this.right.decomposeLeft(e-r,t)}decomposeRight(e,t){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e<r&&this.left.decomposeRight(e,t),this.break&&e<i&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?ot.of(this.break?[e,null,t]:[e,t]):(this.left=da(this.left,e),this.right=da(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,r=!1,i){let{left:s,right:o}=this,a=t+s.length+this.break,l=null;return i&&i.from<=t+s.length&&i.more?l=s=s.updateHeight(e,t,r,i):s.updateHeight(e,t,r),i&&i.from<=a+o.length&&i.more?l=o=o.updateHeight(e,a,r,i):o.updateHeight(e,a,r),l?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Ku(n,e){let t,r;n[e]==null&&(t=n[e-1])instanceof Ge&&(r=n[e+1])instanceof Ge&&n.splice(e-1,3,new Ge(t.length+1+r.length))}const ak=5;class Bh{constructor(e,t){this.pos=e,this.oracle=t,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,t){if(this.lineStart>-1){let r=Math.min(t,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof xt?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new xt(r-this.pos,-1,0)),this.writtenTo=r,t>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,r){if(e<t||r.heightRelevant){let i=r.widget?r.widget.estimatedHeight:0,s=r.widget?r.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let o=t-e;r.block?this.addBlock(new n0(o,i,r)):(o||s||i>=ak)&&this.addLineDeco(i,s,o)}else t>e&&this.span(e,t);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:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,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 xt(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let r=new Ge(t-e);return this.oracle.doc.lineAt(e).to==t&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof xt)return e;let t=new xt(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+r}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof xt)&&!this.isCovered?this.nodes.push(new xt(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let i of this.nodes)i instanceof xt&&i.updateHeight(this.oracle,r),r+=i?i.length:1;return this.nodes}static build(e,t,r,i){let s=new Bh(r,e);return pe.spans(t,r,i,s,0),s.finish(r)}}function lk(n,e,t){let r=new ck;return pe.compare(n,e,t,r,0),r.changes}class ck{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,r,i){(e<t||r&&r.heightRelevant||i&&i.heightRelevant)&&Mr(e,t,this.changes,5)}}function hk(n,e){let t=n.getBoundingClientRect(),r=n.ownerDocument,i=r.defaultView||window,s=Math.max(0,t.left),o=Math.min(i.innerWidth,t.right),a=Math.max(0,t.top),l=Math.min(i.innerHeight,t.bottom);for(let c=n.parentNode;c&&c!=r.body;)if(c.nodeType==1){let h=c,u=window.getComputedStyle(h);if((h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&u.overflow!="visible"){let f=h.getBoundingClientRect();s=Math.max(s,f.left),o=Math.min(o,f.right),a=Math.max(a,f.top),l=Math.min(c==n.parentNode?i.innerHeight:l,f.bottom)}c=u.position=="absolute"||u.position=="fixed"?h.offsetParent:h.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:s-t.left,right:Math.max(s,o)-t.left,top:a-(t.top+e),bottom:Math.max(a,l)-(t.top+e)}}function dk(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function uk(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class xl{constructor(e,t,r,i){this.from=e,this.to=t,this.size=r,this.displaySize=i}static same(e,t){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],s=t[r];if(i.from!=s.from||i.to!=s.to||i.size!=s.size)return!1}return!0}draw(e,t){return ne.replace({widget:new fk(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class fk extends hn{constructor(e,t){super(),this.size=e,this.vertical=t}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 Gu{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=qu,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Pe.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Lh).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new rk(t),this.stateDeco=e.facet(Wi).filter(r=>typeof r!="function"),this.heightMap=ot.empty().applyChanges(this.stateDeco,xe.empty,this.heightOracle.setDoc(e.doc),[new At(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=ne.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let r=0;r<=1;r++){let i=r?t.head:t.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new wo(s,o))}}return this.viewports=e.sort((r,i)=>r.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?qu:new Fh(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(vi(e,this.scaler))})}update(e,t=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Wi).filter(h=>typeof h!="function");let i=e.changedRanges,s=At.extendWithRanges(i,lk(r,this.stateDeco,e?e.changes:ze.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Uu(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||Vr)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let l=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<l.from||t.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let c=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(c||!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),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Eg)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,r=window.getComputedStyle(t),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Pe.RTL:Pe.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),a=t.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,h=0;if(a.width&&a.height){let{scaleX:j,scaleY:k}=gg(t,a);(j>.005&&Math.abs(this.scaleX-j)>.005||k>.005&&Math.abs(this.scaleY-k)>.005)&&(this.scaleX=j,this.scaleY=k,c|=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,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let p=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=p&&(this.scrollAnchorHeight=-1,this.scrollTop=p),this.scrolledToBottom=yg(e.scrollDOM);let m=(this.printing?uk:hk)(t,this.paddingTop),b=m.top-this.pixelViewport.top,y=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(v!=this.inView&&(this.inView=v,v&&(l=!0)),!this.inView&&!this.scrollTarget&&!dk(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,c|=16),l){let j=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(j)&&(o=!0),o||i.lineWrapping&&Math.abs(w-this.contentDOMWidth)>i.charWidth){let{lineHeight:k,charWidth:O,textHeight:x}=e.docView.measureTextSize();o=k>0&&i.refresh(s,k,O,x,Math.max(5,w/O),j),o&&(e.docView.minWidth=0,c|=16)}b>0&&y>0?h=Math.max(b,y):b<0&&y<0&&(h=Math.min(b,y)),Uu();for(let k of this.viewports){let O=k.from==this.viewport.from?j:e.docView.measureVisibleLineHeights(k);this.heightMap=(o?ot.empty().applyChanges(this.stateDeco,xe.empty,this.heightOracle,[new At(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new ik(k.from,O))}Vr&&(c|=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&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),c|=this.updateForViewport()),(c&2||C)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new wo(i.lineAt(o-r*1e3,Ne.ByHeight,s,0,0).from,i.lineAt(a+(1-r)*1e3,Ne.ByHeight,s,0,0).to);if(t){let{head:c}=t.range;if(c<l.from||c>l.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),u=i.lineAt(c,Ne.ByPos,s,0,0),f;t.y=="center"?f=(u.top+u.bottom)/2-h/2:t.y=="start"||t.y=="nearest"&&c<l.from?f=u.top:f=u.bottom-h,l=new wo(i.lineAt(f-1e3/2,Ne.ByHeight,s,0,0).from,i.lineAt(f+h+1e3/2,Ne.ByHeight,s,0,0).to)}}return l}mapViewport(e,t){let r=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new wo(this.heightMap.lineAt(r,Ne.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,Ne.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},r=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,Ne.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,Ne.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||i<=o-Math.max(10,Math.min(-r,250)))&&(t==this.state.doc.length||s>=a+Math.max(10,Math.min(r,250)))&&i>o-2*1e3&&s<a+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let r=[];for(let i of e)t.touchesRange(i.from,i.to)||r.push(new xl(t.mapPos(i.from),t.mapPos(i.to),i.size,i.displaySize));return r}ensureLineGaps(e,t){let r=this.heightOracle.lineWrapping,i=r?1e4:2e3,s=i>>1,o=i<<1;if(this.defaultTextDirection!=Pe.LTR&&!r)return[];let a=[],l=(h,u,f,p)=>{if(u-h<s)return;let m=this.state.selection.main,b=[m.from];m.empty||b.push(m.to);for(let v of b)if(v>h&&v<u){l(h,v-10,f,p),l(v+10,u,f,p);return}let y=mk(e,v=>v.from>=f.from&&v.to<=f.to&&Math.abs(v.from-h)<s&&Math.abs(v.to-u)<s&&!b.some(w=>v.from<w&&v.to>w));if(!y){if(u<f.to&&t&&r&&t.visibleRanges.some(C=>C.from<=u&&C.to>=u)){let C=t.moveToLineBoundary(E.cursor(u),!1,!0).head;C>h&&(u=C)}let v=this.gapSize(f,h,u,p),w=r||v<2e6?v:2e6;y=new xl(h,u,v,w)}a.push(y)},c=h=>{if(h.length<o||h.type!=Je.Text)return;let u=pk(h.from,h.to,this.stateDeco);if(u.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,p,m;if(r){let b=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,y,v;if(f!=null){let w=So(u,f),C=((this.visibleBottom-this.visibleTop)/2+b)/h.height;y=w-C,v=w+C}else y=(this.visibleTop-h.top-b)/h.height,v=(this.visibleBottom-h.top+b)/h.height;p=ko(u,y),m=ko(u,v)}else{let b=u.total*this.heightOracle.charWidth,y=i*this.heightOracle.charWidth,v=0;if(b>2e6)for(let O of e)O.from>=h.from&&O.from<h.to&&O.size!=O.displaySize&&O.from*this.heightOracle.charWidth+v<this.pixelViewport.left&&(v=O.size-O.displaySize);let w=this.pixelViewport.left+v,C=this.pixelViewport.right+v,j,k;if(f!=null){let O=So(u,f),x=((C-w)/2+y)/b;j=O-x,k=O+x}else j=(w-y)/b,k=(C+y)/b;p=ko(u,j),m=ko(u,k)}p>h.from&&l(h.from,p,h,u),m<h.to&&l(m,h.to,h,u)};for(let h of this.viewportLines)Array.isArray(h.type)?h.type.forEach(c):c(h);return a}gapSize(e,t,r,i){let s=So(i,r)-So(i,t);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){xl.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ne.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let r=[];pe.spans(t,this.viewport.from,this.viewport.to,{span(s,o){r.push({from:s,to:o})},point(){}},20);let i=0;if(r.length!=this.visibleRanges.length)i=12;else for(let s=0;s<r.length&&!(i&8);s++){let o=this.visibleRanges[s],a=r[s];(o.from!=a.from||o.to!=a.to)&&(i|=4,e&&e.mapPos(o.from,-1)==a.from&&e.mapPos(o.to,1)==a.to||(i|=8))}return this.visibleRanges=r,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||vi(this.heightMap.lineAt(e,Ne.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(t=>t.top<=e&&t.bottom>=e)||vi(this.heightMap.lineAt(this.scaler.fromDOM(e),Ne.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return vi(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 wo{constructor(e,t){this.from=e,this.to=t}}function pk(n,e,t){let r=[],i=n,s=0;return pe.spans(t,n,e,{span(){},point(o,a){o>i&&(r.push({from:i,to:o}),s+=o-i),i=a}},20),i<e&&(r.push({from:i,to:e}),s+=e-i),{total:s,ranges:r}}function ko({total:n,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let r=Math.floor(n*t);for(let i=0;;i++){let{from:s,to:o}=e[i],a=o-s;if(r<=a)return s+r;r-=a}}function So(n,e){let t=0;for(let{from:r,to:i}of n.ranges){if(e<=i){t+=e-r;break}t+=i-r}return t/n.total}function mk(n,e){for(let t of n)if(e(t))return t}const qu={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};class Fh{constructor(e,t,r){let i=0,s=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let c=t.lineAt(a,Ne.ByPos,e,0,0).top,h=t.lineAt(l,Ne.ByPos,e,0,0).bottom;return i+=h-c,{from:a,to:l,top:c,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(t.height-i);for(let a of this.viewports)a.domTop=o+(a.top-s)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),s=a.bottom}toDOM(e){for(let t=0,r=0,i=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.top)return i+(e-r)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);r=s.bottom,i=s.domBottom}}fromDOM(e){for(let t=0,r=0,i=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.domTop)return r+(e-i)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);r=s.bottom,i=s.domBottom}}eq(e){return e instanceof Fh?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,r)=>t.from==e.viewports[r].from&&t.to==e.viewports[r].to):!1}}function vi(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),r=e.toDOM(n.bottom);return new Bt(n.from,n.length,t,r-t,Array.isArray(n._content)?n._content.map(i=>vi(i,e)):n._content)}const Co=K.define({combine:n=>n.join(" ")}),Wc=K.define({combine:n=>n.indexOf(!0)>-1}),Uc=In.newName(),r0=In.newName(),i0=In.newName(),s0={"&light":"."+r0,"&dark":"."+i0};function Kc(n,e,t){return new In(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return n;if(!t||!t[i])throw new RangeError(`Unsupported selector: ${i}`);return t[i]}):n+" "+r}})}const gk=Kc("."+Uc,{"&":{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"}},s0),bk={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},vl=U.ie&&U.ie_version<=11;class yk{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new J2,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(t=>{for(let r of t)this.queue.push(r);(U.ie&&U.ie_version<=11||U.ios&&e.composing)&&t.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&U.android&&e.constructor.EDIT_CONTEXT!==!1&&!(U.chrome&&U.chrome_version<126)&&(this.editContext=new vk(e),e.state.facet(gn)&&(e.contentDOM.editContext=this.editContext.editContext)),vl&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.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 t;((t=this.view.docView)===null||t===void 0?void 0:t.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(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.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(t=>{t.length>0&&t[t.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((t,r)=>t!=e[r]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,i=this.selectionRange;if(r.state.facet(gn)?r.root.activeElement!=this.dom:!Go(this.dom,i))return;let s=i.anchorNode&&r.docView.tile.nearest(i.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(U.ie&&U.ie_version<=11||U.android&&U.chrome)&&!r.state.selection.main.empty&&i.focusNode&&Pi(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=zi(e.root);if(!t)return!1;let r=U.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&xk(this.view,t)||t;if(!r||this.selectionRange.eq(r))return!1;let i=Go(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Q2(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let r=this.dom;r;)if(r.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=t)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,bk),vl&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),vl&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var r;if(!this.delayedAndroidKey){let i=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&Tr(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,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 t=-1,r=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),t==-1?{from:t,to:r}=o:(t=Math.min(o.from,t),r=Math.max(o.to,r)))}return{from:t,to:r,typeOver:i}}readChange(){let{from:e,to:t,typeOver:r}=this.processRecords(),i=this.selectionChanged&&Go(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new $w(this.view,e,t,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let r=this.view.state,i=Kg(this.view,t);return this.view.state==r&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),i}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let r=Ju(t,e.previousSibling||e.target.previousSibling,-1),i=Ju(t,e.nextSibling||e.target.nextSibling,1);return{from:r?t.posAfter(r):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.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(gn)!=e.state.facet(gn)&&(e.view.contentDOM.editContext=e.state.facet(gn)?this.editContext.editContext:null))}destroy(){var e,t,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let i of this.scrollTargets)i.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 Ju(n,e,t){for(;e;){let r=Ve.get(e);if(r&&r.parent==n)return r;let i=e.parentNode;e=i!=n.dom?i:t>0?e.nextSibling:e.previousSibling}return null}function Yu(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor,1);return Pi(o.node,o.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}function xk(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Yu(n,i)}let t=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",r,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",r,!0),t?Yu(n,t):null}class vk{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=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 i=e.state.selection.main,{anchor:s,head:o}=i,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 c=l-a>r.text.length;a==this.from&&s<this.from?a=s:l==this.to&&s>this.to&&(l=s);let h=Gg(e.state.sliceDoc(a,l),r.text,(c?i.from:i.to)-a,c?"end":null);if(!h){let f=E.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));f.main.eq(i)||e.dispatch({selection:f,userEvent:"select"});return}let u={from:h.from+a,to:h.toA+a,insert:xe.of(r.text.slice(h.from,h.toB).split(`
61
- `))};if((U.mac||U.android)&&u.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(u={from:a,to:l,insert:xe.of([r.text.replace("."," ")])}),this.pendingContextChange=u,!e.state.readOnly){let f=this.to-this.from+(u.to-u.from+u.insert.length);$h(e,u,E.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(t.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(t.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let l=e.coordsForChar(o);s=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||s||new DOMRect,i.push(s)}t.updateCharacterBounds(r.rangeStart,i)},this.handlers.textformatupdate=r=>{let i=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,a=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(s.rangeStart),c=this.toEditorPos(s.rangeEnd);if(l<c){let h=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;i.push(ne.mark({attributes:{style:h}}).range(l,c))}}}e.dispatch({effects:Lg.of(ne.set(i))})},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)t.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let i=zi(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,r=!1,i=this.pendingContextChange;return e.changes.iterChanges((s,o,a,l,c)=>{if(r)return;let h=c.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(c)){i=this.pendingContextChange=null,t+=h,this.to+=h;return}else i=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=h,this.to+=h;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),c.toString()),this.to+=h}t+=h}),i&&!r&&this.revertPending(e.state),!r}update(e){let t=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.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||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+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 t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class H{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 t;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&&(i=>i.forEach(s=>r(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Y2(e.parent)||document,this.viewState=new Gu(e.state||me.create(e)),e.scrollTo&&e.scrollTo.is(yo)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(wr).map(i=>new pl(i));for(let i of this.plugins)i.update(this);this.observer=new yk(this),this.inputState=new zw(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Eu(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=e.length==1&&e[0]instanceof He?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,r=!1,i,s=this.state;for(let f of e){if(f.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=f.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,a=0,l=null;e.some(f=>f.annotation(Zg))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=e0(s,o),l||(a=1));let c=this.observer.delayedAndroidKey,h=null;if(c?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(h=null)):this.observer.clear(),s.facet(me.phrases)!=this.state.facet(me.phrases))return this.setState(s);i=la.create(this,s,e),i.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 Dr(p.empty?p:E.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of f.effects)p.is(yo)&&(u=p.value.clip(this.state))}this.viewState.update(i,u),this.bidiCache=ua.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),t=this.docView.update(i),this.state.facet(yi)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Co)!=i.state.facet(Co)&&(this.viewState.mustMeasureContent=!0),(t||r||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!i.empty)for(let f of this.state.facet(Fc))try{f(i)}catch(p){ut(this.state,p,"update listener")}(l||h)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),h&&!Kg(this,h)&&c.force&&Tr(this.contentDOM,c.key,c.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 t=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new Gu(e),this.plugins=e.facet(wr).map(r=>new pl(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new Eu(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(wr),r=e.state.facet(wr);if(t!=r){let i=[];for(let s of r){let o=t.indexOf(s);if(o<0)i.push(new pl(s));else{let a=this.plugins[o];a.mustUpdate=e,i.push(a)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);t!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(r){ut(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 t=null,r=this.scrollDOM,i=r.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(yg(r))s=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(i);s=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 c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let h=c.map(p=>{try{return p.read(this)}catch(m){return ut(this.state,m),Qu}}),u=la.create(this,this.state,[]),f=!1;u.flags|=l,t?t.flags|=l:t=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<c.length;p++)if(h[p]!=Qu)try{let m=c[p];m.write&&m.write(h[p],this)}catch(m){ut(this.state,m)}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 m=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o;if(m>1||m<-1){i=i+m,r.scrollTop=i/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let a of this.state.facet(Fc))a(t)}get themeClasses(){return Uc+" "+(this.state.facet(Wc)?i0:r0)+" "+this.state.facet(Co)}updateAttrs(){let e=Xu(this,Ig,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(gn)?"true":"false",class:"cm-content",style:`${U.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Xu(this,Lh,t);let r=this.observer.ignore(()=>{let i=Pu(this.contentDOM,this.contentAttrs,t),s=Pu(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=t,r}showAnnouncements(e){let t=!0;for(let r of e)for(let i of r.effects)if(i.is(H.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(yi);let e=this.state.facet(H.cspNonce);In.mount(this.root,this.styleModules.concat(gk).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 t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(r=>r.plugin==e)||null),t&&t.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,t,r){return yl(this,e,Ru(this,e,t,r))}moveByGroup(e,t){return yl(this,e,Ru(this,e,t,r=>Dw(this,e.head,r)))}visualLineSide(e,t){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),s=r[t?r.length-1:0];return E.cursor(s.side(t,i)+e.from,s.forward(!t,i)?1:-1)}moveToLineBoundary(e,t,r=!0){return Tw(this,e,t,r)}moveVertically(e,t,r){return yl(this,e,Ew(this,e,t,r))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let r=_c(this,e,t);return r&&r.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),_c(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let r=this.docView.coordsAt(e,t);if(!r||r.left==r.right)return r;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),o=s[bn.find(s,e-i.from,-1,t)];return _i(r,o.dir==Pe.LTR==t>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(Dg)||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>wk)return Cg(e.length);let t=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||Sg(s.isolates,r=Mu(this,e))))return s.order;r||(r=Mu(this,e));let i=iw(e.text,t,r);return this.bidiCache.push(new ua(e.from,e.to,t,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||U.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{bg(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,t={}){return yo.of(new Dr(typeof e=="number"?E.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return yo.of(new Dr(E.cursor(r.from),"start","start",r.top-e,t,!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 Fe.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Fe.define(()=>({}),{eventObservers:e})}static theme(e,t){let r=In.newName(),i=[Co.of(r),yi.of(Kc(`.${r}`,e))];return t&&t.dark&&i.push(Wc.of(!0)),i}static baseTheme(e){return dr.lowest(yi.of(Kc("."+Uc,e,s0)))}static findFromDOM(e){var t;let r=e.querySelector(".cm-content"),i=r&&Ve.get(r)||Ve.get(e);return((t=i?.root)===null||t===void 0?void 0:t.view)||null}}H.styleModule=yi;H.inputHandler=Mg;H.clipboardInputFilter=Eh;H.clipboardOutputFilter=Rh;H.scrollHandler=Rg;H.focusChangeEffect=Tg;H.perLineTextDirection=Dg;H.exceptionSink=Ag;H.updateListener=Fc;H.editable=gn;H.mouseSelectionStyle=Ng;H.dragMovesSelection=Pg;H.clickAddsSelectionRange=Og;H.decorations=Wi;H.blockWrappers=$g;H.outerDecorations=Bg;H.atomicRanges=_s;H.bidiIsolatedRanges=Fg;H.scrollMargins=Vg;H.darkTheme=Wc;H.cspNonce=K.define({combine:n=>n.length?n[0]:""});H.contentAttributes=Lh;H.editorAttributes=Ig;H.lineWrapping=H.contentAttributes.of({class:"cm-lineWrapping"});H.announce=ae.define();const wk=4096,Qu={};class ua{constructor(e,t,r,i,s,o){this.from=e,this.to=t,this.dir=r,this.isolates=i,this.fresh=s,this.order=o}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:Pe.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==i&&!t.touchesRange(o.from,o.to)&&r.push(new ua(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function Xu(n,e,t){for(let r=n.state.facet(e),i=r.length-1;i>=0;i--){let s=r[i],o=typeof s=="function"?s(n):s;o&&Mh(o,t)}return t}const kk=U.mac?"mac":U.windows?"win":U.linux?"linux":"key";function Sk(n,e){const t=n.split(/-(?!$)/);let r=t[t.length-1];r=="Space"&&(r=" ");let i,s,o,a;for(let l=0;l<t.length-1;++l){const c=t[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))i=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))e=="mac"?a=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return i&&(r="Alt-"+r),s&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function jo(n,e,t){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t!==!1&&e.shiftKey&&(n="Shift-"+n),n}const Ck=dr.default(H.domEventHandlers({keydown(n,e){return a0(o0(e.state),n,e,"editor")}})),Ba=K.define({enables:Ck}),Zu=new WeakMap;function o0(n){let e=n.facet(Ba),t=Zu.get(e);return t||Zu.set(e,t=Pk(e.reduce((r,i)=>r.concat(i),[]))),t}function jk(n,e,t){return a0(o0(n.state),e,n,t)}let Nn=null;const Ok=4e3;function Pk(n,e=kk){let t=Object.create(null),r=Object.create(null),i=(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")},s=(o,a,l,c,h)=>{var u,f;let p=t[o]||(t[o]=Object.create(null)),m=a.split(/ (?!$)/).map(v=>Sk(v,e));for(let v=1;v<m.length;v++){let w=m.slice(0,v).join(" ");i(w,!0),p[w]||(p[w]={preventDefault:!0,stopPropagation:!1,run:[C=>{let j=Nn={view:C,prefix:w,scope:o};return setTimeout(()=>{Nn==j&&(Nn=null)},Ok),!0}]})}let b=m.join(" ");i(b,!1);let y=p[b]||(p[b]={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&&y.run.push(l),c&&(y.preventDefault=!0),h&&(y.stopPropagation=!0)};for(let o of n){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let h=t[c]||(t[c]=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,Gc))}let l=o[e]||o.key;if(l)for(let c of a)s(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return t}let Gc=null;function a0(n,e,t,r){Gc=e;let i=z2(e),s=ct(i,0),o=Zt(s)==i.length&&i!=" ",a="",l=!1,c=!1,h=!1;Nn&&Nn.view==t&&Nn.scope==r&&(a=Nn.prefix+" ",Jg.indexOf(e.keyCode)<0&&(c=!0,Nn=null));let u=new Set,f=y=>{if(y){for(let v of y.run)if(!u.has(v)&&(u.add(v),v(t)))return y.stopPropagation&&(h=!0),!0;y.preventDefault&&(y.stopPropagation&&(h=!0),c=!0)}return!1},p=n[r],m,b;return p&&(f(p[a+jo(i,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(U.windows&&e.ctrlKey&&e.altKey)&&!(U.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(m=$n[e.keyCode])&&m!=i?(f(p[a+jo(m,e,!0)])||e.shiftKey&&(b=Fi[e.keyCode])!=i&&b!=m&&f(p[a+jo(b,e,!1)]))&&(l=!0):o&&e.shiftKey&&f(p[a+jo(i,e,!0)])&&(l=!0),!l&&f(p._any)&&(l=!0)),c&&(l=!0),l&&h&&e.stopPropagation(),Gc=null,l}class Hs{constructor(e,t,r,i,s){this.className=e,this.left=t,this.top=r,this.width=i,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.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,t,r){if(r.empty){let i=e.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let s=l0(e);return[new Hs(t,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return Nk(e,t,r)}}function l0(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==Pe.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function ef(n,e,t,r){let i=n.coordsAtPos(e,t*2);if(!i)return r;let s=n.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,a=n.posAtCoords({x:s.left+1,y:o}),l=n.posAtCoords({x:s.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 Nk(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let r=Math.max(t.from,n.viewport.from),i=Math.min(t.to,n.viewport.to),s=n.textDirection==Pe.LTR,o=n.contentDOM,a=o.getBoundingClientRect(),l=l0(n),c=o.querySelector(".cm-line"),h=c&&window.getComputedStyle(c),u=a.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),f=a.right-(h?parseInt(h.paddingRight):0),p=zc(n,r,1),m=zc(n,i,-1),b=p.type==Je.Text?p:null,y=m.type==Je.Text?m:null;if(b&&(n.lineWrapping||p.widgetLineBreaks)&&(b=ef(n,r,1,b)),y&&(n.lineWrapping||m.widgetLineBreaks)&&(y=ef(n,i,-1,y)),b&&y&&b.from==y.from&&b.to==y.to)return w(C(t.from,t.to,b));{let k=b?C(t.from,null,b):j(p,!1),O=y?C(null,t.to,y):j(m,!0),x=[];return(b||p).to<(y||m).from-(b&&y?1:0)||p.widgetLineBreaks>1&&k.bottom+n.defaultLineHeight/2<O.top?x.push(v(u,k.bottom,f,O.top)):k.bottom<O.top&&n.elementAtHeight((k.bottom+O.top)/2).type==Je.Text&&(k.bottom=O.top=(k.bottom+O.top)/2),w(k).concat(x).concat(w(O))}function v(k,O,x,T){return new Hs(e,k-l.left,O-l.top,x-k,T-O)}function w({top:k,bottom:O,horizontal:x}){let T=[];for(let A=0;A<x.length;A+=2)T.push(v(x[A],k,x[A+1],O));return T}function C(k,O,x){let T=1e9,A=-1e9,R=[];function N(F,B,q,de,z){let J=n.coordsAtPos(F,F==x.to?-2:2),ie=n.coordsAtPos(q,q==x.from?2:-2);!J||!ie||(T=Math.min(J.top,ie.top,T),A=Math.max(J.bottom,ie.bottom,A),z==Pe.LTR?R.push(s&&B?u:J.left,s&&de?f:ie.right):R.push(!s&&de?u:ie.left,!s&&B?f:J.right))}let L=k??x.from,W=O??x.to;for(let F of n.visibleRanges)if(F.to>L&&F.from<W)for(let B=Math.max(F.from,L),q=Math.min(F.to,W);;){let de=n.state.doc.lineAt(B);for(let z of n.bidiSpans(de)){let J=z.from+de.from,ie=z.to+de.from;if(J>=q)break;ie>B&&N(Math.max(J,B),k==null&&J<=L,Math.min(ie,q),O==null&&ie>=W,z.dir)}if(B=de.to+1,B>=q)break}return R.length==0&&N(L,k==null,W,O==null,n.textDirection),{top:T,bottom:A,horizontal:R}}function j(k,O){let x=a.top+(O?k.top:k.bottom);return{top:x,bottom:x,horizontal:[]}}}function Ak(n,e){return n.constructor==e.constructor&&n.eq(e)}class Mk{constructor(e,t){this.view=e,this.layer=t,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"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(Jo)!=e.state.facet(Jo)&&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 t=0,r=e.facet(Jo);for(;t<r.length&&r[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((t,r)=>!Ak(t,this.drawn[r]))){let t=this.dom.firstChild,r=0;for(let i of e)i.update&&t&&i.constructor&&this.drawn[r].constructor&&i.update(t,this.drawn[r])?(t=t.nextSibling,r++):this.dom.insertBefore(i.draw(),t);for(;t;){let i=t.nextSibling;t.remove(),t=i}this.drawn=e,U.safari&&U.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 Jo=K.define();function c0(n){return[Fe.define(e=>new Mk(e,n)),Jo.of(n)]}const Ui=K.define({combine(n){return cn(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function Tk(n={}){return[Ui.of(n),Dk,Ek,Rk,Eg.of(!0)]}function h0(n){return n.startState.facet(Ui)!=n.state.facet(Ui)}const Dk=c0({above:!0,markers(n){let{state:e}=n,t=e.facet(Ui),r=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty||t.drawRangeCursor){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=i.empty?i:E.cursor(i.head,i.head>i.anchor?-1:1);for(let l of Hs.forRange(n,o,a))r.push(l)}}return r},update(n,e){n.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=h0(n);return t&&tf(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){tf(e.state,n)},class:"cm-cursorLayer"});function tf(n,e){e.style.animationDuration=n.facet(Ui).cursorBlinkRate+"ms"}const Ek=c0({above:!1,markers(n){return n.state.selection.ranges.map(e=>e.empty?[]:Hs.forRange(n,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||h0(n)},class:"cm-selectionLayer"}),Rk=dr.highest(H.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"}}}})),d0=ae.define({map(n,e){return n==null?null:e.mapPos(n)}}),wi=Ye.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,r)=>r.is(d0)?r.value:t,n)}}),Lk=Fe.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(wi);t==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"),(n.startState.field(wi)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field(wi),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let r=n.scrollDOM.getBoundingClientRect();return{left:t.left-r.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-r.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;n?(this.cursor.style.left=n.left/e+"px",this.cursor.style.top=n.top/t+"px",this.cursor.style.height=n.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(wi)!=n&&this.view.dispatch({effects:d0.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Ik(){return[wi,Lk]}function nf(n,e,t,r,i){e.lastIndex=0;for(let s=n.iterRange(t,r),o=t,a;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;a=e.exec(s.value);)i(o+a.index,a)}function $k(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let r=[];for(let{from:i,to:s}of t)i=Math.max(n.state.doc.lineAt(i).from,i-e),s=Math.min(n.state.doc.lineAt(s).to,s+e),r.length&&r[r.length-1].to>=i?r[r.length-1].to=s:r.push({from:i,to:s});return r}class Bk{constructor(e){const{regexp:t,decoration:r,decorate:i,boundary:s,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,i)this.addMatch=(a,l,c,h)=>i(h,c,c+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,c,h)=>{let u=r(a,l,c);u&&h(c,c+a[0].length,u)};else if(r)this.addMatch=(a,l,c,h)=>h(c,c+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let t=new yn,r=t.add.bind(t);for(let{from:i,to:s}of $k(e,this.maxLength))nf(e.state.doc,this.regexp,i,s,(o,a)=>this.addMatch(a,e,o,r));return t.finish()}updateDeco(e,t){let r=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,a,l)=>{l>=e.view.viewport.from&&a<=e.view.viewport.to&&(r=Math.min(a,r),i=Math.max(l,i))}),e.viewportMoved||i-r>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,t.map(e.changes),r,i):t}updateRange(e,t,r,i){for(let s of e.visibleRanges){let o=Math.max(s.from,r),a=Math.min(s.to,i);if(a>=o){let l=e.state.doc.lineAt(o),c=l.to<a?e.state.doc.lineAt(a):l,h=Math.max(s.from,l.from),u=Math.min(s.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){h=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){u=a;break}}let f=[],p,m=(b,y,v)=>f.push(v.range(b,y));if(l==c)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,m);else nf(e.state.doc,this.regexp,h,u,(b,y)=>this.addMatch(y,e,b,m));t=t.update({filterFrom:h,filterTo:u,filter:(b,y)=>b<h||y>u,add:f})}}return t}}const qc=/x/.unicode!=null?"gu":"g",Fk=new RegExp(`[\0-\b
62
- --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,qc),Vk={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 wl=null;function zk(){var n;if(wl==null&&typeof document<"u"&&document.body){let e=document.body.style;wl=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return wl||!1}const Yo=K.define({combine(n){let e=cn(n,{render:null,specialChars:Fk,addSpecialChars:null});return(e.replaceTabs=!zk())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,qc)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,qc)),e}});function _k(n={}){return[Yo.of(n),Hk()]}let rf=null;function Hk(){return rf||(rf=Fe.fromClass(class{constructor(n){this.view=n,this.decorations=ne.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(Yo)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new Bk({regexp:n.specialChars,decoration:(e,t,r)=>{let{doc:i}=t.state,s=ct(e[0],0);if(s==9){let o=i.lineAt(r),a=t.state.tabSize,l=Ur(o.text,a,r-o.from);return ne.replace({widget:new Gk((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=ne.replace({widget:new Kk(n,s)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(Yo);n.startState.facet(Yo)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const Wk="•";function Uk(n){return n>=32?Wk:n==10?"␤":String.fromCharCode(9216+n)}class Kk extends hn{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=Uk(this.code),r=e.state.phrase("Control character")+" "+(Vk[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,t);if(i)return i;let s=document.createElement("span");return s.textContent=t,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class Gk extends hn{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 qk(){return Yk}const Jk=ne.line({class:"cm-activeLine"}),Yk=Fe.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let r of n.state.selection.ranges){let i=n.lineBlockAt(r.head);i.from>e&&(t.push(Jk.range(i.from)),e=i.from)}return ne.set(t)}},{decorations:n=>n.decorations});class Qk extends hn{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Oi(e.firstChild):[];if(!t.length)return null;let r=window.getComputedStyle(e.parentNode),i=_i(t[0],r.direction!="rtl"),s=parseInt(r.lineHeight);return i.bottom-i.top>s*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+s}:i}ignoreEvent(){return!1}}function Xk(n){let e=Fe.fromClass(class{constructor(t){this.view=t,this.placeholder=n?ne.set([ne.widget({widget:new Qk(n),side:1}).range(0)]):ne.none}get decorations(){return this.view.state.doc.length?ne.none:this.placeholder}},{decorations:t=>t.decorations});return typeof n=="string"?[e,H.contentAttributes.of({"aria-placeholder":n})]:e}const Jc=2e3;function Zk(n,e,t){let r=Math.min(e.line,t.line),i=Math.max(e.line,t.line),s=[];if(e.off>Jc||t.off>Jc||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=r;l<=i;l++){let c=n.doc.line(l);c.length<=a&&s.push(E.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let l=r;l<=i;l++){let c=n.doc.line(l),h=Nc(c.text,o,n.tabSize,!0);if(h<0)s.push(E.cursor(c.to));else{let u=Nc(c.text,a,n.tabSize);s.push(E.range(c.from+h,c.from+u))}}}return s}function eS(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function sf(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),r=n.state.doc.lineAt(t),i=t-r.from,s=i>Jc?-1:i==r.length?eS(n,e.clientX):Ur(r.text,n.state.tabSize,t-r.from);return{line:r.number,col:s,off:i}}function tS(n,e){let t=sf(n,e),r=n.state.selection;return t?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(t.line).from),o=i.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},r=r.map(i.changes)}},get(i,s,o){let a=sf(n,i);if(!a)return r;let l=Zk(n.state,t,a);return l.length?o?E.create(l.concat(r.ranges)):E.create(l):r}}:null}function nS(n){let e=t=>t.altKey&&t.button==0;return H.mouseSelectionStyle.of((t,r)=>e(r)?tS(t,r):null)}const rS={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},iS={style:"cursor: crosshair"};function sS(n={}){let[e,t]=rS[n.key||"Alt"],r=Fe.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||t(i))},keyup(i){(i.keyCode==e||!t(i))&&this.set(!1)},mousemove(i){this.set(t(i))}}});return[r,H.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?iS:null})]}const Oo="-10000px";class u0{constructor(e,t,r,i){this.facet=t,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,t){var r;let i=e.state.facet(this.facet),s=i.filter(l=>l);if(i===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],a=t?[]:null;for(let l=0;l<s.length;l++){let c=s[l],h=-1;if(c){for(let u=0;u<this.tooltips.length;u++){let f=this.tooltips[u];f&&f.create==c.create&&(h=u)}if(h<0)o[l]=this.createTooltipView(c,l?o[l-1]:null),a&&(a[l]=!!c.above);else{let u=o[l]=this.tooltipViews[h];a&&(a[l]=t[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 t&&(a.forEach((l,c)=>t[c]=l),t.length=a.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function oS(n){let e=n.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const kl=K.define({combine:n=>{var e,t,r;return{position:U.ios?"absolute":((e=n.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(i=>i.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((r=n.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||oS}}}),of=new WeakMap,Vh=Fe.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(kl);this.position=e.position,this.parent=e.parent,this.classes=n.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 u0(n,zh,(t,r)=>this.createTooltip(t,r),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.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 n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,r=n.state.facet(kl);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;t=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),r=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",t.dom.appendChild(i)}return t.dom.style.position=this.position,t.dom.style.top=Oo,t.dom.style.left="0px",this.container.insertBefore(t.dom,r),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(n=r.destroy)===null||n===void 0||n.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(U.safari){let o=s.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else t=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(n=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=Ih(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(kl).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:t,space:r,scaleX:i,scaleY:s}=n,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:h}=c,u=n.pos[a],f=n.size[a];if(!u||l.clip!==!1&&(u.bottom<=Math.max(t.top,r.top)||u.top>=Math.min(t.bottom,r.bottom)||u.right<Math.max(t.left,r.left)-.1||u.left>Math.min(t.right,r.right)+.1)){h.style.top=Oo;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,m=p?7:0,b=f.right-f.left,y=(e=of.get(c))!==null&&e!==void 0?e:f.bottom-f.top,v=c.offset||lS,w=this.view.textDirection==Pe.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)+v.x,r.right-b)):Math.min(Math.max(r.left,u.left-b+(p?14:0)-v.x),r.right-b),j=this.above[a];!l.strictSide&&(j?u.top-y-m-v.y<r.top:u.bottom+y+m+v.y>r.bottom)&&j==r.bottom-u.bottom>u.top-r.top&&(j=this.above[a]=!j);let k=(j?u.top-r.top:r.bottom-u.bottom)-m;if(k<y&&c.resize!==!1){if(k<this.view.defaultLineHeight){h.style.top=Oo;continue}of.set(c,y),h.style.height=(y=k)/s+"px"}else h.style.height&&(h.style.height="");let O=j?u.top-y-m-v.y:u.bottom+m+v.y,x=C+b;if(c.overlap!==!0)for(let T of o)T.left<x&&T.right>C&&T.top<O+y&&T.bottom>O&&(O=j?T.top-y-2-m:T.bottom+m+2);if(this.position=="absolute"?(h.style.top=(O-n.parent.top)/s+"px",af(h,(C-n.parent.left)/i)):(h.style.top=O/s+"px",af(h,C/i)),p){let T=u.left+(w?v.x:-v.x)-(C+14-7);p.style.left=T/i+"px"}c.overlap!==!0&&o.push({left:C,top:O,right:x,bottom:O+y}),h.classList.toggle("cm-tooltip-above",j),h.classList.toggle("cm-tooltip-below",!j),c.positioned&&c.positioned(n.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 n of this.manager.tooltipViews)n.dom.style.top=Oo}},{eventObservers:{scroll(){this.maybeMeasure()}}});function af(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const aS=H.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"}}}),lS={x:0,y:0},zh=K.define({enables:[Vh,aS]}),fa=K.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class Fa{static create(e){return new Fa(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new u0(e,fa,(t,r)=>this.createHostedView(t,r),t=>t.dom.remove())}createHostedView(e,t){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let r of this.manager.tooltipViews){let i=r[e];if(i!==void 0){if(t===void 0)t=i;else if(t!==i)return}}return t}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 cS=zh.compute([fa],n=>{let e=n.facet(fa);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var r;return(r=t.end)!==null&&r!==void 0?r:t.pos})),create:Fa.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class hS{constructor(e,t,r,i,s){this.view=e,this.source=t,this.field=r,this.setHover=i,this.hoverTime=s,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:t}=this,r=e.docView.tile.nearest(t.target);if(!r)return;let i,s=1;if(r.isWidget())i=r.posAtStart;else{if(i=e.posAtCoords(t),i==null)return;let a=e.coordsAtPos(i);if(!a||t.y<a.top||t.y>a.bottom||t.x<a.left-e.defaultCharacterWidth||t.x>a.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(i)).find(h=>h.from<=i&&h.to>=i),c=l&&l.dir==Pe.RTL?-1:1;s=t.x<a.left?-c:c}let o=this.source(e,i,s);if(o?.then){let a=this.pending={pos:i};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=>ut(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(Vh),t=e?e.manager.tooltips.findIndex(r=>r.create==Fa.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,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:i,tooltip:s}=this;if(i.length&&s&&!dS(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,a=(r=(t=i[0])===null||t===void 0?void 0:t.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!uS(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:t}=this;if(t.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 t=r=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Po=4;function dS(n,e){let{left:t,right:r,top:i,bottom:s}=n.getBoundingClientRect(),o;if(o=n.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();i=Math.min(a.top,i),s=Math.max(a.bottom,s)}return e.clientX>=t-Po&&e.clientX<=r+Po&&e.clientY>=i-Po&&e.clientY<=s+Po}function uS(n,e,t,r,i,s){let o=n.scrollDOM.getBoundingClientRect(),a=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,a)<i)return!1;let l=n.posAtCoords({x:r,y:i},!1);return l>=e&&l<=t}function fS(n,e={}){let t=ae.define(),r=Ye.define({create(){return[]},update(i,s){if(i.length&&(e.hideOnChange&&(s.docChanged||s.selection)?i=[]:e.hideOn&&(i=i.filter(o=>!e.hideOn(s,o))),s.docChanged)){let o=[];for(let a of i){let l=s.changes.mapPos(a.pos,-1,st.TrackDel);if(l!=null){let c=Object.assign(Object.create(null),a);c.pos=l,c.end!=null&&(c.end=s.changes.mapPos(c.end)),o.push(c)}}i=o}for(let o of s.effects)o.is(t)&&(i=o.value),o.is(pS)&&(i=[]);return i},provide:i=>fa.from(i)});return{active:r,extension:[r,Fe.define(i=>new hS(i,n,r,t,e.hoverTime||300)),cS]}}function f0(n,e){let t=n.plugin(Vh);if(!t)return null;let r=t.manager.tooltips.indexOf(e);return r<0?null:t.manager.tooltipViews[r]}const pS=ae.define(),lf=K.define({combine(n){let e,t;for(let r of n)e=e||r.topContainer,t=t||r.bottomContainer;return{topContainer:e,bottomContainer:t}}});function Ki(n,e){let t=n.plugin(p0),r=t?t.specs.indexOf(e):-1;return r>-1?t.panels[r]:null}const p0=Fe.fromClass(class{constructor(n){this.input=n.state.facet(Gi),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(lf);this.top=new No(n,!0,e.topContainer),this.bottom=new No(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(lf);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new No(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new No(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Gi);if(t!=this.input){let r=t.filter(l=>l),i=[],s=[],o=[],a=[];for(let l of r){let c=this.specs.indexOf(l),h;c<0?(h=l(n.view),a.push(h)):(h=this.panels[c],h.update&&h.update(n)),i.push(h),(h.top?s:o).push(h)}this.specs=r,this.panels=i,this.top.sync(s),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(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>H.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class No{constructor(e,t,r){this.view=e,this.top=t,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.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 t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=cf(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=cf(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 cf(n){let e=n.nextSibling;return n.remove(),e}const Gi=K.define({enables:p0});class vn extends Ln{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}vn.prototype.elementClass="";vn.prototype.toDOM=void 0;vn.prototype.mapMode=st.TrackBefore;vn.prototype.startSide=vn.prototype.endSide=-1;vn.prototype.point=!0;const Qo=K.define(),mS=K.define(),gS={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>pe.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Ai=K.define();function bS(n){return[m0(),Ai.of({...gS,...n})]}const hf=K.define({combine:n=>n.some(e=>e)});function m0(n){return[yS]}const yS=Fe.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.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=n.state.facet(Ai).map(e=>new uf(n,e)),this.fixed=!n.state.facet(hf);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),n.scrollDOM.insertBefore(this.dom,n.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(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,r=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(r<(t.to-t.from)*.8)}if(n.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(hf)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=pe.iter(this.view.state.facet(Qo),this.view.viewport.from),r=[],i=this.gutters.map(s=>new xS(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let a of s.type)if(a.type==Je.Text&&o){Yc(t,r,a.from);for(let l of i)l.line(this.view,a,r);o=!1}else if(a.widget)for(let l of i)l.widget(this.view,a)}else if(s.type==Je.Text){Yc(t,r,s.from);for(let o of i)o.line(this.view,s,r)}else if(s.widget)for(let o of i)o.widget(this.view,s);for(let s of i)s.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(Ai),t=n.state.facet(Ai),r=n.docChanged||n.heightChanged||n.viewportChanged||!pe.eq(n.startState.facet(Qo),n.state.facet(Qo),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let i of this.gutters)i.update(n)&&(r=!0);else{r=!0;let i=[];for(let s of t){let o=e.indexOf(s);o<0?i.push(new uf(this.view,s)):(this.gutters[o].update(n),i.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),i.indexOf(s)<0&&s.destroy();for(let s of i)s.config.side=="after"?this.getDOMAfter().appendChild(s.dom):this.dom.appendChild(s.dom);this.gutters=i}return r}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>H.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let r=t.dom.offsetWidth*e.scaleX,i=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Pe.LTR?{left:r,right:i}:{right:r,left:i}})});function df(n){return Array.isArray(n)?n:[n]}function Yc(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class xS{constructor(e,t,r){this.gutter=e,this.height=r,this.i=0,this.cursor=pe.iter(e.markers,t.from)}addElement(e,t,r){let{gutter:i}=this,s=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==i.elements.length){let a=new g0(e,o,s,r);i.elements.push(a),i.dom.appendChild(a.dom)}else i.elements[this.i].update(e,o,s,r);this.height=t.bottom,this.i++}line(e,t,r){let i=[];Yc(this.cursor,i,t.from),r.length&&(i=i.concat(r));let s=this.gutter.config.lineMarker(e,t,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,i)}widget(e,t){let r=this.gutter.config.widgetMarker(e,t.widget,t),i=r?[r]:null;for(let s of e.state.facet(mS)){let o=s(e,t.widget,t);o&&(i||(i=[])).push(o)}i&&this.addElement(e,t,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class uf{constructor(e,t){this.view=e,this.config=t,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 t.domEventHandlers)this.dom.addEventListener(r,i=>{let s=i.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let l=s.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=i.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[r](e,a,i)&&i.preventDefault()});this.markers=df(t.markers(e)),t.initialSpacer&&(this.spacer=new g0(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=df(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let r=e.view.viewport;return!pe.eq(this.markers,t,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class g0{constructor(e,t,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,r,i)}update(e,t,r,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),vS(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,t){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let a=o,l=s<t.length?t[s++]:null,c=!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,c=!0;break}}else a=this.markers.length;for(;o<a;){let h=this.markers[o++];if(h.toDOM){h.destroy(i);let u=i.nextSibling;i.remove(),i=u}}if(!l)break;l.toDOM&&(c?i=i.nextSibling:this.dom.insertBefore(l.toDOM(e),i)),c&&o++}this.dom.className=r,this.markers=t}destroy(){this.setMarkers(null,[])}}function vS(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].compare(e[t]))return!1;return!0}const wS=K.define(),kS=K.define(),kr=K.define({combine(n){return cn(n,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let r=Object.assign({},e);for(let i in t){let s=r[i],o=t[i];r[i]=s?(a,l,c)=>s(a,l,c)||o(a,l,c):o}return r}})}});class Sl extends vn{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Cl(n,e){return n.state.facet(kr).formatNumber(e,n.state)}const SS=Ai.compute([kr],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(wS)},lineMarker(e,t,r){return r.some(i=>i.toDOM)?null:new Sl(Cl(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,r)=>{for(let i of e.state.facet(kS)){let s=i(e,t,r);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(kr)!=e.state.facet(kr),initialSpacer(e){return new Sl(Cl(e,ff(e.state.doc.lines)))},updateSpacer(e,t){let r=Cl(t.view,ff(t.view.state.doc.lines));return r==e.number?e:new Sl(r)},domEventHandlers:n.facet(kr).domEventHandlers,side:"before"}));function CS(n={}){return[kr.of(n),m0(),SS]}function ff(n){let e=9;for(;e<n;)e=e*10+9;return e}const jS=new class extends vn{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},OS=Qo.compute(["selection"],n=>{let e=[],t=-1;for(let r of n.selection.ranges){let i=n.doc.lineAt(r.head).from;i>t&&(t=i,e.push(jS.range(i)))}return pe.of(e)});function PS(){return OS}var jl;const Sr=new ue;function NS(n){return K.define({combine:n?e=>e.concat(n):void 0})}const AS=new ue;class Vt{constructor(e,t,r=[],i=""){this.data=e,this.name=i,me.prototype.hasOwnProperty("tree")||Object.defineProperty(me.prototype,"tree",{get(){return tt(this)}}),this.parser=t,this.extension=[Fn.of(this),me.languageData.of((s,o,a)=>{let l=pf(s,o,a),c=l.type.prop(Sr);if(!c)return[];let h=s.facet(c),u=l.type.prop(AS);if(u){let f=l.resolve(o-l.from,a);for(let p of u)if(p.test(f,s)){let m=s.facet(p.facet);return p.type=="replace"?m:m.concat(h)}}return h})].concat(r)}isActiveAt(e,t,r=-1){return pf(e,t,r).type.prop(Sr)==this.data}findRegions(e){let t=e.facet(Fn);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(Sr)==this.data){r.push({from:o,to:o+s.length});return}let a=s.prop(ue.mounted);if(a){if(a.tree.prop(Sr)==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+s.length});return}else if(a.overlay){let l=r.length;if(i(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;l<s.children.length;l++){let c=s.children[l];c instanceof Be&&i(c,s.positions[l]+o)}};return i(tt(e),0),r}get allowsNesting(){return!0}}Vt.setState=ae.define();function pf(n,e,t){let r=n.facet(Fn),i=tt(n).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(e,t,Le.ExcludeBuffers|Le.EnterBracketed))s.type.isTop&&(i=s);return i}class pa extends Vt{constructor(e,t,r){super(e,t,[],r),this.parser=t}static define(e){let t=NS(e.languageData);return new pa(t,e.parser.configure({props:[Sr.add(r=>r.isTop?t:void 0)]}),e.name)}configure(e,t){return new pa(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function tt(n){let e=n.field(Vt.state,!1);return e?e.tree:Be.empty}class MS{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,t){let r=this.cursorPos-this.string.length;return e<r||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-r,t-r)}}let di=null;class ma{constructor(e,t,r=[],i,s,o,a,l){this.parser=e,this.state=t,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,r){return new ma(e,t,[],Be.empty,0,r,[],null)}startParse(){return this.parser.startParse(new MS(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=Be.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(ir.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(ir.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=di;di=this;try{return e()}finally{di=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=mf(e,t.from,t.to);return e}changes(e,t){let{fragments:r,tree:i,treeLen:s,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,h,u,f)=>l.push({fromA:c,toA:h,fromB:u,toB:f})),r=ir.applyChanges(r,l),i=Be.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let h=e.mapPos(c.from,1),u=e.mapPos(c.to,-1);h<u&&a.push({from:h,to:u})}}}return new ma(this.parser,t,r,i,s,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:i,to:s}=this.skipped[r];i<e.to&&s>e.from&&(this.fragments=mf(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Um{createParse(t,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let l=di;if(l){for(let c of i)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new Be(pt.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return di}}function mf(n,e,t){return ir.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class zr{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=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),t.viewport.to);return t.work(20,r)||t.takeTree(),new zr(t)}static init(e){let t=Math.min(3e3,e.doc.length),r=ma.create(e.facet(Fn).parser,e,{from:0,to:t});return r.work(20,t)||r.takeTree(),new zr(r)}}Vt.state=Ye.define({create:zr.init,update(n,e){for(let t of e.effects)if(t.is(Vt.setState))return t.value;return e.startState.facet(Fn)!=e.state.facet(Fn)?zr.init(e.state):n.apply(e)}});let b0=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(b0=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Ol=typeof navigator<"u"&&(!((jl=navigator.scheduling)===null||jl===void 0)&&jl.isInputPending)?()=>navigator.scheduling.isInputPending():null,TS=Fe.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 t=this.view.state.field(Vt.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Vt.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=b0(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:i}}=this.view,s=r.field(Vt.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Ol?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<i&&r.doc.length>i+1e3,l=s.context.work(()=>Ol&&Ol()||Date.now()>o,i+(a?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Vt.setState.of(new zr(s.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>ut(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Fn=K.define({combine(n){return n.length?n[0]:null},enables:n=>[Vt.state,TS,H.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class DS{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const ES=K.define(),Va=K.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function ga(n){let e=n.facet(Va);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function qi(n,e){let t="",r=n.tabSize,i=n.facet(Va)[0];if(i==" "){for(;e>=r;)t+=" ",e-=r;i=" "}for(let s=0;s<e;s++)t+=i;return t}function _h(n,e){n instanceof me&&(n=new za(n));for(let r of n.state.facet(ES)){let i=r(n,e);if(i!==void 0)return i}let t=tt(n.state);return t.length>=e?RS(n,t,e):null}class za{constructor(e,t={}){this.state=e,this.options=t,this.unit=ga(e)}lineAt(e,t=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:r.text.slice(i-r.from),from:i}:{text:r.text.slice(0,i-r.from),from:r.from}:r}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:i}=this.lineAt(e,t);return r.slice(e-i,Math.min(r.length,e+100-i))}column(e,t=1){let{text:r,from:i}=this.lineAt(e,t),s=this.countColumn(r,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return o>-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,t=e.length){return Ur(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:r,from:i}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const y0=new ue;function RS(n,e,t){let r=e.resolveStack(t),i=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(i!=r.node){let s=[];for(let o=i;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return x0(r,n,t)}function x0(n,e,t){for(let r=n;r;r=r.next){let i=IS(r.node);if(i)return i(Hh.create(e,t,r))}return 0}function LS(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function IS(n){let e=n.type.prop(y0);if(e)return e;let t=n.firstChild,r;if(t&&(r=t.type.prop(ue.closedBy))){let i=n.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>VS(o,!0,1,void 0,s&&!LS(o)?i.from:void 0)}return n.parent==null?$S:null}function $S(){return 0}class Hh extends za{constructor(e,t,r){super(e.state,e.options),this.base=e,this.pos=t,this.context=r}get node(){return this.context.node}static create(e,t,r){return new Hh(e,t,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(t.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(BS(r,e))break;t=this.state.doc.lineAt(r.from)}return this.lineIndent(t.from)}continue(){return x0(this.context.next,this.base,this.pos)}}function BS(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function FS(n){let e=n.node,t=e.childAfter(e.from),r=e.lastChild;if(!t)return null;let i=n.options.simulateBreak,s=n.state.doc.lineAt(t.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let a=t.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let c=/^ */.exec(s.text.slice(t.to-s.from))[0].length;return{from:t.from,to:t.to+c}}a=l.to}}function VS(n,e,t,r,i){let s=n.textAfter,o=s.match(/^\s*/)[0].length,a=r&&s.slice(o,o+r.length)==r||i==n.pos+o,l=FS(n);return l?a?n.column(l.from):n.column(l.to):n.baseIndent+(a?0:n.unit*t)}function gf({except:n,units:e=1}={}){return t=>{let r=n&&n.test(t.textAfter);return t.baseIndent+(r?0:e*t.unit)}}const zS=200;function _S(){return me.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:r}=n.newSelection.main,i=t.lineAt(r);if(r>i.from+zS)return n;let s=t.sliceString(i.from,r);if(!e.some(c=>c.test(s)))return n;let{state:o}=n,a=-1,l=[];for(let{head:c}of o.selection.ranges){let h=o.doc.lineAt(c);if(h.from==a)continue;a=h.from;let u=_h(o,h.from);if(u==null)continue;let f=/^\s*/.exec(h.text)[0],p=qi(o,u);f!=p&&l.push({from:h.from,to:h.from+f.length,insert:p})}return l.length?[n,{changes:l,sequential:!0}]:n})}const HS=K.define(),v0=new ue;function WS(n){let e=n.firstChild,t=n.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?n.to:t.from}:null}function US(n,e,t){let r=tt(n);if(r.length<t)return null;let i=r.resolveStack(t,1),s=null;for(let o=i;o;o=o.next){let a=o.node;if(a.to<=t||a.from>t)continue;if(s&&a.from<e)break;let l=a.type.prop(v0);if(l&&(a.to<r.length-50||r.length==n.doc.length||!KS(a))){let c=l(a,n);c&&c.from<=t&&c.from>=e&&c.to>t&&(s=c)}}return s}function KS(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function ba(n,e,t){for(let r of n.facet(HS)){let i=r(n,e,t);if(i)return i}return US(n,e,t)}function w0(n,e){let t=e.mapPos(n.from,1),r=e.mapPos(n.to,-1);return t>=r?void 0:{from:t,to:r}}const _a=ae.define({map:w0}),Ws=ae.define({map:w0});function k0(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(r=>r.from<=t&&r.to>=t)||e.push(n.lineBlockAt(t));return e}const lr=Ye.define({create(){return ne.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,r)=>n=bf(n,t,r)),n=n.map(e.changes);for(let t of e.effects)if(t.is(_a)&&!GS(n,t.value.from,t.value.to)){let{preparePlaceholder:r}=e.state.facet(j0),i=r?ne.replace({widget:new e3(r(e.state,t.value))}):yf;n=n.update({add:[i.range(t.value.from,t.value.to)]})}else t.is(Ws)&&(n=n.update({filter:(r,i)=>t.value.from!=r||t.value.to!=i,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(n=bf(n,e.selection.main.head)),n},provide:n=>H.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(r,i)=>{t.push(r,i)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<n.length;){let r=n[t++],i=n[t++];if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(yf.range(r,i))}return ne.set(e,!0)}});function bf(n,e,t=e){let r=!1;return n.between(e,t,(i,s)=>{i<t&&s>e&&(r=!0)}),r?n.update({filterFrom:e,filterTo:t,filter:(i,s)=>i>=t||s<=e}):n}function ya(n,e,t){var r;let i=null;return(r=n.field(lr,!1))===null||r===void 0||r.between(e,t,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function GS(n,e,t){let r=!1;return n.between(e,e,(i,s)=>{i==e&&s==t&&(r=!0)}),r}function S0(n,e){return n.field(lr,!1)?e:e.concat(ae.appendConfig.of(O0()))}const qS=n=>{for(let e of k0(n)){let t=ba(n.state,e.from,e.to);if(t)return n.dispatch({effects:S0(n.state,[_a.of(t),C0(n,t)])}),!0}return!1},JS=n=>{if(!n.state.field(lr,!1))return!1;let e=[];for(let t of k0(n)){let r=ya(n.state,t.from,t.to);r&&e.push(Ws.of(r),C0(n,r,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function C0(n,e,t=!0){let r=n.state.doc.lineAt(e.from).number,i=n.state.doc.lineAt(e.to).number;return H.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${r} ${n.state.phrase("to")} ${i}.`)}const YS=n=>{let{state:e}=n,t=[];for(let r=0;r<e.doc.length;){let i=n.lineBlockAt(r),s=ba(e,i.from,i.to);s&&t.push(_a.of(s)),r=(s?n.lineBlockAt(s.to):i).to+1}return t.length&&n.dispatch({effects:S0(n.state,t)}),!!t.length},QS=n=>{let e=n.state.field(lr,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(r,i)=>{t.push(Ws.of({from:r,to:i}))}),n.dispatch({effects:t}),!0},XS=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:qS},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:JS},{key:"Ctrl-Alt-[",run:YS},{key:"Ctrl-Alt-]",run:QS}],ZS={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},j0=K.define({combine(n){return cn(n,ZS)}});function O0(n){return[lr,r3]}function P0(n,e){let{state:t}=n,r=t.facet(j0),i=o=>{let a=n.lineBlockAt(n.posAtDOM(o.target)),l=ya(n.state,a.from,a.to);l&&n.dispatch({effects:Ws.of(l)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(n,i,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const yf=ne.replace({widget:new class extends hn{toDOM(n){return P0(n,null)}}});class e3 extends hn{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return P0(e,this.value)}}const t3={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Pl extends vn{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function n3(n={}){let e={...t3,...n},t=new Pl(e,!0),r=new Pl(e,!1),i=Fe.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Fn)!=o.state.facet(Fn)||o.startState.field(lr,!1)!=o.state.field(lr,!1)||tt(o.startState)!=tt(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new yn;for(let l of o.viewportLineBlocks){let c=ya(o.state,l.from,l.to)?r:ba(o.state,l.from,l.to)?t:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:s}=e;return[i,bS({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(i))===null||a===void 0?void 0:a.markers)||pe.empty},initialSpacer(){return new Pl(e,!1)},domEventHandlers:{...s,click:(o,a,l)=>{if(s.click&&s.click(o,a,l))return!0;let c=ya(o.state,a.from,a.to);if(c)return o.dispatch({effects:Ws.of(c)}),!0;let h=ba(o.state,a.from,a.to);return h?(o.dispatch({effects:_a.of(h)}),!0):!1}}}),O0()]}const r3=H.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 Kr{constructor(e,t){this.specs=e;let r;function i(a){let l=In.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const s=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,o=t.scope;this.scope=o instanceof Vt?a=>a.prop(Sr)==o.data:o?a=>a==o:void 0,this.style=qm(e.map(a=>({tag:a.tag,class:a.class||i(Object.assign({},a,{tag:null}))})),{all:s}).style,this.module=r?new In(r):null,this.themeType=t.themeType}static define(e,t){return new Kr(e,t||{})}}const Qc=K.define(),N0=K.define({combine(n){return n.length?[n[0]]:null}});function Nl(n){let e=n.facet(Qc);return e.length?e:n.facet(N0)}function Wh(n,e){let t=[s3],r;return n instanceof Kr&&(n.module&&t.push(H.styleModule.of(n.module)),r=n.themeType),e?.fallback?t.push(N0.of(n)):r?t.push(Qc.computeN([H.darkTheme],i=>i.facet(H.darkTheme)==(r=="dark")?[n]:[])):t.push(Qc.of(n)),t}class i3{constructor(e){this.markCache=Object.create(null),this.tree=tt(e.state),this.decorations=this.buildDeco(e,Nl(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=tt(e.state),r=Nl(e.state),i=r!=Nl(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<s.to&&!i&&t.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return ne.none;let r=new yn;for(let{from:i,to:s}of e.visibleRanges)p2(this.tree,t,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=ne.mark({class:l})))},i,s);return r.finish()}}const s3=dr.high(Fe.fromClass(i3,{decorations:n=>n.decorations})),o3=Kr.define([{tag:D.meta,color:"#404740"},{tag:D.link,textDecoration:"underline"},{tag:D.heading,textDecoration:"underline",fontWeight:"bold"},{tag:D.emphasis,fontStyle:"italic"},{tag:D.strong,fontWeight:"bold"},{tag:D.strikethrough,textDecoration:"line-through"},{tag:D.keyword,color:"#708"},{tag:[D.atom,D.bool,D.url,D.contentSeparator,D.labelName],color:"#219"},{tag:[D.literal,D.inserted],color:"#164"},{tag:[D.string,D.deleted],color:"#a11"},{tag:[D.regexp,D.escape,D.special(D.string)],color:"#e40"},{tag:D.definition(D.variableName),color:"#00f"},{tag:D.local(D.variableName),color:"#30a"},{tag:[D.typeName,D.namespace],color:"#085"},{tag:D.className,color:"#167"},{tag:[D.special(D.variableName),D.macroName],color:"#256"},{tag:D.definition(D.propertyName),color:"#00c"},{tag:D.comment,color:"#940"},{tag:D.invalid,color:"#f00"}]),a3=H.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),A0=1e4,M0="()[]{}",T0=K.define({combine(n){return cn(n,{afterCursor:!0,brackets:M0,maxScanDistance:A0,renderMatch:h3})}}),l3=ne.mark({class:"cm-matchingBracket"}),c3=ne.mark({class:"cm-nonmatchingBracket"});function h3(n){let e=[],t=n.matched?l3:c3;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}const d3=Ye.define({create(){return ne.none},update(n,e){if(!e.docChanged&&!e.selection)return n;let t=[],r=e.state.facet(T0);for(let i of e.state.selection.ranges){if(!i.empty)continue;let s=tn(e.state,i.head,-1,r)||i.head>0&&tn(e.state,i.head-1,1,r)||r.afterCursor&&(tn(e.state,i.head,1,r)||i.head<e.state.doc.length&&tn(e.state,i.head+1,-1,r));s&&(t=t.concat(r.renderMatch(s,e.state)))}return ne.set(t,!0)},provide:n=>H.decorations.from(n)}),u3=[d3,a3];function f3(n={}){return[T0.of(n),u3]}const p3=new ue;function Xc(n,e,t){let r=n.prop(e<0?ue.openedBy:ue.closedBy);if(r)return r;if(n.name.length==1){let i=t.indexOf(n.name);if(i>-1&&i%2==(e<0?1:0))return[t[i+e]]}return null}function Zc(n){let e=n.type.prop(p3);return e?e(n.node):n}function tn(n,e,t,r={}){let i=r.maxScanDistance||A0,s=r.brackets||M0,o=tt(n),a=o.resolveInner(e,t);for(let l=a;l;l=l.parent){let c=Xc(l.type,t,s);if(c&&l.from<l.to){let h=Zc(l);if(h&&(t>0?e>=h.from&&e<h.to:e>h.from&&e<=h.to))return m3(n,e,t,l,h,c,s)}}return g3(n,e,t,o,a.type,i,s)}function m3(n,e,t,r,i,s,o){let a=r.parent,l={from:i.from,to:i.to},c=0,h=a?.cursor();if(h&&(t<0?h.childBefore(r.from):h.childAfter(r.to)))do if(t<0?h.to<=r.from:h.from>=r.to){if(c==0&&s.indexOf(h.type.name)>-1&&h.from<h.to){let u=Zc(h);return{start:l,end:u?{from:u.from,to:u.to}:void 0,matched:!0}}else if(Xc(h.type,t,o))c++;else if(Xc(h.type,-t,o)){if(c==0){let u=Zc(h);return{start:l,end:u&&u.from<u.to?{from:u.from,to:u.to}:void 0,matched:!1}}c--}}while(t<0?h.prevSibling():h.nextSibling());return{start:l,matched:!1}}function g3(n,e,t,r,i,s,o){let a=t<0?n.sliceDoc(e-1,e):n.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=t>0)return null;let c={from:t<0?e-1:e,to:t>0?e+1:e},h=n.doc.iterRange(e,t>0?n.doc.length:0),u=0;for(let f=0;!h.next().done&&f<=s;){let p=h.value;t<0&&(f+=p.length);let m=e+f*t;for(let b=t>0?0:p.length-1,y=t>0?p.length:-1;b!=y;b+=t){let v=o.indexOf(p[b]);if(!(v<0||r.resolveInner(m+b,1).type!=i))if(v%2==0==t>0)u++;else{if(u==1)return{start:c,end:{from:m+b,to:m+b+1},matched:v>>1==l>>1};u--}}t>0&&(f+=p.length)}return h.done?{start:c,matched:!1}:null}const b3=Object.create(null),xf=[pt.none],vf=[],wf=Object.create(null),y3=Object.create(null);for(let[n,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"]])y3[n]=x3(b3,e);function Al(n,e){vf.indexOf(n)>-1||(vf.push(n),console.warn(e))}function x3(n,e){let t=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let h=n[c]||D[c];h?typeof h=="function"?l.length?l=l.map(h):Al(c,`Modifier ${c} used at start of tag`):l.length?Al(c,`Tag ${c} used as modifier`):l=Array.isArray(h)?h:[h]:Al(c,`Unknown highlighting tag ${c}`)}for(let c of l)t.push(c)}if(!t.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+t.map(a=>a.id),s=wf[i];if(s)return s.id;let o=wf[i]=pt.define({id:xf.length,name:r,props:[Km({[r]:t})]});return xf.push(o),o.id}Pe.RTL,Pe.LTR;const v3=pa.define({name:"json",parser:y2.configure({props:[y0.add({Object:gf({except:/^\s*\}/}),Array:gf({except:/^\s*\]/})}),v0.add({"Object Array":WS})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function w3(){return new DS(v3)}function eh(){return eh=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},eh.apply(null,arguments)}function k3(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}const S3=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),r=Kh(n.state,t.from);return r.line?C3(n):r.block?O3(n):!1};function Uh(n,e){return({state:t,dispatch:r})=>{if(t.readOnly)return!1;let i=n(e,t);return i?(r(t.update(i)),!0):!1}}const C3=Uh(A3,0),j3=Uh(D0,0),O3=Uh((n,e)=>D0(n,e,N3(e)),0);function Kh(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const ui=50;function P3(n,{open:e,close:t},r,i){let s=n.sliceDoc(r-ui,r),o=n.sliceDoc(i,i+ui),a=/\s*$/.exec(s)[0].length,l=/^\s*/.exec(o)[0].length,c=s.length-a;if(s.slice(c-e.length,c)==e&&o.slice(l,l+t.length)==t)return{open:{pos:r-a,margin:a&&1},close:{pos:i+l,margin:l&&1}};let h,u;i-r<=2*ui?h=u=n.sliceDoc(r,i):(h=n.sliceDoc(r,r+ui),u=n.sliceDoc(i-ui,i));let f=/^\s*/.exec(h)[0].length,p=/\s*$/.exec(u)[0].length,m=u.length-p-t.length;return h.slice(f,f+e.length)==e&&u.slice(m,m+t.length)==t?{open:{pos:r+f+e.length,margin:/\s/.test(h.charAt(f+e.length))?1:0},close:{pos:i-p-t.length,margin:/\s/.test(u.charAt(m-1))?1:0}}:null}function N3(n){let e=[];for(let t of n.selection.ranges){let r=n.doc.lineAt(t.from),i=t.to<=r.to?r:n.doc.lineAt(t.to);i.from>r.from&&i.from==t.to&&(i=t.to==r.to+1?r:n.doc.lineAt(t.to-1));let s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function D0(n,e,t=e.selection.ranges){let r=t.map(s=>Kh(e,s.from).block);if(!r.every(s=>s))return null;let i=t.map((s,o)=>P3(e,r[o],s.from,s.to));if(n!=2&&!i.every(s=>s))return{changes:e.changes(t.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(n!=1&&i.some(s=>s)){let s=[];for(let o=0,a;o<i.length;o++)if(a=i[o]){let l=r[o],{open:c,close:h}=a;s.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:h.pos-h.margin,to:h.pos+l.close.length})}return{changes:s}}return null}function A3(n,e,t=e.selection.ranges){let r=[],i=-1;for(let{from:s,to:o}of t){let a=r.length,l=1e9,c=Kh(e,s).line;if(c){for(let h=s;h<=o;){let u=e.doc.lineAt(h);if(u.from>i&&(s==o||o>u.from)){i=u.from;let f=/^\s*/.exec(u.text)[0].length,p=f==u.length,m=u.text.slice(f,f+c.length)==c?f:-1;f<u.text.length&&f<l&&(l=f),r.push({line:u,comment:m,token:c,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(n!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:c,empty:h,single:u}of r)(u||!h)&&s.push({from:a.from+c,insert:l+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,h=c+l.length;o.text[h-o.from]==" "&&h++,s.push({from:c,to:h})}return{changes:s}}return null}const th=ln.define(),M3=ln.define(),T3=K.define(),E0=K.define({combine(n){return cn(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(r,i)=>e(r,i)||t(r,i)})}}),R0=Ye.define({create(){return nn.empty},update(n,e){let t=e.state.facet(E0),r=e.annotation(th);if(r){let l=ft.fromTransaction(e,r.selection),c=r.side,h=c==0?n.undone:n.done;return l?h=xa(h,h.length,t.minDepth,l):h=$0(h,e.startState.selection),new nn(c==0?r.rest:h,c==0?h:r.rest)}let i=e.annotation(M3);if((i=="full"||i=="before")&&(n=n.isolate()),e.annotation(He.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let s=ft.fromTransaction(e),o=e.annotation(He.time),a=e.annotation(He.userEvent);return s?n=n.addChanges(s,o,a,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(i=="full"||i=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new nn(n.done.map(ft.fromJSON),n.undone.map(ft.fromJSON))}});function D3(n={}){return[R0,E0.of(n),H.domEventHandlers({beforeinput(e,t){let r=e.inputType=="historyUndo"?L0:e.inputType=="historyRedo"?nh:null;return r?(e.preventDefault(),r(t)):!1}})]}function Ha(n,e){return function({state:t,dispatch:r}){if(!e&&t.readOnly)return!1;let i=t.field(R0,!1);if(!i)return!1;let s=i.pop(n,t,e);return s?(r(s),!0):!1}}const L0=Ha(0,!1),nh=Ha(1,!1),E3=Ha(0,!0),R3=Ha(1,!0);class ft{constructor(e,t,r,i,s){this.changes=e,this.effects=t,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new ft(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new ft(e.changes&&ze.fromJSON(e.changes),[],e.mapped&&sn.fromJSON(e.mapped),e.startSelection&&E.fromJSON(e.startSelection),e.selectionsAfter.map(E.fromJSON))}static fromTransaction(e,t){let r=Mt;for(let i of e.startState.facet(T3)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new ft(e.changes.invert(e.startState.doc),r,void 0,t||e.startState.selection,Mt)}static selection(e){return new ft(void 0,Mt,void 0,void 0,e)}}function xa(n,e,t,r){let i=e+1>t+20?e-t-1:0,s=n.slice(i,e);return s.push(r),s}function L3(n,e){let t=[],r=!1;return n.iterChangedRanges((i,s)=>t.push(i,s)),e.iterChangedRanges((i,s,o,a)=>{for(let l=0;l<t.length;){let c=t[l++],h=t[l++];a>=c&&o<=h&&(r=!0)}}),r}function I3(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,r)=>t.empty!=e.ranges[r].empty).length===0}function I0(n,e){return n.length?e.length?n.concat(e):n:e}const Mt=[],$3=200;function $0(n,e){if(n.length){let t=n[n.length-1],r=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-$3));return r.length&&r[r.length-1].eq(e)?n:(r.push(e),xa(n,n.length-1,1e9,t.setSelAfter(r)))}else return[ft.selection([e])]}function B3(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function Ml(n,e){if(!n.length)return n;let t=n.length,r=Mt;for(;t;){let i=F3(n[t-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=n.slice(0,t);return s[t-1]=i,s}else e=i.mapped,t--,r=i.selectionsAfter}return r.length?[ft.selection(r)]:Mt}function F3(n,e,t){let r=I0(n.selectionsAfter.length?n.selectionsAfter.map(a=>a.map(e)):Mt,t);if(!n.changes)return ft.selection(r);let i=n.changes.map(e),s=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(s):s;return new ft(i,ae.mapEffects(n.effects,e),o,n.startSelection.map(s),r)}const V3=/^(input\.type|delete)($|\.)/;class nn{constructor(e,t,r=0,i=void 0){this.done=e,this.undone=t,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new nn(this.done,this.undone):this}addChanges(e,t,r,i,s){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||V3.test(r))&&(!a.selectionsAfter.length&&t-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,L3(a.changes,e.changes))||r=="input.type.compose")?o=xa(o,o.length-1,i.minDepth,new ft(e.changes.compose(a.changes),I0(ae.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,Mt)):o=xa(o,o.length,i.minDepth,e),new nn(o,Mt,t,r)}addSelection(e,t,r,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Mt;return s.length>0&&t-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&I3(s[s.length-1],e)?this:new nn($0(this.done,e),this.undone,t,r)}addMapping(e){return new nn(Ml(this.done,e),Ml(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,r){let i=e==0?this.done:this.undone;if(i.length==0)return null;let s=i[i.length-1],o=s.selectionsAfter[0]||t.selection;if(r&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:th.of({side:e,rest:B3(i),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let a=i.length==1?Mt:i.slice(0,i.length-1);return s.mapped&&(a=Ml(a,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:th.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}nn.empty=new nn(Mt,Mt);const z3=[{key:"Mod-z",run:L0,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:nh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:nh,preventDefault:!0},{key:"Mod-u",run:E3,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:R3,preventDefault:!0}];function Gr(n,e){return E.create(n.ranges.map(e),n.mainIndex)}function Ht(n,e){return n.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Wt({state:n,dispatch:e},t){let r=Gr(n.selection,t);return r.eq(n.selection,!0)?!1:(e(Ht(n,r)),!0)}function Wa(n,e){return E.cursor(e?n.to:n.from)}function B0(n,e){return Wt(n,t=>t.empty?n.moveByChar(t,e):Wa(t,e))}function nt(n){return n.textDirectionAt(n.state.selection.main.head)==Pe.LTR}const F0=n=>B0(n,!nt(n)),V0=n=>B0(n,nt(n));function z0(n,e){return Wt(n,t=>t.empty?n.moveByGroup(t,e):Wa(t,e))}const _3=n=>z0(n,!nt(n)),H3=n=>z0(n,nt(n));function W3(n,e,t){if(e.type.prop(t))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function Ua(n,e,t){let r=tt(n).resolveInner(e.head),i=t?ue.closedBy:ue.openedBy;for(let l=e.head;;){let c=t?r.childAfter(l):r.childBefore(l);if(!c)break;W3(n,c,i)?r=c:l=t?c.to:c.from}let s=r.type.prop(i),o,a;return s&&(o=t?tn(n,r.from,1):tn(n,r.to,-1))&&o.matched?a=t?o.end.to:o.end.from:a=t?r.to:r.from,E.cursor(a,t?-1:1)}const U3=n=>Wt(n,e=>Ua(n.state,e,!nt(n))),K3=n=>Wt(n,e=>Ua(n.state,e,nt(n)));function _0(n,e){return Wt(n,t=>{if(!t.empty)return Wa(t,e);let r=n.moveVertically(t,e);return r.head!=t.head?r:n.moveToLineBoundary(t,e)})}const H0=n=>_0(n,!1),W0=n=>_0(n,!0);function U0(n){let e=n.scrollDOM.clientHeight<n.scrollDOM.scrollHeight-2,t=0,r=0,i;if(e){for(let s of n.state.facet(H.scrollMargins)){let o=s(n);o?.top&&(t=Math.max(o?.top,t)),o?.bottom&&(r=Math.max(o?.bottom,r))}i=n.scrollDOM.clientHeight-t-r}else i=(n.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:r,selfScroll:e,height:Math.max(n.defaultLineHeight,i-5)}}function K0(n,e){let t=U0(n),{state:r}=n,i=Gr(r.selection,o=>o.empty?n.moveVertically(o,e,t.height):Wa(o,e));if(i.eq(r.selection))return!1;let s;if(t.selfScroll){let o=n.coordsAtPos(r.selection.main.head),a=n.scrollDOM.getBoundingClientRect(),l=a.top+t.marginTop,c=a.bottom-t.marginBottom;o&&o.top>l&&o.bottom<c&&(s=H.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-l}))}return n.dispatch(Ht(r,i),{effects:s}),!0}const kf=n=>K0(n,!1),rh=n=>K0(n,!0);function zn(n,e,t){let r=n.lineBlockAt(e.head),i=n.moveToLineBoundary(e,t);if(i.head==e.head&&i.head!=(t?r.to:r.from)&&(i=n.moveToLineBoundary(e,t,!1)),!t&&i.head==r.from&&r.length){let s=/^\s*/.exec(n.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(i=E.cursor(r.from+s))}return i}const G3=n=>Wt(n,e=>zn(n,e,!0)),q3=n=>Wt(n,e=>zn(n,e,!1)),J3=n=>Wt(n,e=>zn(n,e,!nt(n))),Y3=n=>Wt(n,e=>zn(n,e,nt(n))),Q3=n=>Wt(n,e=>E.cursor(n.lineBlockAt(e.head).from,1)),X3=n=>Wt(n,e=>E.cursor(n.lineBlockAt(e.head).to,-1));function Z3(n,e,t){let r=!1,i=Gr(n.selection,s=>{let o=tn(n,s.head,-1)||tn(n,s.head,1)||s.head>0&&tn(n,s.head-1,1)||s.head<n.doc.length&&tn(n,s.head+1,-1);if(!o||!o.end)return s;r=!0;let a=o.start.from==s.head?o.end.to:o.end.from;return E.cursor(a)});return r?(e(Ht(n,i)),!0):!1}const e4=({state:n,dispatch:e})=>Z3(n,e);function $t(n,e){let t=Gr(n.state.selection,r=>{let i=e(r);return E.range(r.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return t.eq(n.state.selection)?!1:(n.dispatch(Ht(n.state,t)),!0)}function G0(n,e){return $t(n,t=>n.moveByChar(t,e))}const q0=n=>G0(n,!nt(n)),J0=n=>G0(n,nt(n));function Y0(n,e){return $t(n,t=>n.moveByGroup(t,e))}const t4=n=>Y0(n,!nt(n)),n4=n=>Y0(n,nt(n)),r4=n=>$t(n,e=>Ua(n.state,e,!nt(n))),i4=n=>$t(n,e=>Ua(n.state,e,nt(n)));function Q0(n,e){return $t(n,t=>n.moveVertically(t,e))}const X0=n=>Q0(n,!1),Z0=n=>Q0(n,!0);function eb(n,e){return $t(n,t=>n.moveVertically(t,e,U0(n).height))}const Sf=n=>eb(n,!1),Cf=n=>eb(n,!0),s4=n=>$t(n,e=>zn(n,e,!0)),o4=n=>$t(n,e=>zn(n,e,!1)),a4=n=>$t(n,e=>zn(n,e,!nt(n))),l4=n=>$t(n,e=>zn(n,e,nt(n))),c4=n=>$t(n,e=>E.cursor(n.lineBlockAt(e.head).from)),h4=n=>$t(n,e=>E.cursor(n.lineBlockAt(e.head).to)),jf=({state:n,dispatch:e})=>(e(Ht(n,{anchor:0})),!0),Of=({state:n,dispatch:e})=>(e(Ht(n,{anchor:n.doc.length})),!0),Pf=({state:n,dispatch:e})=>(e(Ht(n,{anchor:n.selection.main.anchor,head:0})),!0),Nf=({state:n,dispatch:e})=>(e(Ht(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),d4=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),u4=({state:n,dispatch:e})=>{let t=Ka(n).map(({from:r,to:i})=>E.range(r,Math.min(i+1,n.doc.length)));return e(n.update({selection:E.create(t),userEvent:"select"})),!0},f4=({state:n,dispatch:e})=>{let t=Gr(n.selection,r=>{let i=tt(n),s=i.resolveStack(r.from,1);if(r.empty){let o=i.resolveStack(r.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;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 E.range(a.to,a.from)}return r});return t.eq(n.selection)?!1:(e(Ht(n,t)),!0)};function tb(n,e){let{state:t}=n,r=t.selection,i=t.selection.ranges.slice();for(let s of t.selection.ranges){let o=t.doc.lineAt(s.head);if(e?o.to<n.state.doc.length:o.from>0)for(let a=s;;){let l=n.moveVertically(a,e);if(l.head<o.from||l.head>o.to){i.some(c=>c.head==l.head)||i.push(l);break}else{if(l.head==a.head)break;a=l}}}return i.length==r.ranges.length?!1:(n.dispatch(Ht(t,E.create(i,i.length-1))),!0)}const p4=n=>tb(n,!1),m4=n=>tb(n,!0),g4=({state:n,dispatch:e})=>{let t=n.selection,r=null;return t.ranges.length>1?r=E.create([t.main]):t.main.empty||(r=E.create([E.cursor(t.main.head)])),r?(e(Ht(n,r)),!0):!1};function Us(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:r}=n,i=r.changeByRange(s=>{let{from:o,to:a}=s;if(o==a){let l=e(s);l<o?(t="delete.backward",l=Ao(n,l,!1)):l>o&&(t="delete.forward",l=Ao(n,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=Ao(n,o,!1),a=Ao(n,a,!0);return o==a?{range:s}:{changes:{from:o,to:a},range:E.cursor(o,o<s.head?-1:1)}});return i.changes.empty?!1:(n.dispatch(r.update(i,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?H.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Ao(n,e,t){if(n instanceof H)for(let r of n.state.facet(H.atomicRanges).map(i=>i(n)))r.between(e,e,(i,s)=>{i<e&&s>e&&(e=t?s:i)});return e}const nb=(n,e,t)=>Us(n,r=>{let i=r.from,{state:s}=n,o=s.doc.lineAt(i),a,l;if(t&&!e&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,i-o.from))){if(a[a.length-1]==" ")return i-1;let c=Ur(a,s.tabSize),h=c%ga(s)||ga(s);for(let u=0;u<h&&a[a.length-1-u]==" ";u++)i--;l=i}else l=_e(o.text,i-o.from,e,e)+o.from,l==i&&o.number!=(e?s.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,i-o.from))&&(l=_e(o.text,l-o.from,!1,!1)+o.from);return l}),ih=n=>nb(n,!1,!0),rb=n=>nb(n,!0,!1),ib=(n,e)=>Us(n,t=>{let r=t.head,{state:i}=n,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let a=null;;){if(r==(e?s.to:s.from)){r==t.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let l=_e(s.text,r-s.from,e)+s.from,c=s.text.slice(Math.min(r,l)-s.from,Math.max(r,l)-s.from),h=o(c);if(a!=null&&h!=a)break;(c!=" "||r!=t.head)&&(a=h),r=l}return r}),sb=n=>ib(n,!1),b4=n=>ib(n,!0),y4=n=>Us(n,e=>{let t=n.lineBlockAt(e.head).to;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),x4=n=>Us(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),v4=n=>Us(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),w4=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:xe.of(["",""])},range:E.cursor(r.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},k4=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(r=>{if(!r.empty||r.from==0||r.from==n.doc.length)return{range:r};let i=r.from,s=n.doc.lineAt(i),o=i==s.from?i-1:_e(s.text,i-s.from,!1)+s.from,a=i==s.to?i+1:_e(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:a,insert:n.doc.slice(i,a).append(n.doc.slice(o,i))},range:E.cursor(a)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Ka(n){let e=[],t=-1;for(let r of n.selection.ranges){let i=n.doc.lineAt(r.from),s=n.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=n.doc.lineAt(r.to-1)),t>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(r)}else e.push({from:i.from,to:s.to,ranges:[r]});t=s.number+1}return e}function ob(n,e,t){if(n.readOnly)return!1;let r=[],i=[];for(let s of Ka(n)){if(t?s.to==n.doc.length:s.from==0)continue;let o=n.doc.lineAt(t?s.to+1:s.from-1),a=o.length+1;if(t){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+n.lineBreak});for(let l of s.ranges)i.push(E.range(Math.min(n.doc.length,l.anchor+a),Math.min(n.doc.length,l.head+a)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:n.lineBreak+o.text});for(let l of s.ranges)i.push(E.range(l.anchor-a,l.head-a))}}return r.length?(e(n.update({changes:r,scrollIntoView:!0,selection:E.create(i,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const S4=({state:n,dispatch:e})=>ob(n,e,!1),C4=({state:n,dispatch:e})=>ob(n,e,!0);function ab(n,e,t){if(n.readOnly)return!1;let r=[];for(let s of Ka(n))t?r.push({from:s.from,insert:n.doc.slice(s.from,s.to)+n.lineBreak}):r.push({from:s.to,insert:n.lineBreak+n.doc.slice(s.from,s.to)});let i=n.changes(r);return e(n.update({changes:i,selection:n.selection.map(i,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const j4=({state:n,dispatch:e})=>ab(n,e,!1),O4=({state:n,dispatch:e})=>ab(n,e,!0),P4=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(Ka(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),r=Gr(e.selection,i=>{let s;if(n.lineWrapping){let o=n.lineBlockAt(i.head),a=n.coordsAtPos(i.head,i.assoc||1);a&&(s=o.bottom+n.documentTop-a.bottom+n.defaultLineHeight/2)}return n.moveVertically(i,!0,s)}).map(t);return n.dispatch({changes:t,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function N4(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=tt(n).resolveInner(e),r=t.childBefore(e),i=t.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(ue.closedBy))&&s.indexOf(i.name)>-1&&n.doc.lineAt(r.to).from==n.doc.lineAt(i.from).from&&!/\S/.test(n.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const Af=lb(!1),A4=lb(!0);function lb(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,a=e.doc.lineAt(s),l=!n&&s==o&&N4(e,s);n&&(s=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new za(e,{simulateBreak:s,simulateDoubleBreak:!!l}),h=_h(c,s);for(h==null&&(h=Ur(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:s,to:o}=l:s>a.from&&s<a.from+100&&!/\S/.test(a.text.slice(0,s))&&(s=a.from);let u=["",qi(e,h)];return l&&u.push(qi(e,c.lineIndent(a.from,-1))),{changes:{from:s,to:o,insert:xe.of(u)},range:E.cursor(s+1+u[1].length)}});return t(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Gh(n,e){let t=-1;return n.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let a=n.doc.lineAt(o);a.number>t&&(r.empty||r.to>a.from)&&(e(a,i,r),t=a.number),o=a.to+1}let s=n.changes(i);return{changes:i,range:E.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const M4=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),r=new za(n,{overrideIndentation:s=>{let o=t[s];return o??-1}}),i=Gh(n,(s,o,a)=>{let l=_h(r,s.from);if(l==null)return;/\S/.test(s.text)||(l=0);let c=/^\s*/.exec(s.text)[0],h=qi(n,l);(c!=h||a.from<s.from+c.length)&&(t[s.from]=l,o.push({from:s.from,to:s.from+c.length,insert:h}))});return i.changes.empty||e(n.update(i,{userEvent:"indent"})),!0},cb=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Gh(n,(t,r)=>{r.push({from:t.from,insert:n.facet(Va)})}),{userEvent:"input.indent"})),!0),hb=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Gh(n,(t,r)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let s=Ur(i,n.tabSize),o=0,a=qi(n,Math.max(0,s-ga(n)));for(;o<i.length&&o<a.length&&i.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:t.from+o,to:t.from+i.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),T4=n=>(n.setTabFocusMode(),!0),D4=[{key:"Ctrl-b",run:F0,shift:q0,preventDefault:!0},{key:"Ctrl-f",run:V0,shift:J0},{key:"Ctrl-p",run:H0,shift:X0},{key:"Ctrl-n",run:W0,shift:Z0},{key:"Ctrl-a",run:Q3,shift:c4},{key:"Ctrl-e",run:X3,shift:h4},{key:"Ctrl-d",run:rb},{key:"Ctrl-h",run:ih},{key:"Ctrl-k",run:y4},{key:"Ctrl-Alt-h",run:sb},{key:"Ctrl-o",run:w4},{key:"Ctrl-t",run:k4},{key:"Ctrl-v",run:rh}],E4=[{key:"ArrowLeft",run:F0,shift:q0,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:_3,shift:t4,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:J3,shift:a4,preventDefault:!0},{key:"ArrowRight",run:V0,shift:J0,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:H3,shift:n4,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Y3,shift:l4,preventDefault:!0},{key:"ArrowUp",run:H0,shift:X0,preventDefault:!0},{mac:"Cmd-ArrowUp",run:jf,shift:Pf},{mac:"Ctrl-ArrowUp",run:kf,shift:Sf},{key:"ArrowDown",run:W0,shift:Z0,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Of,shift:Nf},{mac:"Ctrl-ArrowDown",run:rh,shift:Cf},{key:"PageUp",run:kf,shift:Sf},{key:"PageDown",run:rh,shift:Cf},{key:"Home",run:q3,shift:o4,preventDefault:!0},{key:"Mod-Home",run:jf,shift:Pf},{key:"End",run:G3,shift:s4,preventDefault:!0},{key:"Mod-End",run:Of,shift:Nf},{key:"Enter",run:Af,shift:Af},{key:"Mod-a",run:d4},{key:"Backspace",run:ih,shift:ih,preventDefault:!0},{key:"Delete",run:rb,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:sb,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:b4,preventDefault:!0},{mac:"Mod-Backspace",run:x4,preventDefault:!0},{mac:"Mod-Delete",run:v4,preventDefault:!0}].concat(D4.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),R4=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:U3,shift:r4},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:K3,shift:i4},{key:"Alt-ArrowUp",run:S4},{key:"Shift-Alt-ArrowUp",run:j4},{key:"Alt-ArrowDown",run:C4},{key:"Shift-Alt-ArrowDown",run:O4},{key:"Mod-Alt-ArrowUp",run:p4},{key:"Mod-Alt-ArrowDown",run:m4},{key:"Escape",run:g4},{key:"Mod-Enter",run:A4},{key:"Alt-l",mac:"Ctrl-l",run:u4},{key:"Mod-i",run:f4,preventDefault:!0},{key:"Mod-[",run:hb},{key:"Mod-]",run:cb},{key:"Mod-Alt-\\",run:M4},{key:"Shift-Mod-k",run:P4},{key:"Shift-Mod-\\",run:e4},{key:"Mod-/",run:S3},{key:"Alt-A",run:j3},{key:"Ctrl-m",mac:"Shift-Alt-m",run:T4}].concat(E4),L4={key:"Tab",run:cb,shift:hb},Mf=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class _r{constructor(e,t,r=0,i=e.length,s,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,i),this.bufferStart=r,this.normalize=s?a=>s(Mf(a)):Mf,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return ct(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=jh(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Zt(e);let i=this.normalize(t);if(i.length)for(let s=0,o=r;;s++){let a=i.charCodeAt(s),l=this.match(a,o,this.bufferPos+this.bufferStart);if(s==i.length-1){if(l)return this.value=l,this;break}o==r&&s<t.length&&t.charCodeAt(s)==a&&o++}}}match(e,t,r){let i=null;for(let s=0;s<this.matches.length;s+=2){let o=this.matches[s],a=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?i={from:this.matches[s+1],to:r}:(this.matches[s]++,a=!0)),a||(this.matches.splice(s,2),s-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?i={from:t,to:r}:this.matches.push(1,t)),i&&this.test&&!this.test(i.from,i.to,this.buffer,this.bufferStart)&&(i=null),i}}typeof Symbol<"u"&&(_r.prototype[Symbol.iterator]=function(){return this});const db={from:-1,to:-1,match:/.*/.exec("")},qh="gm"+(/x/.unicode==null?"":"u");class ub{constructor(e,t,r,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=db,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new fb(e,t,r,i,s);this.re=new RegExp(t,qh+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=va(e,i),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let r=this.curLineStart+t.index,i=r+t[0].length;if(this.matchPos=va(this.text,i+(r==i?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<i||r>this.value.to)&&(!this.test||this.test(r,i,t)))return this.value={from:r,to:i,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const Tl=new WeakMap;class Er{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,r){let i=Tl.get(e);if(!i||i.from>=r||i.to<=t){let a=new Er(t,e.sliceString(t,r));return Tl.set(e,a),a}if(i.from==t&&i.to==r)return i;let{text:s,from:o}=i;return o>t&&(s=e.sliceString(t,o)+s,o=t),i.to<r&&(s+=e.sliceString(i.to,r)),Tl.set(e,new Er(o,s)),new Er(t,s.slice(t-o,r-o))}}class fb{constructor(e,t,r,i,s){this.text=e,this.to=s,this.done=!1,this.value=db,this.matchPos=va(e,i),this.re=new RegExp(t,qh+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=Er.get(e,i,this.chunkEnd(i+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let r=this.flat.from+t.index,i=r+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,i,t)))return this.value={from:r,to:i,match:t},this.matchPos=va(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Er.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(ub.prototype[Symbol.iterator]=fb.prototype[Symbol.iterator]=function(){return this});function I4(n){try{return new RegExp(n,qh),!0}catch{return!1}}function va(n,e){if(e>=n.length)return e;let t=n.lineAt(e),r;for(;e<t.to&&(r=t.text.charCodeAt(e-t.from))>=56320&&r<57344;)e++;return e}function sh(n){let e=String(n.state.doc.lineAt(n.state.selection.main.head).number),t=je("input",{class:"cm-textfield",name:"line",value:e}),r=je("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),n.dispatch({effects:Mi.of(!1)}),n.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},je("label",n.state.phrase("Go to line"),": ",t)," ",je("button",{class:"cm-button",type:"submit"},n.state.phrase("go")),je("button",{name:"close",onclick:()=>{n.dispatch({effects:Mi.of(!1)}),n.focus()},"aria-label":n.state.phrase("close"),type:"button"},["×"]));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!s)return;let{state:o}=n,a=o.doc.lineAt(o.selection.main.head),[,l,c,h,u]=s,f=h?+h.slice(1):0,p=c?+c:a.number;if(c&&u){let y=p/100;l&&(y=y*(l=="-"?-1:1)+a.number/o.doc.lines),p=Math.round(o.doc.lines*y)}else c&&l&&(p=p*(l=="-"?-1:1)+a.number);let m=o.doc.line(Math.max(1,Math.min(o.doc.lines,p))),b=E.cursor(m.from+Math.max(0,Math.min(f,m.length)));n.dispatch({effects:[Mi.of(!1),H.scrollIntoView(b.from,{y:"center"})],selection:b}),n.focus()}return{dom:r}}const Mi=ae.define(),Tf=Ye.define({create(){return!0},update(n,e){for(let t of e.effects)t.is(Mi)&&(n=t.value);return n},provide:n=>Gi.from(n,e=>e?sh:null)}),$4=n=>{let e=Ki(n,sh);if(!e){let t=[Mi.of(!0)];n.state.field(Tf,!1)==null&&t.push(ae.appendConfig.of([Tf,B4])),n.dispatch({effects:t}),e=Ki(n,sh)}return e&&e.dom.querySelector("input").select(),!0},B4=H.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"}}}),F4={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},V4=K.define({combine(n){return cn(n,F4,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function z4(n){return[K4,U4]}const _4=ne.mark({class:"cm-selectionMatch"}),H4=ne.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Df(n,e,t,r){return(t==0||n(e.sliceDoc(t-1,t))!=De.Word)&&(r==e.doc.length||n(e.sliceDoc(r,r+1))!=De.Word)}function W4(n,e,t,r){return n(e.sliceDoc(t,t+1))==De.Word&&n(e.sliceDoc(r-1,r))==De.Word}const U4=Fe.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(V4),{state:t}=n,r=t.selection;if(r.ranges.length>1)return ne.none;let i=r.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return ne.none;let l=t.wordAt(i.head);if(!l)return ne.none;o=t.charCategorizer(i.head),s=t.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l<e.minSelectionLength||l>200)return ne.none;if(e.wholeWords){if(s=t.sliceDoc(i.from,i.to),o=t.charCategorizer(i.head),!(Df(o,t,i.from,i.to)&&W4(o,t,i.from,i.to)))return ne.none}else if(s=t.sliceDoc(i.from,i.to),!s)return ne.none}let a=[];for(let l of n.visibleRanges){let c=new _r(t.doc,s,l.from,l.to);for(;!c.next().done;){let{from:h,to:u}=c.value;if((!o||Df(o,t,h,u))&&(i.empty&&h<=i.from&&u>=i.to?a.push(H4.range(h,u)):(h>=i.to||u<=i.from)&&a.push(_4.range(h,u)),a.length>e.maxMatches))return ne.none}}return ne.set(a)}},{decorations:n=>n.decorations}),K4=H.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),G4=({state:n,dispatch:e})=>{let{selection:t}=n,r=E.create(t.ranges.map(i=>n.wordAt(i.head)||E.cursor(i.head)),t.mainIndex);return r.eq(t)?!1:(e(n.update({selection:r})),!0)};function q4(n,e){let{main:t,ranges:r}=n.selection,i=n.wordAt(t.head),s=i&&i.from==t.from&&i.to==t.to;for(let o=!1,a=new _r(n.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new _r(n.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(s){let l=n.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const J4=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(s=>s.from===s.to))return G4({state:n,dispatch:e});let r=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(s=>n.sliceDoc(s.from,s.to)!=r))return!1;let i=q4(n,r);return i?(e(n.update({selection:n.selection.addRange(E.range(i.from,i.to),!1),effects:H.scrollIntoView(i.to)})),!0):!1},qr=K.define({combine(n){return cn(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new a5(e),scrollToMatch:e=>H.scrollIntoView(e)})}});class pb{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||I4(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,r)=>r=="n"?`
63
- `: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 Z4(this):new Q4(this)}getCursor(e,t=0,r){let i=e.doc?e:me.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?xr(this,i,t,r):yr(this,i,t,r)}}class mb{constructor(e){this.spec=e}}function yr(n,e,t,r){return new _r(e.doc,n.unquoted,t,r,n.caseSensitive?void 0:i=>i.toLowerCase(),n.wholeWord?Y4(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function Y4(n,e){return(t,r,i,s)=>((s>t||s+i.length<r)&&(s=Math.max(0,t-2),i=n.sliceString(s,Math.min(n.length,r+2))),(e(wa(i,t-s))!=De.Word||e(ka(i,t-s))!=De.Word)&&(e(ka(i,r-s))!=De.Word||e(wa(i,r-s))!=De.Word))}class Q4 extends mb{constructor(e){super(e)}nextMatch(e,t,r){let i=yr(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let s=Math.min(e.doc.length,t+this.spec.unquoted.length);i=yr(this.spec,e,0,s).nextOverlapping()}return i.done||i.value.from==t&&i.value.to==r?null:i.value}prevMatchInRange(e,t,r){for(let i=r;;){let s=Math.max(t,i-1e4-this.spec.unquoted.length),o=yr(this.spec,e,s,i),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==t)return null;i-=1e4}}prevMatch(e,t,r){let i=this.prevMatchInRange(e,0,t);return i||(i=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=t||i.to!=r)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let r=yr(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let s=yr(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function xr(n,e,t,r){return new ub(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:n.wholeWord?X4(e.charCategorizer(e.selection.main.head)):void 0},t,r)}function wa(n,e){return n.slice(_e(n,e,!1),e)}function ka(n,e){return n.slice(e,_e(n,e))}function X4(n){return(e,t,r)=>!r[0].length||(n(wa(r.input,r.index))!=De.Word||n(ka(r.input,r.index))!=De.Word)&&(n(ka(r.input,r.index+r[0].length))!=De.Word||n(wa(r.input,r.index+r[0].length))!=De.Word)}class Z4 extends mb{nextMatch(e,t,r){let i=xr(this.spec,e,r,e.doc.length).next();return i.done&&(i=xr(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,r){for(let i=1;;i++){let s=Math.max(t,r-i*1e4),o=xr(this.spec,e,s,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==t||a.from>s+10))return a;if(s==t)return null}}prevMatch(e,t,r){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let i=r.length;i>0;i--){let s=+r.slice(0,i);if(s>0&&s<e.match.length)return e.match[s]+r.slice(i)}return t})}matchAll(e,t){let r=xr(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let s=xr(this.spec,e,Math.max(0,t-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const Ji=ae.define(),Jh=ae.define(),En=Ye.define({create(n){return new Dl(oh(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Ji)?n=new Dl(t.value.create(),n.panel):t.is(Jh)&&(n=new Dl(n.query,t.value?Yh:null));return n},provide:n=>Gi.from(n,e=>e.panel)});class Dl{constructor(e,t){this.query=e,this.panel=t}}const e5=ne.mark({class:"cm-searchMatch"}),t5=ne.mark({class:"cm-searchMatch cm-searchMatch-selected"}),n5=Fe.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(En))}update(n){let e=n.state.field(En);(e!=n.startState.field(En)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return ne.none;let{view:t}=this,r=new yn;for(let i=0,s=t.visibleRanges,o=s.length;i<o;i++){let{from:a,to:l}=s[i];for(;i<o-1&&l>s[i+1].from-2*250;)l=s[++i].to;n.highlight(t.state,a,l,(c,h)=>{let u=t.state.selection.ranges.some(f=>f.from==c&&f.to==h);r.add(c,h,u?t5:e5)})}return r.finish()}},{decorations:n=>n.decorations});function Ks(n){return e=>{let t=e.state.field(En,!1);return t&&t.query.spec.valid?n(e,t):yb(e)}}const Sa=Ks((n,{query:e})=>{let{to:t}=n.state.selection.main,r=e.nextMatch(n.state,t,t);if(!r)return!1;let i=E.single(r.from,r.to),s=n.state.facet(qr);return n.dispatch({selection:i,effects:[Qh(n,r),s.scrollToMatch(i.main,n)],userEvent:"select.search"}),bb(n),!0}),Ca=Ks((n,{query:e})=>{let{state:t}=n,{from:r}=t.selection.main,i=e.prevMatch(t,r,r);if(!i)return!1;let s=E.single(i.from,i.to),o=n.state.facet(qr);return n.dispatch({selection:s,effects:[Qh(n,i),o.scrollToMatch(s.main,n)],userEvent:"select.search"}),bb(n),!0}),r5=Ks((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:E.create(t.map(r=>E.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),i5=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:r,to:i}=t.main,s=[],o=0;for(let a=new _r(n.doc,n.sliceDoc(r,i));!a.next().done;){if(s.length>1e3)return!1;a.value.from==r&&(o=s.length),s.push(E.range(a.value.from,a.value.to))}return e(n.update({selection:E.create(s,o),userEvent:"select.search.matches"})),!0},Ef=Ks((n,{query:e})=>{let{state:t}=n,{from:r,to:i}=t.selection.main;if(t.readOnly)return!1;let s=e.nextMatch(t,r,r);if(!s)return!1;let o=s,a=[],l,c,h=[];o.from==r&&o.to==i&&(c=t.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:c}),o=e.nextMatch(t,o.from,o.to),h.push(H.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(r).number)+".")));let u=n.state.changes(a);return o&&(l=E.single(o.from,o.to).map(u),h.push(Qh(n,o)),h.push(t.facet(qr).scrollToMatch(l.main,n))),n.dispatch({changes:u,selection:l,effects:h,userEvent:"input.replace"}),!0}),s5=Ks((n,{query:e})=>{if(n.state.readOnly)return!1;let t=e.matchAll(n.state,1e9).map(i=>{let{from:s,to:o}=i;return{from:s,to:o,insert:e.getReplacement(i)}});if(!t.length)return!1;let r=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:H.announce.of(r),userEvent:"input.replace.all"}),!0});function Yh(n){return n.state.facet(qr).createPanel(n)}function oh(n,e){var t,r,i,s,o;let a=n.selection.main,l=a.empty||a.to>a.from+100?"":n.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=n.facet(qr);return new pb({search:((t=e?.literal)!==null&&t!==void 0?t:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(i=e?.literal)!==null&&i!==void 0?i:c.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:c.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function gb(n){let e=Ki(n,Yh);return e&&e.dom.querySelector("[main-field]")}function bb(n){let e=gb(n);e&&e==n.root.activeElement&&e.select()}const yb=n=>{let e=n.state.field(En,!1);if(e&&e.panel){let t=gb(n);if(t&&t!=n.root.activeElement){let r=oh(n.state,e.query.spec);r.valid&&n.dispatch({effects:Ji.of(r)}),t.focus(),t.select()}}else n.dispatch({effects:[Jh.of(!0),e?Ji.of(oh(n.state,e.query.spec)):ae.appendConfig.of(c5)]});return!0},xb=n=>{let e=n.state.field(En,!1);if(!e||!e.panel)return!1;let t=Ki(n,Yh);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:Jh.of(!1)}),!0},o5=[{key:"Mod-f",run:yb,scope:"editor search-panel"},{key:"F3",run:Sa,shift:Ca,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Sa,shift:Ca,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:xb,scope:"editor search-panel"},{key:"Mod-Shift-l",run:i5},{key:"Mod-Alt-g",run:$4},{key:"Mod-d",run:J4,preventDefault:!0}];class a5{constructor(e){this.view=e;let t=this.query=e.state.field(En).query.spec;this.commit=this.commit.bind(this),this.searchField=je("input",{value:t.search,placeholder:yt(e,"Find"),"aria-label":yt(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=je("input",{value:t.replace,placeholder:yt(e,"Replace"),"aria-label":yt(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=je("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=je("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=je("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function r(i,s,o){return je("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=je("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>Sa(e),[yt(e,"next")]),r("prev",()=>Ca(e),[yt(e,"previous")]),r("select",()=>r5(e),[yt(e,"all")]),je("label",null,[this.caseField,yt(e,"match case")]),je("label",null,[this.reField,yt(e,"regexp")]),je("label",null,[this.wordField,yt(e,"by word")]),...e.state.readOnly?[]:[je("br"),this.replaceField,r("replace",()=>Ef(e),[yt(e,"replace")]),r("replaceAll",()=>s5(e),[yt(e,"replace all")])],je("button",{name:"close",onclick:()=>xb(e),"aria-label":yt(e,"close"),type:"button"},["×"])])}commit(){let e=new pb({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:Ji.of(e)}))}keydown(e){jk(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ca:Sa)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Ef(this.view))}update(e){for(let t of e.transactions)for(let r of t.effects)r.is(Ji)&&!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(qr).top}}function yt(n,e){return n.state.phrase(e)}const Mo=30,To=/[\s\.,:;?!]/;function Qh(n,{from:e,to:t}){let r=n.state.doc.lineAt(e),i=n.state.doc.lineAt(t).to,s=Math.max(r.from,e-Mo),o=Math.min(i,t+Mo),a=n.state.sliceDoc(s,o);if(s!=r.from){for(let l=0;l<Mo;l++)if(!To.test(a[l+1])&&To.test(a[l])){a=a.slice(l);break}}if(o!=i){for(let l=a.length-1;l>a.length-Mo;l--)if(!To.test(a[l-1])&&To.test(a[l])){a=a.slice(0,l);break}}return H.announce.of(`${n.state.phrase("current match")}. ${a} ${n.state.phrase("on line")} ${r.number}.`)}const l5=H.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"}}),c5=[En,dr.low(n5),l5];class vb{constructor(e,t,r,i){this.state=e,this.pos=t,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=tt(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),r=Math.max(t.from,this.pos-250),i=t.text.slice(r-t.from,this.pos-t.from),s=i.search(wb(e,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function Rf(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function h5(n){let e=Object.create(null),t=Object.create(null);for(let{label:i}of n){e[i[0]]=!0;for(let s=1;s<i.length;s++)t[i[s]]=!0}let r=Rf(e)+Rf(t)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function d5(n){let e=n.map(i=>typeof i=="string"?{label:i}:i),[t,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:h5(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:t}:null}}class Lf{constructor(e,t,r,i){this.completion=e,this.source=t,this.match=r,this.score=i}}function sr(n){return n.selection.main.from}function wb(n,e){var t;let{source:r}=n,i=e&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?n:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const kb=ln.define();function u5(n,e,t,r){let{main:i}=n.selection,s=t-i.from,o=r-i.from;return{...n.changeByRange(a=>{if(a!=i&&t!=r&&n.sliceDoc(a.from+s,a.from+o)!=n.sliceDoc(t,r))return{range:a};let l=n.toText(e);return{changes:{from:a.from+s,to:r==i.from?a.to:a.from+o,insert:l},range:E.cursor(a.from+s+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const If=new WeakMap;function f5(n){if(!Array.isArray(n))return n;let e=If.get(n);return e||If.set(n,e=d5(n)),e}const ja=ae.define(),Yi=ae.define();class p5{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let r=ct(e,t),i=Zt(r);this.chars.push(r);let s=e.slice(t,t+i),o=s.toUpperCase();this.folded.push(ct(o==s?s.toLowerCase():o,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:r,any:i,precise:s,byWord:o}=this;if(t.length==1){let w=ct(e,0),C=Zt(w),j=C==e.length?0:-100;if(w!=t[0])if(w==r[0])j+=-200;else return null;return this.ret(j,[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=t.length,c=0;if(a<0){for(let w=0,C=Math.min(e.length,200);w<C&&c<l;){let j=ct(e,w);(j==t[c]||j==r[c])&&(i[c++]=w),w+=Zt(j)}if(c<l)return null}let h=0,u=0,f=!1,p=0,m=-1,b=-1,y=/[a-z]/.test(e),v=!0;for(let w=0,C=Math.min(e.length,200),j=0;w<C&&u<l;){let k=ct(e,w);a<0&&(h<l&&k==t[h]&&(s[h++]=w),p<l&&(k==t[p]||k==r[p]?(p==0&&(m=w),b=w+1,p++):p=0));let O,x=k<255?k>=48&&k<=57||k>=97&&k<=122?2:k>=65&&k<=90?1:0:(O=jh(k))!=O.toLowerCase()?1:O!=O.toUpperCase()?2:0;(!w||x==1&&y||j==0&&x!=0)&&(t[u]==k||r[u]==k&&(f=!0)?o[u++]=w:o.length&&(v=!1)),j=x,w+=Zt(k)}return u==l&&o[0]==0&&v?this.result(-100+(f?-200:0),o,e):p==l&&m==0?this.ret(-200-e.length+(b==e.length?0:-100),[0,b]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):p==l?this.ret(-900-e.length,[m,b]):u==l?this.result(-100+(f?-200:0)+-700+(v?0:-1100),o,e):t.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,t,r){let i=[],s=0;for(let o of t){let a=o+(this.astral?Zt(ct(r,o)):1);s&&i[s-1]==o?i[s-1]=a:(i[s++]=o,i[s++]=a)}return this.ret(e-r.length,i)}}class m5{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),r=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,t.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const Ue=K.define({combine(n){return cn(n,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:g5,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>r=>$f(e(r),t(r)),optionClass:(e,t)=>r=>$f(e(r),t(r)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function $f(n,e){return n?e?n+" "+e:n:e}function g5(n,e,t,r,i,s){let o=n.textDirection==Pe.RTL,a=o,l=!1,c="top",h,u,f=e.left-i.left,p=i.right-e.right,m=r.right-r.left,b=r.bottom-r.top;if(a&&f<Math.min(m,p)?a=!1:!a&&p<Math.min(m,f)&&(a=!0),m<=(a?f:p))h=Math.max(i.top,Math.min(t.top,i.bottom-b))-e.top,u=Math.min(400,a?f:p);else{l=!0,u=Math.min(400,(o?e.right:i.right-e.left)-30);let w=i.bottom-e.bottom;w>=b||w>e.top?h=t.bottom-e.top:(c="bottom",h=e.bottom-t.top)}let y=(e.bottom-e.top)/s.offsetHeight,v=(e.right-e.left)/s.offsetWidth;return{style:`${c}: ${h/y}px; max-width: ${u/v}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function b5(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),t.type&&r.classList.add(...t.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(t,r,i,s){let o=document.createElement("span");o.className="cm-completionLabel";let a=t.displayLabel||t.label,l=0;for(let c=0;c<s.length;){let h=s[c++],u=s[c++];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(t){if(!t.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=t.detail,r},position:80}),e.sort((t,r)=>t.position-r.position).map(t=>t.render)}function El(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let i=Math.floor(e/t);return{from:i*t,to:(i+1)*t}}let r=Math.floor((n-e)/t);return{from:n-(r+1)*t,to:n-r*t}}class y5{constructor(e,t,r){this.view=e,this.stateField=t,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 i=e.state.field(t),{options:s,selected:o}=i.open,a=e.state.facet(Ue);this.optionContent=b5(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=El(s.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:c}=e.state.field(t).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]<c.length){this.applyCompletion(e,c[+u[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(Ue).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Yi.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let r=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=i){let{options:s,selected:o,disabled:a}=r.open;(!i.open||i.open.options!=s)&&(this.range=El(s.length,o,e.state.facet(Ue).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),a!=((t=i.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of t.split(" "))r&&this.dom.classList.add(r);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=El(t.options.length,t.selected,this.view.state.facet(Ue).maxRenderedOptions),this.showOptions(t.options,e.id));let r=this.updateSelectedOption(t.selected);if(r){this.destroyInfo();let{completion:i}=t.options[t.selected],{info:s}=i;if(!s)return;let o=typeof s=="string"?document.createTextNode(s):s(i);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,i)}).catch(a=>ut(this.view.state,a,"completion info")):(this.addInfoPane(o,i),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){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:i,destroy:s}=e;r.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)r.nodeName!="LI"||!r.id?i--:i==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),t=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return t&&v5(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return i.top>Math.min(s.bottom,t.bottom)-10||i.bottom<Math.max(s.top,t.top)+10?null:this.view.state.facet(Ue).positionInfo(this.view,t,i,r,s,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,r){const i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",o=>{o.target==i&&o.preventDefault()});let s=null;for(let o=r.from;o<r.to;o++){let{completion:a,match:l}=e[o],{section:c}=a;if(c){let f=typeof c=="string"?c:c.name;if(f!=s&&(o>r.from||r.from==0))if(s=f,typeof c!="string"&&c.header)i.appendChild(c.header(c));else{let p=i.appendChild(document.createElement("completion-section"));p.textContent=f}}const h=i.appendChild(document.createElement("li"));h.id=t+"-"+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&&i.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function x5(n,e){return t=>new y5(t,n,e)}function v5(n,e){let t=n.getBoundingClientRect(),r=e.getBoundingClientRect(),i=t.height/n.offsetHeight;r.top<t.top?n.scrollTop-=(t.top-r.top)/i:r.bottom>t.bottom&&(n.scrollTop+=(r.bottom-t.bottom)/i)}function Bf(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function w5(n,e){let t=[],r=null,i=null,s=h=>{t.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(Ue);for(let h of n)if(h.hasResult()){let u=h.result.getMatch;if(h.result.filter===!1)for(let f of h.result.options)s(new Lf(f,h.source,u?u(f):[],1e9-t.length));else{let f=e.sliceDoc(h.from,h.to),p,m=o.filterStrict?new m5(f):new p5(f);for(let b of h.result.options)if(p=m.match(b.label)){let y=b.displayLabel?u?u(b,p.matched):[]:p.matched,v=p.score+(b.boost||0);if(s(new Lf(b,h.source,y,v)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:w}=b.section;i||(i=Object.create(null)),i[w]=Math.max(v,i[w]||-1e9)}}}}if(r){let h=Object.create(null),u=0,f=(p,m)=>(p.rank==="dynamic"&&m.rank==="dynamic"?i[m.name]-i[p.name]:0)||(typeof p.rank=="number"?p.rank:1e9)-(typeof m.rank=="number"?m.rank:1e9)||(p.name<m.name?-1:1);for(let p of r.sort(f))u-=1e5,h[p.name]=u;for(let p of t){let{section:m}=p.completion;m&&(p.score+=h[typeof m=="string"?m:m.name])}}let a=[],l=null,c=o.compareCompletions;for(let h of t.sort((u,f)=>f.score-u.score||c(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):Bf(h.completion)>Bf(l)&&(a[a.length-1]=h),l=h.completion}return a}class Cr{constructor(e,t,r,i,s,o){this.options=e,this.attrs=t,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new Cr(this.options,Ff(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,r,i,s,o){if(i&&!o&&e.some(c=>c.isPending))return i.setDisabled();let a=w5(e,t);if(!a.length)return i&&e.some(c=>c.isPending)?i.setDisabled():null;let l=t.facet(Ue).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let c=i.options[i.selected].completion;for(let h=0;h<a.length;h++)if(a[h].completion==c){l=h;break}}return new Cr(a,Ff(r,l),{pos:e.reduce((c,h)=>h.hasResult()?Math.min(c,h.from):c,1e8),create:P5,above:s.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new Cr(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Cr(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Oa{constructor(e,t,r){this.active=e,this.id=t,this.open=r}static start(){return new Oa(j5,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,r=t.facet(Ue),s=(r.override||t.languageDataAt("autocomplete",sr(t)).map(f5)).map(l=>(this.active.find(h=>h.source==l)||new Tt(l,this.active.some(h=>h.state!=0)?1:0)).update(e,r));s.length==this.active.length&&s.every((l,c)=>l==this.active[c])&&(s=this.active);let o=this.open,a=e.effects.some(l=>l.is(Xh));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!k5(s,this.active)||a?o=Cr.build(s,t,this.id,o,r,a):o&&o.disabled&&!s.some(l=>l.isPending)&&(o=null),!o&&s.every(l=>!l.isPending)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new Tt(l.source,0):l));for(let l of e.effects)l.is(Cb)&&(o=o&&o.setSelected(l.value,this.id));return s==this.active&&o==this.open?this:new Oa(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?S5:C5}}function k5(n,e){if(n==e)return!0;for(let t=0,r=0;;){for(;t<n.length&&!n[t].hasResult();)t++;for(;r<e.length&&!e[r].hasResult();)r++;let i=t==n.length,s=r==e.length;if(i||s)return i==s;if(n[t++].result!=e[r++].result)return!1}}const S5={"aria-autocomplete":"list"},C5={};function Ff(n,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":n};return e>-1&&(t["aria-activedescendant"]=n+"-"+e),t}const j5=[];function Sb(n,e){if(n.isUserEvent("input.complete")){let r=n.annotation(kb);if(r&&e.activateOnCompletion(r))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class Tt{constructor(e,t,r=!1){this.source=e,this.state=t,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let r=Sb(e,t),i=this;(r&8||r&16&&this.touches(e))&&(i=new Tt(i.source,0)),r&4&&i.state==0&&(i=new Tt(this.source,1)),i=i.updateFor(e,r);for(let s of e.effects)if(s.is(ja))i=new Tt(i.source,1,s.value);else if(s.is(Yi))i=new Tt(i.source,0);else if(s.is(Xh))for(let o of s.value)o.source==i.source&&(i=o);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(sr(e.state))}}class Rr extends Tt{constructor(e,t,r,i,s,o){super(e,3,t),this.limit=r,this.result=i,this.from=s,this.to=o}hasResult(){return!0}updateFor(e,t){var r;if(!(t&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=sr(e.state);if(a>o||!i||t&2&&(sr(e.startState)==this.from||a<this.limit))return new Tt(this.source,t&4?1:0);let l=e.changes.mapPos(this.limit);return O5(i.validFor,e.state,s,o)?new Rr(this.source,this.explicit,l,i,s,o):i.update&&(i=i.update(i,s,o,new vb(e.state,a,!1)))?new Rr(this.source,this.explicit,l,i,i.from,(r=i.to)!==null&&r!==void 0?r:sr(e.state)):new Tt(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Rr(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Tt(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function O5(n,e,t,r){if(!n)return!1;let i=e.sliceDoc(t,r);return typeof n=="function"?n(i,t,r,e):wb(n,!0).test(i)}const Xh=ae.define({map(n,e){return n.map(t=>t.map(e))}}),Cb=ae.define(),ht=Ye.define({create(){return Oa.start()},update(n,e){return n.update(e)},provide:n=>[zh.from(n,e=>e.tooltip),H.contentAttributes.from(n,e=>e.attrs)]});function Zh(n,e){const t=e.completion.apply||e.completion.label;let r=n.state.field(ht).active.find(i=>i.source==e.source);return r instanceof Rr?(typeof t=="string"?n.dispatch({...u5(n.state,t,r.from,r.to),annotations:kb.of(e.completion)}):t(n,e.completion,r.from,r.to),!0):!1}const P5=x5(ht,Zh);function Do(n,e="option"){return t=>{let r=t.state.field(ht,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<t.state.facet(Ue).interactionDelay)return!1;let i=1,s;e=="page"&&(s=f0(t,r.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,a=r.open.selected>-1?r.open.selected+i*(n?1:-1):n?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),t.dispatch({effects:Cb.of(a)}),!0}}const N5=n=>{let e=n.state.field(ht,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<n.state.facet(Ue).interactionDelay?!1:Zh(n,e.open.options[e.open.selected])},Rl=n=>n.state.field(ht,!1)?(n.dispatch({effects:ja.of(!0)}),!0):!1,A5=n=>{let e=n.state.field(ht,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:Yi.of(null)}),!0)};class M5{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const T5=50,D5=1e3,E5=Fe.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(ht).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(ht),t=n.state.facet(Ue);if(!n.selectionSet&&!n.docChanged&&n.startState.field(ht)==e)return;let r=n.transactions.some(s=>{let o=Sb(s,t);return o&8||(s.selection||s.docChanged)&&!(o&3)});for(let s=0;s<this.running.length;s++){let o=this.running[s];if(r||o.context.abortOnDocChange&&n.docChanged||o.updates.length+n.transactions.length>T5&&Date.now()-o.time>D5){for(let a of o.context.abortListeners)try{a()}catch(l){ut(this.view.state,l)}o.context.abortListeners=null,this.running.splice(s--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(s=>s.effects.some(o=>o.is(ja)))&&(this.pendingStart=!0);let i=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(o=>o.active.source==s.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let s of n.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(ht);for(let t of e.active)t.isPending&&!this.running.some(r=>r.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ue).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=sr(e),r=new vb(e,t,n.explicit,this.view),i=new M5(n,r);this.running.push(i),Promise.resolve(n.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:Yi.of(null)}),ut(this.view.state,s)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ue).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(Ue),r=this.view.state.field(ht);for(let i=0;i<this.running.length;i++){let s=this.running[i];if(s.done===void 0)continue;if(this.running.splice(i--,1),s.done){let a=sr(s.updates.length?s.updates[0].startState:this.view.state),l=Math.min(a,s.done.from+(s.active.explicit?0:1)),c=new Rr(s.active.source,s.active.explicit,l,s.done,s.done.from,(n=s.done.to)!==null&&n!==void 0?n:a);for(let h of s.updates)c=c.update(h,t);if(c.hasResult()){e.push(c);continue}}let o=r.active.find(a=>a.source==s.active.source);if(o&&o.isPending)if(s.done==null){let a=new Tt(s.active.source,0);for(let l of s.updates)a=a.update(l,t);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:Xh.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(ht,!1);if(e&&e.tooltip&&this.view.state.facet(Ue).closeOnBlur){let t=e.open&&f0(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Yi.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:ja.of(!1)}),20),this.composing=0}}}),R5=typeof navigator=="object"&&/Win/.test(navigator.platform),L5=dr.highest(H.domEventHandlers({keydown(n,e){let t=e.state.field(ht,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(R5&&n.altKey)||n.metaKey)return!1;let r=t.open.options[t.open.selected],i=t.active.find(o=>o.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(n.key)>-1&&Zh(e,r),!1}})),I5=H.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"}}}),Qi={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},rr=ae.define({map(n,e){let t=e.mapPos(n,-1,st.TrackAfter);return t??void 0}}),ed=new class extends Ln{};ed.startSide=1;ed.endSide=-1;const jb=Ye.define({create(){return pe.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:r=>r>=t.from&&r<=t.to})}for(let t of e.effects)t.is(rr)&&(n=n.update({add:[ed.range(t.value,t.value+1)]}));return n}});function $5(){return[F5,jb]}const Ll="()[]{}<>«»»«[]{}";function Ob(n){for(let e=0;e<Ll.length;e+=2)if(Ll.charCodeAt(e)==n)return Ll.charAt(e+1);return jh(n<128?n:n+1)}function Pb(n,e){return n.languageDataAt("closeBrackets",e)[0]||Qi}const B5=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),F5=H.inputHandler.of((n,e,t,r)=>{if((B5?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let i=n.state.selection.main;if(r.length>2||r.length==2&&Zt(ct(r,0))==1||e!=i.from||t!=i.to)return!1;let s=_5(n.state,r);return s?(n.dispatch(s),!0):!1}),V5=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let r=Pb(n,n.selection.main.head).brackets||Qi.brackets,i=null,s=n.changeByRange(o=>{if(o.empty){let a=H5(n.doc,o.head);for(let l of r)if(l==a&&Ga(n.doc,o.head)==Ob(ct(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:E.cursor(o.head-l.length)}}return{range:i=o}});return i||e(n.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},z5=[{key:"Backspace",run:V5}];function _5(n,e){let t=Pb(n,n.selection.main.head),r=t.brackets||Qi.brackets;for(let i of r){let s=Ob(ct(i,0));if(e==i)return s==i?K5(n,i,r.indexOf(i+i+i)>-1,t):W5(n,i,s,t.before||Qi.before);if(e==s&&Nb(n,n.selection.main.from))return U5(n,i,s)}return null}function Nb(n,e){let t=!1;return n.field(jb).between(0,n.doc.length,r=>{r==e&&(t=!0)}),t}function Ga(n,e){let t=n.sliceString(e,e+2);return t.slice(0,Zt(ct(t,0)))}function H5(n,e){let t=n.sliceString(e-2,e);return Zt(ct(t,0))==t.length?t:t.slice(1)}function W5(n,e,t,r){let i=null,s=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:rr.of(o.to+e.length),range:E.range(o.anchor+e.length,o.head+e.length)};let a=Ga(n.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+t,from:o.head},effects:rr.of(o.head+e.length),range:E.cursor(o.head+e.length)}:{range:i=o}});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function U5(n,e,t){let r=null,i=n.changeByRange(s=>s.empty&&Ga(n.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:E.cursor(s.head+t.length)}:r={range:s});return r?null:n.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function K5(n,e,t,r){let i=r.stringPrefixes||Qi.stringPrefixes,s=null,o=n.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:rr.of(a.to+e.length),range:E.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=Ga(n.doc,l),h;if(c==e){if(Vf(n,l))return{changes:{insert:e+e,from:l},effects:rr.of(l+e.length),range:E.cursor(l+e.length)};if(Nb(n,l)){let f=t&&n.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+f.length,insert:f},range:E.cursor(l+f.length)}}}else{if(t&&n.sliceDoc(l-2*e.length,l)==e+e&&(h=zf(n,l-2*e.length,i))>-1&&Vf(n,h))return{changes:{insert:e+e+e+e,from:l},effects:rr.of(l+e.length),range:E.cursor(l+e.length)};if(n.charCategorizer(l)(c)!=De.Word&&zf(n,l,i)>-1&&!G5(n,l,e,i))return{changes:{insert:e+e,from:l},effects:rr.of(l+e.length),range:E.cursor(l+e.length)}}return{range:s=a}});return s?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Vf(n,e){let t=tt(n).resolveInner(e+1);return t.parent&&t.from==e}function G5(n,e,t,r){let i=tt(n).resolveInner(e,-1),s=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=n.sliceDoc(i.from,Math.min(i.to,i.from+t.length+s)),l=a.indexOf(t);if(!l||l>-1&&r.indexOf(a.slice(0,l))>-1){let h=i.firstChild;for(;h&&h.from==i.from&&h.to-h.from>t.length+l;){if(n.sliceDoc(h.to-t.length,h.to)==t)return!1;h=h.firstChild}return!0}let c=i.to==e&&i.parent;if(!c)break;i=c}return!1}function zf(n,e,t){let r=n.charCategorizer(e);if(r(n.sliceDoc(e-1,e))!=De.Word)return e;for(let i of t){let s=e-i.length;if(n.sliceDoc(s,e)==i&&r(n.sliceDoc(s-1,s))!=De.Word)return s}return-1}function q5(n={}){return[L5,ht,Ue.of(n),E5,J5,I5]}const Ab=[{key:"Ctrl-Space",run:Rl},{mac:"Alt-`",run:Rl},{mac:"Alt-i",run:Rl},{key:"Escape",run:A5},{key:"ArrowDown",run:Do(!0)},{key:"ArrowUp",run:Do(!1)},{key:"PageDown",run:Do(!0,"page")},{key:"PageUp",run:Do(!1,"page")},{key:"Enter",run:N5}],J5=dr.highest(Ba.computeN([Ue],n=>n.facet(Ue).defaultKeymap?[Ab]:[]));class _f{constructor(e,t,r){this.from=e,this.to=t,this.diagnostic=r}}class Qn{constructor(e,t,r){this.diagnostics=e,this.panel=t,this.selected=r}static init(e,t,r){let i=r.facet(Xi).markerFilter;i&&(e=i(e,r));let s=e.slice().sort((p,m)=>p.from-m.from||p.to-m.to),o=new yn,a=[],l=0,c=r.doc.iter(),h=0,u=r.doc.length;for(let p=0;;){let m=p==s.length?null:s[p];if(!m&&!a.length)break;let b,y;if(a.length)b=l,y=a.reduce((C,j)=>Math.min(C,j.to),m&&m.from>b?m.from:1e8);else{if(b=m.from,b>u)break;y=m.to,a.push(m),p++}for(;p<s.length;){let C=s[p];if(C.from==b&&(C.to>C.from||C.to==b))a.push(C),p++,y=Math.min(C.to,y);else{y=Math.min(C.from,y);break}}y=Math.min(y,u);let v=!1;if(a.some(C=>C.from==b&&(C.to==y||y==u))&&(v=b==y,!v&&y-b<10)){let C=b-(h+c.value.length);C>0&&(c.next(C),h=b);for(let j=b;;){if(j>=y){v=!0;break}if(!c.lineBreak&&h+c.value.length>j)break;j=h+c.value.length,h+=c.value.length,c.next()}}let w=lC(a);if(v)o.add(b,b,ne.widget({widget:new iC(w),diagnostics:a.slice()}));else{let C=a.reduce((j,k)=>k.markClass?j+" "+k.markClass:j,"");o.add(b,y,ne.mark({class:"cm-lintRange cm-lintRange-"+w+C,diagnostics:a.slice(),inclusiveEnd:a.some(j=>j.to>y)}))}if(l=y,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 Qn(f,t,Hr(f))}}function Hr(n,e=null,t=0){let r=null;return n.between(t,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new _f(i,s,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new _f(r.from,s,r.diagnostic)}}),r}function Y5(n,e){let t=e.pos,r=e.end||t,i=n.state.facet(Xi).hideOn(n,t,r);if(i!=null)return i;let s=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(Mb))||n.changes.touchesRange(s.from,Math.max(s.to,r)))}function Q5(n,e){return n.field(wt,!1)?e:e.concat(ae.appendConfig.of(cC))}const Mb=ae.define(),td=ae.define(),Tb=ae.define(),wt=Ye.define({create(){return new Qn(ne.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),r=null,i=n.panel;if(n.selected){let s=e.changes.mapPos(n.selected.from,1);r=Hr(t,n.selected.diagnostic,s)||Hr(t,null,s)}!t.size&&i&&e.state.facet(Xi).autoPanel&&(i=null),n=new Qn(t,i,r)}for(let t of e.effects)if(t.is(Mb)){let r=e.state.facet(Xi).autoPanel?t.value.length?Zi.open:null:n.panel;n=Qn.init(t.value,r,e.state)}else t.is(td)?n=new Qn(n.diagnostics,t.value?Zi.open:null,n.selected):t.is(Tb)&&(n=new Qn(n.diagnostics,n.panel,t.value));return n},provide:n=>[Gi.from(n,e=>e.panel),H.decorations.from(n,e=>e.diagnostics)]}),X5=ne.mark({class:"cm-lintRange cm-lintRange-active"});function Z5(n,e,t){let{diagnostics:r}=n.state.field(wt),i,s=-1,o=-1;r.between(e-(t<0?1:0),e+(t>0?1:0),(l,c,{spec:h})=>{if(e>=l&&e<=c&&(l==c||(e>l||t>0)&&(e<c||t<0)))return i=h.diagnostics,s=l,o=c,!1});let a=n.state.facet(Xi).tooltipFilter;return i&&a&&(i=a(i,n.state)),i?{pos:s,end:o,above:n.state.doc.lineAt(s).to<o,create(){return{dom:eC(n,i)}}}:null}function eC(n,e){return je("ul",{class:"cm-tooltip-lint"},e.map(t=>Eb(n,t,!1)))}const tC=n=>{let e=n.state.field(wt,!1);(!e||!e.panel)&&n.dispatch({effects:Q5(n.state,[td.of(!0)])});let t=Ki(n,Zi.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},Hf=n=>{let e=n.state.field(wt,!1);return!e||!e.panel?!1:(n.dispatch({effects:td.of(!1)}),!0)},nC=n=>{let e=n.state.field(wt,!1);if(!e)return!1;let t=n.state.selection.main,r=e.diagnostics.iter(t.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==t.from&&r.to==t.to)?!1:(n.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},rC=[{key:"Mod-Shift-m",run:tC,preventDefault:!0},{key:"F8",run:nC}],Xi=K.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...cn(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Wf,tooltipFilter:Wf,needsRefresh:(e,t)=>e?t?r=>e(r)||t(r):e:t,hideOn:(e,t)=>e?t?(r,i,s)=>e(r,i,s)||t(r,i,s):e:t,autoPanel:(e,t)=>e||t})}}});function Wf(n,e){return n?e?(t,r)=>e(n(t,r),r):n:e}function Db(n){let e=[];if(n)e:for(let{name:t}of n){for(let r=0;r<t.length;r++){let i=t[r];if(/[a-zA-Z]/.test(i)&&!e.some(s=>s.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function Eb(n,e,t){var r;let i=t?Db(e.actions):[];return je("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},je("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((s,o)=>{let a=!1,l=p=>{if(p.preventDefault(),a)return;a=!0;let m=Hr(n.state.field(wt).diagnostics,e);m&&s.apply(n,m.from,m.to)},{name:c}=s,h=i[o]?c.indexOf(i[o]):-1,u=h<0?c:[c.slice(0,h),je("u",c.slice(h,h+1)),c.slice(h+1)],f=s.markClass?" "+s.markClass:"";return je("button",{type:"button",class:"cm-diagnosticAction"+f,onclick:l,onmousedown:l,"aria-label":` Action: ${c}${h<0?"":` (access key "${i[o]})"`}.`},u)}),e.source&&je("div",{class:"cm-diagnosticSource"},e.source))}class iC extends hn{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return je("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Uf{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Eb(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Zi{constructor(e){this.view=e,this.items=[];let t=i=>{if(i.keyCode==27)Hf(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=Db(s.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==i.keyCode){let l=Hr(this.view.state.field(wt).diagnostics,s);l&&s.actions[a].apply(e,l.from,l.to)}}else return;i.preventDefault()},r=i=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(i.target)&&this.moveSelection(s)};this.list=je("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:r}),this.dom=je("div",{class:"cm-panel-lint"},this.list,je("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Hf(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(wt).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(wt),r=0,i=!1,s=null,o=new Set;for(e.between(0,this.view.state.doc.length,(a,l,{spec:c})=>{for(let h of c.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 Uf(this.view,h),this.items.splice(r,0,f),i=!0):(f=this.items[u],u>r&&(this.items.splice(r,u-r),i=!0)),t&&f.diagnostic==t.diagnostic?f.dom.hasAttribute("aria-selected")||(f.dom.setAttribute("aria-selected","true"),s=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);)i=!0,this.items.pop();this.items.length==0&&(this.items.push(new Uf(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let c=l.height/this.list.offsetHeight;a.top<l.top?this.list.scrollTop-=(l.top-a.top)/c:a.bottom>l.bottom&&(this.list.scrollTop+=(a.bottom-l.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function t(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)t();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(wt),r=Hr(t.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Tb.of(r)})}static open(e){return new Zi(e)}}function sC(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(n)}</svg>')`}function Eo(n){return sC(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${n}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const oC=H.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:Eo("#d11")},".cm-lintRange-warning":{backgroundImage:Eo("orange")},".cm-lintRange-info":{backgroundImage:Eo("#999")},".cm-lintRange-hint":{backgroundImage:Eo("#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 aC(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function lC(n){let e="hint",t=1;for(let r of n){let i=aC(r.severity);i>t&&(t=i,e=r.severity)}return e}const cC=[wt,H.decorations.compute([wt],n=>{let{selected:e,panel:t}=n.field(wt);return!e||!t||e.from==e.to?ne.none:ne.set([X5.range(e.from,e.to)])}),fS(Z5,{hideOn:Y5}),oC];var Kf=function(e){e===void 0&&(e={});var{crosshairCursor:t=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(z5)),e.defaultKeymap!==!1&&(r=r.concat(R4)),e.searchKeymap!==!1&&(r=r.concat(o5)),e.historyKeymap!==!1&&(r=r.concat(z3)),e.foldKeymap!==!1&&(r=r.concat(XS)),e.completionKeymap!==!1&&(r=r.concat(Ab)),e.lintKeymap!==!1&&(r=r.concat(rC));var i=[];return e.lineNumbers!==!1&&i.push(CS()),e.highlightActiveLineGutter!==!1&&i.push(PS()),e.highlightSpecialChars!==!1&&i.push(_k()),e.history!==!1&&i.push(D3()),e.foldGutter!==!1&&i.push(n3()),e.drawSelection!==!1&&i.push(Tk()),e.dropCursor!==!1&&i.push(Ik()),e.allowMultipleSelections!==!1&&i.push(me.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&i.push(_S()),e.syntaxHighlighting!==!1&&i.push(Wh(o3,{fallback:!0})),e.bracketMatching!==!1&&i.push(f3()),e.closeBrackets!==!1&&i.push($5()),e.autocompletion!==!1&&i.push(q5()),e.rectangularSelection!==!1&&i.push(nS()),t!==!1&&i.push(sS()),e.highlightActiveLine!==!1&&i.push(qk()),e.highlightSelectionMatches!==!1&&i.push(z4()),e.tabSize&&typeof e.tabSize=="number"&&i.push(Va.of(" ".repeat(e.tabSize))),i.concat([Ba.of(r.flat())]).filter(Boolean)};const hC="#e5c07b",Gf="#e06c75",dC="#56b6c2",uC="#ffffff",Xo="#abb2bf",ah="#7d8799",fC="#61afef",pC="#98c379",qf="#d19a66",mC="#c678dd",gC="#21252b",Jf="#2c313a",Yf="#282c34",Il="#353a42",bC="#3E4451",Qf="#528bff",yC=H.theme({"&":{color:Xo,backgroundColor:Yf},".cm-content":{caretColor:Qf},".cm-cursor, .cm-dropCursor":{borderLeftColor:Qf},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:bC},".cm-panels":{backgroundColor:gC,color:Xo},".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:Yf,color:ah,border:"none"},".cm-activeLineGutter":{backgroundColor:Jf},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Il},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Il,borderBottomColor:Il},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Jf,color:Xo}}},{dark:!0}),xC=Kr.define([{tag:D.keyword,color:mC},{tag:[D.name,D.deleted,D.character,D.propertyName,D.macroName],color:Gf},{tag:[D.function(D.variableName),D.labelName],color:fC},{tag:[D.color,D.constant(D.name),D.standard(D.name)],color:qf},{tag:[D.definition(D.name),D.separator],color:Xo},{tag:[D.typeName,D.className,D.number,D.changed,D.annotation,D.modifier,D.self,D.namespace],color:hC},{tag:[D.operator,D.operatorKeyword,D.url,D.escape,D.regexp,D.link,D.special(D.string)],color:dC},{tag:[D.meta,D.comment],color:ah},{tag:D.strong,fontWeight:"bold"},{tag:D.emphasis,fontStyle:"italic"},{tag:D.strikethrough,textDecoration:"line-through"},{tag:D.link,color:ah,textDecoration:"underline"},{tag:D.heading,fontWeight:"bold",color:Gf},{tag:[D.atom,D.bool,D.special(D.variableName)],color:qf},{tag:[D.processingInstruction,D.string,D.inserted],color:pC},{tag:D.invalid,color:uC}]),vC=[yC,Wh(xC)];var wC=H.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),kC=function(e){e===void 0&&(e={});var{indentWithTab:t=!0,editable:r=!0,readOnly:i=!1,theme:s="light",placeholder:o="",basicSetup:a=!0}=e,l=[];switch(t&&l.unshift(Ba.of([L4])),a&&(typeof a=="boolean"?l.unshift(Kf()):l.unshift(Kf(a))),o&&l.unshift(Xk(o)),s){case"light":l.push(wC);break;case"dark":l.push(vC);break;case"none":break;default:l.push(s);break}return r===!1&&l.push(H.editable.of(!1)),i&&l.push(me.readOnly.of(!0)),[...l]},SC=n=>({line:n.state.doc.lineAt(n.state.selection.main.from),lineCount:n.state.doc.lines,lineBreak:n.state.lineBreak,length:n.state.doc.length,readOnly:n.state.readOnly,tabSize:n.state.tabSize,selection:n.state.selection,selectionAsSingle:n.state.selection.asSingle().main,ranges:n.state.selection.ranges,selectionCode:n.state.sliceDoc(n.state.selection.main.from,n.state.selection.main.to),selections:n.state.selection.ranges.map(e=>n.state.sliceDoc(e.from,e.to)),selectedText:n.state.selection.ranges.some(e=>!e.empty)});class CC{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(t=>{try{t()}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 Xf{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 $l=null,jC=()=>typeof window>"u"?new Xf:($l||($l=new Xf),$l),Zf=ln.define(),OC=200,PC=[];function NC(n){var{value:e,selection:t,onChange:r,onStatistics:i,onCreateEditor:s,onUpdate:o,extensions:a=PC,autoFocus:l,theme:c="light",height:h=null,minHeight:u=null,maxHeight:f=null,width:p=null,minWidth:m=null,maxWidth:b=null,placeholder:y="",editable:v=!0,readOnly:w=!1,indentWithTab:C=!0,basicSetup:j=!0,root:k,initialState:O}=n,[x,T]=g.useState(),[A,R]=g.useState(),[N,L]=g.useState(),W=g.useState(()=>({current:null}))[0],F=g.useState(()=>({current:null}))[0],B=H.theme({"&":{height:h,minHeight:u,maxHeight:f,width:p,minWidth:m,maxWidth:b},"& .cm-scroller":{height:"100% !important"}}),q=H.updateListener.of(J=>{if(J.docChanged&&typeof r=="function"&&!J.transactions.some(fe=>fe.annotation(Zf))){W.current?W.current.reset():(W.current=new CC(()=>{if(F.current){var fe=F.current;F.current=null,fe()}W.current=null},OC),jC().add(W.current));var ie=J.state.doc,le=ie.toString();r(le,J)}i&&i(SC(J))}),de=kC({theme:c,editable:v,readOnly:w,placeholder:y,indentWithTab:C,basicSetup:j}),z=[q,B,...de];return o&&typeof o=="function"&&z.push(H.updateListener.of(o)),z=z.concat(a),g.useLayoutEffect(()=>{if(x&&!N){var J={doc:e,selection:t,extensions:z},ie=O?me.fromJSON(O.json,J,O.fields):me.create(J);if(L(ie),!A){var le=new H({state:ie,parent:x,root:k});R(le),s&&s(le,ie)}}return()=>{A&&(L(void 0),R(void 0))}},[x,N]),g.useEffect(()=>{n.container&&T(n.container)},[n.container]),g.useEffect(()=>()=>{A&&(A.destroy(),R(void 0)),W.current&&(W.current.cancel(),W.current=null)},[A]),g.useEffect(()=>{l&&A&&A.focus()},[l,A]),g.useEffect(()=>{A&&A.dispatch({effects:ae.reconfigure.of(z)})},[c,a,h,u,f,p,m,b,y,v,w,C,j,r,o]),g.useEffect(()=>{if(e!==void 0){var J=A?A.state.doc.toString():"";if(A&&e!==J){var ie=W.current&&!W.current.isDone,le=()=>{A&&e!==A.state.doc.toString()&&A.dispatch({changes:{from:0,to:A.state.doc.toString().length,insert:e||""},annotations:[Zf.of(!0)]})};ie?F.current=le:le()}}},[e,A]),{state:N,setState:L,view:A,setView:R,container:x,setContainer:T}}var AC=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Rb=g.forwardRef((n,e)=>{var{className:t,value:r="",selection:i,extensions:s=[],onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:c,autoFocus:h,theme:u="light",height:f,minHeight:p,maxHeight:m,width:b,minWidth:y,maxWidth:v,basicSetup:w,placeholder:C,indentWithTab:j,editable:k,readOnly:O,root:x,initialState:T}=n,A=k3(n,AC),R=g.useRef(null),{state:N,view:L,container:W,setContainer:F}=NC({root:x,value:r,autoFocus:h,theme:u,height:f,minHeight:p,maxHeight:m,width:b,minWidth:y,maxWidth:v,basicSetup:w,placeholder:C,indentWithTab:j,editable:k,readOnly:O,selection:i,onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:c,extensions:s,initialState:T});g.useImperativeHandle(e,()=>({editor:R.current,state:N,view:L}),[R,W,N,L]);var B=g.useCallback(de=>{R.current=de,F(de)},[F]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var q=typeof u=="string"?"cm-theme-"+u:"cm-theme";return d.jsx("div",eh({ref:B,className:""+q+(t?" "+t:"")},A))});Rb.displayName="CodeMirror";const MC=()=>{const n=H.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=Kr.define([{tag:D.propertyName,color:"var(--dash-accent)"},{tag:D.string,color:"color-mix(in srgb, var(--dash-accent) 70%, var(--dash-text))"},{tag:D.number,color:"var(--dash-accent-hover)"},{tag:D.bool,color:"var(--dash-accent-hover)"},{tag:D.null,color:"var(--dash-text-muted)"},{tag:D.punctuation,color:"var(--dash-text-secondary)"},{tag:D.brace,color:"var(--dash-text-secondary)"},{tag:D.bracket,color:"var(--dash-text-secondary)"}]);return[n,Wh(e)]},TC=({value:n,onChange:e,onCursorLineChange:t,height:r="100%",readOnly:i=!1,className:s})=>{const o=g.useMemo(()=>[w3(),H.lineWrapping,...MC()],[]),a=g.useMemo(()=>{if(t)return l=>{const c=l.state.selection.main.head,h=l.view.state.doc.lineAt(c).number-1;t(h)}},[t]);return d.jsx("div",{className:`h-full [&_.cm-editor]:h-full [&_.cm-editor]:outline-none [&_.cm-focused]:outline-none ${s??""}`.trim(),children:d.jsx(Rb,{value:n,height:r,extensions:o,onChange:e,onUpdate:a,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}})})},nd=({width:n,isLoading:e,jsonText:t,cursorLine:r,syntaxError:i,onChange:s,onCursorLineChange:o,readOnly:a=!1,headerTitle:l,headerPath:c,headerActions:h})=>{const{t:u}=he(),f=p=>{if(a||!p.target.closest(".cm-editor"))return;const b=p.currentTarget;b.scrollHeight<=b.clientHeight||(b.scrollTop+=p.deltaY)};return d.jsxs("div",{style:{width:`${n}%`},className:"bg-dash-surface border border-dash-border rounded-xl overflow-hidden flex flex-col shadow-sm min-w-0 h-full",children:[d.jsx("div",{className:"p-3 border-b border-dash-border bg-dash-surface-hover/50 shrink-0",children:d.jsxs("div",{className:"flex items-end justify-between gap-3",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("h3",{className:"text-xs font-bold text-dash-text-secondary uppercase tracking-widest",children:l??u("jsonTab")}),c&&d.jsx("p",{className:"mt-1 mono text-[11px] text-dash-text-muted truncate",children:c})]}),h&&d.jsx("div",{className:"flex items-center gap-2 shrink-0",children:h})]})}),d.jsx("div",{className:"flex-1 min-h-0 overflow-auto",onWheelCapture:f,children:e?d.jsx("div",{className:"h-full flex items-center justify-center",children:d.jsx("div",{className:"animate-pulse text-dash-text-muted text-sm",children:u("loading")})}):a?d.jsx("pre",{className:"h-full overflow-auto p-4 font-mono text-xs leading-4 text-dash-text whitespace-pre m-0",children:t}):d.jsx(TC,{value:t,onChange:s,onCursorLineChange:o,readOnly:a,className:"[&_.cm-content]:text-xs [&_.cm-content]:leading-4 [&_.cm-gutters]:text-xs [&_.cm-gutters]:leading-4"})}),d.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:[d.jsxs("div",{className:"flex gap-4",children:[d.jsx("span",{children:"UTF-8"}),d.jsx("span",{children:"JSON"}),d.jsxs("span",{children:["L:",r+1]})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[a&&d.jsx("span",{children:u("readOnly")}),i?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),d.jsx("span",{className:"text-red-500 normal-case",children:i})]}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-dash-accent"}),u("syntaxValid")]})]})]})]})},ep=({label:n,value:e})=>d.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 bg-dash-bg border border-dash-border rounded-md",children:[d.jsxs("span",{className:"text-[9px] font-bold text-dash-text-muted uppercase",children:[n,":"]}),d.jsx("span",{className:"text-[10px] mono font-bold text-dash-text-secondary",children:e})]}),Lb=({width:n,fieldDoc:e,activeFieldPath:t,extraContent:r,overrideBadge:i})=>{const{t:s,lang:o}=he();return d.jsxs("div",{style:{width:`${n}%`},className:"bg-dash-surface border border-dash-border rounded-xl flex flex-col shadow-sm overflow-hidden min-w-0",children:[d.jsx("div",{className:"p-3 border-b border-dash-border bg-dash-surface-hover/50 shrink-0",children:d.jsx("h3",{className:"text-xs font-bold text-dash-text-secondary uppercase tracking-widest",children:s("configurationHelp")})}),d.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:e?d.jsxs("div",{className:"space-y-5 animate-in fade-in duration-500",children:[d.jsxs("header",{children:[d.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[d.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:s("field")}),d.jsx("h2",{className:"text-base font-bold text-dash-text mono break-all",children:e.path}),i]}),d.jsxs("div",{className:"flex flex-wrap gap-2 mt-2",children:[d.jsx(ep,{label:s("type"),value:e.type}),d.jsx(ep,{label:s("default"),value:e.default})]})]}),d.jsxs("section",{children:[d.jsx("h4",{className:"text-[10px] font-bold text-dash-text-muted uppercase tracking-widest mb-2",children:s("description")}),d.jsx("p",{className:"text-sm text-dash-text-secondary leading-relaxed italic",children:o==="vi"?e.descriptionVi:e.description})]}),e.validValues&&d.jsxs("section",{children:[d.jsx("h4",{className:"text-[10px] font-bold text-dash-text-muted uppercase tracking-widest mb-2",children:s("validValues")}),d.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.validValues.map(a=>d.jsx("span",{className:"px-2 py-0.5 bg-dash-bg border border-dash-border rounded text-[11px] mono text-dash-text",children:a},a))})]}),e.effect&&d.jsxs("section",{className:"bg-dash-accent-subtle/30 p-3 rounded-lg border border-dash-accent/10",children:[d.jsx("h4",{className:"text-[10px] font-bold text-dash-accent uppercase tracking-widest mb-1",children:s("systemEffect")}),d.jsx("p",{className:"text-[12px] text-dash-text-secondary leading-normal",children:o==="vi"&&e.effectVi?e.effectVi:e.effect})]}),e.example&&d.jsxs("section",{children:[d.jsx("h4",{className:"text-[10px] font-bold text-dash-text-muted uppercase tracking-widest mb-2",children:s("exampleUsage")}),d.jsx("div",{className:"bg-dash-bg p-3 rounded-lg border border-dash-border overflow-hidden",children:d.jsx("pre",{className:"text-[11px] mono text-dash-text-secondary whitespace-pre overflow-x-auto",children:e.example})})]}),r]}):d.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center opacity-40 space-y-4",children:[d.jsx("div",{className:"w-10 h-10 rounded-full bg-dash-bg border border-dash-border flex items-center justify-center text-lg",children:"?"}),d.jsxs("div",{className:"max-w-[180px]",children:[d.jsx("p",{className:"text-sm font-bold text-dash-text mb-1 italic",children:s("knowledgeBase")}),d.jsx("p",{className:"text-xs text-dash-text-secondary",children:s("clickToSeeHelp")})]})]})}),e&&d.jsx("div",{className:"p-3 bg-dash-surface-hover/20 border-t border-dash-border shrink-0",children:d.jsxs("p",{className:"text-[10px] text-dash-text-muted font-medium flex items-center gap-1.5 italic",children:[d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.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"})}),s("extractedFrom")]})})]})},DC=({variant:n="development"})=>{const{t:e}=he(),t={development:e("developmentFeature"),beta:e("betaFeature"),experimental:e("experimentalFeature")};return d.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:t[n]})},EC=({components:n,isChecking:e,isUpdating:t,onCheckAll:r,onUpdateAll:i,className:s})=>{const{t:o}=he(),a=n.filter(h=>h.status==="update-available").length,l=n.length>0&&n.every(h=>h.status==="up-to-date"||h.status==="idle"),c=n.filter(h=>h.status==="up-to-date").length;return d.jsxs("div",{className:`flex flex-wrap items-center gap-2 ${s??""}`,children:[d.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:[d.jsx("output",{className:"inline-flex items-center gap-2","aria-live":"polite","aria-atomic":"true",children:e?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),d.jsx("span",{className:"text-dash-text-secondary",children:o("checkingAll")})]}):a>0?d.jsx("span",{className:"text-amber-500 font-semibold",children:o("updatesAvailable").replace("{count}",a.toString())}):l?d.jsx("span",{className:"text-emerald-500 font-semibold",children:o("allUpToDate")}):d.jsx("span",{className:"text-dash-text-secondary font-medium",children:o("readyToScan")})}),c>0&&d.jsx("span",{className:"mono text-dash-text-muted border-l border-dash-border pl-2",children:c})]}),d.jsx("button",{type:"button",onClick:r,disabled:e||t,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&&d.jsx("button",{type:"button",onClick:i,disabled:t,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")})]})},RC=({value:n,onChange:e,disabled:t=!1})=>{const{t:r}=he();return d.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:[d.jsxs("label",{className:`dash-focus-ring px-3.5 py-2 text-xs font-semibold rounded-lg transition-colors cursor-pointer ${n==="stable"?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover"} ${t?"opacity-50 cursor-not-allowed":""}`,children:[d.jsx("input",{type:"radio",name:"channel",value:"stable",checked:n==="stable",onChange:()=>e("stable"),disabled:t,className:"sr-only"}),r("channelStable")]}),d.jsxs("label",{className:`dash-focus-ring px-3.5 py-2 text-xs font-semibold rounded-lg transition-colors cursor-pointer ${n==="beta"?"bg-amber-500/15 text-amber-500":"text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover"} ${t?"opacity-50 cursor-not-allowed":""}`,children:[d.jsx("input",{type:"radio",name:"channel",value:"beta",checked:n==="beta",onChange:()=>e("beta"),disabled:t,className:"sr-only"}),r("channelBeta")]})]})},LC={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}},Ib=({status:n,ariaLabel:e,size:t="sm"})=>{const r=LC[n],i=t==="sm"?"w-2 h-2":"w-2.5 h-2.5";return d.jsx("span",{className:`
52
+ transition-colors`,placeholder:"Enter passphrase..."}),h.jsx("button",{type:"button",onClick:()=>i(!r),className:"absolute right-2 top-1/2 -translate-y-1/2 text-dash-text-muted hover:text-dash-text transition-colors",children:r?h.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:h.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"})}):h.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),h.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"})]})})]})},Hv={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"},Wv=({source:n})=>{const{t:e}=ce(),t=()=>{switch(n){case"default":return e("default");case"project":return e("scopeProject");case"global":return e("scopeGlobal")}};return h.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded font-bold uppercase tracking-wider ${Hv[n]}`,children:t()})};function Uv(n,e){if(e.includes("passphrase")||e.includes("password"))return"password";if(n.enum&&n.enum.length>0)return"enum";switch(Array.isArray(n.type)?n.type.find(r=>r!=="null")||"string":n.type||"string"){case"boolean":return"boolean";case"integer":case"number":return"number";case"array":return"array";case"object":return"object";default:return"string"}}const Kv=({fieldPath:n,label:e,description:t,schema:r,value:i,source:s,onChange:o,disabled:a})=>{const l=Uv(r,n),c=()=>{const d={value:i,onChange:o,schema:r,disabled:a};switch(l){case"boolean":return h.jsx(Fv,{...d});case"number":return h.jsx(Bv,{...d});case"enum":return h.jsx(Vv,{...d});case"array":return h.jsx(zv,{...d});case"password":return h.jsx(_v,{...d});case"object":return null;default:return h.jsx($v,{...d})}};return l==="object"?null:h.jsx("div",{className:"py-3 border-b border-dash-border/50 last:border-b-0",children:h.jsxs("div",{className:"flex items-start justify-between gap-4",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[h.jsx("span",{className:"text-sm font-medium text-dash-text",children:e}),h.jsx(Wv,{source:s})]}),t&&h.jsx("p",{className:"text-xs text-dash-text-muted mb-2 leading-relaxed",children:t}),h.jsx("p",{className:"text-[10px] text-dash-text-muted/50 font-mono mb-2",children:n})]}),h.jsx("div",{className:l==="boolean"?"shrink-0":"w-1/2 max-w-xs",children:c()})]})})},Gv=({id:n,title:e,defaultCollapsed:t=!1,children:r})=>{const[i,s]=g.useState(t);return h.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-lg overflow-hidden",children:[h.jsxs("button",{type:"button",onClick:()=>s(!i),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":!i,"aria-controls":`section-${n}`,children:[h.jsx("h3",{className:"text-sm font-bold text-dash-text uppercase tracking-wider",children:e}),h.jsx("svg",{className:`w-4 h-4 text-dash-text-muted transition-transform duration-200 ${i?"":"rotate-180"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),h.jsx("div",{id:`section-${n}`,className:`transition-all duration-200 ease-in-out ${i?"max-h-0 overflow-hidden":"max-h-[2000px]"}`,children:h.jsx("div",{className:"px-4 py-2",children:r})})]})},qv=({schema:n,value:e,sources:t,sections:r,onChange:i,disabled:s})=>h.jsx("div",{className:"space-y-4",children:r.map((o,a)=>h.jsx(Gv,{id:o.id,title:o.title,defaultCollapsed:o.defaultCollapsed??a>1,children:o.fields.map(l=>{const c=Iv(n,l.path),d=fc(e,l.path),u=t[l.path]||"default";return h.jsx(Kv,{fieldPath:l.path,label:l.label,description:l.description||c.description,schema:c,value:d,source:u,onChange:f=>i(l.path,f),disabled:s},l.path)})},o.id))}),zm=({width:n,isLoading:e,schema:t,config:r,sources:i,sections:s,onChange:o})=>{const{t:a}=ce();return h.jsxs("div",{style:{width:`${n}%`},className:"bg-dash-surface border border-dash-border rounded-xl overflow-hidden flex flex-col shadow-sm min-w-0",children:[h.jsx("div",{className:"p-3 border-b border-dash-border bg-dash-surface-hover/50 shrink-0",children:h.jsx("h3",{className:"text-xs font-bold text-dash-text-secondary uppercase tracking-widest",children:a("formTab")})}),h.jsx("div",{className:"flex-1 overflow-auto p-4",children:e?h.jsx("div",{className:"h-full flex items-center justify-center",children:h.jsx("div",{className:"animate-pulse text-dash-text-muted text-sm",children:a("loading")})}):t?h.jsx(qv,{schema:t,value:r,sources:i,sections:s,onChange:o}):null})]})},_m=1024;let Jv=0,al=class{constructor(e,t){this.from=e,this.to=t}};class ue{constructor(e={}){this.id=Jv++,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=pt.match(e)),t=>{let r=e(t);return r===void 0?null:[this,r]}}}ue.closedBy=new ue({deserialize:n=>n.split(" ")});ue.openedBy=new ue({deserialize:n=>n.split(" ")});ue.group=new ue({deserialize:n=>n.split(" ")});ue.isolate=new ue({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});ue.contextHash=new ue({perNode:!0});ue.lookAhead=new ue({perNode:!0});ue.mounted=new ue({perNode:!0});class Si{constructor(e,t,r,i=!1){this.tree=e,this.overlay=t,this.parser=r,this.bracketed=i}static get(e){return e&&e.props&&e.props[ue.mounted.id]}}const Yv=Object.create(null);class pt{constructor(e,t,r,i=0){this.name=e,this.props=t,this.id=r,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):Yv,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new pt(e.name||"",t,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return i}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 t=this.prop(ue.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let i of r.split(" "))t[i]=e[r];return r=>{for(let i=r.prop(ue.group),s=-1;s<(i?i.length:0);s++){let o=t[s<0?r.name:i[s]];if(o)return o}}}}pt.none=new pt("",Object.create(null),0,8);class kh{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let r of this.types){let i=null;for(let s of e){let o=s(r);if(o){i||(i=Object.assign({},r.props));let a=o[1],l=o[0];l.combine&&l.id in i&&(a=l.combine(i[l.id],a)),i[l.id]=a}}t.push(i?new pt(r.name,i,r.id,r.flags):r)}return new kh(t)}}const co=new WeakMap,ru=new WeakMap;var Le;(function(n){n[n.ExcludeBuffers=1]="ExcludeBuffers",n[n.IncludeAnonymous=2]="IncludeAnonymous",n[n.IgnoreMounts=4]="IgnoreMounts",n[n.IgnoreOverlays=8]="IgnoreOverlays",n[n.EnterBracketed=16]="EnterBracketed"})(Le||(Le={}));class Be{constructor(e,t,r,i,s){if(this.type=e,this.children=t,this.positions=r,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,a]of s)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=Si.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let r of this.children){let i=r.toString();i&&(t&&(t+=","),t+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new mc(this.topNode,e)}cursorAt(e,t=0,r=0){let i=co.get(this)||this.topNode,s=new mc(i);return s.moveTo(e,t),co.set(this,s._tree),s}get topNode(){return new Et(this,0,0,null)}resolve(e,t=0){let r=Ri(co.get(this)||this.topNode,e,t,!1);return co.set(this,r),r}resolveInner(e,t=0){let r=Ri(ru.get(this)||this.topNode,e,t,!0);return ru.set(this,r),r}resolveStack(e,t=0){return Zv(this,e,t)}iterate(e){let{enter:t,leave:r,from:i=0,to:s=this.length}=e,o=e.mode||0,a=(o&Le.IncludeAnonymous)>0;for(let l=this.cursor(o|Le.IncludeAnonymous);;){let c=!1;if(l.from<=s&&l.to>=i&&(!a&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!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 t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:jh(pt.none,this.children,this.positions,0,this.children.length,0,this.length,(t,r,i)=>new Be(this.type,t,r,i,this.propValues),e.makeTree||((t,r,i)=>new Be(pt.none,t,r,i)))}static build(e){return e2(e)}}Be.empty=new Be(pt.none,[],[],0);class Sh{constructor(e,t){this.buffer=e,this.index=t}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 Sh(this.buffer,this.index)}}class Rn{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return pt.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],r=this.buffer[e+3],i=this.set.types[t],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,r==e)return s;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,r,i,s){let{buffer:o}=this,a=-1;for(let l=e;l!=t&&!(Hm(s,i,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,t,r){let i=this.buffer,s=new Uint16Array(t-e),o=0;for(let a=e,l=0;a<t;){s[l++]=i[a++],s[l++]=i[a++]-r;let c=s[l++]=i[a++]-r;s[l++]=i[a++]-e,o=Math.max(o,c)}return new Rn(s,o,this.set)}}function Hm(n,e,t,r){switch(n){case-2:return t<e;case-1:return r>=e&&t<e;case 0:return t<e&&r>e;case 1:return t<=e&&r>e;case 2:return r>e;case 4:return!0}}function Ri(n,e,t,r){for(var i;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to<e);){let o=!r&&n instanceof Et&&n.index<0?null:n.parent;if(!o)return n;n=o}let s=r?0:Le.IgnoreOverlays;if(r)for(let o=n,a=o.parent;a;o=a,a=o.parent)o instanceof Et&&o.index<0&&((i=a.enter(e,t,s))===null||i===void 0?void 0:i.from)!=o.from&&(n=a);for(;;){let o=n.enter(e,t,s);if(!o)return n;n=o}}class Wm{cursor(e=0){return new mc(this,e)}getChild(e,t=null,r=null){let i=iu(this,e,t,r);return i.length?i[0]:null}getChildren(e,t=null,r=null){return iu(this,e,t,r)}resolve(e,t=0){return Ri(this,e,t,!1)}resolveInner(e,t=0){return Ri(this,e,t,!0)}matchContext(e){return pc(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),r=this;for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(r=t,t=i.prevSibling):t=i}return r}get node(){return this}get next(){return this.parent}}class Et extends Wm{constructor(e,t,r,i){super(),this._tree=e,this.from=t,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,i,s=0){var o;for(let a=this;;){for(let{children:l,positions:c}=a._tree,d=t>0?l.length:-1;e!=d;e+=t){let u=l[e],f=c[e]+a.from;if(!(!(s&Le.EnterBracketed&&u instanceof Be&&((o=Si.get(u))===null||o===void 0?void 0:o.overlay)===null&&(f>=r||f+u.length<=r))&&!Hm(i,r,f,f+u.length))){if(u instanceof Rn){if(s&Le.ExcludeBuffers)continue;let p=u.findChild(0,u.buffer.length,t,r-f,i);if(p>-1)return new Mn(new Qv(a,u,e,f),null,p)}else if(s&Le.IncludeAnonymous||!u.type.isAnonymous||Ch(u)){let p;if(!(s&Le.IgnoreMounts)&&(p=Si.get(u))&&!p.overlay)return new Et(p.tree,f,e,a);let m=new Et(u,f,e,a);return s&Le.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(t<0?u.children.length-1:0,t,r,i,s)}}}if(s&Le.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+t:e=t<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,t,r=0){let i;if(!(r&Le.IgnoreOverlays)&&(i=Si.get(this._tree))&&i.overlay){let s=e-this.from,o=r&Le.EnterBracketed&&i.bracketed;for(let{from:a,to:l}of i.overlay)if((t>0||o?a<=s:a<s)&&(t<0||o?l>=s:l>s))return new Et(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,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 iu(n,e,t,r){let i=n.cursor(),s=[];if(!i.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=i.type.is(t),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function pc(n,e,t=e.length-1){for(let r=n;t>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[t]&&e[t]!=r.name)return!1;t--}}return!0}class Qv{constructor(e,t,r,i){this.parent=e,this.buffer=t,this.index=r,this.start=i}}class Mn extends Wm{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,t,r){super(),this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,r);return s<0?null:new Mn(this.context,this,s)}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,t,r=0){if(r&Le.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new Mn(this.context,this,s)}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,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Mn(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Mn(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let o=r.buffer[this.index+1];e.push(r.slice(i,s,o)),t.push(0)}return new Be(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Um(n){if(!n.length)return null;let e=0,t=n[0];for(let s=1;s<n.length;s++){let o=n[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let r=t instanceof Et&&t.index<0?null:t.parent,i=n.slice();return r?i[e]=r:i.splice(e,1),new Xv(i,t)}class Xv{constructor(e,t){this.heads=e,this.node=t}get next(){return Um(this.heads)}}function Zv(n,e,t){let r=n.resolveInner(e,t),i=null;for(let s=r instanceof Et?r:r.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[r])).push(o.resolve(e,t)),s=o}else{let o=Si.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Et(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(Ri(a,e,t,!1))}}return i?Um(i):r}class mc{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~Le.EnterBracketed,e instanceof Et)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,t){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof Et?(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,t,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}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,t,r=this.mode){return this.buffer?r&Le.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Le.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Le.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:t}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(t.findChild(i,this.index,-1,0,4))}else{let i=t.buffer[this.index+3];if(i<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(i)}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 t,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:r}=i)}else({index:t,_parent:r}=this._tree);for(;r;{index:t,_parent:r}=r)if(t>-1)for(let s=t+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let a=r._tree.children[s];if(this.mode&Le.IncludeAnonymous||a instanceof Rn||!a.type.isAnonymous||Ch(a))return!1}return!0}move(e,t){if(t&&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,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;t=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)t=new Mn(this.buffer,t,this.stack[i]);return this.bufferNode=new Mn(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&t&&t(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return pc(this.node.parent,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return pc(this._tree,e,i);let o=r[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function Ch(n){return n.children.some(e=>e instanceof Rn||!e.type.isAnonymous||Ch(e))}function e2(n){var e;let{buffer:t,nodeSet:r,maxBufferLength:i=_m,reused:s=[],minRepeatType:o=r.types.length}=n,a=Array.isArray(t)?new Sh(t,t.length):t,l=r.types,c=0,d=0;function u(k,O,y,D,A,R){let{id:N,start:L,end:W,size:F}=a,B=d,q=c;if(F<0)if(a.next(),F==-1){let le=s[N];y.push(le),D.push(L-k);return}else if(F==-3){c=N;return}else if(F==-4){d=N;return}else throw new RangeError(`Unrecognized record size: ${F}`);let de=l[N],z,J,ie=L-k;if(W-L<=i&&(J=x(a.pos-O,A))){let le=new Uint16Array(J.size-J.skip),fe=a.pos-J.size,we=le.length;for(;a.pos>fe;)we=w(J.start,le,we);z=new Rn(le,W-J.start,r),ie=J.start-k}else{let le=a.pos-F;a.next();let fe=[],we=[],ke=N>=o?N:-1,Ae=0,Qe=W;for(;a.pos>le;)ke>=0&&a.id==ke&&a.size>=0?(a.end<=Qe-i&&(m(fe,we,L,Ae,a.end,Qe,ke,B,q),Ae=fe.length,Qe=a.end),a.next()):R>2500?f(L,le,fe,we):u(L,le,fe,we,ke,R+1);if(ke>=0&&Ae>0&&Ae<fe.length&&m(fe,we,L,Ae,L,Qe,ke,B,q),fe.reverse(),we.reverse(),ke>-1&&Ae>0){let mt=p(de,q);z=jh(de,fe,we,0,fe.length,0,W-L,mt,mt)}else z=b(de,fe,we,W-L,B-W,q)}y.push(z),D.push(ie)}function f(k,O,y,D){let A=[],R=0,N=-1;for(;a.pos>O;){let{id:L,start:W,end:F,size:B}=a;if(B>4)a.next();else{if(N>-1&&W<N)break;N<0&&(N=F-i),A.push(L,W,F),R++,a.next()}}if(R){let L=new Uint16Array(R*4),W=A[A.length-2];for(let F=A.length-3,B=0;F>=0;F-=3)L[B++]=A[F],L[B++]=A[F+1]-W,L[B++]=A[F+2]-W,L[B++]=B;y.push(new Rn(L,A[2]-W,r)),D.push(W-k)}}function p(k,O){return(y,D,A)=>{let R=0,N=y.length-1,L,W;if(N>=0&&(L=y[N])instanceof Be){if(!N&&L.type==k&&L.length==A)return L;(W=L.prop(ue.lookAhead))&&(R=D[N]+L.length+W)}return b(k,y,D,A,R,O)}}function m(k,O,y,D,A,R,N,L,W){let F=[],B=[];for(;k.length>D;)F.push(k.pop()),B.push(O.pop()+y-A);k.push(b(r.types[N],F,B,R-A,L-R,W)),O.push(A-y)}function b(k,O,y,D,A,R,N){if(R){let L=[ue.contextHash,R];N=N?[L].concat(N):[L]}if(A>25){let L=[ue.lookAhead,A];N=N?[L].concat(N):[L]}return new Be(k,O,y,D,N)}function x(k,O){let y=a.fork(),D=0,A=0,R=0,N=y.end-i,L={size:0,start:0,skip:0};e:for(let W=y.pos-k;y.pos>W;){let F=y.size;if(y.id==O&&F>=0){L.size=D,L.start=A,L.skip=R,R+=4,D+=4,y.next();continue}let B=y.pos-F;if(F<0||B<W||y.start<N)break;let q=y.id>=o?4:0,de=y.start;for(y.next();y.pos>B;){if(y.size<0)if(y.size==-3||y.size==-4)q+=4;else break e;else y.id>=o&&(q+=4);y.next()}A=de,D+=F,R+=q}return(O<0||D==k)&&(L.size=D,L.start=A,L.skip=R),L.size>4?L:void 0}function w(k,O,y){let{id:D,start:A,end:R,size:N}=a;if(a.next(),N>=0&&D<o){let L=y;if(N>4){let W=a.pos-(N-4);for(;a.pos>W;)y=w(k,O,y)}O[--y]=L,O[--y]=R-k,O[--y]=A-k,O[--y]=D}else N==-3?c=D:N==-4&&(d=D);return y}let v=[],S=[];for(;a.pos>0;)u(n.start||0,n.bufferStart||0,v,S,-1,0);let j=(e=n.length)!==null&&e!==void 0?e:v.length?S[0]+v[0].length:0;return new Be(l[n.topID],v.reverse(),S.reverse(),j)}const su=new WeakMap;function Ho(n,e){if(!n.isAnonymous||e instanceof Rn||e.type!=n)return 1;let t=su.get(e);if(t==null){t=1;for(let r of e.children){if(r.type!=n||!(r instanceof Be)){t=1;break}t+=Ho(n,r)}su.set(e,t)}return t}function jh(n,e,t,r,i,s,o,a,l){let c=0;for(let m=r;m<i;m++)c+=Ho(n,e[m]);let d=Math.ceil(c*1.5/8),u=[],f=[];function p(m,b,x,w,v){for(let S=x;S<w;){let j=S,k=b[S],O=Ho(n,m[S]);for(S++;S<w;S++){let y=Ho(n,m[S]);if(O+y>=d)break;O+=y}if(S==j+1){if(O>d){let y=m[j];p(y.children,y.positions,0,y.children.length,b[j]+v);continue}u.push(m[j])}else{let y=b[S-1]+m[S-1].length-k;u.push(jh(n,m,b,j,S,k,y,null,l))}f.push(k+v-s)}}return p(e,t,r,i,0),(a||l)(u,f,o)}class ir{constructor(e,t,r,i,s=!1,o=!1){this.from=e,this.to=t,this.tree=r,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],r=!1){let i=[new ir(0,e.length,e,0,!1,r)];for(let s of t)s.to>e.length&&i.push(s);return i}static applyChanges(e,t,r=128){if(!t.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let d=a<t.length?t[a]:null,u=d?d.fromA:1e9;if(u-l>=r)for(;o&&o.from<u;){let f=o;if(l>=f.from||u<=f.to||c){let p=Math.max(f.from,l)-c,m=Math.min(f.to,u)-c;f=p>=m?null:new ir(p,m,f.tree,f.offset+c,a>0,!!d)}if(f&&i.push(f),o.to>u)break;o=s<e.length?e[s++]:null}if(!d)break;l=d.toA,c=d.toA-d.toB}return i}}class Km{startParse(e,t,r){return typeof e=="string"&&(e=new t2(e)),r=r?r.length?r.map(i=>new al(i.from,i.to)):[new al(0,0)]:[new al(0,e.length)],this.createParse(e,t||[],r)}parse(e,t,r){let i=this.startParse(e,t,r);for(;;){let s=i.advance();if(s)return s}}}class t2{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new ue({perNode:!0});var ou={};class ea{constructor(e,t,r,i,s,o,a,l,c,d=0,u){this.p=e,this.stack=t,this.state=r,this.reducePos=i,this.pos=s,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=d,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,r=0){let i=e.parser.context;return new ea(e,[],t,r,r,0,[],0,i?new au(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let r=e>>19,i=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=s.dynamicPrecedence(i);if(a&&(this.score+=a),r==0){this.pushState(s.getGoto(this.state,i,!0),this.reducePos),i<s.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(i,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from,d=this.reducePos-c;d>=2e3&&!(!((t=this.p.parser.nodeSet.types[i])===null||t===void 0)&&t.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=d):this.p.lastBigReductionSize<d&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=d));let u=l?this.stack[l-1]:0,f=this.bufferBase+this.buffer.length-u;if(i<s.minRepeatTerm||e&131072){let p=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,c,p,f+4,!0)}if(e&262144)this.state=this.stack[l];else{let p=this.stack[l-3];this.state=s.getGoto(p,i,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(i,c)}storeNode(e,t,r,i=4,s=!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(t==r)return;if(o.buffer[a-2]>=t){o.buffer[a-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,t,r,i);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,i>4&&(i-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=r,this.buffer[o+3]=i}}shift(e,t,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=i,this.shiftContext(t,r),t<=this.p.parser.maxNode&&this.buffer.push(t,r,i,4);else{let s=e,{parser:o}=this.p;(i>this.pos||t<=o.maxNode)&&(this.pos=i,o.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,r),this.shiftContext(t,r),t<=o.maxNode&&this.buffer.push(t,r,i,4)}}apply(e,t,r,i){e&65536?this.reduce(e):this.shift(e,t,r,i)}useNode(e,t){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(t,i),this.buffer.push(r,i,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,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let r=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new ea(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,r?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new n2(this);;){let r=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(r==0)return!1;if(!(r&65536))return!0;t.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let i=[];for(let s=0,o;s<t.length;s+=2)(o=t[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&i.push(t[s],o);if(this.stack.length<120)for(let s=0;i.length<8&&s<t.length;s+=2){let o=t[s+1];i.some((a,l)=>l&1&&a==o)||i.push(t[s],o)}t=i}let r=[];for(let i=0;i<t.length&&r.length<4;i+=2){let s=t[i+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[i],this.pos),o.reducePos=this.pos,o.score-=200,r.push(o)}return r}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let r=t>>19,i=t&65535,s=this.stack.length-r*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],r=(i,s)=>{if(!t.includes(i))return t.push(i),e.allActions(i,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-s;if(a>1){let l=o&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(o,s+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 t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}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 t=new au(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}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 au{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class n2{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=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 i=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=i}}class ta{constructor(e,t,r){this.stack=e,this.pos=t,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new ta(e,t,t-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 ta(this.stack,this.pos,this.index)}}function ho(n,e=Uint16Array){if(typeof n!="string")return n;let t=null;for(let r=0,i=0;r<n.length;){let s=0;for(;;){let o=n.charCodeAt(r++),a=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),s+=l,a)break;s*=46}t?t[i++]=s:t=new e(s)}return t}class Wo{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const lu=new Wo;class r2{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=lu,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let r=this.range,i=this.rangeIndex,s=this.pos+e;for(;s<r.from;){if(!i)return null;let o=this.ranges[--i];s-=r.from-o.to,r=o}for(;t<0?s>r.to:s>=r.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-r.to,r=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,r,i;if(t>=0&&t<this.chunk.length)r=this.pos+e,i=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(r=s,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)i=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)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(e,t=0){let r=t?this.resolveOffset(t,-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,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>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,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=lu,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,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let r="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return r}}class Nr{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:r}=t.p;i2(this.data,e,t,this.id,r.data,r.tokenPrecTable)}}Nr.prototype.contextual=Nr.prototype.fallback=Nr.prototype.extend=!1;Nr.prototype.fallback=Nr.prototype.extend=!1;function i2(n,e,t,r,i,s){let o=0,a=1<<r,{dialect:l}=t.p.parser;e:for(;a&n[o];){let c=n[o+1];for(let p=o+3;p<c;p+=2)if((n[p+1]&a)>0){let m=n[p];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||s2(m,e.token.value,i,s))){e.acceptToken(m);break}}let d=e.next,u=0,f=n[o+2];if(e.next<0&&f>u&&n[c+f*3-3]==65535){o=n[c+f*3-1];continue e}for(;u<f;){let p=u+f>>1,m=c+p+(p<<1),b=n[m],x=n[m+1]||65536;if(d<b)f=p;else if(d>=x)u=p+1;else{o=n[m+2],e.advance();continue e}}break}}function cu(n,e,t){for(let r=e,i;(i=n[r])!=65535;r++)if(i==t)return r-e;return-1}function s2(n,e,t,r){let i=cu(t,r,e);return i<0||cu(t,r,n)<i}const bt=typeof process<"u"&&ou&&/\bparse\b/.test(ou.LOG);let ll=null;function hu(n,e,t){let r=n.cursor(Le.IncludeAnonymous);for(r.moveTo(e);;)if(!(t<0?r.childBefore(e):r.childAfter(e)))for(;;){if((t<0?r.to<e:r.from>e)&&!r.type.isError)return t<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(n.length,Math.max(r.from+1,e+25));if(t<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return t<0?0:n.length}}class o2{constructor(e,t){this.fragments=e,this.nodeSet=t,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?hu(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?hu(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 t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let r=this.trees[t],i=this.index[t];if(i==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=r.children[i],o=this.start[t]+r.positions[i];if(o>e)return this.nextStart=o,null;if(s instanceof Be){if(o==e){if(o<this.safeFrom)return null;let a=o+s.length;if(a<=this.safeTo){let l=s.prop(ue.lookAhead);if(!l||a+l<this.fragment.to)return s}}this.index[t]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}}class a2{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Wo)}getActions(e){let t=0,r=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<s.length;c++){if(!(1<<c&o))continue;let d=s[c],u=this.tokens[c];if(!(r&&!d.fallback)&&((d.contextual||u.start!=e.pos||u.mask!=o||u.context!=a)&&(this.updateCachedToken(u,d,e),u.mask=o,u.context=a),u.lookAhead>u.end+25&&(l=Math.max(u.lookAhead,l)),u.value!=0)){let f=t;if(u.extended>-1&&(t=this.addActions(e,u.extended,u.end,t)),t=this.addActions(e,u.value,u.end,t),!d.extend&&(r=u,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new Wo,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,t=this.addActions(e,r.value,r.end,t)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Wo,{pos:r,p:i}=e;return t.start=r,t.end=Math.min(r+1,i.stream.end),t.value=r==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,r){let i=this.stream.clipPos(r.pos);if(t.token(this.stream.reset(i,e),r),e.value>-1){let{parser:s}=r.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let a=s.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(i+1)}putAction(e,t,r,i){for(let s=0;s<i;s+=3)if(this.actions[s]==e)return i;return this.actions[i++]=e,this.actions[i++]=t,this.actions[i++]=r,i}addActions(e,t,r,i){let{state:s}=e,{parser:o}=e.p,{data:a}=o;for(let l=0;l<2;l++)for(let c=o.stateSlot(s,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=mn(a,c+2);else{i==0&&a[c+1]==2&&(i=this.putAction(mn(a,c+2),t,r,i));break}a[c]==t&&(i=this.putAction(mn(a,c+1),t,r,i))}return i}}class l2{constructor(e,t,r,i){this.parser=e,this.input=t,this.ranges=i,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 r2(t,i),this.tokens=new a2(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[ea.start(this,e.top[0],s)],this.fragments=r.length&&this.stream.end-s>e.bufferLength*4?new o2(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,r=this.stacks=[],i,s;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>t)r.push(a);else{if(this.advanceStack(a,r,e))continue;{i||(i=[],s=[]),i.push(a);let l=this.tokens.getMainToken(a);s.push(l.value,l.end)}}break}}if(!r.length){let o=i&&h2(i);if(o)return bt&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw bt&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,r);if(o)return bt&&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>t)&&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 c=r[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.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,t,r){let i=e.pos,{parser:s}=this,o=bt?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,d=c?e.curContext.hash:0;for(let u=this.fragments.nodeAt(i);u;){let f=this.parser.nodeSet.types[u.type.id]==u.type?s.getGoto(e.state,u.type.id):-1;if(f>-1&&u.length&&(!c||(u.prop(ue.contextHash)||0)==d))return e.useNode(u,f),bt&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(u.type.id)})`),!0;if(!(u instanceof Be)||u.children.length==0||u.positions[0]>0)break;let p=u.children[0];if(p instanceof Be&&u.positions[0]==0)u=p;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),bt&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let d=l[c++],u=l[c++],f=l[c++],p=c==l.length||!r,m=p?e:e.split(),b=this.tokens.mainToken;if(m.apply(d,u,b?b.start:m.pos,f),bt&&console.log(o+this.stackID(m)+` (via ${d&65536?`reduce of ${s.getName(d&65535)}`:"shift"} for ${s.getName(u)} @ ${i}${m==e?"":", split"})`),p)return!0;m.pos>i?t.push(m):r.push(m)}return!1}advanceFully(e,t){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return du(e,t),!0}}runRecovery(e,t,r){let i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o],l=t[o<<1],c=t[(o<<1)+1],d=bt?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),bt&&console.log(d+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let u=a.split(),f=d;for(let p=0;p<10&&u.forceReduce()&&(bt&&console.log(f+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,r));p++)bt&&(f=this.stackID(u)+" -> ");for(let p of a.recoverByInsert(l))bt&&console.log(d+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,r);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),bt&&console.log(d+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),du(a,r)):(!i||i.score<a.score)&&(i=a)}return i}stackToTree(e){return e.close(),Be.build({buffer:ta.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 t=(ll||(ll=new WeakMap)).get(e);return t||ll.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function du(n,e){for(let t=0;t<e.length;t++){let r=e[t];if(r.pos==n.pos&&r.sameState(n)){e[t].score<n.score&&(e[t]=n);return}}e.push(n)}class c2{constructor(e,t,r){this.source=e,this.flags=t,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}class na extends Km{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let a=0;a<e.repeatNodeCount;a++)t.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),i=[];for(let a=0;a<t.length;a++)i.push([]);function s(a,l,c){i[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=ue[l]);for(let c=1;c<a.length;){let d=a[c++];if(d>=0)s(d,l,a[c++]);else{let u=a[c+-d];for(let f=-d;f>0;f--)s(a[c++],l,u);c++}}}this.nodeSet=new kh(t.map((a,l)=>pt.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:i[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=_m;let o=ho(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(uu),this.states=ho(e.states,Uint32Array),this.data=ho(e.stateData),this.goto=ho(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new Nr(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,t,r){let i=new l2(this,e,t,r);for(let s of this.wrappers)i=s(i,e,t,r);return i}getGoto(e,t,r=!1){let i=this.goto;if(t>=i[0])return-1;for(let s=i[t+1];;){let o=i[s++],a=o&1,l=i[s++];if(a&&r)return l;for(let c=s+(o>>1);s<c;s++)if(i[s]==e)return l;if(a)return-1}}hasAction(e,t){let r=this.data;for(let i=0;i<2;i++)for(let s=this.stateSlot(e,i?2:1),o;;s+=3){if((o=r[s])==65535)if(r[s+1]==1)o=r[s=mn(r,s+2)];else{if(r[s+1]==2)return mn(r,s+2);break}if(o==t||o==0)return mn(r,s+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,r=>r==t?!0:null)}allActions(e,t){let r=this.stateSlot(e,4),i=r?t(r):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=mn(this.data,s+2);else break;i=t(mn(this.data,s+1))}return i}nextStates(e){let t=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=mn(this.data,r+2);else break;if(!(this.data[r+2]&1)){let i=this.data[r+1];t.some((s,o)=>o&1&&s==i)||t.push(this.data[r],i)}}return t}configure(e){let t=Object.assign(Object.create(na.prototype),this);if(e.props&&(t.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}`);t.top=r}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(s=>s.from==r);return i?i.to:r})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((r,i)=>{let s=e.specializers.find(a=>a.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return t.specializers[i]=uu(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}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 t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),r=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(r[o]=!0)}let i=null;for(let s=0;s<t.length;s++)if(!r[s])for(let o=this.dialects[t[s]],a;(a=this.data[o++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new c2(e,r,i)}static deserialize(e){return new na(e)}}function mn(n,e){return n[e]|n[e+1]<<16}function h2(n){let e=null;for(let t of n){let r=t.p.stoppedAt;(t.pos==t.p.stream.end||r!=null&&t.pos>r)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function uu(n){if(n.external){let e=n.extend?1:0;return(t,r)=>n.external(t,r)<<1|e}return n.get}let d2=0;class At{constructor(e,t,r,i){this.name=e,this.set=t,this.base=r,this.modified=i,this.id=d2++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let r=typeof e=="string"?e:"?";if(e instanceof At&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let i=new At(r,[],null,[]);if(i.set.push(i),t)for(let s of t.set)i.set.push(s);return i}static defineModifier(e){let t=new ra(e);return r=>r.modified.indexOf(t)>-1?r:ra.get(r.base||r,r.modified.concat(t).sort((i,s)=>i.id-s.id))}}let u2=0;class ra{constructor(e){this.name=e,this.instances=[],this.id=u2++}static get(e,t){if(!t.length)return e;let r=t[0].instances.find(a=>a.base==e&&f2(t,a.modified));if(r)return r;let i=[],s=new At(e.name,i,e,t);for(let a of t)a.instances.push(s);let o=p2(t);for(let a of e.set)if(!a.modified.length)for(let l of o)i.push(ra.get(a,l));return s}}function f2(n,e){return n.length==e.length&&n.every((t,r)=>t==e[r])}function p2(n){let e=[[]];for(let t=0;t<n.length;t++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(n[t]));return e.sort((t,r)=>r.length-t.length)}function Gm(n){let e=Object.create(null);for(let t in n){let r=n[t];Array.isArray(r)||(r=[r]);for(let i of t.split(" "))if(i){let s=[],o=2,a=i;for(let u=0;;){if(a=="..."&&u>0&&u+3==i.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+i);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),u+=f[0].length,u==i.length)break;let p=i[u++];if(u==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);a=i.slice(u)}let l=s.length-1,c=s[l];if(!c)throw new RangeError("Invalid path: "+i);let d=new Li(r,o,l>0?s.slice(0,l):null);e[c]=d.sort(e[c])}}return qm.add(e)}const qm=new ue({combine(n,e){let t,r,i;for(;n||e;){if(!n||e&&n.depth>=e.depth?(i=e,e=e.next):(i=n,n=n.next),t&&t.mode==i.mode&&!i.context&&!t.context)continue;let s=new Li(i.tags,i.mode,i.context);t?t.next=s:r=s,t=s}return r}});class Li{constructor(e,t,r,i){this.tags=e,this.mode=t,this.context=r,this.next=i}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}}Li.empty=new Li([],2,null);function Jm(n,e){let t=Object.create(null);for(let s of n)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let o of s.tag)t[o.id]=s.class;let{scope:r,all:i=null}=e||{};return{style:s=>{let o=i;for(let a of s)for(let l of a.set){let c=t[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function m2(n,e){let t=null;for(let r of n){let i=r.style(e);i&&(t=t?t+" "+i:i)}return t}function g2(n,e,t,r=0,i=n.length){let s=new b2(r,Array.isArray(e)?e:[e],t);s.highlightRange(n.cursor(),r,i,"",s.highlighters),s.flush(i)}class b2{constructor(e,t,r){this.at=e,this.highlighters=t,this.span=r,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,r,i,s){let{type:o,from:a,to:l}=e;if(a>=r||l<=t)return;o.isTop&&(s=this.highlighters.filter(p=>!p.scope||p.scope(o)));let c=i,d=x2(e)||Li.empty,u=m2(s,d.tags);if(u&&(c&&(c+=" "),c+=u,d.mode==1&&(i+=(i?" ":"")+u)),this.startSpan(Math.max(t,a),c),d.opaque)return;let f=e.tree&&e.tree.prop(ue.mounted);if(f&&f.overlay){let p=e.node.enter(f.overlay[0].from+a,1),m=this.highlighters.filter(x=>!x.scope||x.scope(f.tree.type)),b=e.firstChild();for(let x=0,w=a;;x++){let v=x<f.overlay.length?f.overlay[x]:null,S=v?v.from+a:l,j=Math.max(t,w),k=Math.min(r,S);if(j<k&&b)for(;e.from<k&&(this.highlightRange(e,j,k,i,s),this.startSpan(Math.min(k,e.to),c),!(e.to>=S||!e.nextSibling())););if(!v||S>r)break;w=v.to+a,w>t&&(this.highlightRange(p.cursor(),Math.max(t,v.from+a),Math.min(r,w),"",m),this.startSpan(Math.min(r,w),c))}b&&e.parent()}else if(e.firstChild()){f&&(i="");do if(!(e.to<=t)){if(e.from>=r)break;this.highlightRange(e,t,r,i,s),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function x2(n){let e=n.type.prop(qm);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const _=At.define,uo=_(),Sn=_(),fu=_(Sn),pu=_(Sn),Cn=_(),fo=_(Cn),cl=_(Cn),Yt=_(),qn=_(Yt),Gt=_(),qt=_(),gc=_(),li=_(gc),po=_(),T={comment:uo,lineComment:_(uo),blockComment:_(uo),docComment:_(uo),name:Sn,variableName:_(Sn),typeName:fu,tagName:_(fu),propertyName:pu,attributeName:_(pu),className:_(Sn),labelName:_(Sn),namespace:_(Sn),macroName:_(Sn),literal:Cn,string:fo,docString:_(fo),character:_(fo),attributeValue:_(fo),number:cl,integer:_(cl),float:_(cl),bool:_(Cn),regexp:_(Cn),escape:_(Cn),color:_(Cn),url:_(Cn),keyword:Gt,self:_(Gt),null:_(Gt),atom:_(Gt),unit:_(Gt),modifier:_(Gt),operatorKeyword:_(Gt),controlKeyword:_(Gt),definitionKeyword:_(Gt),moduleKeyword:_(Gt),operator:qt,derefOperator:_(qt),arithmeticOperator:_(qt),logicOperator:_(qt),bitwiseOperator:_(qt),compareOperator:_(qt),updateOperator:_(qt),definitionOperator:_(qt),typeOperator:_(qt),controlOperator:_(qt),punctuation:gc,separator:_(gc),bracket:li,angleBracket:_(li),squareBracket:_(li),paren:_(li),brace:_(li),content:Yt,heading:qn,heading1:_(qn),heading2:_(qn),heading3:_(qn),heading4:_(qn),heading5:_(qn),heading6:_(qn),contentSeparator:_(Yt),list:_(Yt),quote:_(Yt),emphasis:_(Yt),strong:_(Yt),link:_(Yt),monospace:_(Yt),strikethrough:_(Yt),inserted:_(),deleted:_(),changed:_(),invalid:_(),meta:po,documentMeta:_(po),annotation:_(po),processingInstruction:_(po),definition:At.defineModifier("definition"),constant:At.defineModifier("constant"),function:At.defineModifier("function"),standard:At.defineModifier("standard"),local:At.defineModifier("local"),special:At.defineModifier("special")};for(let n in T){let e=T[n];e instanceof At&&(e.name=n)}Jm([{tag:T.link,class:"tok-link"},{tag:T.heading,class:"tok-heading"},{tag:T.emphasis,class:"tok-emphasis"},{tag:T.strong,class:"tok-strong"},{tag:T.keyword,class:"tok-keyword"},{tag:T.atom,class:"tok-atom"},{tag:T.bool,class:"tok-bool"},{tag:T.url,class:"tok-url"},{tag:T.labelName,class:"tok-labelName"},{tag:T.inserted,class:"tok-inserted"},{tag:T.deleted,class:"tok-deleted"},{tag:T.literal,class:"tok-literal"},{tag:T.string,class:"tok-string"},{tag:T.number,class:"tok-number"},{tag:[T.regexp,T.escape,T.special(T.string)],class:"tok-string2"},{tag:T.variableName,class:"tok-variableName"},{tag:T.local(T.variableName),class:"tok-variableName tok-local"},{tag:T.definition(T.variableName),class:"tok-variableName tok-definition"},{tag:T.special(T.variableName),class:"tok-variableName2"},{tag:T.definition(T.propertyName),class:"tok-propertyName tok-definition"},{tag:T.typeName,class:"tok-typeName"},{tag:T.namespace,class:"tok-namespace"},{tag:T.className,class:"tok-className"},{tag:T.macroName,class:"tok-macroName"},{tag:T.propertyName,class:"tok-propertyName"},{tag:T.operator,class:"tok-operator"},{tag:T.comment,class:"tok-comment"},{tag:T.meta,class:"tok-meta"},{tag:T.invalid,class:"tok-invalid"},{tag:T.punctuation,class:"tok-punctuation"}]);const y2=Gm({String:T.string,Number:T.number,"True False":T.bool,PropertyName:T.propertyName,Null:T.null,", :":T.separator,"[ ]":T.squareBracket,"{ }":T.brace}),v2=na.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:[y2],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 bc=[],Ym=[];(()=>{let n="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,t=0;e<n.length;e++)(e%2?Ym:bc).push(t=t+n[e])})();function w2(n){if(n<768)return!1;for(let e=0,t=bc.length;;){let r=e+t>>1;if(n<bc[r])t=r;else if(n>=Ym[r])e=r+1;else return!0;if(e==t)return!1}}function mu(n){return n>=127462&&n<=127487}const gu=8205;function k2(n,e,t=!0,r=!0){return(t?Qm:S2)(n,e,r)}function Qm(n,e,t){if(e==n.length)return e;e&&Xm(n.charCodeAt(e))&&Zm(n.charCodeAt(e-1))&&e--;let r=hl(n,e);for(e+=bu(r);e<n.length;){let i=hl(n,e);if(r==gu||i==gu||t&&w2(i))e+=bu(i),r=i;else if(mu(i)){let s=0,o=e-2;for(;o>=0&&mu(hl(n,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function S2(n,e,t){for(;e>0;){let r=Qm(n,e-2,t);if(r<e)return r;e--}return 0}function hl(n,e){let t=n.charCodeAt(e);if(!Zm(t)||e+1==n.length)return t;let r=n.charCodeAt(e+1);return Xm(r)?(t-55296<<10)+(r-56320)+65536:t}function Xm(n){return n>=56320&&n<57344}function Zm(n){return n>=55296&&n<56320}function bu(n){return n<65536?1:2}class ye{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,t,r){[e,t]=Ir(this,e,t);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(t,this.length,i,1),Xt.from(i,this.length-(t-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Ir(this,e,t);let r=[];return this.decompose(e,t,r,0),Xt.from(r,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new Ci(this),s=new Ci(e);for(let o=t,a=t;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(a+=i.value.length,i.done||a>=r)return!0}}iter(e=1){return new Ci(this,e)}iterRange(e,t=this.length){return new eg(this,e,t)}iterLines(e,t){let r;if(e==null)r=this.iter();else{t==null&&(t=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new tg(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]?ye.empty:e.length<=32?new $e(e):Xt.from($e.split(e,[]))}}class $e extends ye{constructor(e,t=C2(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,r,i){for(let s=0;;s++){let o=this.text[s],a=i+o.length;if((t?r:a)>=e)return new j2(i,a,r,o);i=a+1,r++}}decompose(e,t,r,i){let s=e<=0&&t>=this.length?this:new $e(xu(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),a=Uo(s.text,o.text.slice(),0,s.length);if(a.length<=32)r.push(new $e(a,o.length+s.length));else{let l=a.length>>1;r.push(new $e(a.slice(0,l)),new $e(a.slice(l)))}}else r.push(s)}replace(e,t,r){if(!(r instanceof $e))return super.replace(e,t,r);[e,t]=Ir(this,e,t);let i=Uo(this.text,Uo(r.text,xu(this.text,0,e)),t),s=this.length+r.length-(t-e);return i.length<=32?new $e(i,s):Xt.from($e.split(i,[]),s)}sliceString(e,t=this.length,r=`
53
+ `){[e,t]=Ir(this,e,t);let i="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let a=this.text[o],l=s+a.length;s>e&&o&&(i+=r),e<l&&t>s&&(i+=a.slice(Math.max(0,e-s),t-s)),s=l+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(t.push(new $e(r,i)),r=[],i=-1);return i>-1&&t.push(new $e(r,i)),t}}class Xt extends ye{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,t,r,i){for(let s=0;;s++){let o=this.children[s],a=i+o.length,l=r+o.lines-1;if((t?l:a)>=e)return o.lineInner(e,t,r,i);i=a+1,r=l+1}}decompose(e,t,r,i){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let a=this.children[s],l=o+a.length;if(e<=l&&t>=o){let c=i&((o<=e?1:0)|(l>=t?2:0));o>=e&&l<=t&&!c?r.push(a):a.decompose(e-o,t-o,r,c)}o=l+1}}replace(e,t,r){if([e,t]=Ir(this,e,t),r.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let o=this.children[i],a=s+o.length;if(e>=s&&t<=a){let l=o.replace(e-s,t-s,r),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let d=this.children.slice();return d[i]=l,new Xt(d,this.length-(t-e)+r.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,t,r)}sliceString(e,t=this.length,r=`
54
+ `){[e,t]=Ir(this,e,t);let i="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let a=this.children[s],l=o+a.length;o>e&&s&&(i+=r),e<l&&t>o&&(i+=a.sliceString(e-o,t-o,r)),o=l+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Xt))return 0;let r=0,[i,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,s+=t){if(i==o||s==a)return r;let l=this.children[i],c=e.children[s];if(l!=c)return r+l.scanIdentical(c,t);r+=l.length+1}}static from(e,t=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let p of e)r+=p.lines;if(r<32){let p=[];for(let m of e)m.flatten(p);return new $e(p,t)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,a=[],l=0,c=-1,d=[];function u(p){let m;if(p.lines>s&&p instanceof Xt)for(let b of p.children)u(b);else p.lines>o&&(l>o||!l)?(f(),a.push(p)):p instanceof $e&&l&&(m=d[d.length-1])instanceof $e&&p.lines+m.lines<=32?(l+=p.lines,c+=p.length+1,d[d.length-1]=new $e(m.text.concat(p.text),m.length+1+p.length)):(l+p.lines>i&&f(),l+=p.lines,c+=p.length+1,d.push(p))}function f(){l!=0&&(a.push(d.length==1?d[0]:Xt.from(d,c)),c=-1,l=d.length=0)}for(let p of e)u(p);return f(),a.length==1?a[0]:new Xt(a,t)}}ye.empty=new $e([""],0);function C2(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Uo(n,e,t=0,r=1e9){for(let i=0,s=0,o=!0;s<n.length&&i<=r;s++){let a=n[s],l=i+a.length;l>=t&&(l>r&&(a=a.slice(0,r-i)),i<t&&(a=a.slice(t-i)),o?(e[e.length-1]+=a,o=!1):e.push(a)),i=l+1}return e}function xu(n,e,t){return Uo(n,[""],e,t)}class Ci{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof $e?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,a=i instanceof $e?i.text.length:i.children.length;if(o==(t>0?a:0)){if(r==0)return this.done=!0,this.value="",this;t>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[r]+=t,e==0)return this.lineBreak=!0,this.value=`
55
+ `,this;e--}else if(i instanceof $e){let l=i.text[o+(t<0?-1:0)];if(this.offsets[r]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=t):(t<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof $e?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 eg{constructor(e,t,r){this.value="",this.done=!1,this.cursor=new Ci(e,t>r?-1:1),this.pos=t>r?e.length:0,this.from=Math.min(t,r),this.to=Math.max(t,r)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let r=t<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=r?i:t<0?i.slice(i.length-r):i.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 tg{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:r,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(ye.prototype[Symbol.iterator]=function(){return this.iter()},Ci.prototype[Symbol.iterator]=eg.prototype[Symbol.iterator]=tg.prototype[Symbol.iterator]=function(){return this});class j2{constructor(e,t,r,i){this.from=e,this.to=t,this.number=r,this.text=i}get length(){return this.to-this.from}}function Ir(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function _e(n,e,t=!0,r=!0){return k2(n,e,t,r)}function O2(n){return n>=56320&&n<57344}function P2(n){return n>=55296&&n<56320}function ct(n,e){let t=n.charCodeAt(e);if(!P2(t)||e+1==n.length)return t;let r=n.charCodeAt(e+1);return O2(r)?(t-55296<<10)+(r-56320)+65536:t}function Oh(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Zt(n){return n<65536?1:2}const xc=/\r\n?|\n/;var ot=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(ot||(ot={}));class sn{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t+1];e+=r<0?this.sections[t]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,r=0,i=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(r,i,s),i+=s):i+=o,r+=s}}iterChangedRanges(e,t=!1){yc(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let r=this.sections[t++],i=this.sections[t++];i<0?e.push(r,i):e.push(i,r)}return new sn(e)}composeDesc(e){return this.empty?e:e.empty?this:ng(this,e)}mapDesc(e,t=!1){return e.empty?this:vc(this,e,t)}mapPos(e,t=-1,r=ot.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=i+a;if(l<0){if(c>e)return s+(e-i);s+=a}else{if(r!=ot.Simple&&c>=e&&(r==ot.TrackDel&&i<e&&c>e||r==ot.TrackBefore&&i<e||r==ot.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!a)return e==i||t<0?s:s+l;s+=l}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,t=e){for(let r=0,i=0;r<this.sections.length&&i<=t;){let s=this.sections[r++],o=this.sections[r++],a=i+s;if(o>=0&&i<=t&&a>=e)return i<e&&a>t?"cover":!0;i=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let r=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new sn(e)}static create(e){return new sn(e)}}class ze extends sn{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return yc(this,(t,r,i,s,o)=>e=e.replace(i,i+(r-t),o),!1),e}mapDesc(e,t=!1){return vc(this,e,t,!0)}invert(e){let t=this.sections.slice(),r=[];for(let i=0,s=0;i<t.length;i+=2){let o=t[i],a=t[i+1];if(a>=0){t[i]=a,t[i+1]=o;let l=i>>1;for(;r.length<l;)r.push(ye.empty);r.push(o?e.slice(s,s+o):ye.empty)}s+=o}return new ze(t,r)}compose(e){return this.empty?e:e.empty?this:ng(this,e,!0)}map(e,t=!1){return e.empty?this:vc(this,e,t,!0)}iterChanges(e,t=!1){yc(this,e,t)}get desc(){return sn.create(this.sections)}filter(e){let t=[],r=[],i=[],s=new Ii(this);e:for(let o=0,a=0;;){let l=o==e.length?1e9:e[o++];for(;a<l||a==l&&s.len==0;){if(s.done)break e;let d=Math.min(s.len,l-a);et(i,d,-1);let u=s.ins==-1?-1:s.off==0?s.ins:0;et(t,d,u),u>0&&Dn(r,t,s.text),s.forward(d),a+=d}let c=e[o++];for(;a<c;){if(s.done)break e;let d=Math.min(s.len,c-a);et(t,d,-1),et(i,d,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(d),a+=d}}return{changes:new ze(t,r),filtered:sn.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t],i=this.sections[t+1];i<0?e.push(r):i==0?e.push([r]):e.push([r].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,r){let i=[],s=[],o=0,a=null;function l(d=!1){if(!d&&!i.length)return;o<t&&et(i,t-o,-1);let u=new ze(i,s);a=a?a.compose(u.map(a)):u,i=[],s=[],o=0}function c(d){if(Array.isArray(d))for(let u of d)c(u);else if(d instanceof ze){if(d.length!=t)throw new RangeError(`Mismatched change set length (got ${d.length}, expected ${t})`);l(),a=a?a.compose(d.map(a)):d}else{let{from:u,to:f=u,insert:p}=d;if(u>f||u<0||f>t)throw new RangeError(`Invalid change range ${u} to ${f} (in doc of length ${t})`);let m=p?typeof p=="string"?ye.of(p.split(r||xc)):p:ye.empty,b=m.length;if(u==f&&b==0)return;u<o&&l(),u>o&&et(i,u-o,-1),et(i,f-u,b),Dn(s,i,m),o=f}}return c(e),l(!a),a}static empty(e){return new ze(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],r=[];for(let i=0;i<e.length;i++){let s=e[i];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;r.length<i;)r.push(ye.empty);r[i]=ye.of(s.slice(1)),t.push(s[0],r[i].length)}}}return new ze(t,r)}static createSet(e,t){return new ze(e,t)}}function et(n,e,t,r=!1){if(e==0&&t<=0)return;let i=n.length-2;i>=0&&t<=0&&t==n[i+1]?n[i]+=e:i>=0&&e==0&&n[i]==0?n[i+1]+=t:r?(n[i]+=e,n[i+1]+=t):n.push(e,t)}function Dn(n,e,t){if(t.length==0)return;let r=e.length-2>>1;if(r<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<r;)n.push(ye.empty);n.push(t)}}function yc(n,e,t){let r=n.inserted;for(let i=0,s=0,o=0;o<n.sections.length;){let a=n.sections[o++],l=n.sections[o++];if(l<0)i+=a,s+=a;else{let c=i,d=s,u=ye.empty;for(;c+=a,d+=l,l&&r&&(u=u.append(r[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)a=n.sections[o++],l=n.sections[o++];e(i,c,s,d,u),i=c,s=d}}}function vc(n,e,t,r=!1){let i=[],s=r?[]:null,o=new Ii(n),a=new Ii(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 c=Math.min(o.len,a.len);et(i,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!t))){let c=a.len;for(et(i,a.ins,-1);c;){let d=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=d&&(et(i,0,o.ins),s&&Dn(s,i,o.text),l=o.i),o.forward(d),c-=d}a.next()}else if(o.ins>=0){let c=0,d=o.len;for(;d;)if(a.ins==-1){let u=Math.min(d,a.len);c+=u,d-=u,a.forward(u)}else if(a.ins==0&&a.len<d)d-=a.len,a.next();else break;et(i,c,l<o.i?o.ins:0),s&&l<o.i&&Dn(s,i,o.text),l=o.i,o.forward(o.len-d)}else{if(o.done&&a.done)return s?ze.createSet(i,s):sn.create(i);throw new Error("Mismatched change set lengths")}}}function ng(n,e,t=!1){let r=[],i=t?[]:null,s=new Ii(n),o=new Ii(e);for(let a=!1;;){if(s.done&&o.done)return i?ze.createSet(r,i):sn.create(r);if(s.ins==0)et(r,s.len,0,a),s.next();else if(o.len==0&&!o.done)et(r,0,o.ins,a),i&&Dn(i,r,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(s.len2,o.len),c=r.length;if(s.ins==-1){let d=o.ins==-1?-1:o.off?0:o.ins;et(r,l,d,a),i&&d&&Dn(i,r,o.text)}else o.ins==-1?(et(r,s.off?0:s.len,l,a),i&&Dn(i,r,s.textBit(l))):(et(r,s.off?0:s.len,o.off?0:o.ins,a),i&&!o.off&&Dn(i,r,o.text));a=(s.ins>l||o.ins>=0&&o.len>l)&&(a||r.length>c),s.forward2(l),o.forward(l)}}}}class Ii{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,t=this.i-2>>1;return t>=e.length?ye.empty:e[t]}textBit(e){let{inserted:t}=this.set,r=this.i-2>>1;return r>=t.length&&!e?ye.empty:t[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 tr{constructor(e,t,r){this.from=e,this.to=t,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,t=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,t):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new tr(r,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return E.range(e,t);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return E.range(this.anchor,r)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!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 E.range(e.anchor,e.head)}static create(e,t,r){return new tr(e,t,r)}}class E{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:E.create(this.ranges.map(r=>r.map(e,t)),this.mainIndex)}eq(e,t=!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],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new E([this.main],0)}addRange(e,t=!0){return E.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let r=this.ranges.slice();return r[t]=e,E.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 E(e.ranges.map(t=>tr.fromJSON(t)),e.main)}static single(e,t=e){return new E([E.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;i<e.length;i++){let s=e[i];if(s.empty?s.from<=r:s.from<r)return E.normalized(e.slice(),t);r=s.to}return new E(e,t)}static cursor(e,t=0,r,i){return tr.create(e,e,(t==0?0:t<0?8:16)|(r==null?7:Math.min(6,r))|(i??16777215)<<6)}static range(e,t,r,i){let s=(r??16777215)<<6|(i==null?7:Math.min(6,i));return t<e?tr.create(t,e,48|s):tr.create(e,t,(t>e?8:0)|s)}static normalized(e,t=0){let r=e[t];e.sort((i,s)=>i.from-s.from),t=e.indexOf(r);for(let i=1;i<e.length;i++){let s=e[i],o=e[i-1];if(s.empty?s.from<=o.to:s.from<o.to){let a=o.from,l=Math.max(s.to,o.to);i<=t&&t--,e.splice(--i,2,s.anchor>s.head?E.range(l,a):E.range(a,l))}}return new E(e,t)}}function rg(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Ph=0;class K{constructor(e,t,r,i,s){this.combine=e,this.compareInput=t,this.compare=r,this.isStatic=i,this.id=Ph++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new K(e.combine||(t=>t),e.compareInput||((t,r)=>t===r),e.compare||(e.combine?(t,r)=>t===r:Nh),!!e.static,e.enables)}of(e){return new Ko([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ko(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ko(e,this,2,t)}from(e,t){return t||(t=r=>r),this.compute([e],r=>t(r.field(e)))}}function Nh(n,e){return n==e||n.length==e.length&&n.every((t,r)=>t===e[r])}class Ko{constructor(e,t,r,i){this.dependencies=e,this.facet=t,this.type=r,this.value=i,this.id=Ph++}dynamicSlot(e){var t;let r=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,a=this.type==2,l=!1,c=!1,d=[];for(let u of this.dependencies)u=="doc"?l=!0:u=="selection"?c=!0:((t=e[u.id])!==null&&t!==void 0?t:1)&1||d.push(e[u.id]);return{create(u){return u.values[o]=r(u),1},update(u,f){if(l&&f.docChanged||c&&(f.docChanged||f.selection)||wc(u,d)){let p=r(u);if(a?!yu(p,u.values[o],i):!i(p,u.values[o]))return u.values[o]=p,1}return 0},reconfigure:(u,f)=>{let p,m=f.config.address[s];if(m!=null){let b=sa(f,m);if(this.dependencies.every(x=>x instanceof K?f.facet(x)===u.facet(x):x instanceof Ye?f.field(x,!1)==u.field(x,!1):!0)||(a?yu(p=r(u),b,i):i(p=r(u),b)))return u.values[o]=b,0}else p=r(u);return u.values[o]=p,1}}}}function yu(n,e,t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!t(n[r],e[r]))return!1;return!0}function wc(n,e){let t=!1;for(let r of e)ji(n,r)&1&&(t=!0);return t}function N2(n,e,t){let r=t.map(l=>n[l.id]),i=t.map(l=>l.type),s=r.filter(l=>!(l&1)),o=n[e.id]>>1;function a(l){let c=[];for(let d=0;d<r.length;d++){let u=sa(l,r[d]);if(i[d]==2)for(let f of u)c.push(f);else c.push(u)}return e.combine(c)}return{create(l){for(let c of r)ji(l,c);return l.values[o]=a(l),1},update(l,c){if(!wc(l,s))return 0;let d=a(l);return e.compare(d,l.values[o])?0:(l.values[o]=d,1)},reconfigure(l,c){let d=wc(l,r),u=c.config.facets[e.id],f=c.facet(e);if(u&&!d&&Nh(t,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 mo=K.define({static:!0});class Ye{constructor(e,t,r,i,s){this.id=e,this.createF=t,this.updateF=r,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let t=new Ye(Ph++,e.create,e.update,e.compare||((r,i)=>r===i),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(mo).find(r=>r.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:r=>(r.values[t]=this.create(r),1),update:(r,i)=>{let s=r.values[t],o=this.updateF(s,i);return this.compareF(s,o)?0:(r.values[t]=o,1)},reconfigure:(r,i)=>{let s=r.facet(mo),o=i.facet(mo),a;return(a=s.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(r.values[t]=a.create(r),1):i.config.address[this.id]!=null?(r.values[t]=i.field(this),0):(r.values[t]=this.create(r),1)}}}init(e){return[this,mo.of({field:this,create:e})]}get extension(){return this}}const Yn={lowest:4,low:3,default:2,high:1,highest:0};function ci(n){return e=>new ig(e,n)}const dr={highest:ci(Yn.highest),high:ci(Yn.high),default:ci(Yn.default),low:ci(Yn.low),lowest:ci(Yn.lowest)};class ig{constructor(e,t){this.inner=e,this.prec=t}}class Ea{of(e){return new kc(this,e)}reconfigure(e){return Ea.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class kc{constructor(e,t){this.compartment=e,this.inner=t}}class ia{constructor(e,t,r,i,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,r){let i=[],s=Object.create(null),o=new Map;for(let f of A2(e,t,o))f instanceof Ye?i.push(f):(s[f.facet.id]||(s[f.facet.id]=[])).push(f);let a=Object.create(null),l=[],c=[];for(let f of i)a[f.id]=c.length<<1,c.push(p=>f.slot(p));let d=r?.config.facets;for(let f in s){let p=s[f],m=p[0].facet,b=d&&d[f]||[];if(p.every(x=>x.type==0))if(a[m.id]=l.length<<1|1,Nh(b,p))l.push(r.facet(m));else{let x=m.combine(p.map(w=>w.value));l.push(r&&m.compare(x,r.facet(m))?r.facet(m):x)}else{for(let x of p)x.type==0?(a[x.id]=l.length<<1|1,l.push(x.value)):(a[x.id]=c.length<<1,c.push(w=>x.dynamicSlot(w)));a[m.id]=c.length<<1,c.push(x=>N2(x,m,p))}}let u=c.map(f=>f(a));return new ia(e,o,u,a,l,s)}}function A2(n,e,t){let r=[[],[],[],[],[]],i=new Map;function s(o,a){let l=i.get(o);if(l!=null){if(l<=a)return;let c=r[l].indexOf(o);c>-1&&r[l].splice(c,1),o instanceof kc&&t.delete(o.compartment)}if(i.set(o,a),Array.isArray(o))for(let c of o)s(c,a);else if(o instanceof kc){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;t.set(o.compartment,c),s(c,a)}else if(o instanceof ig)s(o.inner,o.prec);else if(o instanceof Ye)r[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof Ko)r[a].push(o),o.facet.extensions&&s(o.facet.extensions,Yn.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(c,a)}}return s(n,Yn.default),r.reduce((o,a)=>o.concat(a))}function ji(n,e){if(e&1)return 2;let t=e>>1,r=n.status[t];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;n.status[t]=4;let i=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|i}function sa(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const sg=K.define(),Sc=K.define({combine:n=>n.some(e=>e),static:!0}),og=K.define({combine:n=>n.length?n[0]:void 0,static:!0}),ag=K.define(),lg=K.define(),cg=K.define(),hg=K.define({combine:n=>n.length?n[0]:!1});class ln{constructor(e,t){this.type=e,this.value=t}static define(){return new M2}}class M2{of(e){return new ln(this,e)}}class D2{constructor(e){this.map=e}of(e){return new ae(this,e)}}class ae{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new ae(this.type,t)}is(e){return this.type==e}static define(e={}){return new D2(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let r=[];for(let i of e){let s=i.map(t);s&&r.push(s)}return r}}ae.reconfigure=ae.define();ae.appendConfig=ae.define();class He{constructor(e,t,r,i,s,o){this.startState=e,this.changes=t,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&rg(r,t.newLength),s.some(a=>a.type==He.time)||(this.annotations=s.concat(He.time.of(Date.now())))}static create(e,t,r,i,s,o){return new He(e,t,r,i,s,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 t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(He.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}He.time=ln.define();He.userEvent=ln.define();He.addToHistory=ln.define();He.remote=ln.define();function T2(n,e){let t=[];for(let r=0,i=0;;){let s,o;if(r<n.length&&(i==e.length||e[i]>=n[r]))s=n[r++],o=n[r++];else if(i<e.length)s=e[i++],o=e[i++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function dg(n,e,t){var r;let i,s,o;return t?(i=e.changes,s=ze.empty(e.changes.length),o=n.changes.compose(e.changes)):(i=e.changes.map(n.changes),s=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(i)),{changes:o,selection:e.selection?e.selection.map(s):(r=n.selection)===null||r===void 0?void 0:r.map(i),effects:ae.mapEffects(n.effects,i).concat(ae.mapEffects(e.effects,s)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function Cc(n,e,t){let r=e.selection,i=Ar(e.annotations);return e.userEvent&&(i=i.concat(He.userEvent.of(e.userEvent))),{changes:e.changes instanceof ze?e.changes:ze.of(e.changes||[],t,n.facet(og)),selection:r&&(r instanceof E?r:E.single(r.anchor,r.head)),effects:Ar(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function ug(n,e,t){let r=Cc(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;r=dg(r,Cc(n,e[s],o?r.changes.newLength:n.doc.length),o)}let i=He.create(n,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return R2(t?E2(i):i)}function E2(n){let e=n.startState,t=!0;for(let i of e.facet(ag)){let s=i(n);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:T2(t,s))}if(t!==!0){let i,s;if(t===!1)s=n.changes.invertedDesc,i=ze.empty(e.doc.length);else{let o=n.changes.filter(t);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}n=He.create(e,i,n.selection&&n.selection.map(s),ae.mapEffects(n.effects,s),n.annotations,n.scrollIntoView)}let r=e.facet(lg);for(let i=r.length-1;i>=0;i--){let s=r[i](n);s instanceof He?n=s:Array.isArray(s)&&s.length==1&&s[0]instanceof He?n=s[0]:n=ug(e,Ar(s),!1)}return n}function R2(n){let e=n.startState,t=e.facet(cg),r=n;for(let i=t.length-1;i>=0;i--){let s=t[i](n);s&&Object.keys(s).length&&(r=dg(r,Cc(e,s,n.changes.newLength),!0))}return r==n?n:He.create(e,n.changes,n.selection,r.effects,r.annotations,r.scrollIntoView)}const L2=[];function Ar(n){return n==null?L2:Array.isArray(n)?n:[n]}var Te=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(Te||(Te={}));const I2=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let jc;try{jc=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function $2(n){if(jc)return jc.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||I2.test(t)))return!0}return!1}function B2(n){return e=>{if(!/\S/.test(e))return Te.Space;if($2(e))return Te.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return Te.Word;return Te.Other}}class me{constructor(e,t,r,i,s,o){this.config=e,this.doc=t,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)ji(this,a<<1);this.computeSlot=null}field(e,t=!0){let r=this.config.address[e.id];if(r==null){if(t)throw new RangeError("Field is not present in this state");return}return ji(this,r),sa(this,r)}update(...e){return ug(this,e,!0)}applyTransaction(e){let t=this.config,{base:r,compartments:i}=t;for(let a of e.effects)a.is(Ea.reconfigure)?(t&&(i=new Map,t.compartments.forEach((l,c)=>i.set(c,l)),t=null),i.set(a.value.compartment,a.value.extension)):a.is(ae.reconfigure)?(t=null,r=a.value):a.is(ae.appendConfig)&&(t=null,r=Ar(r).concat(a.value));let s;t?s=e.startState.values.slice():(t=ia.resolve(r,i,this),s=new me(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=e.startState.facet(Sc)?e.newSelection:e.newSelection.asSingle();new me(t,e.newDoc,o,s,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:E.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,r=e(t.ranges[0]),i=this.changes(r.changes),s=[r.range],o=Ar(r.effects);for(let a=1;a<t.ranges.length;a++){let l=e(t.ranges[a]),c=this.changes(l.changes),d=c.map(i);for(let f=0;f<a;f++)s[f]=s[f].map(d);let u=i.mapDesc(c,!0);s.push(l.range.map(u)),i=i.compose(d),o=ae.mapEffects(o,d).concat(ae.mapEffects(Ar(l.effects),u))}return{changes:i,selection:E.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof ze?e:ze.of(e,this.doc.length,this.facet(me.lineSeparator))}toText(e){return ye.of(e.split(this.facet(me.lineSeparator)||xc))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(ji(this,t),sa(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let i=e[r];i instanceof Ye&&this.config.address[i.id]!=null&&(t[r]=i.spec.toJSON(this.field(e[r]),this))}return t}static fromJSON(e,t={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(r){for(let s in r)if(Object.prototype.hasOwnProperty.call(e,s)){let o=r[s],a=e[s];i.push(o.init(l=>o.spec.fromJSON(a,l)))}}return me.create({doc:e.doc,selection:E.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=ia.resolve(e.extensions||[],new Map),r=e.doc instanceof ye?e.doc:ye.of((e.doc||"").split(t.staticFacet(me.lineSeparator)||xc)),i=e.selection?e.selection instanceof E?e.selection:E.single(e.selection.anchor,e.selection.head):E.single(0);return rg(i,r.length),t.staticFacet(Sc)||(i=i.asSingle()),new me(t,r,i,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(me.tabSize)}get lineBreak(){return this.facet(me.lineSeparator)||`
56
+ `}get readOnly(){return this.facet(hg)}phrase(e,...t){for(let r of this.facet(me.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>t.length?r:t[s-1]})),e}languageDataAt(e,t,r=-1){let i=[];for(let s of this.facet(sg))for(let o of s(this,t,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return B2(t.length?t[0]:"")}wordAt(e){let{text:t,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let l=_e(t,o,!1);if(s(t.slice(l,o))!=Te.Word)break;o=l}for(;a<i;){let l=_e(t,a);if(s(t.slice(a,l))!=Te.Word)break;a=l}return o==a?null:E.range(o+r,a+r)}}me.allowMultipleSelections=Sc;me.tabSize=K.define({combine:n=>n.length?n[0]:4});me.lineSeparator=og;me.readOnly=hg;me.phrases=K.define({compare(n,e){let t=Object.keys(n),r=Object.keys(e);return t.length==r.length&&t.every(i=>n[i]==e[i])}});me.languageData=sg;me.changeFilter=ag;me.transactionFilter=lg;me.transactionExtender=cg;Ea.reconfigure=ae.define();function cn(n,e,t={}){let r={};for(let i of n)for(let s of Object.keys(i)){let o=i[s],a=r[s];if(a===void 0)r[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,s))r[s]=t[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)r[i]===void 0&&(r[i]=e[i]);return r}class Ln{eq(e){return this==e}range(e,t=e){return $i.create(e,t,this)}}Ln.prototype.startSide=Ln.prototype.endSide=0;Ln.prototype.point=!1;Ln.prototype.mapMode=ot.TrackDel;function Ah(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}class $i{constructor(e,t,r){this.from=e,this.to=t,this.value=r}static create(e,t,r){return new $i(e,t,r)}}function Oc(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class Mh{constructor(e,t,r,i){this.from=e,this.to=t,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,r,i=0){let s=r?this.to:this.from;for(let o=i,a=s.length;;){if(o==a)return o;let l=o+a>>1,c=s[l]-e||(r?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,t,r,i){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(r,1e9,!1,s);s<o;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let r=[],i=[],s=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],d=this.from[l]+e,u=this.to[l]+e,f,p;if(d==u){let m=t.mapPos(d,c.startSide,c.mapMode);if(m==null||(f=p=m,c.startSide!=c.endSide&&(p=t.mapPos(d,c.endSide),p<f)))continue}else if(f=t.mapPos(d,c.startSide),p=t.mapPos(u,c.endSide),f>p||f==p&&c.startSide>0&&c.endSide<=0)continue;(p-f||c.endSide-c.startSide)<0||(o<0&&(o=f),c.point&&(a=Math.max(a,p-f)),r.push(c),i.push(f-o),s.push(p-o))}return{mapped:r.length?new Mh(i,s,r,a):null,pos:o}}}class pe{constructor(e,t,r,i){this.chunkPos=e,this.chunk=t,this.nextLayer=r,this.maxPoint=i}static create(e,t,r,i){return new pe(e,t,r,i)}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 t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(r&&(t=t.slice().sort(Oc)),this.isEmpty)return t.length?pe.of(t):this;let a=new fg(this,null,-1).goto(0),l=0,c=[],d=new xn;for(;a.value||l<t.length;)if(l<t.length&&(a.from-t[l].from||a.startSide-t[l].value.startSide)>=0){let u=t[l++];d.addInner(u.from,u.to,u.value)||c.push(u)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(a.chunkIndex)<t[l].from)&&(!o||i>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&d.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||i>a.to||s<a.from||o(a.from,a.to,a.value))&&(d.addInner(a.from,a.to,a.value)||c.push($i.create(a.from,a.to,a.value))),a.next());return d.finishInner(this.nextLayer.isEmpty&&!c.length?pe.empty:this.nextLayer.update({add:c,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],r=[],i=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=e.touchesRange(a,a+l.length);if(c===!1)i=Math.max(i,l.maxPoint),t.push(l),r.push(e.mapPos(a));else if(c===!0){let{mapped:d,pos:u}=l.map(a,e);d&&(i=Math.max(i,d.maxPoint),t.push(d),r.push(u))}}let s=this.nextLayer.map(e);return t.length==0?s:new pe(r,t,s||pe.empty,i)}between(e,t,r){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,r)===!1)return}this.nextLayer.between(e,t,r)}}iter(e=0){return Bi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Bi.from(e).goto(t)}static compare(e,t,r,i,s=-1){let o=e.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=s),a=t.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=s),l=vu(o,a,r),c=new hi(o,l,s),d=new hi(a,l,s);r.iterGaps((u,f,p)=>wu(c,u,d,f,p,i)),r.empty&&r.length==0&&wu(c,0,d,0,0,i)}static eq(e,t,r=0,i){i==null&&(i=999999999);let s=e.filter(d=>!d.isEmpty&&t.indexOf(d)<0),o=t.filter(d=>!d.isEmpty&&e.indexOf(d)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let a=vu(s,o),l=new hi(s,a,0).goto(r),c=new hi(o,a,0).goto(r);for(;;){if(l.to!=c.to||!Pc(l.active,c.active)||l.point&&(!c.point||!Ah(l.point,c.point)))return!1;if(l.to>i)return!0;l.next(),c.next()}}static spans(e,t,r,i,s=-1){let o=new hi(e,null,s).goto(t),a=t,l=o.openStart;for(;;){let c=Math.min(o.to,r);if(o.point){let d=o.activeForPoint(o.to),u=o.pointFrom<t?d.length+1:o.point.startSide<0?d.length:Math.min(d.length,l);i.point(a,c,o.point,d,u,o.pointRank),l=Math.min(o.openEnd(c),d.length)}else c>a&&(i.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>r)return l+(o.point&&o.to>r?1:0);a=o.to,o.next()}}static of(e,t=!1){let r=new xn;for(let i of e instanceof $i?[e]:t?F2(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return pe.empty;let t=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=pe.empty;i=i.nextLayer)t=new pe(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}pe.empty=new pe([],[],null,-1);function F2(n){if(n.length>1)for(let e=n[0],t=1;t<n.length;t++){let r=n[t];if(Oc(e,r)>0)return n.slice().sort(Oc);e=r}return n}pe.empty.nextLayer=pe.empty;class xn{finishChunk(e){this.chunks.push(new Mh(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,t,r){this.addInner(e,t,r)||(this.nextLayer||(this.nextLayer=new xn)).add(e,t,r)}addInner(e,t,r){let i=e-this.lastTo||r.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=t,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let r=t.value.length-1;return this.last=t.value[r],this.lastFrom=t.from[r]+e,this.lastTo=t.to[r]+e,!0}finish(){return this.finishInner(pe.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=pe.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function vu(n,e,t){let r=new Map;for(let s of n)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&r.set(s.chunk[o],s.chunkPos[o]);let i=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let a=r.get(s.chunk[o]);a!=null&&(t?t.mapPos(a):a)==s.chunkPos[o]&&!t?.touchesRange(a,a+s.chunk[o].length)&&i.add(s.chunk[o])}return i}class fg{constructor(e,t,r,i=0){this.layer=e,this.skip=t,this.minPoint=r,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,r){for(;this.chunkIndex<this.layer.chunk.length;){let i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<e||i.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!r||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!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],t=this.layer.chunk[this.chunkIndex],r=e+t.from[this.rangeIndex];if(this.from=r,this.to=e+t.to[this.rangeIndex],this.value=t.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 Bi{constructor(e){this.heap=e}static from(e,t=null,r=-1){let i=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&i.push(new fg(o,t,r,s));return i.length==1?i[0]:new Bi(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let r of this.heap)r.goto(e,t);for(let r=this.heap.length>>1;r>=0;r--)dl(this.heap,r);return this.next(),this}forward(e,t){for(let r of this.heap)r.forward(e,t);for(let r=this.heap.length>>1;r>=0;r--)dl(this.heap,r);(this.to-e||this.value.endSide-t)<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(),dl(this.heap,0)}}}function dl(n,e){for(let t=n[e];;){let r=(e<<1)+1;if(r>=n.length)break;let i=n[r];if(r+1<n.length&&i.compare(n[r+1])>=0&&(i=n[r+1],r++),t.compare(i)<0)break;n[r]=t,n[e]=i,e=r}}class hi{constructor(e,t,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=Bi.from(e,t,r)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){go(this.active,e),go(this.activeTo,e),go(this.activeRank,e),this.minActive=ku(this.active,this.activeTo)}addActive(e){let t=0,{value:r,to:i,rank:s}=this.cursor;for(;t<this.activeRank.length&&(s-this.activeRank[t]||i-this.activeTo[t])>0;)t++;bo(this.active,t,r),bo(this.activeTo,t,i),bo(this.activeRank,t,s),e&&bo(e,t,this.cursor.from),this.minActive=ku(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),r&&go(r,i)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.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 i=r.length-1;i>=0&&r[i]<e;i--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];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)&&t.push(this.active[r]);return t.reverse()}openEnd(e){let t=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)t++;return t}}function wu(n,e,t,r,i,s){n.goto(e),t.goto(r);let o=r+i,a=r,l=r-e,c=!!s.boundChange;for(let d=!1;;){let u=n.to+l-t.to,f=u||n.endSide-t.endSide,p=f<0?n.to+l:t.to,m=Math.min(p,o);if(n.point||t.point?(n.point&&t.point&&Ah(n.point,t.point)&&Pc(n.activeForPoint(n.to),t.activeForPoint(t.to))||s.comparePoint(a,m,n.point,t.point),d=!1):(d&&s.boundChange(a),m>a&&!Pc(n.active,t.active)&&s.compareRange(a,m,n.active,t.active),c&&m<o&&(u||n.openEnd(p)!=t.openEnd(p))&&(d=!0)),p>o)break;a=p,f<=0&&n.next(),f>=0&&t.next()}}function Pc(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!=e[t]&&!Ah(n[t],e[t]))return!1;return!0}function go(n,e){for(let t=e,r=n.length-1;t<r;t++)n[t]=n[t+1];n.pop()}function bo(n,e,t){for(let r=n.length-1;r>=e;r--)n[r+1]=n[r];n[e]=t}function ku(n,e){let t=-1,r=1e9;for(let i=0;i<e.length;i++)(e[i]-r||n[i].endSide-n[t].endSide)<0&&(t=i,r=e[i]);return t}function Ur(n,e,t=n.length){let r=0;for(let i=0;i<t&&i<n.length;)n.charCodeAt(i)==9?(r+=e-r%e,i++):(r++,i=_e(n,i));return r}function Nc(n,e,t,r){for(let i=0,s=0;;){if(s>=e)return i;if(i==n.length)break;s+=n.charCodeAt(i)==9?t-s%t:1,i=_e(n,i)}return r===!0?-1:n.length}const Ac="ͼ",Su=typeof Symbol>"u"?"__"+Ac:Symbol.for(Ac),Mc=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Cu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class In{constructor(e,t){this.rules=[];let{finish:r}=t||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,a,l,c){let d=[],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 m=a[p];if(/&/.test(p))s(p.split(/,\s*/).map(b=>o.map(x=>b.replace(/&/,x))).reduce((b,x)=>b.concat(x)),m,l);else if(m&&typeof m=="object"){if(!u)throw new RangeError("The value of a property ("+p+") should be a primitive value.");s(i(p),m,d,f)}else m!=null&&d.push(p.replace(/_.*/,"").replace(/[A-Z]/g,b=>"-"+b.toLowerCase())+": "+m+";")}(d.length||f)&&l.push((r&&!u&&!c?o.map(r):o).join(", ")+" {"+d.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
57
+ `)}static newName(){let e=Cu[Su]||1;return Cu[Su]=e+1,Ac+e.toString(36)}static mount(e,t,r){let i=e[Mc],s=r&&r.nonce;i?s&&i.setNonce(s):i=new V2(e,s),i.mount(Array.isArray(t)?t:[t],e)}}let ju=new Map;class V2{constructor(e,t){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=ju.get(r);if(s)return e[Mc]=s;this.sheet=new i.CSSStyleSheet,ju.set(r,this)}else this.styleTag=r.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Mc]=this}mount(e,t){let r=this.sheet,i=0,s=0;for(let o=0;o<e.length;o++){let a=e[o],l=this.modules.indexOf(a);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,a),r)for(let c=0;c<a.rules.length;c++)r.insertRule(a.rules[c],i++)}else{for(;s<l;)i+=this.modules[s++].rules.length;i+=a.rules.length,s++}}if(r)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
58
+ `;this.styleTag.textContent=o;let a=t.head||t;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 $n={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:"'"},Fi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},z2=typeof navigator<"u"&&/Mac/.test(navigator.platform),_2=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var qe=0;qe<10;qe++)$n[48+qe]=$n[96+qe]=String(qe);for(var qe=1;qe<=24;qe++)$n[qe+111]="F"+qe;for(var qe=65;qe<=90;qe++)$n[qe]=String.fromCharCode(qe+32),Fi[qe]=String.fromCharCode(qe);for(var ul in $n)Fi.hasOwnProperty(ul)||(Fi[ul]=$n[ul]);function H2(n){var e=z2&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||_2&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Fi:$n)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function je(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=t[r];typeof i=="string"?n.setAttribute(r,i):i!=null&&(n[r]=i)}e++}for(;e<arguments.length;e++)pg(n,arguments[e]);return n}function pg(n,e){if(typeof e=="string")n.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)n.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)pg(n,e[t]);else throw new RangeError("Unsupported child node: "+e)}let st=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Dc=typeof document<"u"?document:{documentElement:{style:{}}};const Tc=/Edge\/(\d+)/.exec(st.userAgent),mg=/MSIE \d/.test(st.userAgent),Ec=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(st.userAgent),Ra=!!(mg||Ec||Tc),Ou=!Ra&&/gecko\/(\d+)/i.test(st.userAgent),fl=!Ra&&/Chrome\/(\d+)/.exec(st.userAgent),W2="webkitFontSmoothing"in Dc.documentElement.style,Rc=!Ra&&/Apple Computer/.test(st.vendor),Pu=Rc&&(/Mobile\/\w+/.test(st.userAgent)||st.maxTouchPoints>2);var U={mac:Pu||/Mac/.test(st.platform),windows:/Win/.test(st.platform),linux:/Linux|X11/.test(st.platform),ie:Ra,ie_version:mg?Dc.documentMode||6:Ec?+Ec[1]:Tc?+Tc[1]:0,gecko:Ou,gecko_version:Ou?+(/Firefox\/(\d+)/.exec(st.userAgent)||[0,0])[1]:0,chrome:!!fl,chrome_version:fl?+fl[1]:0,ios:Pu,android:/Android\b/.test(st.userAgent),webkit_version:W2?+(/\bAppleWebKit\/(\d+)/.exec(st.userAgent)||[0,0])[1]:0,safari:Rc,safari_version:Rc?+(/\bVersion\/(\d+(\.\d+)?)/.exec(st.userAgent)||[0,0])[1]:0,tabSize:Dc.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Dh(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}const oa=Object.create(null);function Th(n,e,t){if(n==e)return!0;n||(n=oa),e||(e=oa);let r=Object.keys(n),i=Object.keys(e);if(r.length-0!=i.length-0)return!1;for(let s of r)if(s!=t&&(i.indexOf(s)==-1||n[s]!==e[s]))return!1;return!0}function U2(n,e){for(let t=n.attributes.length-1;t>=0;t--){let r=n.attributes[t].name;e[r]==null&&n.removeAttribute(r)}for(let t in e){let r=e[t];t=="style"?n.style.cssText=r:n.getAttribute(t)!=r&&n.setAttribute(t,r)}}function Nu(n,e,t){let r=!1;if(e)for(let i in e)t&&i in t||(r=!0,i=="style"?n.style.cssText="":n.removeAttribute(i));if(t)for(let i in t)e&&e[i]==t[i]||(r=!0,i=="style"?n.style.cssText=t[i]:n.setAttribute(i,t[i]));return r}function K2(n){let e=Object.create(null);for(let t=0;t<n.attributes.length;t++){let r=n.attributes[t];e[r.name]=r.value}return e}class hn{eq(e){return!1}updateDOM(e,t){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,t,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Je=function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n}(Je||(Je={}));class ne extends Ln{constructor(e,t,r,i){super(),this.startSide=e,this.endSide=t,this.widget=r,this.spec=i}get heightRelevant(){return!1}static mark(e){return new Vs(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return t+=r&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new or(e,t,t,r,e.widget||null,!1)}static replace(e){let t=!!e.block,r,i;if(e.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:o}=gg(e,t);r=(s?t?-3e8:-1:5e8)-1,i=(o?t?2e8:1:-6e8)+1}return new or(e,r,i,t,e.widget||null,!0)}static line(e){return new zs(e)}static set(e,t=!1){return pe.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ne.none=pe.empty;class Vs extends ne{constructor(e){let{start:t,end:r}=gg(e);super(t?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Dh(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||oa}eq(e){return this==e||e instanceof Vs&&this.tagName==e.tagName&&Th(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}Vs.prototype.point=!1;class zs extends ne{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof zs&&this.spec.class==e.spec.class&&Th(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}zs.prototype.mapMode=ot.TrackBefore;zs.prototype.point=!0;class or extends ne{constructor(e,t,r,i,s,o){super(t,r,s,e),this.block=i,this.isReplace=o,this.mapMode=i?t<=0?ot.TrackBefore:ot.TrackAfter:ot.TrackDel}get type(){return this.startSide!=this.endSide?Je.WidgetRange:this.startSide<=0?Je.WidgetBefore:Je.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof or&&G2(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}or.prototype.point=!0;function gg(n,e=!1){let{inclusiveStart:t,inclusiveEnd:r}=n;return t==null&&(t=n.inclusive),r==null&&(r=n.inclusive),{start:t??e,end:r??e}}function G2(n,e){return n==e||!!(n&&e&&n.compare(e))}function Mr(n,e,t,r=0){let i=t.length-1;i>=0&&t[i]+r>=n?t[i]=Math.max(t[i],e):t.push(n,e)}class Vi extends Ln{constructor(e,t){super(),this.tagName=e,this.attributes=t}eq(e){return e==this||e instanceof Vi&&this.tagName==e.tagName&&Th(this.attributes,e.attributes)}static create(e){return new Vi(e.tagName,e.attributes||oa)}static set(e,t=!1){return pe.of(e,t)}}Vi.prototype.startSide=Vi.prototype.endSide=-1;function zi(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function Lc(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function Go(n,e){if(!e.anchorNode)return!1;try{return Lc(n,e.anchorNode)}catch{return!1}}function Oi(n){return n.nodeType==3?Hi(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function Pi(n,e,t,r){return t?Au(n,e,t,r,-1)||Au(n,e,t,r,1):!1}function Bn(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function aa(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function Au(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:yn(n))){if(n.nodeName=="DIV")return!1;let s=n.parentNode;if(!s||s.nodeType!=1)return!1;e=Bn(n)+(i<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=i<0?yn(n):0}else return!1}}function yn(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function _i(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function q2(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function bg(n,e){let t=e.width/n.offsetWidth,r=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-n.offsetHeight)<1)&&(r=1),{scaleX:t,scaleY:r}}function J2(n,e,t,r,i,s,o,a){let l=n.ownerDocument,c=l.defaultView||window;for(let d=n,u=!1;d&&!u;)if(d.nodeType==1){let f,p=d==l.body,m=1,b=1;if(p)f=q2(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(d).position)&&(u=!0),d.scrollHeight<=d.clientHeight&&d.scrollWidth<=d.clientWidth){d=d.assignedSlot||d.parentNode;continue}let v=d.getBoundingClientRect();({scaleX:m,scaleY:b}=bg(d,v)),f={left:v.left,right:v.left+d.clientWidth*m,top:v.top,bottom:v.top+d.clientHeight*b}}let x=0,w=0;if(i=="nearest")e.top<f.top?(w=e.top-(f.top+o),t>0&&e.bottom>f.bottom+w&&(w=e.bottom-f.bottom+o)):e.bottom>f.bottom&&(w=e.bottom-f.bottom+o,t<0&&e.top-w<f.top&&(w=e.top-(f.top+o)));else{let v=e.bottom-e.top,S=f.bottom-f.top;w=(i=="center"&&v<=S?e.top+v/2-S/2:i=="start"||i=="center"&&t<0?e.top-o:e.bottom-S+o)-f.top}if(r=="nearest"?e.left<f.left?(x=e.left-(f.left+s),t>0&&e.right>f.right+x&&(x=e.right-f.right+s)):e.right>f.right&&(x=e.right-f.right+s,t<0&&e.left<f.left+x&&(x=e.left-(f.left+s))):x=(r=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:r=="start"==a?e.left-s:e.right-(f.right-f.left)+s)-f.left,x||w)if(p)c.scrollBy(x,w);else{let v=0,S=0;if(w){let j=d.scrollTop;d.scrollTop+=w/b,S=(d.scrollTop-j)*b}if(x){let j=d.scrollLeft;d.scrollLeft+=x/m,v=(d.scrollLeft-j)*m}e={left:e.left-v,top:e.top-S,right:e.right-v,bottom:e.bottom-S},v&&Math.abs(v-x)<1&&(r="nearest"),S&&Math.abs(S-w)<1&&(i="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)}),d=d.assignedSlot||d.parentNode}else if(d.nodeType==11)d=d.host;else break}function Y2(n){let e=n.ownerDocument,t,r;for(let i=n.parentNode;i&&!(i==e.body||t&&r);)if(i.nodeType==1)!r&&i.scrollHeight>i.clientHeight&&(r=i),!t&&i.scrollWidth>i.clientWidth&&(t=i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;return{x:t,y:r}}class Q2{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:t,focusNode:r}=e;this.set(t,Math.min(e.anchorOffset,t?yn(t):0),r,Math.min(e.focusOffset,r?yn(r):0))}set(e,t,r,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=r,this.focusOffset=i}}let Jn=null;U.safari&&U.safari_version>=26&&(Jn=!1);function xg(n){if(n.setActive)return n.setActive();if(Jn)return n.focus(Jn);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(Jn==null?{get preventScroll(){return Jn={preventScroll:!0},!0}}:void 0),!Jn){Jn=!1;for(let t=0;t<e.length;){let r=e[t++],i=e[t++],s=e[t++];r.scrollTop!=i&&(r.scrollTop=i),r.scrollLeft!=s&&(r.scrollLeft=s)}}}let Mu;function Hi(n,e,t=e){let r=Mu||(Mu=document.createRange());return r.setEnd(n,t),r.setStart(n,e),r}function Dr(n,e,t,r){let i={key:e,code:e,keyCode:t,which:t,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let s=new KeyboardEvent("keydown",i);s.synthetic=!0,n.dispatchEvent(s);let o=new KeyboardEvent("keyup",i);return o.synthetic=!0,n.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function X2(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function Z2(n,e){let t=e.focusNode,r=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=r)return!1;for(r=Math.min(r,yn(t));;)if(r){if(t.nodeType!=1)return!1;let i=t.childNodes[r-1];i.contentEditable=="false"?r--:(t=i,r=yn(t))}else{if(t==n)return!0;r=Bn(t),t=t.parentNode}}function yg(n){return n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function vg(n,e){for(let t=n,r=e;;){if(t.nodeType==3&&r>0)return{node:t,offset:r};if(t.nodeType==1&&r>0){if(t.contentEditable=="false")return null;t=t.childNodes[r-1],r=yn(t)}else if(t.parentNode&&!aa(t))r=Bn(t),t=t.parentNode;else return null}}function wg(n,e){for(let t=n,r=e;;){if(t.nodeType==3&&r<t.nodeValue.length)return{node:t,offset:r};if(t.nodeType==1&&r<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[r],r=0}else if(t.parentNode&&!aa(t))r=Bn(t)+1,t=t.parentNode;else return null}}class Ft{constructor(e,t,r=!0){this.node=e,this.offset=t,this.precise=r}static before(e,t){return new Ft(e.parentNode,Bn(e),t)}static after(e,t){return new Ft(e.parentNode,Bn(e)+1,t)}}var Pe=function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n}(Pe||(Pe={}));const ar=Pe.LTR,Eh=Pe.RTL;function kg(n){let e=[];for(let t=0;t<n.length;t++)e.push(1<<+n[t]);return e}const ew=kg("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),tw=kg("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Ic=Object.create(null),Jt=[];for(let n of["()","[]","{}"]){let e=n.charCodeAt(0),t=n.charCodeAt(1);Ic[e]=t,Ic[t]=-e}function Sg(n){return n<=247?ew[n]:1424<=n&&n<=1524?2:1536<=n&&n<=1785?tw[n-1536]:1774<=n&&n<=2220?4:8192<=n&&n<=8204?256:64336<=n&&n<=65023?4:1}const nw=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class bn{get dir(){return this.level%2?Eh:ar}constructor(e,t,r){this.from=e,this.to=t,this.level=r}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,r,i){let s=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=t&&a.to>=t){if(a.level==r)return o;(s<0||(i!=0?i<0?a.from<t:a.to>t:e[s].level>a.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function Cg(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++){let r=n[t],i=e[t];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!Cg(r.inner,i.inner))return!1}return!0}const Oe=[];function rw(n,e,t,r,i){for(let s=0;s<=r.length;s++){let o=s?r[s-1].to:e,a=s<r.length?r[s].from:t,l=s?256:i;for(let c=o,d=l,u=l;c<a;c++){let f=Sg(n.charCodeAt(c));f==512?f=d:f==8&&u==4&&(f=16),Oe[c]=f==4?2:f,f&7&&(u=f),d=f}for(let c=o,d=l,u=l;c<a;c++){let f=Oe[c];if(f==128)c<a-1&&d==Oe[c+1]&&d&24?f=Oe[c]=d:Oe[c]=256;else if(f==64){let p=c+1;for(;p<a&&Oe[p]==64;)p++;let m=c&&d==8||p<t&&Oe[p]==8?u==1?1:8:256;for(let b=c;b<p;b++)Oe[b]=m;c=p-1}else f==8&&u==1&&(Oe[c]=1);d=f,f&7&&(u=f)}}}function iw(n,e,t,r,i){let s=i==1?2:1;for(let o=0,a=0,l=0;o<=r.length;o++){let c=o?r[o-1].to:e,d=o<r.length?r[o].from:t;for(let u=c,f,p,m;u<d;u++)if(p=Ic[f=n.charCodeAt(u)])if(p<0){for(let b=a-3;b>=0;b-=3)if(Jt[b+1]==-p){let x=Jt[b+2],w=x&2?i:x&4?x&1?s:i:0;w&&(Oe[u]=Oe[Jt[b]]=w),a=b;break}}else{if(Jt.length==189)break;Jt[a++]=u,Jt[a++]=f,Jt[a++]=l}else if((m=Oe[u])==2||m==1){let b=m==i;l=b?0:1;for(let x=a-3;x>=0;x-=3){let w=Jt[x+2];if(w&2)break;if(b)Jt[x+2]|=2;else{if(w&4)break;Jt[x+2]|=4}}}}}function sw(n,e,t,r){for(let i=0,s=r;i<=t.length;i++){let o=i?t[i-1].to:n,a=i<t.length?t[i].from:e;for(let l=o;l<a;){let c=Oe[l];if(c==256){let d=l+1;for(;;)if(d==a){if(i==t.length)break;d=t[i++].to,a=i<t.length?t[i].from:e}else if(Oe[d]==256)d++;else break;let u=s==1,f=(d<e?Oe[d]:r)==1,p=u==f?u?1:2:r;for(let m=d,b=i,x=b?t[b-1].to:n;m>l;)m==x&&(m=t[--b].from,x=b?t[b-1].to:n),Oe[--m]=p;l=d}else s=c,l++}}}function $c(n,e,t,r,i,s,o){let a=r%2?2:1;if(r%2==i%2)for(let l=e,c=0;l<t;){let d=!0,u=!1;if(c==s.length||l<s[c].from){let b=Oe[l];b!=a&&(d=!1,u=b==16)}let f=!d&&a==1?[]:null,p=d?r:r+1,m=l;e:for(;;)if(c<s.length&&m==s[c].from){if(u)break e;let b=s[c];if(!d)for(let x=b.to,w=c+1;;){if(x==t)break e;if(w<s.length&&s[w].from==x)x=s[w++].to;else{if(Oe[x]==a)break e;break}}if(c++,f)f.push(b);else{b.from>l&&o.push(new bn(l,b.from,p));let x=b.direction==ar!=!(p%2);Bc(n,x?r+1:r,i,b.inner,b.from,b.to,o),l=b.to}m=b.to}else{if(m==t||(d?Oe[m]!=a:Oe[m]==a))break;m++}f?$c(n,l,m,r+1,i,f,o):l<m&&o.push(new bn(l,m,p)),l=m}else for(let l=t,c=s.length;l>e;){let d=!0,u=!1;if(!c||l>s[c-1].to){let b=Oe[l-1];b!=a&&(d=!1,u=b==16)}let f=!d&&a==1?[]:null,p=d?r:r+1,m=l;e:for(;;)if(c&&m==s[c-1].to){if(u)break e;let b=s[--c];if(!d)for(let x=b.from,w=c;;){if(x==e)break e;if(w&&s[w-1].to==x)x=s[--w].from;else{if(Oe[x-1]==a)break e;break}}if(f)f.push(b);else{b.to<l&&o.push(new bn(b.to,l,p));let x=b.direction==ar!=!(p%2);Bc(n,x?r+1:r,i,b.inner,b.from,b.to,o),l=b.from}m=b.from}else{if(m==e||(d?Oe[m-1]!=a:Oe[m-1]==a))break;m--}f?$c(n,m,l,r+1,i,f,o):m<l&&o.push(new bn(m,l,p)),l=m}}function Bc(n,e,t,r,i,s,o){let a=e%2?2:1;rw(n,i,s,r,a),iw(n,i,s,r,a),sw(i,s,r,a),$c(n,i,s,e,t,r,o)}function ow(n,e,t){if(!n)return[new bn(0,0,e==Eh?1:0)];if(e==ar&&!t.length&&!nw.test(n))return jg(n.length);if(t.length)for(;n.length>Oe.length;)Oe[Oe.length]=256;let r=[],i=e==ar?0:1;return Bc(n,i,i,t,0,n.length,r),r}function jg(n){return[new bn(0,n,0)]}let Og="";function aw(n,e,t,r,i){var s;let o=r.head-n.from,a=bn.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),l=e[a],c=l.side(i,t);if(o==c){let f=a+=i?1:-1;if(f<0||f>=e.length)return null;l=e[a=f],o=l.side(!i,t),c=l.side(i,t)}let d=_e(n.text,o,l.forward(i,t));(d<l.from||d>l.to)&&(d=c),Og=n.text.slice(Math.min(o,d),Math.max(o,d));let u=a==(i?e.length-1:0)?null:e[a+(i?1:-1)];return u&&d==c&&u.level+(i?0:1)<l.level?E.cursor(u.side(!i,t)+n.from,u.forward(i,t)?1:-1,u.level):E.cursor(d+n.from,l.forward(i,t)?-1:1,l.level)}function lw(n,e,t){for(let r=e;r<t;r++){let i=Sg(n.charCodeAt(r));if(i==1)return ar;if(i==2||i==4)return Eh}return ar}const Pg=K.define(),Ng=K.define(),Ag=K.define(),Mg=K.define(),Fc=K.define(),Dg=K.define(),Tg=K.define(),Rh=K.define(),Lh=K.define(),Eg=K.define({combine:n=>n.some(e=>e)}),Rg=K.define({combine:n=>n.some(e=>e)}),Lg=K.define();class Tr{constructor(e,t="nearest",r="nearest",i=5,s=5,o=!1){this.range=e,this.y=t,this.x=r,this.yMargin=i,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new Tr(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 Tr(E.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const xo=ae.define({map:(n,e)=>n.map(e)}),Ig=ae.define();function ut(n,e,t){let r=n.facet(Mg);r.length?r[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const gn=K.define({combine:n=>n.length?n[0]:!0});let cw=0;const wr=K.define({combine(n){return n.filter((e,t)=>{for(let r=0;r<t;r++)if(n[r].plugin==e.plugin)return!1;return!0})}});class Fe{constructor(e,t,r,i,s){this.id=e,this.create=t,this.domEventHandlers=r,this.domEventObservers=i,this.baseExtensions=s(this),this.extension=this.baseExtensions.concat(wr.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(wr.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:r,eventObservers:i,provide:s,decorations:o}=t||{};return new Fe(cw++,e,r,i,a=>{let l=[];return o&&l.push(Wi.of(c=>{let d=c.plugin(a);return d?o(d):ne.none})),s&&l.push(s(a)),l})}static fromClass(e,t){return Fe.define((r,i)=>new e(r,i),t)}}class pl{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 t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(r){if(ut(t.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(t){ut(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(r){ut(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const $g=K.define(),Ih=K.define(),Wi=K.define(),Bg=K.define(),Fg=K.define(),_s=K.define(),Vg=K.define();function Du(n,e){let t=n.state.facet(Vg);if(!t.length)return t;let r=t.map(s=>s instanceof Function?s(n):s),i=[];return pe.spans(r,e.from,e.to,{point(){},span(s,o,a,l){let c=s-e.from,d=o-e.from,u=i;for(let f=a.length-1;f>=0;f--,l--){let p=a[f].spec.bidiIsolate,m;if(p==null&&(p=lw(e.text,c,d)),l>0&&u.length&&(m=u[u.length-1]).to==c&&m.direction==p)m.to=d,u=m.inner;else{let b={from:c,to:d,direction:p,inner:[]};u.push(b),u=b.inner}}}}),i}const zg=K.define();function $h(n){let e=0,t=0,r=0,i=0;for(let s of n.state.facet(zg)){let o=s(n);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:t,top:r,bottom:i}}const xi=K.define();class Mt{constructor(e,t,r,i){this.fromA=e,this.toA=t,this.fromB=r,this.toB=i}join(e){return new Mt(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 t=e.length,r=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>r.toA)){if(i.toA<r.fromA)break;r=r.join(i),e.splice(t-1,1)}}return e.splice(t,0,r),e}static extendWithRanges(e,t){if(t.length==0)return e;let r=[];for(let i=0,s=0,o=0;;){let a=i<e.length?e[i].fromB:1e9,l=s<t.length?t[s]:1e9,c=Math.min(a,l);if(c==1e9)break;let d=c+o,u=c,f=d;for(;;)if(s<t.length&&t[s]<=u){let p=t[s+1];s+=2,u=Math.max(u,p);for(let m=i;m<e.length&&e[m].fromB<=u;m++)o=e[m].toA-e[m].toB;f=Math.max(f,p+o)}else if(i<e.length&&e[i].fromB<=u){let p=e[i++];u=Math.max(u,p.toB),f=Math.max(f,p.toA),o=p.toA-p.toB}else break;r.push(new Mt(d,f,c,u))}return r}}class la{constructor(e,t,r){this.view=e,this.state=t,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=ze.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,o,a,l)=>i.push(new Mt(s,o,a,l))),this.changedRanges=i}static create(e,t,r){return new la(e,t,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 hw=[];class Ve{constructor(e,t,r=0){this.dom=e,this.length=t,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return hw}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 t=this.domAttrs;t&&U2(this.dom,t)}}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,t=this.posAtStart){let r=t;for(let i of this.children){if(i==e)return r;r+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let r=Bn(this.dom),i=this.length?e>0:t>0;return new Ft(this.parent.dom,r+(i?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 Ia)return e;return null}static get(e){return e.cmTile}}class La extends Ve{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 t=this.dom,r=null,i,s=e?.node==t?e:null,o=0;for(let a of this.children){if(a.sync(e),o+=a.length+a.breakAfter,i=r?r.nextSibling:t.firstChild,s&&i!=a.dom&&(s.written=!0),a.dom.parentNode==t)for(;i&&i!=a.dom;)i=Tu(i);else t.insertBefore(a.dom,i);r=a.dom}for(i=r?r.nextSibling:t.firstChild,s&&i&&(s.written=!0);i;)i=Tu(i);this.length=o}}function Tu(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Ia extends La{constructor(e,t){super(t),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 t=Ve.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],r=this,i=0,s=0;;)if(i==r.children.length){if(!t.length)return;r=r.parent,r.breakAfter&&s++,i=t.pop()}else{let o=r.children[i++];if(o instanceof Tn)t.push(i),r=o,i=0;else{let a=s+o.length,l=e(o,s);if(l!==void 0)return l;s=a+o.breakAfter}}}resolveBlock(e,t){let r,i=-1,s,o=-1;if(this.blockTiles((a,l)=>{let c=l+a.length;if(e>=l&&e<=c){if(a.isWidget()&&t>=-1&&t<=1){if(a.flags&32)return!0;a.flags&16&&(r=void 0)}(l<e||e==c&&(t<-1?a.length:a.covers(1)))&&(!r||!a.isWidget()&&r.isWidget())&&(r=a,i=e-l),(c>e||e==l&&(t>1?a.length:a.covers(-1)))&&(!s||!a.isWidget()&&s.isWidget())&&(s=a,o=e-l)}}),!r&&!s)throw new Error("No tile at position "+e);return r&&t<0||!s?{tile:r,offset:i}:{tile:s,offset:o}}}class Tn extends La{constructor(e,t){super(e),this.wrapper=t}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,t){let r=new Tn(t||document.createElement(e.tagName),e);return t||(r.flags|=4),r}}class $r extends La{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,r){let i=new $r(t||document.createElement("div"),e);return(!t||!r)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,t,r){let i=null,s=-1,o=null,a=-1;function l(d,u){for(let f=0,p=0;f<d.children.length&&p<=u;f++){let m=d.children[f],b=p+m.length;b>=u&&(m.isComposite()?l(m,u-p):(!o||o.isHidden&&(t>0||r&&uw(o,m)))&&(b>u||m.flags&32)?(o=m,a=u-p):(p<u||m.flags&16&&!m.isHidden)&&(i=m,s=u-p)),p=b}}l(this,e);let c=(t<0?i:o)||i||o;return c?{tile:c,offset:c==i?s:a}:null}coordsIn(e,t){let r=this.resolveInline(e,t,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),t):dw(this)}domIn(e,t){let r=this.resolveInline(e,t);if(r){let{tile:i,offset:s}=r;if(this.dom.contains(i.dom))return i.isText()?new Ft(i.dom,Math.min(i.dom.nodeValue.length,s)):i.domPosFor(s,i.flags&16?1:i.flags&32?-1:t);let o=r.tile.parent,a=!1;for(let l of o.children){if(a)return new Ft(l.dom,0);l==r.tile&&(a=!0)}}return new Ft(this.dom,0)}}function dw(n){let e=n.dom.lastChild;if(!e)return n.dom.getBoundingClientRect();let t=Oi(e);return t[t.length-1]||null}function uw(n,e){let t=n.coordsIn(0,1),r=e.coordsIn(0,1);return t&&r&&r.top<t.bottom}class dt extends La{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let r=new dt(t||document.createElement(e.tagName),e);return t||(r.flags|=4),r}}class nr extends Ve{constructor(e,t){super(e,t.length),this.text=t}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,t){let r=this.dom.nodeValue.length;e>r&&(e=r);let i=e,s=e,o=0;e==0&&t<0||e==r&&t>=0?U.chrome||U.gecko||(e?(i--,o=1):s<r&&(s++,o=-1)):t<0?i--:s<r&&s++;let a=Hi(this.dom,i,s).getClientRects();if(!a.length)return null;let l=a[(o?o<0:t>=0)?0:a.length-1];return U.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?_i(l,o<0):l||null}static of(e,t){let r=new nr(t||document.createTextNode(e),e);return t||(r.flags|=2),r}}class Br extends Ve{constructor(e,t,r,i){super(e,t,i),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,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,r){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;if(r)return _i(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let s=this.dom.getClientRects(),o=null;if(!s.length)return null;let a=this.flags&16?!0:this.flags&32?!1:e>0;for(let l=a?s.length-1:0;o=s[l],!(e>0?l==0:l==s.length-1||o.top<o.bottom);l+=a?-1:1);return _i(o,!a)}}get overrideDOMText(){if(!this.length)return ye.empty;let{root:e}=this;if(!e)return ye.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,r,i,s){return s||(s=e.toDOM(t),e.editable||(s.contentEditable="false")),new Br(s,r,e,i)}}class ca extends Ve{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!1}get overrideDOMText(){return ye.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class fw{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,r){let{tile:i,index:s,beforeBreak:o,parents:a}=this;for(;e||t>0;)if(i.isComposite())if(o){if(!e)break;r&&r.break(),e--,o=!1}else if(s==i.children.length){if(!e&&!a.length)break;r&&r.leave(i),o=!!i.breakAfter,{tile:i,index:s}=a.pop(),s++}else{let l=i.children[s],c=l.breakAfter;(t>0?l.length<=e:l.length<e)&&(!r||r.skip(l,0,l.length)!==!1||!l.isComposite)?(o=!!c,s++,e-=l.length):(a.push({tile:i,index:s}),i=l,s=0,r&&l.isComposite()&&r.enter(l))}else if(s==i.length)o=!!i.breakAfter,{tile:i,index:s}=a.pop(),s++;else if(e){let l=Math.min(e,i.length-s);r&&r.skip(i,s,s+l),e-=l,s+=l}else break;return this.tile=i,this.index=s,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class pw{constructor(e,t,r,i){this.from=e,this.to=t,this.wrapper=r,this.rank=i}}class mw{constructor(e,t,r){this.cache=e,this.root=t,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,r,i){var s;this.flushBuffer();let o=this.ensureMarks(t,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 nr(a.dom,a.text+e);l.parent=o}else o.append(i||nr.of(e,(s=this.cache.find(nr))===null||s===void 0?void 0:s.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let r=this.curLine;r.dom!=t.line.dom&&(r.setDOM(this.cache.reused.has(t.line)?ml(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let i=r;for(let a=t.marks.length-1;a>=0;a--){let l=t.marks[a],c=i.lastChild;if(c instanceof dt&&c.mark.eq(l.mark))c.dom!=l.dom&&c.setDOM(ml(l.dom)),i=c;else{if(this.cache.reused.get(l)){let u=Ve.get(l.dom);u&&u.setDOM(ml(l.dom))}let d=dt.of(l.mark,l.dom);i.append(d),i=d}this.cache.reused.set(l,2)}let s=Ve.get(e.text);s&&this.cache.reused.set(s,2);let o=new nr(e.text,e.text.nodeValue);o.flags|=8,i.append(o)}addInlineWidget(e,t,r){let i=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);i||this.flushBuffer();let s=this.ensureMarks(t,r);!i&&!(e.flags&16)&&s.append(this.getBuffer(1)),s.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,r){this.flushBuffer(),this.ensureMarks(t,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 t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var r;e||(e=_g);let i=$r.start(e,t||((r=this.cache.find($r))===null||r===void 0?void 0:r.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=i)}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,t){var r;let i=this.curLine;for(let s=e.length-1;s>=0;s--){let o=e[s],a;if(t>0&&(a=i.lastChild)&&a instanceof dt&&a.mark.eq(o))i=a,t--;else{let l=dt.of(o,(r=this.cache.find(dt,c=>c.mark.eq(o)))===null||r===void 0?void 0:r.dom);i.append(l),i=l,t=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!Eu(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(U.ios&&Eu(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(gl,0,32)||new Br(gl.toDOM(),0,gl,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 t=new pw(e.from,e.to,e.value,e.rank),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-t.rank||this.wrappers[r-1].to-t.to)<0;)r--;this.wrappers.splice(r,0,t)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let r of this.wrappers){let i=t.lastChild;if(r.from<this.pos&&i instanceof Tn&&i.wrapper.eq(r.wrapper))t=i;else{let s=Tn.of(r.wrapper,(e=this.cache.find(Tn,o=>o.wrapper.eq(r.wrapper)))===null||e===void 0?void 0:e.dom);t.append(s),t=s}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),r=this.cache.find(ca,void 0,1);return r&&(r.flags=t),r||new ca(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class gw{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:i,lineBreak:s,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=i;let a=this.textOff=Math.min(e,i.length);return s?null:i.slice(0,a)}let t=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,t);return this.textOff=t,r}}const ha=[Br,$r,nr,dt,ca,Tn,Ia];for(let n=0;n<ha.length;n++)ha[n].bucket=n;class bw{constructor(e){this.view=e,this.buckets=ha.map(()=>[]),this.index=ha.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,r=this.buckets[t];r.length<6?r.push(e):r[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,r=2){let i=e.bucket,s=this.buckets[i],o=this.index[i];for(let a=s.length-1;a>=0;a--){let l=(a+o)%s.length,c=s[l];if((!t||t(c))&&!this.reused.has(c))return s.splice(l,1),l<o&&this.index[i]--,this.reused.set(c,r),c}return null}findWidget(e,t,r){let i=this.buckets[0];if(i.length)for(let s=0,o=0;;s++){if(s==i.length){if(o)return null;o=1,s=0}let a=i[s];if(!this.reused.has(a)&&(o==0?a.widget.compare(e):a.widget.constructor==e.constructor&&e.updateDOM(a.dom,this.view)))return i.splice(s,1),s<this.index[0]&&this.index[0]--,this.reused.set(a,1),a.length=t,a.flags=a.flags&-498|r,a}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}}class xw{constructor(e,t,r,i,s){this.view=e,this.decorations=i,this.disallowBlockEffectsFor=s,this.openWidget=!1,this.openMarks=0,this.cache=new bw(e),this.text=new gw(e.state.doc),this.builder=new mw(this.cache,new Ia(e,e.contentDOM),pe.iter(r)),this.cache.reused.set(t,2),this.old=new fw(t),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,t){let r=t&&this.getCompositionContext(t.text);for(let i=0,s=0,o=0;;){let a=o<e.length?e[o++]:null,l=a?a.fromA:this.old.root.length;if(l>i){let c=l-i;this.preserve(c,!o,!a),i=l,s+=c}if(!a)break;this.forward(a.fromA,a.toA),t&&a.fromA<=t.range.fromA&&a.toA>=t.range.toA?(this.emit(s,t.range.fromB),this.builder.addComposition(t,r),this.text.skip(t.range.toB-t.range.fromB),this.emit(t.range.toB,a.toB)):this.emit(s,a.toB),s=a.toB,i=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,r){let i=ww(this.old),s=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 c=l>0||a<o.length?Br.of(o.widget,this.view,l-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);c.flags&256?(c.flags&=-2,this.builder.addBlockWidget(c)):(this.builder.ensureLine(null),this.builder.addInlineWidget(c,i,s),s=i.length)}else if(o.isText())this.builder.ensureLine(null),!a&&l==o.length?this.builder.addText(o.text,i,s,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,l),i,s)),s=i.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof ca)this.cache.add(o);else if(o instanceof dt)this.builder.ensureLine(null),this.builder.addMark(o,i,s),this.cache.reused.set(o,1),s=i.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 dt&&i.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?i.length&&(i.length=s=0):o instanceof dt&&(i.shift(),s=Math.min(s,i.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let r=null,i=this.builder,s=0,o=pe.spans(this.decorations,e,t,{point:(a,l,c,d,u,f)=>{if(c instanceof or){if(this.disallowBlockEffectsFor[f]){if(c.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(s=d.length,u>d.length)i.continueWidget(l-a);else{let p=c.widget||(c.block?Fr.block:Fr.inline),m=yw(c),b=this.cache.findWidget(p,l-a,m)||Br.of(p,this.view,l-a,m);c.block?(c.startSide>0&&i.addLineStartIfNotCovered(r),i.addBlockWidget(b)):(i.ensureLine(r),i.addInlineWidget(b,d,u))}r=null}else r=vw(r,c);l>a&&this.text.skip(l-a)},span:(a,l,c,d)=>{for(let u=a;u<l;){let f=this.text.next(Math.min(512,l-u));f==null?(i.addLineStartIfNotCovered(r),i.addBreak(),u++):(i.ensureLine(r),i.addText(f,c,d),u+=f.length),r=null}}});i.addLineStartIfNotCovered(r),this.openWidget=o>s,this.openMarks=o}forward(e,t){t-e<=10?this.old.advance(t-e,1,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,1,this.reuseWalker))}getCompositionContext(e){let t=[],r=null;for(let i=e.parentNode;;i=i.parentNode){let s=Ve.get(i);if(i==this.view.contentDOM)break;s instanceof dt?t.push(s):s?.isLine()?r=s:i.nodeName=="DIV"&&!r&&i!=this.view.contentDOM?r=new $r(i,_g):t.push(dt.of(new Vs({tagName:i.nodeName.toLowerCase(),attributes:K2(i)}),i))}return{line:r,marks:t}}}function Eu(n,e){let t=r=>{for(let i of r.children)if((e?i.isText():i.length)||t(i))return!0;return!1};return t(n)}function yw(n){let e=n.isReplace?(n.startSide<0?64:0)|(n.endSide>0?128:0):n.startSide>0?32:16;return n.block&&(e|=256),e}const _g={class:"cm-line"};function vw(n,e){let t=e.spec.attributes,r=e.spec.class;return!t&&!r||(n||(n={class:"cm-line"}),t&&Dh(t,n),r&&(n.class+=" "+r)),n}function ww(n){let e=[];for(let t=n.parents.length;t>1;t--){let r=t==n.parents.length?n.tile:n.parents[t].tile;r instanceof dt&&e.push(r.mark)}return e}function ml(n){let e=Ve.get(n);return e&&e.setDOM(n.cloneNode()),n}class Fr extends hn{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}}Fr.inline=new Fr("span");Fr.block=new Fr("div");const gl=new class extends hn{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Ru{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=ne.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 Ia(e,e.contentDOM),this.updateInner([new Mt(0,0,0,e.state.doc.length)],null)}update(e){var t;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:d,toA:u})=>u<this.minWidthFrom||d>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 i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?i=this.domChanged.newSel.head:!Mw(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?Sw(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:u}=this.hasComposition;r=new Mt(d,u,e.changes.mapPos(d,-1),e.changes.mapPos(u,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(U.ie||U.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let l=Ow(o,this.decorations,e.changes);l.length&&(r=Mt.extendWithRanges(r,l));let c=Nw(a,this.blockWrappers,e.changes);return c.length&&(r=Mt.extendWithRanges(r,c)),s&&!r.some(d=>d.fromA<=s.range.fromA&&d.toA>=s.range.toA)&&(r=s.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(t||e.length){let o=this.tile,a=new xw(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=a.run(e,t),Vc(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 s=U.chrome||U.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||r.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let i=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let s of this.tile.children)s.isWidget()&&s.widget instanceof bl&&i.push(s.dom);r.updateGaps(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let r of t.effects)r.is(Ig)&&(this.editContextFormatting=r.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,i=this.view.root.activeElement,s=i==r,o=!s&&!(this.view.state.facet(gn)||r.tabIndex>-1)&&Go(r,this.view.observer.selectionRange)&&!(i&&r.contains(i));if(!(s||t||o))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c,d;if(l.empty?d=c=this.inlineDOMNearPos(l.anchor,l.assoc||1):(d=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),c=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),U.gecko&&l.empty&&!this.hasComposition&&kw(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=d=new Ft(f,0),a=!0}let u=this.view.observer.selectionRange;(a||!u.focusNode||(!Pi(c.node,c.offset,u.anchorNode,u.anchorOffset)||!Pi(d.node,d.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,l))&&(this.view.observer.ignore(()=>{U.android&&U.chrome&&r.contains(u.focusNode)&&Aw(u.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let f=zi(this.view.root);if(f)if(l.empty){if(U.gecko){let p=Cw(c.node,c.offset);if(p&&p!=3){let m=(p==1?vg:wg)(c.node,c.offset);m&&(c=new Ft(m.node,m.offset))}}f.collapse(c.node,c.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=l.bidiLevel)}else if(f.extend){f.collapse(c.node,c.offset);try{f.extend(d.node,d.offset)}catch{}}else{let p=document.createRange();l.anchor>l.head&&([c,d]=[d,c]),p.setEnd(d.node,d.offset),p.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(p)}o&&this.view.root.activeElement==r&&(r.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(c,d)),this.impreciseAnchor=c.precise?null:new Ft(u.anchorNode,u.anchorOffset),this.impreciseHead=d.precise?null:new Ft(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Pi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,r=zi(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!t.empty||!t.assoc||!r.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let a=o.posAtStart;if(t.head==a||t.head==a+o.length)return;let l=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!l||!c||l.bottom>c.top)return;let d=this.domAtPos(t.head+t.assoc,t.assoc);r.collapse(d.node,d.offset),r.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&r.collapse(i,s)}posFromDOM(e,t){let r=this.tile.nearest(e);if(!r)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let i=r.posAtStart;if(r.isComposite()){let s;if(e==r.dom)s=r.dom.childNodes[t];else{let o=yn(e)==0?0:t==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?s=e:s=e.nextSibling}if(s==r.dom.firstChild)return i;for(;s&&!Ve.get(s);)s=s.nextSibling;if(!s)return i+r.length;for(let o=0,a=i;;o++){let l=r.children[o];if(l.dom==s)return a;a+=l.length+l.breakAfter}}else return r.isText()?e==r.dom?i+t:i+(t?r.length:0):i}domAtPos(e,t){let{tile:r,offset:i}=this.tile.resolveBlock(e,t);return r.isWidget()?r.domPosFor(e,t):r.domIn(i,t)}inlineDOMNearPos(e,t){let r,i=-1,s=!1,o,a=-1,l=!1;return this.tile.blockTiles((c,d)=>{if(c.isWidget()){if(c.flags&32&&d>=e)return!0;c.flags&16&&(s=!0)}else{let u=d+c.length;if(d<=e&&(r=c,i=e-d,s=u<e),u>=e&&!o&&(o=c,a=e-d,l=d>e),d>e&&o)return!0}}),!r&&!o?this.domAtPos(e,t):(s&&o?r=null:l&&r&&(o=null),r&&t<0||!o?r.domIn(i,t):o.domIn(a,t))}coordsAt(e,t){let{tile:r,offset:i}=this.tile.resolveBlock(e,t);return r.isWidget()?r.widget instanceof bl?null:r.coordsInWidget(i,t,!0):r.coordsIn(i,t)}lineAt(e,t){let{tile:r}=this.tile.resolveBlock(e,t);return r.isLine()?r:null}coordsForChar(e){let{tile:t,offset:r}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function i(s,o){if(s.isComposite())for(let a of s.children){if(a.length>=o){let l=i(a,o);if(l)return l}if(o-=a.length,o<0)break}else if(s.isText()&&o<s.length){let a=_e(s.text,o);if(a==o)return null;let l=Hi(s.dom,o,a).getClientRects();for(let c=0;c<l.length;c++){let d=l[c];if(c==l.length-1||d.top<d.bottom&&d.left<d.right)return d}}return null}return i(t,r)}measureVisibleLineHeights(e){let t=[],{from:r,to:i}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==Pe.LTR,c=0,d=(u,f,p)=>{for(let m=0;m<u.children.length&&!(f>i);m++){let b=u.children[m],x=f+b.length,w=b.dom.getBoundingClientRect(),{height:v}=w;if(p&&!m&&(c+=w.top-p.top),b instanceof Tn)x>r&&d(b,f,w);else if(f>=r&&(c>0&&t.push(-c),t.push(v+c),c=0,o)){let S=b.dom.lastChild,j=S?Oi(S):[];if(j.length){let k=j[j.length-1],O=l?k.right-w.left:w.right-k.left;O>a&&(a=O,this.minWidth=s,this.minWidthFrom=f,this.minWidthTo=x)}}p&&m==u.children.length-1&&(c+=p.bottom-w.bottom),f=x+b.breakAfter}};return d(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?Pe.RTL:Pe.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,l;for(let c of o.children){if(!c.isText()||/[^ -~]/.test(c.text))return;let d=Oi(c.dom);if(d.length!=1)return;a+=d[0].width,l=d[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:l}}});if(e)return e;let t=document.createElement("div"),r,i,s;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=Oi(t.firstChild)[0];r=t.getBoundingClientRect().height,i=o&&o.width?o.width/27:7,s=o&&o.height?o.height:r,t.remove()}),{lineHeight:r,charWidth:i,textHeight:s}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let r=0,i=0;;i++){let s=i==t.viewports.length?null:t.viewports[i],o=s?s.from-1:this.view.state.doc.length;if(o>r){let a=(t.lineBlockAt(o).bottom-t.lineBlockAt(r).top)/this.view.scaleY;e.push(ne.replace({widget:new bl(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return ne.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Wi).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(Fg).map((s,o)=>{let a=typeof s=="function";return a&&(r=!0),a?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[e++]=r,t.push(pe.join(i))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(Bg).map(s=>typeof s=="function"?s(this.view):s)}scrollIntoView(e){if(e.isSnapshot){let c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let c of this.view.state.facet(Lg))try{if(c(this.view,e.range,e))return!0}catch(d){ut(this.view.state,d,"scroll handler")}let{range:t}=e,r=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),i;if(!r)return;!t.empty&&(i=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let s=$h(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;J2(this.view.scrollDOM,o,t.head<t.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==Pe.LTR)}lineHasWidget(e){let t=r=>r.isWidget()||r.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){Vc(this.tile)}}function Vc(n,e){let t=e?.get(n);if(t!=1){t==null&&n.destroy();for(let r of n.children)Vc(r,e)}}function kw(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function Hg(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let r=vg(t.focusNode,t.focusOffset),i=wg(t.focusNode,t.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let a=Ve.get(i.node);if(!a||a.isText()&&a.text!=i.node.nodeValue)s=i;else if(n.docView.lastCompositionAfterCursor){let l=Ve.get(r.node);!l||l.isText()&&l.text!=r.node.nodeValue||(s=i)}}if(n.docView.lastCompositionAfterCursor=s!=r,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function Sw(n,e,t){let r=Hg(n,t);if(!r)return null;let{node:i,from:s,to:o}=r,a=i.nodeValue;if(/[\n\r]/.test(a)||n.state.doc.sliceString(r.from,r.to)!=a)return null;let l=e.invertedDesc;return{range:new Mt(l.mapPos(s),l.mapPos(o),s,o),text:i}}function Cw(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e<n.childNodes.length&&n.childNodes[e].contentEditable=="false"?2:0)}let jw=class{constructor(){this.changes=[]}compareRange(e,t){Mr(e,t,this.changes)}comparePoint(e,t){Mr(e,t,this.changes)}boundChange(e){Mr(e,e,this.changes)}};function Ow(n,e,t){let r=new jw;return pe.compare(n,e,t,r),r.changes}class Pw{constructor(){this.changes=[]}compareRange(e,t){Mr(e,t,this.changes)}comparePoint(){}boundChange(e){Mr(e,e,this.changes)}}function Nw(n,e,t){let r=new Pw;return pe.compare(n,e,t,r),r.changes}function Aw(n,e){for(let t=n;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function Mw(n,e){let t=!1;return e&&n.iterChangedRanges((r,i)=>{r<e.to&&i>e.from&&(t=!0)}),t}class bl extends hn{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 Dw(n,e,t=1){let r=n.charCategorizer(e),i=n.doc.lineAt(e),s=e-i.from;if(i.length==0)return E.cursor(e);s==0?t=1:s==i.length&&(t=-1);let o=s,a=s;t<0?o=_e(i.text,s,!1):a=_e(i.text,s);let l=r(i.text.slice(o,a));for(;o>0;){let c=_e(i.text,o,!1);if(r(i.text.slice(c,o))!=l)break;o=c}for(;a<i.length;){let c=_e(i.text,a);if(r(i.text.slice(a,c))!=l)break;a=c}return E.range(o+i.from,a+i.from)}function Tw(n,e,t,r,i){let s=Math.round((r-e.left)*n.defaultCharacterWidth);if(n.lineWrapping&&t.height>n.defaultLineHeight*1.5){let a=n.viewState.heightOracle.textHeight,l=Math.floor((i-t.top-(n.defaultLineHeight-a)*.5)/a);s+=l*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+Nc(o,s,n.state.tabSize)}function zc(n,e,t){let r=n.lineBlockAt(e);if(Array.isArray(r.type)){let i;for(let s of r.type){if(s.from>e)break;if(!(s.to<e)){if(s.from<e&&s.to>e)return s;(!i||s.type==Je.Text&&(i.type!=s.type||(t<0?s.from<e:s.to>e)))&&(i=s)}}return i||r}return r}function Ew(n,e,t,r){let i=zc(n,e.head,e.assoc||-1),s=!r||i.type!=Je.Text||!(n.lineWrapping||i.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=n.dom.getBoundingClientRect(),a=n.textDirectionAt(i.from),l=n.posAtCoords({x:t==(a==Pe.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(l!=null)return E.cursor(l,t?-1:1)}return E.cursor(t?i.to:i.from,t?-1:1)}function Lu(n,e,t,r){let i=n.state.doc.lineAt(e.head),s=n.bidiSpans(i),o=n.textDirectionAt(i.from);for(let a=e,l=null;;){let c=aw(i,s,o,a,t),d=Og;if(!c){if(i.number==(t?n.state.doc.lines:1))return a;d=`
59
+ `,i=n.state.doc.line(i.number+(t?1:-1)),s=n.bidiSpans(i),c=n.visualLineSide(i,!t)}if(l){if(!l(d))return a}else{if(!r)return c;l=r(d)}a=c}}function Rw(n,e,t){let r=n.state.charCategorizer(e),i=r(t);return s=>{let o=r(s);return i==Te.Space&&(i=o),i==o}}function Lw(n,e,t,r){let i=e.head,s=t?1:-1;if(i==(t?n.state.doc.length:0))return E.cursor(i,e.assoc);let o=e.goalColumn,a,l=n.contentDOM.getBoundingClientRect(),c=n.coordsAtPos(i,e.assoc||-1),d=n.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let p=n.viewState.lineBlockAt(i);o==null&&(o=Math.min(l.right-l.left,n.defaultCharacterWidth*(i-p.from))),a=(s<0?p.top:p.bottom)+d}let u=l.left+o,f=r??n.viewState.heightOracle.textHeight>>1;for(let p=0;;p+=10){let m=a+(f+p)*s,b=_c(n,{x:u,y:m},!1,s);return E.cursor(b.pos,b.assoc,void 0,o)}}function Ni(n,e,t){for(;;){let r=0;for(let i of n)i.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=r||t||(e-s<o-e?-1:1);e=l<0?s:o,r=l}});if(!r)return e}}function Wg(n,e){let t=null;for(let r=0;r<e.ranges.length;r++){let i=e.ranges[r],s=null;if(i.empty){let o=Ni(n,i.from,0);o!=i.from&&(s=E.cursor(o,-1))}else{let o=Ni(n,i.from,-1),a=Ni(n,i.to,1);(o!=i.from||a!=i.to)&&(s=E.range(i.from==i.anchor?o:a,i.from==i.head?o:a))}s&&(t||(t=e.ranges.slice()),t[r]=s)}return t?E.create(t,e.mainIndex):e}function xl(n,e,t){let r=Ni(n.state.facet(_s).map(i=>i(n)),t.from,e.head>t.from?-1:1);return r==t.from?t:E.cursor(r,r<t.from?1:-1)}class en{constructor(e,t){this.pos=e,this.assoc=t}}function _c(n,e,t,r){let i=n.contentDOM.getBoundingClientRect(),s=i.top+n.viewState.paddingTop,{x:o,y:a}=e,l=a-s,c;for(;;){if(l<0)return new en(0,1);if(l>n.viewState.docHeight)return new en(n.state.doc.length,-1);if(c=n.elementAtHeight(l),r==null)break;if(c.type==Je.Text){let f=n.docView.coordsAt(r<0?c.from:c.to,r);if(f&&(r<0?f.top<=l+s:f.bottom>=l+s))break}let u=n.viewState.heightOracle.textHeight/2;l=r>0?c.bottom+u:c.top-u}if(n.viewport.from>=c.to||n.viewport.to<=c.from){if(t)return null;if(c.type==Je.Text){let u=Tw(n,i,c,o,a);return new en(u,u==c.from?1:-1)}}if(c.type!=Je.Text)return l<(c.top+c.bottom)/2?new en(c.from,1):new en(c.to,-1);let d=n.docView.lineAt(c.from,2);return(!d||d.length!=c.length)&&(d=n.docView.lineAt(c.from,-2)),Ug(n,d,c.from,o,a)}function Ug(n,e,t,r,i){let s=-1,o=null,a=1e9,l=1e9,c=i,d=i,u=(f,p)=>{for(let m=0;m<f.length;m++){let b=f[m];if(b.top==b.bottom)continue;let x=b.left>r?b.left-r:b.right<r?r-b.right:0,w=b.top>i?b.top-i:b.bottom<i?i-b.bottom:0;b.top<=d&&b.bottom>=c&&(c=Math.min(b.top,c),d=Math.max(b.bottom,d),w=0),(s<0||(w-l||x-a)<0)&&(s>=0&&l&&a<x&&o.top<=d-2&&o.bottom>=c+2?l=0:(s=p,a=x,l=w,o=b))}};if(e.isText()){for(let p=0;p<e.length;){let m=_e(e.text,p);if(u(Hi(e.dom,p,m).getClientRects(),p),!a&&!l)break;p=m}return r>(o.left+o.right)/2==(Iu(n,s+t)==Pe.LTR)?new en(t+_e(e.text,s),-1):new en(t+s,1)}else{if(!e.length)return new en(t,1);for(let b=0;b<e.children.length;b++){let x=e.children[b];if(x.flags&48)continue;let w=(x.dom.nodeType==1?x.dom:Hi(x.dom,0,x.length)).getClientRects();if(u(w,b),!a&&!l)break}let f=e.children[s],p=e.posBefore(f,t);return f.isComposite()||f.isText()?Ug(n,f,p,Math.max(o.left,Math.min(o.right,r)),i):r>(o.left+o.right)/2==(Iu(n,s+t)==Pe.LTR)?new en(p+f.length,-1):new en(p,1)}}function Iu(n,e){let t=n.state.doc.lineAt(e);return n.bidiSpans(t)[bn.find(n.bidiSpans(t),e-t.from,-1,1)].dir}const yi="￿";class Iw{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(me.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=yi}readRange(e,t){if(!e)return this;let r=e.parentNode;for(let i=e;;){this.findPointBefore(r,i);let s=this.text.length;this.readNode(i);let o=Ve.get(i),a=i.nextSibling;if(a==t){o?.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=Ve.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:aa(i))||aa(a)&&(i.nodeName!="BR"||o?.isWidget())&&this.text.length>s)&&!Bw(a,t)&&this.lineBreak(),i=a}return this.findPointBefore(r,t),this}readTextNode(e){let t=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,t.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,a;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=i.exec(t))&&(s=a.index,o=a[0].length),this.append(t.slice(r,s<0?t.length:s)),s<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=s+o}}readNode(e){let t=Ve.get(e),r=t&&t.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let i=r.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.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,t){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==t&&(r.pos=this.text.length)}findPointInside(e,t){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+($w(e,r.node,r.offset)?t:0))}}function $w(n,e,t){for(;;){if(!e||t<yn(e))return!1;if(e==n)return!0;t=Bn(e)+1,e=e.parentNode}}function Bw(n,e){let t;for(;!(n==e||!n);n=n.nextSibling){let r=Ve.get(n);if(!r?.isWidget())return!1;r&&(t||(t=[])).push(r)}if(t)for(let r of t){let i=r.overrideDOMText;if(i?.length)return!1}return!0}class $u{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class Fw{constructor(e,t,r,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=Kg(e.docView.tile,t,r,0))){let a=s||o?[]:zw(e),l=new Iw(a,e);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=_w(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!Lc(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!Lc(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),d=e.viewport;if((U.ios||U.chrome)&&e.state.selection.main.empty&&l!=c&&(d.from>0||d.to<e.state.doc.length)){let u=Math.min(l,c),f=Math.max(l,c),p=d.from-u,m=d.to-f;(p==0||p==1||u==0)&&(m==0||m==-1||f==e.state.doc.length)&&(l=0,c=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(E.range(c,l)):this.newSel=E.single(c,l)}}}function Kg(n,e,t,r){if(n.isComposite()){let i=-1,s=-1,o=-1,a=-1;for(let l=0,c=r,d=r;l<n.children.length;l++){let u=n.children[l],f=c+u.length;if(c<e&&f>t)return Kg(u,e,t,c);if(f>=e&&i==-1&&(i=l,s=c),c>t&&u.dom.parentNode==n.dom){o=l,a=d;break}d=f,c=f+u.breakAfter}return{from:s,to:a<0?r+n.length:a,startDOM:(i?n.children[i-1].dom.nextSibling:null)||n.dom.firstChild,endDOM:o<n.children.length&&o>=0?n.children[o].dom:null}}else return n.isText()?{from:r,to:r+n.length,startDOM:n.dom,endDOM:n.dom.nextSibling}:null}function Gg(n,e){let t,{newSel:r}=e,i=n.state.selection.main,s=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,l=i.from,c=null;(s===8||U.android&&e.text.length<a-o)&&(l=i.to,c="end");let d=qg(n.state.doc.sliceString(o,a,yi),e.text,l-o,c);d&&(U.chrome&&s==13&&d.toB==d.from+2&&e.text.slice(d.from,d.toB)==yi+yi&&d.toB--,t={from:o+d.from,to:o+d.toA,insert:ye.of(e.text.slice(d.from,d.toB).split(yi))})}else r&&(!n.hasFocus&&n.state.facet(gn)||r.main.eq(i))&&(r=null);if(!t&&!r)return!1;if(!t&&e.typeOver&&!i.empty&&r&&r.main.empty?t={from:i.from,to:i.to,insert:n.state.doc.slice(i.from,i.to)}:(U.mac||U.android)&&t&&t.from==t.to&&t.from==i.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(r&&t.insert.length==2&&(r=E.single(r.main.anchor-1,r.main.head-1)),t={from:t.from,to:t.to,insert:ye.of([t.insert.toString().replace("."," ")])}):t&&t.from>=i.from&&t.to<=i.to&&(t.from!=i.from||t.to!=i.to)&&i.to-i.from-(t.to-t.from)<=4?t={from:i.from,to:i.to,insert:n.state.doc.slice(i.from,t.from).append(t.insert).append(n.state.doc.slice(t.to,i.to))}:n.state.doc.lineAt(i.from).to<i.to&&n.docView.lineHasWidget(i.to)&&n.inputState.insertingTextAt>Date.now()-50?t={from:i.from,to:i.to,insert:n.state.toText(n.inputState.insertingText)}:U.chrome&&t&&t.from==t.to&&t.from==i.head&&t.insert.toString()==`
60
+ `&&n.lineWrapping&&(r&&(r=E.single(r.main.anchor-1,r.main.head-1)),t={from:i.from,to:i.to,insert:ye.of([" "])}),t)return Bh(n,t,r,s);if(r&&!r.main.eq(i)){let o=!1,a="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(o=!0),a=n.inputState.lastSelectionOrigin,a=="select.pointer"&&(r=Wg(n.state.facet(_s).map(l=>l(n)),r))),n.dispatch({selection:r,scrollIntoView:o,userEvent:a}),!0}else return!1}function Bh(n,e,t,r=-1){if(U.ios&&n.inputState.flushIOSKey(e))return!0;let i=n.state.selection.main;if(U.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&n.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Dr(n.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>i.head)&&Dr(n.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&Dr(n.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,a=()=>o||(o=Vw(n,e,t));return n.state.facet(Dg).some(l=>l(n,e.from,e.to,s,a))||n.dispatch(a()),!0}function Vw(n,e,t){let r,i=n.state,s=i.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let l=e.from<s.from?-1:1,c=l<0?s.from:s.to,d=Ni(i.facet(_s).map(u=>u(n)),c,l);e.from==d&&(o=d)}if(o>-1)r={changes:e,selection:E.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let l=s.from<e.from?i.sliceDoc(s.from,e.from):"",c=s.to>e.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(n.state.toText(l+e.insert.sliceString(0,void 0,n.state.lineBreak)+c))}else{let l=i.changes(e),c=t&&t.main.to<=l.newLength?t.main:void 0;if(i.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let d=n.state.sliceDoc(e.from,e.to),u,f=t&&Hg(n,t.main.head);if(f){let m=e.insert.length-(e.to-e.from);u={from:f.from,to:f.to-m}}else u=n.state.doc.lineAt(s.head);let p=s.to-e.to;r=i.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:l,range:c||m.map(l)};let b=m.to-p,x=b-d.length;if(n.state.sliceDoc(x,b)!=d||b>=u.from&&x<=u.to)return{range:m};let w=i.changes({from:x,to:b,insert:e.insert}),v=m.to-s.to;return{changes:w,range:c?E.range(Math.max(0,c.anchor+v),Math.max(0,c.head+v)):m.map(w)}})}else r={changes:l,selection:c&&i.selection.replaceRange(c)}}let a="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,a+=".compose",n.inputState.compositionFirstChange&&(a+=".start",n.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:a,scrollIntoView:!0})}function qg(n,e,t,r){let i=Math.min(n.length,e.length),s=0;for(;s<i&&n.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&n.length==e.length)return null;let o=n.length,a=e.length;for(;o>0&&a>0&&n.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,s-Math.min(o,a));t-=o+l-s}if(o<s&&n.length<e.length){let l=t<=s&&t>=o?s-t:0;s-=l,a=s+(a-o),o=s}else if(a<s){let l=t<=s&&t>=a?s-t:0;s-=l,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function zw(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}=n.observer.selectionRange;return t&&(e.push(new $u(t,r)),(i!=t||s!=r)&&e.push(new $u(i,s))),e}function _w(n,e){if(n.length==0)return null;let t=n[0].pos,r=n.length==2?n[1].pos:t;return t>-1&&r>-1?E.single(t+e,r+e):null}class Hw{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,U.safari&&e.contentDOM.addEventListener("input",()=>null),U.gecko&&ik(e.contentDOM.ownerDocument)}handleEvent(e){!Qw(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,t){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,t);for(let i of r.handlers){if(t.defaultPrevented)break;if(i(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Ww(e),r=this.handlers,i=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,a=r[s];a&&o!=!a.handlers.length&&(i.removeEventListener(s,this.handleEvent),a=null),a||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!="scroll"&&!t[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=t}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&&Yg.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),U.android&&U.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return U.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=Jg.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||Uw.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Dr(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:U.safari&&!U.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 Bu(n,e){return(t,r)=>{try{return e.call(n,r,t)}catch(i){ut(t.state,i)}}}function Ww(n){let e=Object.create(null);function t(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of n){let i=r.spec,s=i&&i.plugin.domEventHandlers,o=i&&i.plugin.domEventObservers;if(s)for(let a in s){let l=s[a];l&&t(a).handlers.push(Bu(r.value,l))}if(o)for(let a in o){let l=o[a];l&&t(a).observers.push(Bu(r.value,l))}}for(let r in zt)t(r).handlers.push(zt[r]);for(let r in Lt)t(r).observers.push(Lt[r]);return e}const Jg=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Uw="dthko",Yg=[16,17,18,20,91,92,224,225],yo=6;function vo(n){return Math.max(0,n)*.7+8}function Kw(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class Gw{constructor(e,t,r,i){this.view=e,this.startEvent=t,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=Y2(e.contentDOM),this.atoms=e.state.facet(_s).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(me.allowMultipleSelections)&&qw(e,t),this.dragging=Yw(e,t)&&Zg(t)==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&&Kw(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,r=0,i=0,s=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=$h(this.view);e.clientX-l.left<=i+yo?t=-vo(i-e.clientX):e.clientX+l.right>=o-yo&&(t=vo(e.clientX-o)),e.clientY-l.top<=s+yo?r=-vo(s-e.clientY):e.clientY+l.bottom>=a-yo&&(r=vo(e.clientY-a)),this.setScrollSpeed(t,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,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,r=Wg(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function qw(n,e){let t=n.state.facet(Pg);return t.length?t[0](e):U.mac?e.metaKey:e.ctrlKey}function Jw(n,e){let t=n.state.facet(Ng);return t.length?t[0](e):U.mac?!e.altKey:!e.ctrlKey}function Yw(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let r=zi(n.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let s=0;s<i.length;s++){let o=i[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function Qw(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,r;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(r=Ve.get(t))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const zt=Object.create(null),Lt=Object.create(null),Qg=U.ie&&U.ie_version<15||U.ios&&U.webkit_version<604;function Xw(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),Xg(n,t.value)},50)}function $a(n,e,t){for(let r of n.facet(e))t=r(t,n);return t}function Xg(n,e){e=$a(n.state,Rh,e);let{state:t}=n,r,i=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(Hc!=null&&t.selection.ranges.every(l=>l.empty)&&Hc==s.toString()){let l=-1;r=t.changeByRange(c=>{let d=t.doc.lineAt(c.from);if(d.from==l)return{range:c};l=d.from;let u=t.toText((o?s.line(i++).text:e)+t.lineBreak);return{changes:{from:d.from,insert:u},range:E.cursor(c.from+u.length)}})}else o?r=t.changeByRange(l=>{let c=s.line(i++);return{changes:{from:l.from,to:l.to,insert:c.text},range:E.cursor(l.from+c.length)}}):r=t.replaceSelection(s);n.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Lt.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop,n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};zt.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);Lt.touchstart=(n,e)=>{n.inputState.lastTouchTime=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};Lt.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};zt.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let r of n.state.facet(Ag))if(t=r(n,e),t)break;if(!t&&e.button==0&&(t=ek(n,e)),t){let r=!n.hasFocus;n.inputState.startMouseSelection(new Gw(n,e,t,r)),r&&n.observer.ignore(()=>{xg(n.contentDOM);let s=n.root.activeElement;s&&!s.contains(n.contentDOM)&&s.blur()});let i=n.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function Fu(n,e,t,r){if(r==1)return E.cursor(e,t);if(r==2)return Dw(n.state,e,t);{let i=n.docView.lineAt(e,t),s=n.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,a=i?i.posAtEnd:s.to;return a<n.state.doc.length&&a==s.to&&a++,E.range(o,a)}}const Zw=U.ie&&U.ie_version<=11;let Vu=null,zu=0,_u=0;function Zg(n){if(!Zw)return n.detail;let e=Vu,t=_u;return Vu=n,_u=Date.now(),zu=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(zu+1)%3:1}function ek(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=Zg(e),i=n.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),i=i.map(s.changes))},get(s,o,a){let l=n.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),c,d=Fu(n,l.pos,l.assoc,r);if(t.pos!=l.pos&&!o){let u=Fu(n,t.pos,t.assoc,r),f=Math.min(u.from,d.from),p=Math.max(u.to,d.to);d=f<d.from?E.range(f,p):E.range(p,f)}return o?i.replaceRange(i.main.extend(d.from,d.to)):a&&r==1&&i.ranges.length>1&&(c=tk(i,l.pos))?c:a?i.addRange(d):E.create([d])}}}function tk(n,e){for(let t=0;t<n.ranges.length;t++){let{from:r,to:i}=n.ranges[t];if(r<=e&&i>=e)return E.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}zt.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let i=n.docView.tile.nearest(e.target);if(i&&i.isWidget()){let s=i.posAtStart,o=s+i.length;(s>=t.to||o<=t.from)&&(t=E.range(s,o))}}let{inputState:r}=n;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",$a(n.state,Lh,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};zt.dragend=n=>(n.inputState.draggedContent=null,!1);function Hu(n,e,t,r){if(t=$a(n.state,Rh,t),!t)return;let i=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=n.inputState,o=r&&s&&Jw(n,e)?{from:s.from,to:s.to}:null,a={from:i,insert:t},l=n.state.changes(o?[o,a]:a);n.focus(),n.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}zt.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let r=Array(t.length),i=0,s=()=>{++i==t.length&&Hu(n,e,r.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let a=new FileReader;a.onerror=s,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[o]=a.result),s()},a.readAsText(t[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Hu(n,e,r,!0),!0}return!1};zt.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=Qg?null:e.clipboardData;return t?(Xg(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(Xw(n),!1)};function nk(n,e){let t=n.dom.parentNode;if(!t)return;let r=t.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(),n.focus()},50)}function rk(n){let e=[],t=[],r=!1;for(let i of n.selection.ranges)i.empty||(e.push(n.sliceDoc(i.from,i.to)),t.push(i));if(!e.length){let i=-1;for(let{from:s}of n.selection.ranges){let o=n.doc.lineAt(s);o.number>i&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),i=o.number}r=!0}return{text:$a(n,Lh,e.join(n.lineBreak)),ranges:t,linewise:r}}let Hc=null;zt.copy=zt.cut=(n,e)=>{let{text:t,ranges:r,linewise:i}=rk(n.state);if(!t&&!i)return!1;Hc=i?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=Qg?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(nk(n,t),!1)};const e0=ln.define();function t0(n,e){let t=[];for(let r of n.facet(Tg)){let i=r(n,e);i&&t.push(i)}return t.length?n.update({effects:t,annotations:e0.of(!0)}):null}function n0(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=t0(n.state,e);t?n.dispatch(t):n.update([])}},10)}Lt.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),n0(n)};Lt.blur=n=>{n.observer.clearSelectionRange(),n0(n)};Lt.compositionstart=Lt.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};Lt.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,U.chrome&&U.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};Lt.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};zt.beforeinput=(n,e)=>{var t,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let s=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let a=o[0],l=n.posAtDOM(a.startContainer,a.startOffset),c=n.posAtDOM(a.endContainer,a.endOffset);return Bh(n,{from:l,to:c,insert:n.state.toText(s)},null),!0}}let i;if(U.chrome&&U.android&&(i=Jg.find(s=>s.inputType==e.inputType))&&(n.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((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)>s+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return U.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),U.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>Lt.compositionend(n,e),20),!1};const Wu=new Set;function ik(n){Wu.has(n)||(Wu.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const Uu=["pre-wrap","normal","pre-line","break-spaces"];let Vr=!1;function Ku(){Vr=!1}class sk{constructor(e){this.lineWrapping=e,this.doc=ye.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let r=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((t-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 Uu.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let r=0;r<e.length;r++){let i=e[r];i<0?r++:this.heightSamples[Math.floor(i*10)]||(t=!0,this.heightSamples[Math.floor(i*10)]=!0)}return t}refresh(e,t,r,i,s,o){let a=Uu.indexOf(e)>-1,l=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=t,this.charWidth=r,this.textHeight=i,this.lineLength=s,l){this.heightSamples={};for(let c=0;c<o.length;c++){let d=o[c];d<0?c++:this.heightSamples[Math.floor(d*10)]=!0}}return l}}class ok{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class Bt{constructor(e,t,r,i,s){this.from=e,this.length=t,this.top=r,this.height=i,this._content=s}get type(){return typeof this._content=="number"?Je.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 or?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Bt(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Ne=function(n){return n[n.ByPos=0]="ByPos",n[n.ByHeight=1]="ByHeight",n[n.ByPosNoHeight=2]="ByPosNoHeight",n}(Ne||(Ne={}));const qo=.001;class at{constructor(e,t,r=2){this.length=e,this.height=t,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)>qo&&(Vr=!0),this.height=e)}replace(e,t,r){return at.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,r,i){let s=this,o=r.doc;for(let a=i.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:d,toB:u}=i[a],f=s.lineAt(l,Ne.ByPosNoHeight,r.setDoc(t),0,0),p=f.to>=c?f:s.lineAt(c,Ne.ByPosNoHeight,r,0,0);for(u+=p.to-c,c=p.to;a>0&&f.from<=i[a-1].toA;)l=i[a-1].fromA,d=i[a-1].fromB,a--,l<f.from&&(f=s.lineAt(l,Ne.ByPosNoHeight,r,0,0));d+=f.from-l,l=f.from;let m=Fh.build(r.setDoc(o),e,d,u);s=da(s,s.replace(l,c,m))}return s.updateHeight(r,0)}static empty(){return new yt(0,0,0)}static of(e){if(e.length==1)return e[0];let t=0,r=e.length,i=0,s=0;for(;;)if(t==r)if(i>s*2){let a=e[t-1];a.break?e.splice(--t,1,a.left,null,a.right):e.splice(--t,1,a.left,a.right),r+=1+a.break,i-=a.size}else if(s>i*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,s-=a.size}else break;else if(i<s){let a=e[t++];a&&(i+=a.size)}else{let a=e[--r];a&&(s+=a.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,r++),new lk(at.of(e.slice(0,t)),o,at.of(e.slice(r)))}}function da(n,e){return n==e?n:(n.constructor!=e.constructor&&(Vr=!0),e)}at.prototype.size=1;const ak=ne.replace({});class r0 extends at{constructor(e,t,r){super(e,t),this.deco=r,this.spaceAbove=0}mainBlock(e,t){return new Bt(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,r,i){return this.spaceAbove&&e<r+this.spaceAbove?new Bt(i,0,r,this.spaceAbove,ak):this.mainBlock(r,i)}lineAt(e,t,r,i,s){let o=this.mainBlock(i,s);return this.spaceAbove?this.blockAt(0,r,i,s).join(o):o}forEachLine(e,t,r,i,s,o){e<=s+this.length&&t>=s&&o(this.lineAt(0,Ne.ByPos,r,i,s))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,r=!1,i){return i&&i.from<=t&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class yt extends r0{constructor(e,t,r){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,t){return new Bt(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,r){let i=r[0];return r.length==1&&(i instanceof yt||i instanceof Ge&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Ge?i=new yt(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):at.of(r)}updateHeight(e,t=0,r=!1,i){return i&&i.from<=t&&i.more?this.setMeasuredHeight(i):(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 Ge extends at{constructor(e){super(e,0)}heightMetrics(e,t){let r=e.doc.lineAt(t).number,i=e.doc.lineAt(t+this.length).number,s=i-r+1,o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*s);o=l/s,this.length>s+1&&(a=(this.height-l)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:i,perLine:o,perChar:a}}blockAt(e,t,r,i){let{firstLine:s,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(t,i);if(t.lineWrapping){let c=i+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),d=t.doc.lineAt(c),u=a+d.length*l,f=Math.max(r,e-u/2);return new Bt(d.from,d.length,f,u,0)}else{let c=Math.max(0,Math.min(o-s,Math.floor((e-r)/a))),{from:d,length:u}=t.doc.line(s+c);return new Bt(d,u,r+a*c,a,0)}}lineAt(e,t,r,i,s){if(t==Ne.ByHeight)return this.blockAt(e,r,i,s);if(t==Ne.ByPosNoHeight){let{from:p,to:m}=r.doc.lineAt(e);return new Bt(p,m-p,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(r,s),c=r.doc.lineAt(e),d=a+c.length*l,u=c.number-o,f=i+a*u+l*(c.from-s-u);return new Bt(c.from,c.length,Math.max(i,Math.min(f,i+this.height-d)),d,0)}forEachLine(e,t,r,i,s,o){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(r,s);for(let d=e,u=i;d<=t;){let f=r.doc.lineAt(d);if(d==e){let m=f.number-a;u+=l*m+c*(e-s-m)}let p=l+c*f.length;o(new Bt(f.from,f.length,u,p,0)),u+=p,d=f.to+1}}replace(e,t,r){let i=this.length-t;if(i>0){let s=r[r.length-1];s instanceof Ge?r[r.length-1]=new Ge(s.length+i):r.push(null,new Ge(i-1))}if(e>0){let s=r[0];s instanceof Ge?r[0]=new Ge(e+s.length):r.unshift(new Ge(e-1),null)}return at.of(r)}decomposeLeft(e,t){t.push(new Ge(e-1),null)}decomposeRight(e,t){t.push(null,new Ge(this.length-e-1))}updateHeight(e,t=0,r=!1,i){let s=t+this.length;if(i&&i.from<=t+this.length&&i.more){let o=[],a=Math.max(t,i.from),l=-1;for(i.from>t&&o.push(new Ge(i.from-t-1).updateHeight(e,t));a<=s&&i.more;){let d=e.doc.lineAt(a).length;o.length&&o.push(null);let u=i.heights[i.index++],f=0;u<0&&(f=-u,u=i.heights[i.index++]),l==-1?l=u:Math.abs(u-l)>=qo&&(l=-2);let p=new yt(d,u,f);p.outdated=!1,o.push(p),a+=d+1}a<=s&&o.push(null,new Ge(s-a).updateHeight(e,a));let c=at.of(o);return(l<0||Math.abs(c.height-this.height)>=qo||Math.abs(l-this.heightMetrics(e,t).perLine)>=qo)&&(Vr=!0),da(this,c)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class lk extends at{constructor(e,t,r){super(e.length+t+r.length,e.height+r.height,t|(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,t,r,i){let s=r+this.left.height;return e<s?this.left.blockAt(e,t,r,i):this.right.blockAt(e,t,s,i+this.left.length+this.break)}lineAt(e,t,r,i,s){let o=i+this.left.height,a=s+this.left.length+this.break,l=t==Ne.ByHeight?e<o:e<a,c=l?this.left.lineAt(e,t,r,i,s):this.right.lineAt(e,t,r,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let d=t==Ne.ByPosNoHeight?Ne.ByPosNoHeight:Ne.ByPos;return l?c.join(this.right.lineAt(a,d,r,o,a)):this.left.lineAt(a,d,r,i,s).join(c)}forEachLine(e,t,r,i,s,o){let a=i+this.left.height,l=s+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,t,r,i,s,o),t>=l&&this.right.forEachLine(e,t,r,a,l,o);else{let c=this.lineAt(l,Ne.ByPos,r,i,s);e<c.from&&this.left.forEachLine(e,c.from-1,r,i,s,o),c.to>=e&&c.from<=t&&o(c),t>c.to&&this.right.forEachLine(c.to+1,t,r,a,l,o)}}replace(e,t,r){let i=this.left.length+this.break;if(t<i)return this.balanced(this.left.replace(e,t,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,r));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let a of r)s.push(a);if(e>0&&Gu(s,o-1),t<this.length){let a=s.length;this.decomposeRight(t,s),Gu(s,a)}return at.of(s)}decomposeLeft(e,t){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(r++,e>=r&&t.push(null)),e>r&&this.right.decomposeLeft(e-r,t)}decomposeRight(e,t){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e<r&&this.left.decomposeRight(e,t),this.break&&e<i&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?at.of(this.break?[e,null,t]:[e,t]):(this.left=da(this.left,e),this.right=da(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,r=!1,i){let{left:s,right:o}=this,a=t+s.length+this.break,l=null;return i&&i.from<=t+s.length&&i.more?l=s=s.updateHeight(e,t,r,i):s.updateHeight(e,t,r),i&&i.from<=a+o.length&&i.more?l=o=o.updateHeight(e,a,r,i):o.updateHeight(e,a,r),l?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Gu(n,e){let t,r;n[e]==null&&(t=n[e-1])instanceof Ge&&(r=n[e+1])instanceof Ge&&n.splice(e-1,3,new Ge(t.length+1+r.length))}const ck=5;class Fh{constructor(e,t){this.pos=e,this.oracle=t,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,t){if(this.lineStart>-1){let r=Math.min(t,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof yt?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new yt(r-this.pos,-1,0)),this.writtenTo=r,t>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,r){if(e<t||r.heightRelevant){let i=r.widget?r.widget.estimatedHeight:0,s=r.widget?r.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let o=t-e;r.block?this.addBlock(new r0(o,i,r)):(o||s||i>=ck)&&this.addLineDeco(i,s,o)}else t>e&&this.span(e,t);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:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,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 yt(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let r=new Ge(t-e);return this.oracle.doc.lineAt(e).to==t&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof yt)return e;let t=new yt(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+r}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof yt)&&!this.isCovered?this.nodes.push(new yt(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let i of this.nodes)i instanceof yt&&i.updateHeight(this.oracle,r),r+=i?i.length:1;return this.nodes}static build(e,t,r,i){let s=new Fh(r,e);return pe.spans(t,r,i,s,0),s.finish(r)}}function hk(n,e,t){let r=new dk;return pe.compare(n,e,t,r,0),r.changes}class dk{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,r,i){(e<t||r&&r.heightRelevant||i&&i.heightRelevant)&&Mr(e,t,this.changes,5)}}function uk(n,e){let t=n.getBoundingClientRect(),r=n.ownerDocument,i=r.defaultView||window,s=Math.max(0,t.left),o=Math.min(i.innerWidth,t.right),a=Math.max(0,t.top),l=Math.min(i.innerHeight,t.bottom);for(let c=n.parentNode;c&&c!=r.body;)if(c.nodeType==1){let d=c,u=window.getComputedStyle(d);if((d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth)&&u.overflow!="visible"){let f=d.getBoundingClientRect();s=Math.max(s,f.left),o=Math.min(o,f.right),a=Math.max(a,f.top),l=Math.min(c==n.parentNode?i.innerHeight:l,f.bottom)}c=u.position=="absolute"||u.position=="fixed"?d.offsetParent:d.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:s-t.left,right:Math.max(s,o)-t.left,top:a-(t.top+e),bottom:Math.max(a,l)-(t.top+e)}}function fk(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function pk(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class yl{constructor(e,t,r,i){this.from=e,this.to=t,this.size=r,this.displaySize=i}static same(e,t){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],s=t[r];if(i.from!=s.from||i.to!=s.to||i.size!=s.size)return!1}return!0}draw(e,t){return ne.replace({widget:new mk(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class mk extends hn{constructor(e,t){super(),this.size=e,this.vertical=t}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 qu{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=Ju,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Pe.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Ih).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new sk(t),this.stateDeco=e.facet(Wi).filter(r=>typeof r!="function"),this.heightMap=at.empty().applyChanges(this.stateDeco,ye.empty,this.heightOracle.setDoc(e.doc),[new Mt(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=ne.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let r=0;r<=1;r++){let i=r?t.head:t.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new wo(s,o))}}return this.viewports=e.sort((r,i)=>r.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Ju:new Vh(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(vi(e,this.scaler))})}update(e,t=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Wi).filter(d=>typeof d!="function");let i=e.changedRanges,s=Mt.extendWithRanges(i,hk(r,this.stateDeco,e?e.changes:ze.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Ku(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||Vr)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let l=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<l.from||t.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let c=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(c||!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),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Rg)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,r=window.getComputedStyle(t),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Pe.RTL:Pe.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),a=t.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,d=0;if(a.width&&a.height){let{scaleX:j,scaleY:k}=bg(t,a);(j>.005&&Math.abs(this.scaleX-j)>.005||k>.005&&Math.abs(this.scaleY-k)>.005)&&(this.scaleX=j,this.scaleY=k,c|=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,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let p=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=p&&(this.scrollAnchorHeight=-1,this.scrollTop=p),this.scrolledToBottom=yg(e.scrollDOM);let m=(this.printing?pk:uk)(t,this.paddingTop),b=m.top-this.pixelViewport.top,x=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(l=!0)),!this.inView&&!this.scrollTarget&&!fk(e.dom))return 0;let v=a.width;if((this.contentDOMWidth!=v||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),l){let j=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(j)&&(o=!0),o||i.lineWrapping&&Math.abs(v-this.contentDOMWidth)>i.charWidth){let{lineHeight:k,charWidth:O,textHeight:y}=e.docView.measureTextSize();o=k>0&&i.refresh(s,k,O,y,Math.max(5,v/O),j),o&&(e.docView.minWidth=0,c|=16)}b>0&&x>0?d=Math.max(b,x):b<0&&x<0&&(d=Math.min(b,x)),Ku();for(let k of this.viewports){let O=k.from==this.viewport.from?j:e.docView.measureVisibleLineHeights(k);this.heightMap=(o?at.empty().applyChanges(this.stateDeco,ye.empty,this.heightOracle,[new Mt(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new ok(k.from,O))}Vr&&(c|=2)}let S=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return S&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),c|=this.updateForViewport()),(c&2||S)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new wo(i.lineAt(o-r*1e3,Ne.ByHeight,s,0,0).from,i.lineAt(a+(1-r)*1e3,Ne.ByHeight,s,0,0).to);if(t){let{head:c}=t.range;if(c<l.from||c>l.to){let d=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),u=i.lineAt(c,Ne.ByPos,s,0,0),f;t.y=="center"?f=(u.top+u.bottom)/2-d/2:t.y=="start"||t.y=="nearest"&&c<l.from?f=u.top:f=u.bottom-d,l=new wo(i.lineAt(f-1e3/2,Ne.ByHeight,s,0,0).from,i.lineAt(f+d+1e3/2,Ne.ByHeight,s,0,0).to)}}return l}mapViewport(e,t){let r=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new wo(this.heightMap.lineAt(r,Ne.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,Ne.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},r=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,Ne.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,Ne.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||i<=o-Math.max(10,Math.min(-r,250)))&&(t==this.state.doc.length||s>=a+Math.max(10,Math.min(r,250)))&&i>o-2*1e3&&s<a+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let r=[];for(let i of e)t.touchesRange(i.from,i.to)||r.push(new yl(t.mapPos(i.from),t.mapPos(i.to),i.size,i.displaySize));return r}ensureLineGaps(e,t){let r=this.heightOracle.lineWrapping,i=r?1e4:2e3,s=i>>1,o=i<<1;if(this.defaultTextDirection!=Pe.LTR&&!r)return[];let a=[],l=(d,u,f,p)=>{if(u-d<s)return;let m=this.state.selection.main,b=[m.from];m.empty||b.push(m.to);for(let w of b)if(w>d&&w<u){l(d,w-10,f,p),l(w+10,u,f,p);return}let x=bk(e,w=>w.from>=f.from&&w.to<=f.to&&Math.abs(w.from-d)<s&&Math.abs(w.to-u)<s&&!b.some(v=>w.from<v&&w.to>v));if(!x){if(u<f.to&&t&&r&&t.visibleRanges.some(S=>S.from<=u&&S.to>=u)){let S=t.moveToLineBoundary(E.cursor(u),!1,!0).head;S>d&&(u=S)}let w=this.gapSize(f,d,u,p),v=r||w<2e6?w:2e6;x=new yl(d,u,w,v)}a.push(x)},c=d=>{if(d.length<o||d.type!=Je.Text)return;let u=gk(d.from,d.to,this.stateDeco);if(u.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,p,m;if(r){let b=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,x,w;if(f!=null){let v=So(u,f),S=((this.visibleBottom-this.visibleTop)/2+b)/d.height;x=v-S,w=v+S}else x=(this.visibleTop-d.top-b)/d.height,w=(this.visibleBottom-d.top+b)/d.height;p=ko(u,x),m=ko(u,w)}else{let b=u.total*this.heightOracle.charWidth,x=i*this.heightOracle.charWidth,w=0;if(b>2e6)for(let O of e)O.from>=d.from&&O.from<d.to&&O.size!=O.displaySize&&O.from*this.heightOracle.charWidth+w<this.pixelViewport.left&&(w=O.size-O.displaySize);let v=this.pixelViewport.left+w,S=this.pixelViewport.right+w,j,k;if(f!=null){let O=So(u,f),y=((S-v)/2+x)/b;j=O-y,k=O+y}else j=(v-x)/b,k=(S+x)/b;p=ko(u,j),m=ko(u,k)}p>d.from&&l(d.from,p,d,u),m<d.to&&l(m,d.to,d,u)};for(let d of this.viewportLines)Array.isArray(d.type)?d.type.forEach(c):c(d);return a}gapSize(e,t,r,i){let s=So(i,r)-So(i,t);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){yl.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ne.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let r=[];pe.spans(t,this.viewport.from,this.viewport.to,{span(s,o){r.push({from:s,to:o})},point(){}},20);let i=0;if(r.length!=this.visibleRanges.length)i=12;else for(let s=0;s<r.length&&!(i&8);s++){let o=this.visibleRanges[s],a=r[s];(o.from!=a.from||o.to!=a.to)&&(i|=4,e&&e.mapPos(o.from,-1)==a.from&&e.mapPos(o.to,1)==a.to||(i|=8))}return this.visibleRanges=r,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||vi(this.heightMap.lineAt(e,Ne.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(t=>t.top<=e&&t.bottom>=e)||vi(this.heightMap.lineAt(this.scaler.fromDOM(e),Ne.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return vi(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 wo{constructor(e,t){this.from=e,this.to=t}}function gk(n,e,t){let r=[],i=n,s=0;return pe.spans(t,n,e,{span(){},point(o,a){o>i&&(r.push({from:i,to:o}),s+=o-i),i=a}},20),i<e&&(r.push({from:i,to:e}),s+=e-i),{total:s,ranges:r}}function ko({total:n,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let r=Math.floor(n*t);for(let i=0;;i++){let{from:s,to:o}=e[i],a=o-s;if(r<=a)return s+r;r-=a}}function So(n,e){let t=0;for(let{from:r,to:i}of n.ranges){if(e<=i){t+=e-r;break}t+=i-r}return t/n.total}function bk(n,e){for(let t of n)if(e(t))return t}const Ju={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};class Vh{constructor(e,t,r){let i=0,s=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let c=t.lineAt(a,Ne.ByPos,e,0,0).top,d=t.lineAt(l,Ne.ByPos,e,0,0).bottom;return i+=d-c,{from:a,to:l,top:c,bottom:d,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(t.height-i);for(let a of this.viewports)a.domTop=o+(a.top-s)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),s=a.bottom}toDOM(e){for(let t=0,r=0,i=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.top)return i+(e-r)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);r=s.bottom,i=s.domBottom}}fromDOM(e){for(let t=0,r=0,i=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.domTop)return r+(e-i)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);r=s.bottom,i=s.domBottom}}eq(e){return e instanceof Vh?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,r)=>t.from==e.viewports[r].from&&t.to==e.viewports[r].to):!1}}function vi(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),r=e.toDOM(n.bottom);return new Bt(n.from,n.length,t,r-t,Array.isArray(n._content)?n._content.map(i=>vi(i,e)):n._content)}const Co=K.define({combine:n=>n.join(" ")}),Wc=K.define({combine:n=>n.indexOf(!0)>-1}),Uc=In.newName(),i0=In.newName(),s0=In.newName(),o0={"&light":"."+i0,"&dark":"."+s0};function Kc(n,e,t){return new In(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return n;if(!t||!t[i])throw new RangeError(`Unsupported selector: ${i}`);return t[i]}):n+" "+r}})}const xk=Kc("."+Uc,{"&":{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"}},o0),yk={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},vl=U.ie&&U.ie_version<=11;class vk{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Q2,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(t=>{for(let r of t)this.queue.push(r);(U.ie&&U.ie_version<=11||U.ios&&e.composing)&&t.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&U.android&&e.constructor.EDIT_CONTEXT!==!1&&!(U.chrome&&U.chrome_version<126)&&(this.editContext=new kk(e),e.state.facet(gn)&&(e.contentDOM.editContext=this.editContext.editContext)),vl&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.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 t;((t=this.view.docView)===null||t===void 0?void 0:t.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(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.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(t=>{t.length>0&&t[t.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((t,r)=>t!=e[r]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,i=this.selectionRange;if(r.state.facet(gn)?r.root.activeElement!=this.dom:!Go(this.dom,i))return;let s=i.anchorNode&&r.docView.tile.nearest(i.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(U.ie&&U.ie_version<=11||U.android&&U.chrome)&&!r.state.selection.main.empty&&i.focusNode&&Pi(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=zi(e.root);if(!t)return!1;let r=U.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&wk(this.view,t)||t;if(!r||this.selectionRange.eq(r))return!1;let i=Go(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Z2(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let r=this.dom;r;)if(r.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=t)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,yk),vl&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),vl&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var r;if(!this.delayedAndroidKey){let i=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&Dr(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,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 t=-1,r=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),t==-1?{from:t,to:r}=o:(t=Math.min(o.from,t),r=Math.max(o.to,r)))}return{from:t,to:r,typeOver:i}}readChange(){let{from:e,to:t,typeOver:r}=this.processRecords(),i=this.selectionChanged&&Go(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new Fw(this.view,e,t,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let r=this.view.state,i=Gg(this.view,t);return this.view.state==r&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),i}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let r=Yu(t,e.previousSibling||e.target.previousSibling,-1),i=Yu(t,e.nextSibling||e.target.nextSibling,1);return{from:r?t.posAfter(r):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.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(gn)!=e.state.facet(gn)&&(e.view.contentDOM.editContext=e.state.facet(gn)?this.editContext.editContext:null))}destroy(){var e,t,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let i of this.scrollTargets)i.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 Yu(n,e,t){for(;e;){let r=Ve.get(e);if(r&&r.parent==n)return r;let i=e.parentNode;e=i!=n.dom?i:t>0?e.nextSibling:e.previousSibling}return null}function Qu(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor,1);return Pi(o.node,o.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}function wk(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Qu(n,i)}let t=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",r,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",r,!0),t?Qu(n,t):null}class kk{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=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 i=e.state.selection.main,{anchor:s,head:o}=i,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 c=l-a>r.text.length;a==this.from&&s<this.from?a=s:l==this.to&&s>this.to&&(l=s);let d=qg(e.state.sliceDoc(a,l),r.text,(c?i.from:i.to)-a,c?"end":null);if(!d){let f=E.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));f.main.eq(i)||e.dispatch({selection:f,userEvent:"select"});return}let u={from:d.from+a,to:d.toA+a,insert:ye.of(r.text.slice(d.from,d.toB).split(`
61
+ `))};if((U.mac||U.android)&&u.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(u={from:a,to:l,insert:ye.of([r.text.replace("."," ")])}),this.pendingContextChange=u,!e.state.readOnly){let f=this.to-this.from+(u.to-u.from+u.insert.length);Bh(e,u,E.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(t.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(t.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let l=e.coordsForChar(o);s=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||s||new DOMRect,i.push(s)}t.updateCharacterBounds(r.rangeStart,i)},this.handlers.textformatupdate=r=>{let i=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,a=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(s.rangeStart),c=this.toEditorPos(s.rangeEnd);if(l<c){let d=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;i.push(ne.mark({attributes:{style:d}}).range(l,c))}}}e.dispatch({effects:Ig.of(ne.set(i))})},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)t.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let i=zi(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,r=!1,i=this.pendingContextChange;return e.changes.iterChanges((s,o,a,l,c)=>{if(r)return;let d=c.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(c)){i=this.pendingContextChange=null,t+=d,this.to+=d;return}else i=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=d,this.to+=d;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),c.toString()),this.to+=d}t+=d}),i&&!r&&this.revertPending(e.state),!r}update(e){let t=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.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||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+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 t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class H{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 t;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&&(i=>i.forEach(s=>r(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||X2(e.parent)||document,this.viewState=new qu(e.state||me.create(e)),e.scrollTo&&e.scrollTo.is(xo)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(wr).map(i=>new pl(i));for(let i of this.plugins)i.update(this);this.observer=new vk(this),this.inputState=new Hw(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Ru(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=e.length==1&&e[0]instanceof He?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,r=!1,i,s=this.state;for(let f of e){if(f.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=f.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,a=0,l=null;e.some(f=>f.annotation(e0))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=t0(s,o),l||(a=1));let c=this.observer.delayedAndroidKey,d=null;if(c?(this.observer.clearDelayedAndroidKey(),d=this.observer.readChange(),(d&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(d=null)):this.observer.clear(),s.facet(me.phrases)!=this.state.facet(me.phrases))return this.setState(s);i=la.create(this,s,e),i.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 Tr(p.empty?p:E.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of f.effects)p.is(xo)&&(u=p.value.clip(this.state))}this.viewState.update(i,u),this.bidiCache=ua.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),t=this.docView.update(i),this.state.facet(xi)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Co)!=i.state.facet(Co)&&(this.viewState.mustMeasureContent=!0),(t||r||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!i.empty)for(let f of this.state.facet(Fc))try{f(i)}catch(p){ut(this.state,p,"update listener")}(l||d)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),d&&!Gg(this,d)&&c.force&&Dr(this.contentDOM,c.key,c.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 t=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new qu(e),this.plugins=e.facet(wr).map(r=>new pl(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new Ru(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(wr),r=e.state.facet(wr);if(t!=r){let i=[];for(let s of r){let o=t.indexOf(s);if(o<0)i.push(new pl(s));else{let a=this.plugins[o];a.mustUpdate=e,i.push(a)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);t!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(r){ut(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 t=null,r=this.scrollDOM,i=r.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(yg(r))s=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(i);s=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 c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let d=c.map(p=>{try{return p.read(this)}catch(m){return ut(this.state,m),Xu}}),u=la.create(this,this.state,[]),f=!1;u.flags|=l,t?t.flags|=l:t=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<c.length;p++)if(d[p]!=Xu)try{let m=c[p];m.write&&m.write(d[p],this)}catch(m){ut(this.state,m)}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 m=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o;if(m>1||m<-1){i=i+m,r.scrollTop=i/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let a of this.state.facet(Fc))a(t)}get themeClasses(){return Uc+" "+(this.state.facet(Wc)?s0:i0)+" "+this.state.facet(Co)}updateAttrs(){let e=Zu(this,$g,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(gn)?"true":"false",class:"cm-content",style:`${U.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Zu(this,Ih,t);let r=this.observer.ignore(()=>{let i=Nu(this.contentDOM,this.contentAttrs,t),s=Nu(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=t,r}showAnnouncements(e){let t=!0;for(let r of e)for(let i of r.effects)if(i.is(H.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(xi);let e=this.state.facet(H.cspNonce);In.mount(this.root,this.styleModules.concat(xk).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 t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(r=>r.plugin==e)||null),t&&t.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,t,r){return xl(this,e,Lu(this,e,t,r))}moveByGroup(e,t){return xl(this,e,Lu(this,e,t,r=>Rw(this,e.head,r)))}visualLineSide(e,t){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),s=r[t?r.length-1:0];return E.cursor(s.side(t,i)+e.from,s.forward(!t,i)?1:-1)}moveToLineBoundary(e,t,r=!0){return Ew(this,e,t,r)}moveVertically(e,t,r){return xl(this,e,Lw(this,e,t,r))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let r=_c(this,e,t);return r&&r.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),_c(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let r=this.docView.coordsAt(e,t);if(!r||r.left==r.right)return r;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),o=s[bn.find(s,e-i.from,-1,t)];return _i(r,o.dir==Pe.LTR==t>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(Eg)||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>Sk)return jg(e.length);let t=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||Cg(s.isolates,r=Du(this,e))))return s.order;r||(r=Du(this,e));let i=ow(e.text,t,r);return this.bidiCache.push(new ua(e.from,e.to,t,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||U.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{xg(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,t={}){return xo.of(new Tr(typeof e=="number"?E.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return xo.of(new Tr(E.cursor(r.from),"start","start",r.top-e,t,!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 Fe.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Fe.define(()=>({}),{eventObservers:e})}static theme(e,t){let r=In.newName(),i=[Co.of(r),xi.of(Kc(`.${r}`,e))];return t&&t.dark&&i.push(Wc.of(!0)),i}static baseTheme(e){return dr.lowest(xi.of(Kc("."+Uc,e,o0)))}static findFromDOM(e){var t;let r=e.querySelector(".cm-content"),i=r&&Ve.get(r)||Ve.get(e);return((t=i?.root)===null||t===void 0?void 0:t.view)||null}}H.styleModule=xi;H.inputHandler=Dg;H.clipboardInputFilter=Rh;H.clipboardOutputFilter=Lh;H.scrollHandler=Lg;H.focusChangeEffect=Tg;H.perLineTextDirection=Eg;H.exceptionSink=Mg;H.updateListener=Fc;H.editable=gn;H.mouseSelectionStyle=Ag;H.dragMovesSelection=Ng;H.clickAddsSelectionRange=Pg;H.decorations=Wi;H.blockWrappers=Bg;H.outerDecorations=Fg;H.atomicRanges=_s;H.bidiIsolatedRanges=Vg;H.scrollMargins=zg;H.darkTheme=Wc;H.cspNonce=K.define({combine:n=>n.length?n[0]:""});H.contentAttributes=Ih;H.editorAttributes=$g;H.lineWrapping=H.contentAttributes.of({class:"cm-lineWrapping"});H.announce=ae.define();const Sk=4096,Xu={};class ua{constructor(e,t,r,i,s,o){this.from=e,this.to=t,this.dir=r,this.isolates=i,this.fresh=s,this.order=o}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:Pe.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==i&&!t.touchesRange(o.from,o.to)&&r.push(new ua(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function Zu(n,e,t){for(let r=n.state.facet(e),i=r.length-1;i>=0;i--){let s=r[i],o=typeof s=="function"?s(n):s;o&&Dh(o,t)}return t}const Ck=U.mac?"mac":U.windows?"win":U.linux?"linux":"key";function jk(n,e){const t=n.split(/-(?!$)/);let r=t[t.length-1];r=="Space"&&(r=" ");let i,s,o,a;for(let l=0;l<t.length-1;++l){const c=t[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))i=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))e=="mac"?a=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return i&&(r="Alt-"+r),s&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function jo(n,e,t){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t!==!1&&e.shiftKey&&(n="Shift-"+n),n}const Ok=dr.default(H.domEventHandlers({keydown(n,e){return l0(a0(e.state),n,e,"editor")}})),Ba=K.define({enables:Ok}),ef=new WeakMap;function a0(n){let e=n.facet(Ba),t=ef.get(e);return t||ef.set(e,t=Ak(e.reduce((r,i)=>r.concat(i),[]))),t}function Pk(n,e,t){return l0(a0(n.state),e,n,t)}let Nn=null;const Nk=4e3;function Ak(n,e=Ck){let t=Object.create(null),r=Object.create(null),i=(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")},s=(o,a,l,c,d)=>{var u,f;let p=t[o]||(t[o]=Object.create(null)),m=a.split(/ (?!$)/).map(w=>jk(w,e));for(let w=1;w<m.length;w++){let v=m.slice(0,w).join(" ");i(v,!0),p[v]||(p[v]={preventDefault:!0,stopPropagation:!1,run:[S=>{let j=Nn={view:S,prefix:v,scope:o};return setTimeout(()=>{Nn==j&&(Nn=null)},Nk),!0}]})}let b=m.join(" ");i(b,!1);let x=p[b]||(p[b]={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&&x.run.push(l),c&&(x.preventDefault=!0),d&&(x.stopPropagation=!0)};for(let o of n){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let d=t[c]||(t[c]=Object.create(null));d._any||(d._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:u}=o;for(let f in d)d[f].run.push(p=>u(p,Gc))}let l=o[e]||o.key;if(l)for(let c of a)s(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return t}let Gc=null;function l0(n,e,t,r){Gc=e;let i=H2(e),s=ct(i,0),o=Zt(s)==i.length&&i!=" ",a="",l=!1,c=!1,d=!1;Nn&&Nn.view==t&&Nn.scope==r&&(a=Nn.prefix+" ",Yg.indexOf(e.keyCode)<0&&(c=!0,Nn=null));let u=new Set,f=x=>{if(x){for(let w of x.run)if(!u.has(w)&&(u.add(w),w(t)))return x.stopPropagation&&(d=!0),!0;x.preventDefault&&(x.stopPropagation&&(d=!0),c=!0)}return!1},p=n[r],m,b;return p&&(f(p[a+jo(i,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(U.windows&&e.ctrlKey&&e.altKey)&&!(U.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(m=$n[e.keyCode])&&m!=i?(f(p[a+jo(m,e,!0)])||e.shiftKey&&(b=Fi[e.keyCode])!=i&&b!=m&&f(p[a+jo(b,e,!1)]))&&(l=!0):o&&e.shiftKey&&f(p[a+jo(i,e,!0)])&&(l=!0),!l&&f(p._any)&&(l=!0)),c&&(l=!0),l&&d&&e.stopPropagation(),Gc=null,l}class Hs{constructor(e,t,r,i,s){this.className=e,this.left=t,this.top=r,this.width=i,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.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,t,r){if(r.empty){let i=e.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let s=c0(e);return[new Hs(t,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return Mk(e,t,r)}}function c0(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==Pe.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function tf(n,e,t,r){let i=n.coordsAtPos(e,t*2);if(!i)return r;let s=n.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,a=n.posAtCoords({x:s.left+1,y:o}),l=n.posAtCoords({x:s.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 Mk(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let r=Math.max(t.from,n.viewport.from),i=Math.min(t.to,n.viewport.to),s=n.textDirection==Pe.LTR,o=n.contentDOM,a=o.getBoundingClientRect(),l=c0(n),c=o.querySelector(".cm-line"),d=c&&window.getComputedStyle(c),u=a.left+(d?parseInt(d.paddingLeft)+Math.min(0,parseInt(d.textIndent)):0),f=a.right-(d?parseInt(d.paddingRight):0),p=zc(n,r,1),m=zc(n,i,-1),b=p.type==Je.Text?p:null,x=m.type==Je.Text?m:null;if(b&&(n.lineWrapping||p.widgetLineBreaks)&&(b=tf(n,r,1,b)),x&&(n.lineWrapping||m.widgetLineBreaks)&&(x=tf(n,i,-1,x)),b&&x&&b.from==x.from&&b.to==x.to)return v(S(t.from,t.to,b));{let k=b?S(t.from,null,b):j(p,!1),O=x?S(null,t.to,x):j(m,!0),y=[];return(b||p).to<(x||m).from-(b&&x?1:0)||p.widgetLineBreaks>1&&k.bottom+n.defaultLineHeight/2<O.top?y.push(w(u,k.bottom,f,O.top)):k.bottom<O.top&&n.elementAtHeight((k.bottom+O.top)/2).type==Je.Text&&(k.bottom=O.top=(k.bottom+O.top)/2),v(k).concat(y).concat(v(O))}function w(k,O,y,D){return new Hs(e,k-l.left,O-l.top,y-k,D-O)}function v({top:k,bottom:O,horizontal:y}){let D=[];for(let A=0;A<y.length;A+=2)D.push(w(y[A],k,y[A+1],O));return D}function S(k,O,y){let D=1e9,A=-1e9,R=[];function N(F,B,q,de,z){let J=n.coordsAtPos(F,F==y.to?-2:2),ie=n.coordsAtPos(q,q==y.from?2:-2);!J||!ie||(D=Math.min(J.top,ie.top,D),A=Math.max(J.bottom,ie.bottom,A),z==Pe.LTR?R.push(s&&B?u:J.left,s&&de?f:ie.right):R.push(!s&&de?u:ie.left,!s&&B?f:J.right))}let L=k??y.from,W=O??y.to;for(let F of n.visibleRanges)if(F.to>L&&F.from<W)for(let B=Math.max(F.from,L),q=Math.min(F.to,W);;){let de=n.state.doc.lineAt(B);for(let z of n.bidiSpans(de)){let J=z.from+de.from,ie=z.to+de.from;if(J>=q)break;ie>B&&N(Math.max(J,B),k==null&&J<=L,Math.min(ie,q),O==null&&ie>=W,z.dir)}if(B=de.to+1,B>=q)break}return R.length==0&&N(L,k==null,W,O==null,n.textDirection),{top:D,bottom:A,horizontal:R}}function j(k,O){let y=a.top+(O?k.top:k.bottom);return{top:y,bottom:y,horizontal:[]}}}function Dk(n,e){return n.constructor==e.constructor&&n.eq(e)}class Tk{constructor(e,t){this.view=e,this.layer=t,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"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(Jo)!=e.state.facet(Jo)&&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 t=0,r=e.facet(Jo);for(;t<r.length&&r[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((t,r)=>!Dk(t,this.drawn[r]))){let t=this.dom.firstChild,r=0;for(let i of e)i.update&&t&&i.constructor&&this.drawn[r].constructor&&i.update(t,this.drawn[r])?(t=t.nextSibling,r++):this.dom.insertBefore(i.draw(),t);for(;t;){let i=t.nextSibling;t.remove(),t=i}this.drawn=e,U.safari&&U.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 Jo=K.define();function h0(n){return[Fe.define(e=>new Tk(e,n)),Jo.of(n)]}const Ui=K.define({combine(n){return cn(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function Ek(n={}){return[Ui.of(n),Rk,Lk,Ik,Rg.of(!0)]}function d0(n){return n.startState.facet(Ui)!=n.state.facet(Ui)}const Rk=h0({above:!0,markers(n){let{state:e}=n,t=e.facet(Ui),r=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty||t.drawRangeCursor){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=i.empty?i:E.cursor(i.head,i.head>i.anchor?-1:1);for(let l of Hs.forRange(n,o,a))r.push(l)}}return r},update(n,e){n.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=d0(n);return t&&nf(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){nf(e.state,n)},class:"cm-cursorLayer"});function nf(n,e){e.style.animationDuration=n.facet(Ui).cursorBlinkRate+"ms"}const Lk=h0({above:!1,markers(n){return n.state.selection.ranges.map(e=>e.empty?[]:Hs.forRange(n,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||d0(n)},class:"cm-selectionLayer"}),Ik=dr.highest(H.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"}}}})),u0=ae.define({map(n,e){return n==null?null:e.mapPos(n)}}),wi=Ye.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,r)=>r.is(u0)?r.value:t,n)}}),$k=Fe.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(wi);t==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"),(n.startState.field(wi)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field(wi),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let r=n.scrollDOM.getBoundingClientRect();return{left:t.left-r.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-r.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;n?(this.cursor.style.left=n.left/e+"px",this.cursor.style.top=n.top/t+"px",this.cursor.style.height=n.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(wi)!=n&&this.view.dispatch({effects:u0.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Bk(){return[wi,$k]}function rf(n,e,t,r,i){e.lastIndex=0;for(let s=n.iterRange(t,r),o=t,a;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;a=e.exec(s.value);)i(o+a.index,a)}function Fk(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let r=[];for(let{from:i,to:s}of t)i=Math.max(n.state.doc.lineAt(i).from,i-e),s=Math.min(n.state.doc.lineAt(s).to,s+e),r.length&&r[r.length-1].to>=i?r[r.length-1].to=s:r.push({from:i,to:s});return r}class Vk{constructor(e){const{regexp:t,decoration:r,decorate:i,boundary:s,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,i)this.addMatch=(a,l,c,d)=>i(d,c,c+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,c,d)=>{let u=r(a,l,c);u&&d(c,c+a[0].length,u)};else if(r)this.addMatch=(a,l,c,d)=>d(c,c+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let t=new xn,r=t.add.bind(t);for(let{from:i,to:s}of Fk(e,this.maxLength))rf(e.state.doc,this.regexp,i,s,(o,a)=>this.addMatch(a,e,o,r));return t.finish()}updateDeco(e,t){let r=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,a,l)=>{l>=e.view.viewport.from&&a<=e.view.viewport.to&&(r=Math.min(a,r),i=Math.max(l,i))}),e.viewportMoved||i-r>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,t.map(e.changes),r,i):t}updateRange(e,t,r,i){for(let s of e.visibleRanges){let o=Math.max(s.from,r),a=Math.min(s.to,i);if(a>=o){let l=e.state.doc.lineAt(o),c=l.to<a?e.state.doc.lineAt(a):l,d=Math.max(s.from,l.from),u=Math.min(s.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){d=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){u=a;break}}let f=[],p,m=(b,x,w)=>f.push(w.range(b,x));if(l==c)for(this.regexp.lastIndex=d-l.from;(p=this.regexp.exec(l.text))&&p.index<u-l.from;)this.addMatch(p,e,p.index+l.from,m);else rf(e.state.doc,this.regexp,d,u,(b,x)=>this.addMatch(x,e,b,m));t=t.update({filterFrom:d,filterTo:u,filter:(b,x)=>b<d||x>u,add:f})}}return t}}const qc=/x/.unicode!=null?"gu":"g",zk=new RegExp(`[\0-\b
62
+ --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,qc),_k={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 wl=null;function Hk(){var n;if(wl==null&&typeof document<"u"&&document.body){let e=document.body.style;wl=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return wl||!1}const Yo=K.define({combine(n){let e=cn(n,{render:null,specialChars:zk,addSpecialChars:null});return(e.replaceTabs=!Hk())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,qc)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,qc)),e}});function Wk(n={}){return[Yo.of(n),Uk()]}let sf=null;function Uk(){return sf||(sf=Fe.fromClass(class{constructor(n){this.view=n,this.decorations=ne.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(Yo)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new Vk({regexp:n.specialChars,decoration:(e,t,r)=>{let{doc:i}=t.state,s=ct(e[0],0);if(s==9){let o=i.lineAt(r),a=t.state.tabSize,l=Ur(o.text,a,r-o.from);return ne.replace({widget:new Jk((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=ne.replace({widget:new qk(n,s)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(Yo);n.startState.facet(Yo)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const Kk="•";function Gk(n){return n>=32?Kk:n==10?"␤":String.fromCharCode(9216+n)}class qk extends hn{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=Gk(this.code),r=e.state.phrase("Control character")+" "+(_k[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,t);if(i)return i;let s=document.createElement("span");return s.textContent=t,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class Jk extends hn{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 Yk(){return Xk}const Qk=ne.line({class:"cm-activeLine"}),Xk=Fe.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let r of n.state.selection.ranges){let i=n.lineBlockAt(r.head);i.from>e&&(t.push(Qk.range(i.from)),e=i.from)}return ne.set(t)}},{decorations:n=>n.decorations});class Zk extends hn{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Oi(e.firstChild):[];if(!t.length)return null;let r=window.getComputedStyle(e.parentNode),i=_i(t[0],r.direction!="rtl"),s=parseInt(r.lineHeight);return i.bottom-i.top>s*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+s}:i}ignoreEvent(){return!1}}function eS(n){let e=Fe.fromClass(class{constructor(t){this.view=t,this.placeholder=n?ne.set([ne.widget({widget:new Zk(n),side:1}).range(0)]):ne.none}get decorations(){return this.view.state.doc.length?ne.none:this.placeholder}},{decorations:t=>t.decorations});return typeof n=="string"?[e,H.contentAttributes.of({"aria-placeholder":n})]:e}const Jc=2e3;function tS(n,e,t){let r=Math.min(e.line,t.line),i=Math.max(e.line,t.line),s=[];if(e.off>Jc||t.off>Jc||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=r;l<=i;l++){let c=n.doc.line(l);c.length<=a&&s.push(E.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let l=r;l<=i;l++){let c=n.doc.line(l),d=Nc(c.text,o,n.tabSize,!0);if(d<0)s.push(E.cursor(c.to));else{let u=Nc(c.text,a,n.tabSize);s.push(E.range(c.from+d,c.from+u))}}}return s}function nS(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function of(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),r=n.state.doc.lineAt(t),i=t-r.from,s=i>Jc?-1:i==r.length?nS(n,e.clientX):Ur(r.text,n.state.tabSize,t-r.from);return{line:r.number,col:s,off:i}}function rS(n,e){let t=of(n,e),r=n.state.selection;return t?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(t.line).from),o=i.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},r=r.map(i.changes)}},get(i,s,o){let a=of(n,i);if(!a)return r;let l=tS(n.state,t,a);return l.length?o?E.create(l.concat(r.ranges)):E.create(l):r}}:null}function iS(n){let e=t=>t.altKey&&t.button==0;return H.mouseSelectionStyle.of((t,r)=>e(r)?rS(t,r):null)}const sS={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},oS={style:"cursor: crosshair"};function aS(n={}){let[e,t]=sS[n.key||"Alt"],r=Fe.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||t(i))},keyup(i){(i.keyCode==e||!t(i))&&this.set(!1)},mousemove(i){this.set(t(i))}}});return[r,H.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?oS:null})]}const Oo="-10000px";class f0{constructor(e,t,r,i){this.facet=t,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,t){var r;let i=e.state.facet(this.facet),s=i.filter(l=>l);if(i===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],a=t?[]:null;for(let l=0;l<s.length;l++){let c=s[l],d=-1;if(c){for(let u=0;u<this.tooltips.length;u++){let f=this.tooltips[u];f&&f.create==c.create&&(d=u)}if(d<0)o[l]=this.createTooltipView(c,l?o[l-1]:null),a&&(a[l]=!!c.above);else{let u=o[l]=this.tooltipViews[d];a&&(a[l]=t[d]),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 t&&(a.forEach((l,c)=>t[c]=l),t.length=a.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function lS(n){let e=n.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const kl=K.define({combine:n=>{var e,t,r;return{position:U.ios?"absolute":((e=n.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(i=>i.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((r=n.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||lS}}}),af=new WeakMap,zh=Fe.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(kl);this.position=e.position,this.parent=e.parent,this.classes=n.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 f0(n,_h,(t,r)=>this.createTooltip(t,r),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.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 n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,r=n.state.facet(kl);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;t=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),r=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",t.dom.appendChild(i)}return t.dom.style.position=this.position,t.dom.style.top=Oo,t.dom.style.left="0px",this.container.insertBefore(t.dom,r),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(n=r.destroy)===null||n===void 0||n.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(U.safari){let o=s.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else t=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(n=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=$h(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(kl).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:t,space:r,scaleX:i,scaleY:s}=n,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:d}=c,u=n.pos[a],f=n.size[a];if(!u||l.clip!==!1&&(u.bottom<=Math.max(t.top,r.top)||u.top>=Math.min(t.bottom,r.bottom)||u.right<Math.max(t.left,r.left)-.1||u.left>Math.min(t.right,r.right)+.1)){d.style.top=Oo;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,m=p?7:0,b=f.right-f.left,x=(e=af.get(c))!==null&&e!==void 0?e:f.bottom-f.top,w=c.offset||hS,v=this.view.textDirection==Pe.LTR,S=f.width>r.right-r.left?v?r.left:r.right-f.width:v?Math.max(r.left,Math.min(u.left-(p?14:0)+w.x,r.right-b)):Math.min(Math.max(r.left,u.left-b+(p?14:0)-w.x),r.right-b),j=this.above[a];!l.strictSide&&(j?u.top-x-m-w.y<r.top:u.bottom+x+m+w.y>r.bottom)&&j==r.bottom-u.bottom>u.top-r.top&&(j=this.above[a]=!j);let k=(j?u.top-r.top:r.bottom-u.bottom)-m;if(k<x&&c.resize!==!1){if(k<this.view.defaultLineHeight){d.style.top=Oo;continue}af.set(c,x),d.style.height=(x=k)/s+"px"}else d.style.height&&(d.style.height="");let O=j?u.top-x-m-w.y:u.bottom+m+w.y,y=S+b;if(c.overlap!==!0)for(let D of o)D.left<y&&D.right>S&&D.top<O+x&&D.bottom>O&&(O=j?D.top-x-2-m:D.bottom+m+2);if(this.position=="absolute"?(d.style.top=(O-n.parent.top)/s+"px",lf(d,(S-n.parent.left)/i)):(d.style.top=O/s+"px",lf(d,S/i)),p){let D=u.left+(v?w.x:-w.x)-(S+14-7);p.style.left=D/i+"px"}c.overlap!==!0&&o.push({left:S,top:O,right:y,bottom:O+x}),d.classList.toggle("cm-tooltip-above",j),d.classList.toggle("cm-tooltip-below",!j),c.positioned&&c.positioned(n.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 n of this.manager.tooltipViews)n.dom.style.top=Oo}},{eventObservers:{scroll(){this.maybeMeasure()}}});function lf(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const cS=H.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"}}}),hS={x:0,y:0},_h=K.define({enables:[zh,cS]}),fa=K.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class Fa{static create(e){return new Fa(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new f0(e,fa,(t,r)=>this.createHostedView(t,r),t=>t.dom.remove())}createHostedView(e,t){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let r of this.manager.tooltipViews){let i=r[e];if(i!==void 0){if(t===void 0)t=i;else if(t!==i)return}}return t}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 dS=_h.compute([fa],n=>{let e=n.facet(fa);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var r;return(r=t.end)!==null&&r!==void 0?r:t.pos})),create:Fa.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class uS{constructor(e,t,r,i,s){this.view=e,this.source=t,this.field=r,this.setHover=i,this.hoverTime=s,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:t}=this,r=e.docView.tile.nearest(t.target);if(!r)return;let i,s=1;if(r.isWidget())i=r.posAtStart;else{if(i=e.posAtCoords(t),i==null)return;let a=e.coordsAtPos(i);if(!a||t.y<a.top||t.y>a.bottom||t.x<a.left-e.defaultCharacterWidth||t.x>a.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(i)).find(d=>d.from<=i&&d.to>=i),c=l&&l.dir==Pe.RTL?-1:1;s=t.x<a.left?-c:c}let o=this.source(e,i,s);if(o?.then){let a=this.pending={pos:i};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=>ut(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(zh),t=e?e.manager.tooltips.findIndex(r=>r.create==Fa.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,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:i,tooltip:s}=this;if(i.length&&s&&!fS(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,a=(r=(t=i[0])===null||t===void 0?void 0:t.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!pS(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:t}=this;if(t.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 t=r=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Po=4;function fS(n,e){let{left:t,right:r,top:i,bottom:s}=n.getBoundingClientRect(),o;if(o=n.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();i=Math.min(a.top,i),s=Math.max(a.bottom,s)}return e.clientX>=t-Po&&e.clientX<=r+Po&&e.clientY>=i-Po&&e.clientY<=s+Po}function pS(n,e,t,r,i,s){let o=n.scrollDOM.getBoundingClientRect(),a=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,a)<i)return!1;let l=n.posAtCoords({x:r,y:i},!1);return l>=e&&l<=t}function mS(n,e={}){let t=ae.define(),r=Ye.define({create(){return[]},update(i,s){if(i.length&&(e.hideOnChange&&(s.docChanged||s.selection)?i=[]:e.hideOn&&(i=i.filter(o=>!e.hideOn(s,o))),s.docChanged)){let o=[];for(let a of i){let l=s.changes.mapPos(a.pos,-1,ot.TrackDel);if(l!=null){let c=Object.assign(Object.create(null),a);c.pos=l,c.end!=null&&(c.end=s.changes.mapPos(c.end)),o.push(c)}}i=o}for(let o of s.effects)o.is(t)&&(i=o.value),o.is(gS)&&(i=[]);return i},provide:i=>fa.from(i)});return{active:r,extension:[r,Fe.define(i=>new uS(i,n,r,t,e.hoverTime||300)),dS]}}function p0(n,e){let t=n.plugin(zh);if(!t)return null;let r=t.manager.tooltips.indexOf(e);return r<0?null:t.manager.tooltipViews[r]}const gS=ae.define(),cf=K.define({combine(n){let e,t;for(let r of n)e=e||r.topContainer,t=t||r.bottomContainer;return{topContainer:e,bottomContainer:t}}});function Ki(n,e){let t=n.plugin(m0),r=t?t.specs.indexOf(e):-1;return r>-1?t.panels[r]:null}const m0=Fe.fromClass(class{constructor(n){this.input=n.state.facet(Gi),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(cf);this.top=new No(n,!0,e.topContainer),this.bottom=new No(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(cf);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new No(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new No(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Gi);if(t!=this.input){let r=t.filter(l=>l),i=[],s=[],o=[],a=[];for(let l of r){let c=this.specs.indexOf(l),d;c<0?(d=l(n.view),a.push(d)):(d=this.panels[c],d.update&&d.update(n)),i.push(d),(d.top?s:o).push(d)}this.specs=r,this.panels=i,this.top.sync(s),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(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>H.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class No{constructor(e,t,r){this.view=e,this.top=t,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.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 t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=hf(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=hf(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 hf(n){let e=n.nextSibling;return n.remove(),e}const Gi=K.define({enables:m0});class vn extends Ln{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}vn.prototype.elementClass="";vn.prototype.toDOM=void 0;vn.prototype.mapMode=ot.TrackBefore;vn.prototype.startSide=vn.prototype.endSide=-1;vn.prototype.point=!0;const Qo=K.define(),bS=K.define(),xS={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>pe.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Ai=K.define();function yS(n){return[g0(),Ai.of({...xS,...n})]}const df=K.define({combine:n=>n.some(e=>e)});function g0(n){return[vS]}const vS=Fe.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.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=n.state.facet(Ai).map(e=>new ff(n,e)),this.fixed=!n.state.facet(df);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),n.scrollDOM.insertBefore(this.dom,n.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(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,r=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(r<(t.to-t.from)*.8)}if(n.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(df)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=pe.iter(this.view.state.facet(Qo),this.view.viewport.from),r=[],i=this.gutters.map(s=>new wS(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let a of s.type)if(a.type==Je.Text&&o){Yc(t,r,a.from);for(let l of i)l.line(this.view,a,r);o=!1}else if(a.widget)for(let l of i)l.widget(this.view,a)}else if(s.type==Je.Text){Yc(t,r,s.from);for(let o of i)o.line(this.view,s,r)}else if(s.widget)for(let o of i)o.widget(this.view,s);for(let s of i)s.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(Ai),t=n.state.facet(Ai),r=n.docChanged||n.heightChanged||n.viewportChanged||!pe.eq(n.startState.facet(Qo),n.state.facet(Qo),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let i of this.gutters)i.update(n)&&(r=!0);else{r=!0;let i=[];for(let s of t){let o=e.indexOf(s);o<0?i.push(new ff(this.view,s)):(this.gutters[o].update(n),i.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),i.indexOf(s)<0&&s.destroy();for(let s of i)s.config.side=="after"?this.getDOMAfter().appendChild(s.dom):this.dom.appendChild(s.dom);this.gutters=i}return r}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>H.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let r=t.dom.offsetWidth*e.scaleX,i=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Pe.LTR?{left:r,right:i}:{right:r,left:i}})});function uf(n){return Array.isArray(n)?n:[n]}function Yc(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class wS{constructor(e,t,r){this.gutter=e,this.height=r,this.i=0,this.cursor=pe.iter(e.markers,t.from)}addElement(e,t,r){let{gutter:i}=this,s=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==i.elements.length){let a=new b0(e,o,s,r);i.elements.push(a),i.dom.appendChild(a.dom)}else i.elements[this.i].update(e,o,s,r);this.height=t.bottom,this.i++}line(e,t,r){let i=[];Yc(this.cursor,i,t.from),r.length&&(i=i.concat(r));let s=this.gutter.config.lineMarker(e,t,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,i)}widget(e,t){let r=this.gutter.config.widgetMarker(e,t.widget,t),i=r?[r]:null;for(let s of e.state.facet(bS)){let o=s(e,t.widget,t);o&&(i||(i=[])).push(o)}i&&this.addElement(e,t,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class ff{constructor(e,t){this.view=e,this.config=t,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 t.domEventHandlers)this.dom.addEventListener(r,i=>{let s=i.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let l=s.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=i.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[r](e,a,i)&&i.preventDefault()});this.markers=uf(t.markers(e)),t.initialSpacer&&(this.spacer=new b0(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=uf(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let r=e.view.viewport;return!pe.eq(this.markers,t,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class b0{constructor(e,t,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,r,i)}update(e,t,r,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),kS(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,t){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let a=o,l=s<t.length?t[s++]:null,c=!1;if(l){let d=l.elementClass;d&&(r+=" "+d);for(let u=o;u<this.markers.length;u++)if(this.markers[u].compare(l)){a=u,c=!0;break}}else a=this.markers.length;for(;o<a;){let d=this.markers[o++];if(d.toDOM){d.destroy(i);let u=i.nextSibling;i.remove(),i=u}}if(!l)break;l.toDOM&&(c?i=i.nextSibling:this.dom.insertBefore(l.toDOM(e),i)),c&&o++}this.dom.className=r,this.markers=t}destroy(){this.setMarkers(null,[])}}function kS(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].compare(e[t]))return!1;return!0}const SS=K.define(),CS=K.define(),kr=K.define({combine(n){return cn(n,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let r=Object.assign({},e);for(let i in t){let s=r[i],o=t[i];r[i]=s?(a,l,c)=>s(a,l,c)||o(a,l,c):o}return r}})}});class Sl extends vn{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Cl(n,e){return n.state.facet(kr).formatNumber(e,n.state)}const jS=Ai.compute([kr],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(SS)},lineMarker(e,t,r){return r.some(i=>i.toDOM)?null:new Sl(Cl(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,r)=>{for(let i of e.state.facet(CS)){let s=i(e,t,r);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(kr)!=e.state.facet(kr),initialSpacer(e){return new Sl(Cl(e,pf(e.state.doc.lines)))},updateSpacer(e,t){let r=Cl(t.view,pf(t.view.state.doc.lines));return r==e.number?e:new Sl(r)},domEventHandlers:n.facet(kr).domEventHandlers,side:"before"}));function OS(n={}){return[kr.of(n),g0(),jS]}function pf(n){let e=9;for(;e<n;)e=e*10+9;return e}const PS=new class extends vn{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},NS=Qo.compute(["selection"],n=>{let e=[],t=-1;for(let r of n.selection.ranges){let i=n.doc.lineAt(r.head).from;i>t&&(t=i,e.push(PS.range(i)))}return pe.of(e)});function AS(){return NS}var jl;const Sr=new ue;function MS(n){return K.define({combine:n?e=>e.concat(n):void 0})}const DS=new ue;class Vt{constructor(e,t,r=[],i=""){this.data=e,this.name=i,me.prototype.hasOwnProperty("tree")||Object.defineProperty(me.prototype,"tree",{get(){return nt(this)}}),this.parser=t,this.extension=[Fn.of(this),me.languageData.of((s,o,a)=>{let l=mf(s,o,a),c=l.type.prop(Sr);if(!c)return[];let d=s.facet(c),u=l.type.prop(DS);if(u){let f=l.resolve(o-l.from,a);for(let p of u)if(p.test(f,s)){let m=s.facet(p.facet);return p.type=="replace"?m:m.concat(d)}}return d})].concat(r)}isActiveAt(e,t,r=-1){return mf(e,t,r).type.prop(Sr)==this.data}findRegions(e){let t=e.facet(Fn);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(Sr)==this.data){r.push({from:o,to:o+s.length});return}let a=s.prop(ue.mounted);if(a){if(a.tree.prop(Sr)==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+s.length});return}else if(a.overlay){let l=r.length;if(i(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;l<s.children.length;l++){let c=s.children[l];c instanceof Be&&i(c,s.positions[l]+o)}};return i(nt(e),0),r}get allowsNesting(){return!0}}Vt.setState=ae.define();function mf(n,e,t){let r=n.facet(Fn),i=nt(n).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(e,t,Le.ExcludeBuffers|Le.EnterBracketed))s.type.isTop&&(i=s);return i}class pa extends Vt{constructor(e,t,r){super(e,t,[],r),this.parser=t}static define(e){let t=MS(e.languageData);return new pa(t,e.parser.configure({props:[Sr.add(r=>r.isTop?t:void 0)]}),e.name)}configure(e,t){return new pa(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function nt(n){let e=n.field(Vt.state,!1);return e?e.tree:Be.empty}class TS{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,t){let r=this.cursorPos-this.string.length;return e<r||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-r,t-r)}}let di=null;class ma{constructor(e,t,r=[],i,s,o,a,l){this.parser=e,this.state=t,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,r){return new ma(e,t,[],Be.empty,0,r,[],null)}startParse(){return this.parser.startParse(new TS(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=Be.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(ir.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(ir.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=di;di=this;try{return e()}finally{di=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=gf(e,t.from,t.to);return e}changes(e,t){let{fragments:r,tree:i,treeLen:s,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,d,u,f)=>l.push({fromA:c,toA:d,fromB:u,toB:f})),r=ir.applyChanges(r,l),i=Be.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let d=e.mapPos(c.from,1),u=e.mapPos(c.to,-1);d<u&&a.push({from:d,to:u})}}}return new ma(this.parser,t,r,i,s,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:i,to:s}=this.skipped[r];i<e.to&&s>e.from&&(this.fragments=gf(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Km{createParse(t,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let l=di;if(l){for(let c of i)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new Be(pt.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return di}}function gf(n,e,t){return ir.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class zr{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=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),t.viewport.to);return t.work(20,r)||t.takeTree(),new zr(t)}static init(e){let t=Math.min(3e3,e.doc.length),r=ma.create(e.facet(Fn).parser,e,{from:0,to:t});return r.work(20,t)||r.takeTree(),new zr(r)}}Vt.state=Ye.define({create:zr.init,update(n,e){for(let t of e.effects)if(t.is(Vt.setState))return t.value;return e.startState.facet(Fn)!=e.state.facet(Fn)?zr.init(e.state):n.apply(e)}});let x0=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(x0=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Ol=typeof navigator<"u"&&(!((jl=navigator.scheduling)===null||jl===void 0)&&jl.isInputPending)?()=>navigator.scheduling.isInputPending():null,ES=Fe.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 t=this.view.state.field(Vt.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Vt.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=x0(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:i}}=this.view,s=r.field(Vt.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Ol?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<i&&r.doc.length>i+1e3,l=s.context.work(()=>Ol&&Ol()||Date.now()>o,i+(a?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Vt.setState.of(new zr(s.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>ut(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Fn=K.define({combine(n){return n.length?n[0]:null},enables:n=>[Vt.state,ES,H.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class RS{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const LS=K.define(),Va=K.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function ga(n){let e=n.facet(Va);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function qi(n,e){let t="",r=n.tabSize,i=n.facet(Va)[0];if(i==" "){for(;e>=r;)t+=" ",e-=r;i=" "}for(let s=0;s<e;s++)t+=i;return t}function Hh(n,e){n instanceof me&&(n=new za(n));for(let r of n.state.facet(LS)){let i=r(n,e);if(i!==void 0)return i}let t=nt(n.state);return t.length>=e?IS(n,t,e):null}class za{constructor(e,t={}){this.state=e,this.options=t,this.unit=ga(e)}lineAt(e,t=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:r.text.slice(i-r.from),from:i}:{text:r.text.slice(0,i-r.from),from:r.from}:r}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:i}=this.lineAt(e,t);return r.slice(e-i,Math.min(r.length,e+100-i))}column(e,t=1){let{text:r,from:i}=this.lineAt(e,t),s=this.countColumn(r,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return o>-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,t=e.length){return Ur(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:r,from:i}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const y0=new ue;function IS(n,e,t){let r=e.resolveStack(t),i=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(i!=r.node){let s=[];for(let o=i;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return v0(r,n,t)}function v0(n,e,t){for(let r=n;r;r=r.next){let i=BS(r.node);if(i)return i(Wh.create(e,t,r))}return 0}function $S(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function BS(n){let e=n.type.prop(y0);if(e)return e;let t=n.firstChild,r;if(t&&(r=t.type.prop(ue.closedBy))){let i=n.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>_S(o,!0,1,void 0,s&&!$S(o)?i.from:void 0)}return n.parent==null?FS:null}function FS(){return 0}class Wh extends za{constructor(e,t,r){super(e.state,e.options),this.base=e,this.pos=t,this.context=r}get node(){return this.context.node}static create(e,t,r){return new Wh(e,t,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(t.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(VS(r,e))break;t=this.state.doc.lineAt(r.from)}return this.lineIndent(t.from)}continue(){return v0(this.context.next,this.base,this.pos)}}function VS(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function zS(n){let e=n.node,t=e.childAfter(e.from),r=e.lastChild;if(!t)return null;let i=n.options.simulateBreak,s=n.state.doc.lineAt(t.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let a=t.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let c=/^ */.exec(s.text.slice(t.to-s.from))[0].length;return{from:t.from,to:t.to+c}}a=l.to}}function _S(n,e,t,r,i){let s=n.textAfter,o=s.match(/^\s*/)[0].length,a=r&&s.slice(o,o+r.length)==r||i==n.pos+o,l=zS(n);return l?a?n.column(l.from):n.column(l.to):n.baseIndent+(a?0:n.unit*t)}function bf({except:n,units:e=1}={}){return t=>{let r=n&&n.test(t.textAfter);return t.baseIndent+(r?0:e*t.unit)}}const HS=200;function WS(){return me.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:r}=n.newSelection.main,i=t.lineAt(r);if(r>i.from+HS)return n;let s=t.sliceString(i.from,r);if(!e.some(c=>c.test(s)))return n;let{state:o}=n,a=-1,l=[];for(let{head:c}of o.selection.ranges){let d=o.doc.lineAt(c);if(d.from==a)continue;a=d.from;let u=Hh(o,d.from);if(u==null)continue;let f=/^\s*/.exec(d.text)[0],p=qi(o,u);f!=p&&l.push({from:d.from,to:d.from+f.length,insert:p})}return l.length?[n,{changes:l,sequential:!0}]:n})}const US=K.define(),w0=new ue;function KS(n){let e=n.firstChild,t=n.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?n.to:t.from}:null}function GS(n,e,t){let r=nt(n);if(r.length<t)return null;let i=r.resolveStack(t,1),s=null;for(let o=i;o;o=o.next){let a=o.node;if(a.to<=t||a.from>t)continue;if(s&&a.from<e)break;let l=a.type.prop(w0);if(l&&(a.to<r.length-50||r.length==n.doc.length||!qS(a))){let c=l(a,n);c&&c.from<=t&&c.from>=e&&c.to>t&&(s=c)}}return s}function qS(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function ba(n,e,t){for(let r of n.facet(US)){let i=r(n,e,t);if(i)return i}return GS(n,e,t)}function k0(n,e){let t=e.mapPos(n.from,1),r=e.mapPos(n.to,-1);return t>=r?void 0:{from:t,to:r}}const _a=ae.define({map:k0}),Ws=ae.define({map:k0});function S0(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(r=>r.from<=t&&r.to>=t)||e.push(n.lineBlockAt(t));return e}const lr=Ye.define({create(){return ne.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,r)=>n=xf(n,t,r)),n=n.map(e.changes);for(let t of e.effects)if(t.is(_a)&&!JS(n,t.value.from,t.value.to)){let{preparePlaceholder:r}=e.state.facet(O0),i=r?ne.replace({widget:new n3(r(e.state,t.value))}):yf;n=n.update({add:[i.range(t.value.from,t.value.to)]})}else t.is(Ws)&&(n=n.update({filter:(r,i)=>t.value.from!=r||t.value.to!=i,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(n=xf(n,e.selection.main.head)),n},provide:n=>H.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(r,i)=>{t.push(r,i)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<n.length;){let r=n[t++],i=n[t++];if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(yf.range(r,i))}return ne.set(e,!0)}});function xf(n,e,t=e){let r=!1;return n.between(e,t,(i,s)=>{i<t&&s>e&&(r=!0)}),r?n.update({filterFrom:e,filterTo:t,filter:(i,s)=>i>=t||s<=e}):n}function xa(n,e,t){var r;let i=null;return(r=n.field(lr,!1))===null||r===void 0||r.between(e,t,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function JS(n,e,t){let r=!1;return n.between(e,e,(i,s)=>{i==e&&s==t&&(r=!0)}),r}function C0(n,e){return n.field(lr,!1)?e:e.concat(ae.appendConfig.of(P0()))}const YS=n=>{for(let e of S0(n)){let t=ba(n.state,e.from,e.to);if(t)return n.dispatch({effects:C0(n.state,[_a.of(t),j0(n,t)])}),!0}return!1},QS=n=>{if(!n.state.field(lr,!1))return!1;let e=[];for(let t of S0(n)){let r=xa(n.state,t.from,t.to);r&&e.push(Ws.of(r),j0(n,r,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function j0(n,e,t=!0){let r=n.state.doc.lineAt(e.from).number,i=n.state.doc.lineAt(e.to).number;return H.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${r} ${n.state.phrase("to")} ${i}.`)}const XS=n=>{let{state:e}=n,t=[];for(let r=0;r<e.doc.length;){let i=n.lineBlockAt(r),s=ba(e,i.from,i.to);s&&t.push(_a.of(s)),r=(s?n.lineBlockAt(s.to):i).to+1}return t.length&&n.dispatch({effects:C0(n.state,t)}),!!t.length},ZS=n=>{let e=n.state.field(lr,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(r,i)=>{t.push(Ws.of({from:r,to:i}))}),n.dispatch({effects:t}),!0},e3=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:YS},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:QS},{key:"Ctrl-Alt-[",run:XS},{key:"Ctrl-Alt-]",run:ZS}],t3={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},O0=K.define({combine(n){return cn(n,t3)}});function P0(n){return[lr,s3]}function N0(n,e){let{state:t}=n,r=t.facet(O0),i=o=>{let a=n.lineBlockAt(n.posAtDOM(o.target)),l=xa(n.state,a.from,a.to);l&&n.dispatch({effects:Ws.of(l)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(n,i,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const yf=ne.replace({widget:new class extends hn{toDOM(n){return N0(n,null)}}});class n3 extends hn{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return N0(e,this.value)}}const r3={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Pl extends vn{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function i3(n={}){let e={...r3,...n},t=new Pl(e,!0),r=new Pl(e,!1),i=Fe.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Fn)!=o.state.facet(Fn)||o.startState.field(lr,!1)!=o.state.field(lr,!1)||nt(o.startState)!=nt(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new xn;for(let l of o.viewportLineBlocks){let c=xa(o.state,l.from,l.to)?r:ba(o.state,l.from,l.to)?t:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:s}=e;return[i,yS({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(i))===null||a===void 0?void 0:a.markers)||pe.empty},initialSpacer(){return new Pl(e,!1)},domEventHandlers:{...s,click:(o,a,l)=>{if(s.click&&s.click(o,a,l))return!0;let c=xa(o.state,a.from,a.to);if(c)return o.dispatch({effects:Ws.of(c)}),!0;let d=ba(o.state,a.from,a.to);return d?(o.dispatch({effects:_a.of(d)}),!0):!1}}}),P0()]}const s3=H.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 Kr{constructor(e,t){this.specs=e;let r;function i(a){let l=In.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const s=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,o=t.scope;this.scope=o instanceof Vt?a=>a.prop(Sr)==o.data:o?a=>a==o:void 0,this.style=Jm(e.map(a=>({tag:a.tag,class:a.class||i(Object.assign({},a,{tag:null}))})),{all:s}).style,this.module=r?new In(r):null,this.themeType=t.themeType}static define(e,t){return new Kr(e,t||{})}}const Qc=K.define(),A0=K.define({combine(n){return n.length?[n[0]]:null}});function Nl(n){let e=n.facet(Qc);return e.length?e:n.facet(A0)}function Uh(n,e){let t=[a3],r;return n instanceof Kr&&(n.module&&t.push(H.styleModule.of(n.module)),r=n.themeType),e?.fallback?t.push(A0.of(n)):r?t.push(Qc.computeN([H.darkTheme],i=>i.facet(H.darkTheme)==(r=="dark")?[n]:[])):t.push(Qc.of(n)),t}class o3{constructor(e){this.markCache=Object.create(null),this.tree=nt(e.state),this.decorations=this.buildDeco(e,Nl(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=nt(e.state),r=Nl(e.state),i=r!=Nl(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<s.to&&!i&&t.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return ne.none;let r=new xn;for(let{from:i,to:s}of e.visibleRanges)g2(this.tree,t,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=ne.mark({class:l})))},i,s);return r.finish()}}const a3=dr.high(Fe.fromClass(o3,{decorations:n=>n.decorations})),l3=Kr.define([{tag:T.meta,color:"#404740"},{tag:T.link,textDecoration:"underline"},{tag:T.heading,textDecoration:"underline",fontWeight:"bold"},{tag:T.emphasis,fontStyle:"italic"},{tag:T.strong,fontWeight:"bold"},{tag:T.strikethrough,textDecoration:"line-through"},{tag:T.keyword,color:"#708"},{tag:[T.atom,T.bool,T.url,T.contentSeparator,T.labelName],color:"#219"},{tag:[T.literal,T.inserted],color:"#164"},{tag:[T.string,T.deleted],color:"#a11"},{tag:[T.regexp,T.escape,T.special(T.string)],color:"#e40"},{tag:T.definition(T.variableName),color:"#00f"},{tag:T.local(T.variableName),color:"#30a"},{tag:[T.typeName,T.namespace],color:"#085"},{tag:T.className,color:"#167"},{tag:[T.special(T.variableName),T.macroName],color:"#256"},{tag:T.definition(T.propertyName),color:"#00c"},{tag:T.comment,color:"#940"},{tag:T.invalid,color:"#f00"}]),c3=H.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),M0=1e4,D0="()[]{}",T0=K.define({combine(n){return cn(n,{afterCursor:!0,brackets:D0,maxScanDistance:M0,renderMatch:u3})}}),h3=ne.mark({class:"cm-matchingBracket"}),d3=ne.mark({class:"cm-nonmatchingBracket"});function u3(n){let e=[],t=n.matched?h3:d3;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}const f3=Ye.define({create(){return ne.none},update(n,e){if(!e.docChanged&&!e.selection)return n;let t=[],r=e.state.facet(T0);for(let i of e.state.selection.ranges){if(!i.empty)continue;let s=tn(e.state,i.head,-1,r)||i.head>0&&tn(e.state,i.head-1,1,r)||r.afterCursor&&(tn(e.state,i.head,1,r)||i.head<e.state.doc.length&&tn(e.state,i.head+1,-1,r));s&&(t=t.concat(r.renderMatch(s,e.state)))}return ne.set(t,!0)},provide:n=>H.decorations.from(n)}),p3=[f3,c3];function m3(n={}){return[T0.of(n),p3]}const g3=new ue;function Xc(n,e,t){let r=n.prop(e<0?ue.openedBy:ue.closedBy);if(r)return r;if(n.name.length==1){let i=t.indexOf(n.name);if(i>-1&&i%2==(e<0?1:0))return[t[i+e]]}return null}function Zc(n){let e=n.type.prop(g3);return e?e(n.node):n}function tn(n,e,t,r={}){let i=r.maxScanDistance||M0,s=r.brackets||D0,o=nt(n),a=o.resolveInner(e,t);for(let l=a;l;l=l.parent){let c=Xc(l.type,t,s);if(c&&l.from<l.to){let d=Zc(l);if(d&&(t>0?e>=d.from&&e<d.to:e>d.from&&e<=d.to))return b3(n,e,t,l,d,c,s)}}return x3(n,e,t,o,a.type,i,s)}function b3(n,e,t,r,i,s,o){let a=r.parent,l={from:i.from,to:i.to},c=0,d=a?.cursor();if(d&&(t<0?d.childBefore(r.from):d.childAfter(r.to)))do if(t<0?d.to<=r.from:d.from>=r.to){if(c==0&&s.indexOf(d.type.name)>-1&&d.from<d.to){let u=Zc(d);return{start:l,end:u?{from:u.from,to:u.to}:void 0,matched:!0}}else if(Xc(d.type,t,o))c++;else if(Xc(d.type,-t,o)){if(c==0){let u=Zc(d);return{start:l,end:u&&u.from<u.to?{from:u.from,to:u.to}:void 0,matched:!1}}c--}}while(t<0?d.prevSibling():d.nextSibling());return{start:l,matched:!1}}function x3(n,e,t,r,i,s,o){let a=t<0?n.sliceDoc(e-1,e):n.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=t>0)return null;let c={from:t<0?e-1:e,to:t>0?e+1:e},d=n.doc.iterRange(e,t>0?n.doc.length:0),u=0;for(let f=0;!d.next().done&&f<=s;){let p=d.value;t<0&&(f+=p.length);let m=e+f*t;for(let b=t>0?0:p.length-1,x=t>0?p.length:-1;b!=x;b+=t){let w=o.indexOf(p[b]);if(!(w<0||r.resolveInner(m+b,1).type!=i))if(w%2==0==t>0)u++;else{if(u==1)return{start:c,end:{from:m+b,to:m+b+1},matched:w>>1==l>>1};u--}}t>0&&(f+=p.length)}return d.done?{start:c,matched:!1}:null}const y3=Object.create(null),vf=[pt.none],wf=[],kf=Object.create(null),v3=Object.create(null);for(let[n,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"]])v3[n]=w3(y3,e);function Al(n,e){wf.indexOf(n)>-1||(wf.push(n),console.warn(e))}function w3(n,e){let t=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let d=n[c]||T[c];d?typeof d=="function"?l.length?l=l.map(d):Al(c,`Modifier ${c} used at start of tag`):l.length?Al(c,`Tag ${c} used as modifier`):l=Array.isArray(d)?d:[d]:Al(c,`Unknown highlighting tag ${c}`)}for(let c of l)t.push(c)}if(!t.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+t.map(a=>a.id),s=kf[i];if(s)return s.id;let o=kf[i]=pt.define({id:vf.length,name:r,props:[Gm({[r]:t})]});return vf.push(o),o.id}Pe.RTL,Pe.LTR;const k3=pa.define({name:"json",parser:v2.configure({props:[y0.add({Object:bf({except:/^\s*\}/}),Array:bf({except:/^\s*\]/})}),w0.add({"Object Array":KS})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function S3(){return new RS(k3)}function eh(){return eh=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},eh.apply(null,arguments)}function C3(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}const j3=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),r=Gh(n.state,t.from);return r.line?O3(n):r.block?N3(n):!1};function Kh(n,e){return({state:t,dispatch:r})=>{if(t.readOnly)return!1;let i=n(e,t);return i?(r(t.update(i)),!0):!1}}const O3=Kh(D3,0),P3=Kh(E0,0),N3=Kh((n,e)=>E0(n,e,M3(e)),0);function Gh(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const ui=50;function A3(n,{open:e,close:t},r,i){let s=n.sliceDoc(r-ui,r),o=n.sliceDoc(i,i+ui),a=/\s*$/.exec(s)[0].length,l=/^\s*/.exec(o)[0].length,c=s.length-a;if(s.slice(c-e.length,c)==e&&o.slice(l,l+t.length)==t)return{open:{pos:r-a,margin:a&&1},close:{pos:i+l,margin:l&&1}};let d,u;i-r<=2*ui?d=u=n.sliceDoc(r,i):(d=n.sliceDoc(r,r+ui),u=n.sliceDoc(i-ui,i));let f=/^\s*/.exec(d)[0].length,p=/\s*$/.exec(u)[0].length,m=u.length-p-t.length;return d.slice(f,f+e.length)==e&&u.slice(m,m+t.length)==t?{open:{pos:r+f+e.length,margin:/\s/.test(d.charAt(f+e.length))?1:0},close:{pos:i-p-t.length,margin:/\s/.test(u.charAt(m-1))?1:0}}:null}function M3(n){let e=[];for(let t of n.selection.ranges){let r=n.doc.lineAt(t.from),i=t.to<=r.to?r:n.doc.lineAt(t.to);i.from>r.from&&i.from==t.to&&(i=t.to==r.to+1?r:n.doc.lineAt(t.to-1));let s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function E0(n,e,t=e.selection.ranges){let r=t.map(s=>Gh(e,s.from).block);if(!r.every(s=>s))return null;let i=t.map((s,o)=>A3(e,r[o],s.from,s.to));if(n!=2&&!i.every(s=>s))return{changes:e.changes(t.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(n!=1&&i.some(s=>s)){let s=[];for(let o=0,a;o<i.length;o++)if(a=i[o]){let l=r[o],{open:c,close:d}=a;s.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:d.pos-d.margin,to:d.pos+l.close.length})}return{changes:s}}return null}function D3(n,e,t=e.selection.ranges){let r=[],i=-1;for(let{from:s,to:o}of t){let a=r.length,l=1e9,c=Gh(e,s).line;if(c){for(let d=s;d<=o;){let u=e.doc.lineAt(d);if(u.from>i&&(s==o||o>u.from)){i=u.from;let f=/^\s*/.exec(u.text)[0].length,p=f==u.length,m=u.text.slice(f,f+c.length)==c?f:-1;f<u.text.length&&f<l&&(l=f),r.push({line:u,comment:m,token:c,indent:f,empty:p,single:!1})}d=u.to+1}if(l<1e9)for(let d=a;d<r.length;d++)r[d].indent<r[d].line.text.length&&(r[d].indent=l);r.length==a+1&&(r[a].single=!0)}}if(n!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:c,empty:d,single:u}of r)(u||!d)&&s.push({from:a.from+c,insert:l+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,d=c+l.length;o.text[d-o.from]==" "&&d++,s.push({from:c,to:d})}return{changes:s}}return null}const th=ln.define(),T3=ln.define(),E3=K.define(),R0=K.define({combine(n){return cn(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(r,i)=>e(r,i)||t(r,i)})}}),L0=Ye.define({create(){return nn.empty},update(n,e){let t=e.state.facet(R0),r=e.annotation(th);if(r){let l=ft.fromTransaction(e,r.selection),c=r.side,d=c==0?n.undone:n.done;return l?d=ya(d,d.length,t.minDepth,l):d=B0(d,e.startState.selection),new nn(c==0?r.rest:d,c==0?d:r.rest)}let i=e.annotation(T3);if((i=="full"||i=="before")&&(n=n.isolate()),e.annotation(He.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let s=ft.fromTransaction(e),o=e.annotation(He.time),a=e.annotation(He.userEvent);return s?n=n.addChanges(s,o,a,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(i=="full"||i=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new nn(n.done.map(ft.fromJSON),n.undone.map(ft.fromJSON))}});function R3(n={}){return[L0,R0.of(n),H.domEventHandlers({beforeinput(e,t){let r=e.inputType=="historyUndo"?I0:e.inputType=="historyRedo"?nh:null;return r?(e.preventDefault(),r(t)):!1}})]}function Ha(n,e){return function({state:t,dispatch:r}){if(!e&&t.readOnly)return!1;let i=t.field(L0,!1);if(!i)return!1;let s=i.pop(n,t,e);return s?(r(s),!0):!1}}const I0=Ha(0,!1),nh=Ha(1,!1),L3=Ha(0,!0),I3=Ha(1,!0);class ft{constructor(e,t,r,i,s){this.changes=e,this.effects=t,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new ft(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new ft(e.changes&&ze.fromJSON(e.changes),[],e.mapped&&sn.fromJSON(e.mapped),e.startSelection&&E.fromJSON(e.startSelection),e.selectionsAfter.map(E.fromJSON))}static fromTransaction(e,t){let r=Dt;for(let i of e.startState.facet(E3)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new ft(e.changes.invert(e.startState.doc),r,void 0,t||e.startState.selection,Dt)}static selection(e){return new ft(void 0,Dt,void 0,void 0,e)}}function ya(n,e,t,r){let i=e+1>t+20?e-t-1:0,s=n.slice(i,e);return s.push(r),s}function $3(n,e){let t=[],r=!1;return n.iterChangedRanges((i,s)=>t.push(i,s)),e.iterChangedRanges((i,s,o,a)=>{for(let l=0;l<t.length;){let c=t[l++],d=t[l++];a>=c&&o<=d&&(r=!0)}}),r}function B3(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,r)=>t.empty!=e.ranges[r].empty).length===0}function $0(n,e){return n.length?e.length?n.concat(e):n:e}const Dt=[],F3=200;function B0(n,e){if(n.length){let t=n[n.length-1],r=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-F3));return r.length&&r[r.length-1].eq(e)?n:(r.push(e),ya(n,n.length-1,1e9,t.setSelAfter(r)))}else return[ft.selection([e])]}function V3(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function Ml(n,e){if(!n.length)return n;let t=n.length,r=Dt;for(;t;){let i=z3(n[t-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=n.slice(0,t);return s[t-1]=i,s}else e=i.mapped,t--,r=i.selectionsAfter}return r.length?[ft.selection(r)]:Dt}function z3(n,e,t){let r=$0(n.selectionsAfter.length?n.selectionsAfter.map(a=>a.map(e)):Dt,t);if(!n.changes)return ft.selection(r);let i=n.changes.map(e),s=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(s):s;return new ft(i,ae.mapEffects(n.effects,e),o,n.startSelection.map(s),r)}const _3=/^(input\.type|delete)($|\.)/;class nn{constructor(e,t,r=0,i=void 0){this.done=e,this.undone=t,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new nn(this.done,this.undone):this}addChanges(e,t,r,i,s){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||_3.test(r))&&(!a.selectionsAfter.length&&t-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,$3(a.changes,e.changes))||r=="input.type.compose")?o=ya(o,o.length-1,i.minDepth,new ft(e.changes.compose(a.changes),$0(ae.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,Dt)):o=ya(o,o.length,i.minDepth,e),new nn(o,Dt,t,r)}addSelection(e,t,r,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Dt;return s.length>0&&t-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&B3(s[s.length-1],e)?this:new nn(B0(this.done,e),this.undone,t,r)}addMapping(e){return new nn(Ml(this.done,e),Ml(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,r){let i=e==0?this.done:this.undone;if(i.length==0)return null;let s=i[i.length-1],o=s.selectionsAfter[0]||t.selection;if(r&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:th.of({side:e,rest:V3(i),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let a=i.length==1?Dt:i.slice(0,i.length-1);return s.mapped&&(a=Ml(a,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:th.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}nn.empty=new nn(Dt,Dt);const H3=[{key:"Mod-z",run:I0,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:nh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:nh,preventDefault:!0},{key:"Mod-u",run:L3,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:I3,preventDefault:!0}];function Gr(n,e){return E.create(n.ranges.map(e),n.mainIndex)}function Ht(n,e){return n.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Wt({state:n,dispatch:e},t){let r=Gr(n.selection,t);return r.eq(n.selection,!0)?!1:(e(Ht(n,r)),!0)}function Wa(n,e){return E.cursor(e?n.to:n.from)}function F0(n,e){return Wt(n,t=>t.empty?n.moveByChar(t,e):Wa(t,e))}function rt(n){return n.textDirectionAt(n.state.selection.main.head)==Pe.LTR}const V0=n=>F0(n,!rt(n)),z0=n=>F0(n,rt(n));function _0(n,e){return Wt(n,t=>t.empty?n.moveByGroup(t,e):Wa(t,e))}const W3=n=>_0(n,!rt(n)),U3=n=>_0(n,rt(n));function K3(n,e,t){if(e.type.prop(t))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function Ua(n,e,t){let r=nt(n).resolveInner(e.head),i=t?ue.closedBy:ue.openedBy;for(let l=e.head;;){let c=t?r.childAfter(l):r.childBefore(l);if(!c)break;K3(n,c,i)?r=c:l=t?c.to:c.from}let s=r.type.prop(i),o,a;return s&&(o=t?tn(n,r.from,1):tn(n,r.to,-1))&&o.matched?a=t?o.end.to:o.end.from:a=t?r.to:r.from,E.cursor(a,t?-1:1)}const G3=n=>Wt(n,e=>Ua(n.state,e,!rt(n))),q3=n=>Wt(n,e=>Ua(n.state,e,rt(n)));function H0(n,e){return Wt(n,t=>{if(!t.empty)return Wa(t,e);let r=n.moveVertically(t,e);return r.head!=t.head?r:n.moveToLineBoundary(t,e)})}const W0=n=>H0(n,!1),U0=n=>H0(n,!0);function K0(n){let e=n.scrollDOM.clientHeight<n.scrollDOM.scrollHeight-2,t=0,r=0,i;if(e){for(let s of n.state.facet(H.scrollMargins)){let o=s(n);o?.top&&(t=Math.max(o?.top,t)),o?.bottom&&(r=Math.max(o?.bottom,r))}i=n.scrollDOM.clientHeight-t-r}else i=(n.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:r,selfScroll:e,height:Math.max(n.defaultLineHeight,i-5)}}function G0(n,e){let t=K0(n),{state:r}=n,i=Gr(r.selection,o=>o.empty?n.moveVertically(o,e,t.height):Wa(o,e));if(i.eq(r.selection))return!1;let s;if(t.selfScroll){let o=n.coordsAtPos(r.selection.main.head),a=n.scrollDOM.getBoundingClientRect(),l=a.top+t.marginTop,c=a.bottom-t.marginBottom;o&&o.top>l&&o.bottom<c&&(s=H.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-l}))}return n.dispatch(Ht(r,i),{effects:s}),!0}const Sf=n=>G0(n,!1),rh=n=>G0(n,!0);function zn(n,e,t){let r=n.lineBlockAt(e.head),i=n.moveToLineBoundary(e,t);if(i.head==e.head&&i.head!=(t?r.to:r.from)&&(i=n.moveToLineBoundary(e,t,!1)),!t&&i.head==r.from&&r.length){let s=/^\s*/.exec(n.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(i=E.cursor(r.from+s))}return i}const J3=n=>Wt(n,e=>zn(n,e,!0)),Y3=n=>Wt(n,e=>zn(n,e,!1)),Q3=n=>Wt(n,e=>zn(n,e,!rt(n))),X3=n=>Wt(n,e=>zn(n,e,rt(n))),Z3=n=>Wt(n,e=>E.cursor(n.lineBlockAt(e.head).from,1)),e4=n=>Wt(n,e=>E.cursor(n.lineBlockAt(e.head).to,-1));function t4(n,e,t){let r=!1,i=Gr(n.selection,s=>{let o=tn(n,s.head,-1)||tn(n,s.head,1)||s.head>0&&tn(n,s.head-1,1)||s.head<n.doc.length&&tn(n,s.head+1,-1);if(!o||!o.end)return s;r=!0;let a=o.start.from==s.head?o.end.to:o.end.from;return E.cursor(a)});return r?(e(Ht(n,i)),!0):!1}const n4=({state:n,dispatch:e})=>t4(n,e);function $t(n,e){let t=Gr(n.state.selection,r=>{let i=e(r);return E.range(r.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return t.eq(n.state.selection)?!1:(n.dispatch(Ht(n.state,t)),!0)}function q0(n,e){return $t(n,t=>n.moveByChar(t,e))}const J0=n=>q0(n,!rt(n)),Y0=n=>q0(n,rt(n));function Q0(n,e){return $t(n,t=>n.moveByGroup(t,e))}const r4=n=>Q0(n,!rt(n)),i4=n=>Q0(n,rt(n)),s4=n=>$t(n,e=>Ua(n.state,e,!rt(n))),o4=n=>$t(n,e=>Ua(n.state,e,rt(n)));function X0(n,e){return $t(n,t=>n.moveVertically(t,e))}const Z0=n=>X0(n,!1),eb=n=>X0(n,!0);function tb(n,e){return $t(n,t=>n.moveVertically(t,e,K0(n).height))}const Cf=n=>tb(n,!1),jf=n=>tb(n,!0),a4=n=>$t(n,e=>zn(n,e,!0)),l4=n=>$t(n,e=>zn(n,e,!1)),c4=n=>$t(n,e=>zn(n,e,!rt(n))),h4=n=>$t(n,e=>zn(n,e,rt(n))),d4=n=>$t(n,e=>E.cursor(n.lineBlockAt(e.head).from)),u4=n=>$t(n,e=>E.cursor(n.lineBlockAt(e.head).to)),Of=({state:n,dispatch:e})=>(e(Ht(n,{anchor:0})),!0),Pf=({state:n,dispatch:e})=>(e(Ht(n,{anchor:n.doc.length})),!0),Nf=({state:n,dispatch:e})=>(e(Ht(n,{anchor:n.selection.main.anchor,head:0})),!0),Af=({state:n,dispatch:e})=>(e(Ht(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),f4=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),p4=({state:n,dispatch:e})=>{let t=Ka(n).map(({from:r,to:i})=>E.range(r,Math.min(i+1,n.doc.length)));return e(n.update({selection:E.create(t),userEvent:"select"})),!0},m4=({state:n,dispatch:e})=>{let t=Gr(n.selection,r=>{let i=nt(n),s=i.resolveStack(r.from,1);if(r.empty){let o=i.resolveStack(r.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;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 E.range(a.to,a.from)}return r});return t.eq(n.selection)?!1:(e(Ht(n,t)),!0)};function nb(n,e){let{state:t}=n,r=t.selection,i=t.selection.ranges.slice();for(let s of t.selection.ranges){let o=t.doc.lineAt(s.head);if(e?o.to<n.state.doc.length:o.from>0)for(let a=s;;){let l=n.moveVertically(a,e);if(l.head<o.from||l.head>o.to){i.some(c=>c.head==l.head)||i.push(l);break}else{if(l.head==a.head)break;a=l}}}return i.length==r.ranges.length?!1:(n.dispatch(Ht(t,E.create(i,i.length-1))),!0)}const g4=n=>nb(n,!1),b4=n=>nb(n,!0),x4=({state:n,dispatch:e})=>{let t=n.selection,r=null;return t.ranges.length>1?r=E.create([t.main]):t.main.empty||(r=E.create([E.cursor(t.main.head)])),r?(e(Ht(n,r)),!0):!1};function Us(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:r}=n,i=r.changeByRange(s=>{let{from:o,to:a}=s;if(o==a){let l=e(s);l<o?(t="delete.backward",l=Ao(n,l,!1)):l>o&&(t="delete.forward",l=Ao(n,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=Ao(n,o,!1),a=Ao(n,a,!0);return o==a?{range:s}:{changes:{from:o,to:a},range:E.cursor(o,o<s.head?-1:1)}});return i.changes.empty?!1:(n.dispatch(r.update(i,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?H.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Ao(n,e,t){if(n instanceof H)for(let r of n.state.facet(H.atomicRanges).map(i=>i(n)))r.between(e,e,(i,s)=>{i<e&&s>e&&(e=t?s:i)});return e}const rb=(n,e,t)=>Us(n,r=>{let i=r.from,{state:s}=n,o=s.doc.lineAt(i),a,l;if(t&&!e&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,i-o.from))){if(a[a.length-1]==" ")return i-1;let c=Ur(a,s.tabSize),d=c%ga(s)||ga(s);for(let u=0;u<d&&a[a.length-1-u]==" ";u++)i--;l=i}else l=_e(o.text,i-o.from,e,e)+o.from,l==i&&o.number!=(e?s.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,i-o.from))&&(l=_e(o.text,l-o.from,!1,!1)+o.from);return l}),ih=n=>rb(n,!1,!0),ib=n=>rb(n,!0,!1),sb=(n,e)=>Us(n,t=>{let r=t.head,{state:i}=n,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let a=null;;){if(r==(e?s.to:s.from)){r==t.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let l=_e(s.text,r-s.from,e)+s.from,c=s.text.slice(Math.min(r,l)-s.from,Math.max(r,l)-s.from),d=o(c);if(a!=null&&d!=a)break;(c!=" "||r!=t.head)&&(a=d),r=l}return r}),ob=n=>sb(n,!1),y4=n=>sb(n,!0),v4=n=>Us(n,e=>{let t=n.lineBlockAt(e.head).to;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),w4=n=>Us(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),k4=n=>Us(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),S4=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:ye.of(["",""])},range:E.cursor(r.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},C4=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(r=>{if(!r.empty||r.from==0||r.from==n.doc.length)return{range:r};let i=r.from,s=n.doc.lineAt(i),o=i==s.from?i-1:_e(s.text,i-s.from,!1)+s.from,a=i==s.to?i+1:_e(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:a,insert:n.doc.slice(i,a).append(n.doc.slice(o,i))},range:E.cursor(a)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Ka(n){let e=[],t=-1;for(let r of n.selection.ranges){let i=n.doc.lineAt(r.from),s=n.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=n.doc.lineAt(r.to-1)),t>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(r)}else e.push({from:i.from,to:s.to,ranges:[r]});t=s.number+1}return e}function ab(n,e,t){if(n.readOnly)return!1;let r=[],i=[];for(let s of Ka(n)){if(t?s.to==n.doc.length:s.from==0)continue;let o=n.doc.lineAt(t?s.to+1:s.from-1),a=o.length+1;if(t){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+n.lineBreak});for(let l of s.ranges)i.push(E.range(Math.min(n.doc.length,l.anchor+a),Math.min(n.doc.length,l.head+a)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:n.lineBreak+o.text});for(let l of s.ranges)i.push(E.range(l.anchor-a,l.head-a))}}return r.length?(e(n.update({changes:r,scrollIntoView:!0,selection:E.create(i,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const j4=({state:n,dispatch:e})=>ab(n,e,!1),O4=({state:n,dispatch:e})=>ab(n,e,!0);function lb(n,e,t){if(n.readOnly)return!1;let r=[];for(let s of Ka(n))t?r.push({from:s.from,insert:n.doc.slice(s.from,s.to)+n.lineBreak}):r.push({from:s.to,insert:n.lineBreak+n.doc.slice(s.from,s.to)});let i=n.changes(r);return e(n.update({changes:i,selection:n.selection.map(i,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const P4=({state:n,dispatch:e})=>lb(n,e,!1),N4=({state:n,dispatch:e})=>lb(n,e,!0),A4=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(Ka(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),r=Gr(e.selection,i=>{let s;if(n.lineWrapping){let o=n.lineBlockAt(i.head),a=n.coordsAtPos(i.head,i.assoc||1);a&&(s=o.bottom+n.documentTop-a.bottom+n.defaultLineHeight/2)}return n.moveVertically(i,!0,s)}).map(t);return n.dispatch({changes:t,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function M4(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=nt(n).resolveInner(e),r=t.childBefore(e),i=t.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(ue.closedBy))&&s.indexOf(i.name)>-1&&n.doc.lineAt(r.to).from==n.doc.lineAt(i.from).from&&!/\S/.test(n.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const Mf=cb(!1),D4=cb(!0);function cb(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,a=e.doc.lineAt(s),l=!n&&s==o&&M4(e,s);n&&(s=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new za(e,{simulateBreak:s,simulateDoubleBreak:!!l}),d=Hh(c,s);for(d==null&&(d=Ur(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:s,to:o}=l:s>a.from&&s<a.from+100&&!/\S/.test(a.text.slice(0,s))&&(s=a.from);let u=["",qi(e,d)];return l&&u.push(qi(e,c.lineIndent(a.from,-1))),{changes:{from:s,to:o,insert:ye.of(u)},range:E.cursor(s+1+u[1].length)}});return t(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function qh(n,e){let t=-1;return n.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let a=n.doc.lineAt(o);a.number>t&&(r.empty||r.to>a.from)&&(e(a,i,r),t=a.number),o=a.to+1}let s=n.changes(i);return{changes:i,range:E.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const T4=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),r=new za(n,{overrideIndentation:s=>{let o=t[s];return o??-1}}),i=qh(n,(s,o,a)=>{let l=Hh(r,s.from);if(l==null)return;/\S/.test(s.text)||(l=0);let c=/^\s*/.exec(s.text)[0],d=qi(n,l);(c!=d||a.from<s.from+c.length)&&(t[s.from]=l,o.push({from:s.from,to:s.from+c.length,insert:d}))});return i.changes.empty||e(n.update(i,{userEvent:"indent"})),!0},hb=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(qh(n,(t,r)=>{r.push({from:t.from,insert:n.facet(Va)})}),{userEvent:"input.indent"})),!0),db=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(qh(n,(t,r)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let s=Ur(i,n.tabSize),o=0,a=qi(n,Math.max(0,s-ga(n)));for(;o<i.length&&o<a.length&&i.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:t.from+o,to:t.from+i.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),E4=n=>(n.setTabFocusMode(),!0),R4=[{key:"Ctrl-b",run:V0,shift:J0,preventDefault:!0},{key:"Ctrl-f",run:z0,shift:Y0},{key:"Ctrl-p",run:W0,shift:Z0},{key:"Ctrl-n",run:U0,shift:eb},{key:"Ctrl-a",run:Z3,shift:d4},{key:"Ctrl-e",run:e4,shift:u4},{key:"Ctrl-d",run:ib},{key:"Ctrl-h",run:ih},{key:"Ctrl-k",run:v4},{key:"Ctrl-Alt-h",run:ob},{key:"Ctrl-o",run:S4},{key:"Ctrl-t",run:C4},{key:"Ctrl-v",run:rh}],L4=[{key:"ArrowLeft",run:V0,shift:J0,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:W3,shift:r4,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Q3,shift:c4,preventDefault:!0},{key:"ArrowRight",run:z0,shift:Y0,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:U3,shift:i4,preventDefault:!0},{mac:"Cmd-ArrowRight",run:X3,shift:h4,preventDefault:!0},{key:"ArrowUp",run:W0,shift:Z0,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Of,shift:Nf},{mac:"Ctrl-ArrowUp",run:Sf,shift:Cf},{key:"ArrowDown",run:U0,shift:eb,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Pf,shift:Af},{mac:"Ctrl-ArrowDown",run:rh,shift:jf},{key:"PageUp",run:Sf,shift:Cf},{key:"PageDown",run:rh,shift:jf},{key:"Home",run:Y3,shift:l4,preventDefault:!0},{key:"Mod-Home",run:Of,shift:Nf},{key:"End",run:J3,shift:a4,preventDefault:!0},{key:"Mod-End",run:Pf,shift:Af},{key:"Enter",run:Mf,shift:Mf},{key:"Mod-a",run:f4},{key:"Backspace",run:ih,shift:ih,preventDefault:!0},{key:"Delete",run:ib,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:ob,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:y4,preventDefault:!0},{mac:"Mod-Backspace",run:w4,preventDefault:!0},{mac:"Mod-Delete",run:k4,preventDefault:!0}].concat(R4.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),I4=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:G3,shift:s4},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:q3,shift:o4},{key:"Alt-ArrowUp",run:j4},{key:"Shift-Alt-ArrowUp",run:P4},{key:"Alt-ArrowDown",run:O4},{key:"Shift-Alt-ArrowDown",run:N4},{key:"Mod-Alt-ArrowUp",run:g4},{key:"Mod-Alt-ArrowDown",run:b4},{key:"Escape",run:x4},{key:"Mod-Enter",run:D4},{key:"Alt-l",mac:"Ctrl-l",run:p4},{key:"Mod-i",run:m4,preventDefault:!0},{key:"Mod-[",run:db},{key:"Mod-]",run:hb},{key:"Mod-Alt-\\",run:T4},{key:"Shift-Mod-k",run:A4},{key:"Shift-Mod-\\",run:n4},{key:"Mod-/",run:j3},{key:"Alt-A",run:P3},{key:"Ctrl-m",mac:"Shift-Alt-m",run:E4}].concat(L4),$4={key:"Tab",run:hb,shift:db},Df=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class _r{constructor(e,t,r=0,i=e.length,s,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,i),this.bufferStart=r,this.normalize=s?a=>s(Df(a)):Df,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return ct(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Oh(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Zt(e);let i=this.normalize(t);if(i.length)for(let s=0,o=r;;s++){let a=i.charCodeAt(s),l=this.match(a,o,this.bufferPos+this.bufferStart);if(s==i.length-1){if(l)return this.value=l,this;break}o==r&&s<t.length&&t.charCodeAt(s)==a&&o++}}}match(e,t,r){let i=null;for(let s=0;s<this.matches.length;s+=2){let o=this.matches[s],a=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?i={from:this.matches[s+1],to:r}:(this.matches[s]++,a=!0)),a||(this.matches.splice(s,2),s-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?i={from:t,to:r}:this.matches.push(1,t)),i&&this.test&&!this.test(i.from,i.to,this.buffer,this.bufferStart)&&(i=null),i}}typeof Symbol<"u"&&(_r.prototype[Symbol.iterator]=function(){return this});const ub={from:-1,to:-1,match:/.*/.exec("")},Jh="gm"+(/x/.unicode==null?"":"u");class fb{constructor(e,t,r,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=ub,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new pb(e,t,r,i,s);this.re=new RegExp(t,Jh+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=va(e,i),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let r=this.curLineStart+t.index,i=r+t[0].length;if(this.matchPos=va(this.text,i+(r==i?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<i||r>this.value.to)&&(!this.test||this.test(r,i,t)))return this.value={from:r,to:i,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const Dl=new WeakMap;class Er{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,r){let i=Dl.get(e);if(!i||i.from>=r||i.to<=t){let a=new Er(t,e.sliceString(t,r));return Dl.set(e,a),a}if(i.from==t&&i.to==r)return i;let{text:s,from:o}=i;return o>t&&(s=e.sliceString(t,o)+s,o=t),i.to<r&&(s+=e.sliceString(i.to,r)),Dl.set(e,new Er(o,s)),new Er(t,s.slice(t-o,r-o))}}class pb{constructor(e,t,r,i,s){this.text=e,this.to=s,this.done=!1,this.value=ub,this.matchPos=va(e,i),this.re=new RegExp(t,Jh+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=Er.get(e,i,this.chunkEnd(i+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let r=this.flat.from+t.index,i=r+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,i,t)))return this.value={from:r,to:i,match:t},this.matchPos=va(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Er.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(fb.prototype[Symbol.iterator]=pb.prototype[Symbol.iterator]=function(){return this});function B4(n){try{return new RegExp(n,Jh),!0}catch{return!1}}function va(n,e){if(e>=n.length)return e;let t=n.lineAt(e),r;for(;e<t.to&&(r=t.text.charCodeAt(e-t.from))>=56320&&r<57344;)e++;return e}function sh(n){let e=String(n.state.doc.lineAt(n.state.selection.main.head).number),t=je("input",{class:"cm-textfield",name:"line",value:e}),r=je("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),n.dispatch({effects:Mi.of(!1)}),n.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},je("label",n.state.phrase("Go to line"),": ",t)," ",je("button",{class:"cm-button",type:"submit"},n.state.phrase("go")),je("button",{name:"close",onclick:()=>{n.dispatch({effects:Mi.of(!1)}),n.focus()},"aria-label":n.state.phrase("close"),type:"button"},["×"]));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!s)return;let{state:o}=n,a=o.doc.lineAt(o.selection.main.head),[,l,c,d,u]=s,f=d?+d.slice(1):0,p=c?+c:a.number;if(c&&u){let x=p/100;l&&(x=x*(l=="-"?-1:1)+a.number/o.doc.lines),p=Math.round(o.doc.lines*x)}else c&&l&&(p=p*(l=="-"?-1:1)+a.number);let m=o.doc.line(Math.max(1,Math.min(o.doc.lines,p))),b=E.cursor(m.from+Math.max(0,Math.min(f,m.length)));n.dispatch({effects:[Mi.of(!1),H.scrollIntoView(b.from,{y:"center"})],selection:b}),n.focus()}return{dom:r}}const Mi=ae.define(),Tf=Ye.define({create(){return!0},update(n,e){for(let t of e.effects)t.is(Mi)&&(n=t.value);return n},provide:n=>Gi.from(n,e=>e?sh:null)}),F4=n=>{let e=Ki(n,sh);if(!e){let t=[Mi.of(!0)];n.state.field(Tf,!1)==null&&t.push(ae.appendConfig.of([Tf,V4])),n.dispatch({effects:t}),e=Ki(n,sh)}return e&&e.dom.querySelector("input").select(),!0},V4=H.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"}}}),z4={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},_4=K.define({combine(n){return cn(n,z4,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function H4(n){return[q4,G4]}const W4=ne.mark({class:"cm-selectionMatch"}),U4=ne.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Ef(n,e,t,r){return(t==0||n(e.sliceDoc(t-1,t))!=Te.Word)&&(r==e.doc.length||n(e.sliceDoc(r,r+1))!=Te.Word)}function K4(n,e,t,r){return n(e.sliceDoc(t,t+1))==Te.Word&&n(e.sliceDoc(r-1,r))==Te.Word}const G4=Fe.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(_4),{state:t}=n,r=t.selection;if(r.ranges.length>1)return ne.none;let i=r.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return ne.none;let l=t.wordAt(i.head);if(!l)return ne.none;o=t.charCategorizer(i.head),s=t.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l<e.minSelectionLength||l>200)return ne.none;if(e.wholeWords){if(s=t.sliceDoc(i.from,i.to),o=t.charCategorizer(i.head),!(Ef(o,t,i.from,i.to)&&K4(o,t,i.from,i.to)))return ne.none}else if(s=t.sliceDoc(i.from,i.to),!s)return ne.none}let a=[];for(let l of n.visibleRanges){let c=new _r(t.doc,s,l.from,l.to);for(;!c.next().done;){let{from:d,to:u}=c.value;if((!o||Ef(o,t,d,u))&&(i.empty&&d<=i.from&&u>=i.to?a.push(U4.range(d,u)):(d>=i.to||u<=i.from)&&a.push(W4.range(d,u)),a.length>e.maxMatches))return ne.none}}return ne.set(a)}},{decorations:n=>n.decorations}),q4=H.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),J4=({state:n,dispatch:e})=>{let{selection:t}=n,r=E.create(t.ranges.map(i=>n.wordAt(i.head)||E.cursor(i.head)),t.mainIndex);return r.eq(t)?!1:(e(n.update({selection:r})),!0)};function Y4(n,e){let{main:t,ranges:r}=n.selection,i=n.wordAt(t.head),s=i&&i.from==t.from&&i.to==t.to;for(let o=!1,a=new _r(n.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new _r(n.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(s){let l=n.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const Q4=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(s=>s.from===s.to))return J4({state:n,dispatch:e});let r=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(s=>n.sliceDoc(s.from,s.to)!=r))return!1;let i=Y4(n,r);return i?(e(n.update({selection:n.selection.addRange(E.range(i.from,i.to),!1),effects:H.scrollIntoView(i.to)})),!0):!1},qr=K.define({combine(n){return cn(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new c5(e),scrollToMatch:e=>H.scrollIntoView(e)})}});class mb{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||B4(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,r)=>r=="n"?`
63
+ `: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 t5(this):new Z4(this)}getCursor(e,t=0,r){let i=e.doc?e:me.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?yr(this,i,t,r):xr(this,i,t,r)}}class gb{constructor(e){this.spec=e}}function xr(n,e,t,r){return new _r(e.doc,n.unquoted,t,r,n.caseSensitive?void 0:i=>i.toLowerCase(),n.wholeWord?X4(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function X4(n,e){return(t,r,i,s)=>((s>t||s+i.length<r)&&(s=Math.max(0,t-2),i=n.sliceString(s,Math.min(n.length,r+2))),(e(wa(i,t-s))!=Te.Word||e(ka(i,t-s))!=Te.Word)&&(e(ka(i,r-s))!=Te.Word||e(wa(i,r-s))!=Te.Word))}class Z4 extends gb{constructor(e){super(e)}nextMatch(e,t,r){let i=xr(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let s=Math.min(e.doc.length,t+this.spec.unquoted.length);i=xr(this.spec,e,0,s).nextOverlapping()}return i.done||i.value.from==t&&i.value.to==r?null:i.value}prevMatchInRange(e,t,r){for(let i=r;;){let s=Math.max(t,i-1e4-this.spec.unquoted.length),o=xr(this.spec,e,s,i),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==t)return null;i-=1e4}}prevMatch(e,t,r){let i=this.prevMatchInRange(e,0,t);return i||(i=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=t||i.to!=r)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let r=xr(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let s=xr(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function yr(n,e,t,r){return new fb(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:n.wholeWord?e5(e.charCategorizer(e.selection.main.head)):void 0},t,r)}function wa(n,e){return n.slice(_e(n,e,!1),e)}function ka(n,e){return n.slice(e,_e(n,e))}function e5(n){return(e,t,r)=>!r[0].length||(n(wa(r.input,r.index))!=Te.Word||n(ka(r.input,r.index))!=Te.Word)&&(n(ka(r.input,r.index+r[0].length))!=Te.Word||n(wa(r.input,r.index+r[0].length))!=Te.Word)}class t5 extends gb{nextMatch(e,t,r){let i=yr(this.spec,e,r,e.doc.length).next();return i.done&&(i=yr(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,r){for(let i=1;;i++){let s=Math.max(t,r-i*1e4),o=yr(this.spec,e,s,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==t||a.from>s+10))return a;if(s==t)return null}}prevMatch(e,t,r){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let i=r.length;i>0;i--){let s=+r.slice(0,i);if(s>0&&s<e.match.length)return e.match[s]+r.slice(i)}return t})}matchAll(e,t){let r=yr(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let s=yr(this.spec,e,Math.max(0,t-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const Ji=ae.define(),Yh=ae.define(),En=Ye.define({create(n){return new Tl(oh(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Ji)?n=new Tl(t.value.create(),n.panel):t.is(Yh)&&(n=new Tl(n.query,t.value?Qh:null));return n},provide:n=>Gi.from(n,e=>e.panel)});class Tl{constructor(e,t){this.query=e,this.panel=t}}const n5=ne.mark({class:"cm-searchMatch"}),r5=ne.mark({class:"cm-searchMatch cm-searchMatch-selected"}),i5=Fe.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(En))}update(n){let e=n.state.field(En);(e!=n.startState.field(En)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return ne.none;let{view:t}=this,r=new xn;for(let i=0,s=t.visibleRanges,o=s.length;i<o;i++){let{from:a,to:l}=s[i];for(;i<o-1&&l>s[i+1].from-2*250;)l=s[++i].to;n.highlight(t.state,a,l,(c,d)=>{let u=t.state.selection.ranges.some(f=>f.from==c&&f.to==d);r.add(c,d,u?r5:n5)})}return r.finish()}},{decorations:n=>n.decorations});function Ks(n){return e=>{let t=e.state.field(En,!1);return t&&t.query.spec.valid?n(e,t):yb(e)}}const Sa=Ks((n,{query:e})=>{let{to:t}=n.state.selection.main,r=e.nextMatch(n.state,t,t);if(!r)return!1;let i=E.single(r.from,r.to),s=n.state.facet(qr);return n.dispatch({selection:i,effects:[Xh(n,r),s.scrollToMatch(i.main,n)],userEvent:"select.search"}),xb(n),!0}),Ca=Ks((n,{query:e})=>{let{state:t}=n,{from:r}=t.selection.main,i=e.prevMatch(t,r,r);if(!i)return!1;let s=E.single(i.from,i.to),o=n.state.facet(qr);return n.dispatch({selection:s,effects:[Xh(n,i),o.scrollToMatch(s.main,n)],userEvent:"select.search"}),xb(n),!0}),s5=Ks((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:E.create(t.map(r=>E.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),o5=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:r,to:i}=t.main,s=[],o=0;for(let a=new _r(n.doc,n.sliceDoc(r,i));!a.next().done;){if(s.length>1e3)return!1;a.value.from==r&&(o=s.length),s.push(E.range(a.value.from,a.value.to))}return e(n.update({selection:E.create(s,o),userEvent:"select.search.matches"})),!0},Rf=Ks((n,{query:e})=>{let{state:t}=n,{from:r,to:i}=t.selection.main;if(t.readOnly)return!1;let s=e.nextMatch(t,r,r);if(!s)return!1;let o=s,a=[],l,c,d=[];o.from==r&&o.to==i&&(c=t.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:c}),o=e.nextMatch(t,o.from,o.to),d.push(H.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(r).number)+".")));let u=n.state.changes(a);return o&&(l=E.single(o.from,o.to).map(u),d.push(Xh(n,o)),d.push(t.facet(qr).scrollToMatch(l.main,n))),n.dispatch({changes:u,selection:l,effects:d,userEvent:"input.replace"}),!0}),a5=Ks((n,{query:e})=>{if(n.state.readOnly)return!1;let t=e.matchAll(n.state,1e9).map(i=>{let{from:s,to:o}=i;return{from:s,to:o,insert:e.getReplacement(i)}});if(!t.length)return!1;let r=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:H.announce.of(r),userEvent:"input.replace.all"}),!0});function Qh(n){return n.state.facet(qr).createPanel(n)}function oh(n,e){var t,r,i,s,o;let a=n.selection.main,l=a.empty||a.to>a.from+100?"":n.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=n.facet(qr);return new mb({search:((t=e?.literal)!==null&&t!==void 0?t:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(i=e?.literal)!==null&&i!==void 0?i:c.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:c.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function bb(n){let e=Ki(n,Qh);return e&&e.dom.querySelector("[main-field]")}function xb(n){let e=bb(n);e&&e==n.root.activeElement&&e.select()}const yb=n=>{let e=n.state.field(En,!1);if(e&&e.panel){let t=bb(n);if(t&&t!=n.root.activeElement){let r=oh(n.state,e.query.spec);r.valid&&n.dispatch({effects:Ji.of(r)}),t.focus(),t.select()}}else n.dispatch({effects:[Yh.of(!0),e?Ji.of(oh(n.state,e.query.spec)):ae.appendConfig.of(d5)]});return!0},vb=n=>{let e=n.state.field(En,!1);if(!e||!e.panel)return!1;let t=Ki(n,Qh);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:Yh.of(!1)}),!0},l5=[{key:"Mod-f",run:yb,scope:"editor search-panel"},{key:"F3",run:Sa,shift:Ca,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Sa,shift:Ca,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:vb,scope:"editor search-panel"},{key:"Mod-Shift-l",run:o5},{key:"Mod-Alt-g",run:F4},{key:"Mod-d",run:Q4,preventDefault:!0}];class c5{constructor(e){this.view=e;let t=this.query=e.state.field(En).query.spec;this.commit=this.commit.bind(this),this.searchField=je("input",{value:t.search,placeholder:xt(e,"Find"),"aria-label":xt(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=je("input",{value:t.replace,placeholder:xt(e,"Replace"),"aria-label":xt(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=je("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=je("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=je("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function r(i,s,o){return je("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=je("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>Sa(e),[xt(e,"next")]),r("prev",()=>Ca(e),[xt(e,"previous")]),r("select",()=>s5(e),[xt(e,"all")]),je("label",null,[this.caseField,xt(e,"match case")]),je("label",null,[this.reField,xt(e,"regexp")]),je("label",null,[this.wordField,xt(e,"by word")]),...e.state.readOnly?[]:[je("br"),this.replaceField,r("replace",()=>Rf(e),[xt(e,"replace")]),r("replaceAll",()=>a5(e),[xt(e,"replace all")])],je("button",{name:"close",onclick:()=>vb(e),"aria-label":xt(e,"close"),type:"button"},["×"])])}commit(){let e=new mb({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:Ji.of(e)}))}keydown(e){Pk(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ca:Sa)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Rf(this.view))}update(e){for(let t of e.transactions)for(let r of t.effects)r.is(Ji)&&!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(qr).top}}function xt(n,e){return n.state.phrase(e)}const Mo=30,Do=/[\s\.,:;?!]/;function Xh(n,{from:e,to:t}){let r=n.state.doc.lineAt(e),i=n.state.doc.lineAt(t).to,s=Math.max(r.from,e-Mo),o=Math.min(i,t+Mo),a=n.state.sliceDoc(s,o);if(s!=r.from){for(let l=0;l<Mo;l++)if(!Do.test(a[l+1])&&Do.test(a[l])){a=a.slice(l);break}}if(o!=i){for(let l=a.length-1;l>a.length-Mo;l--)if(!Do.test(a[l-1])&&Do.test(a[l])){a=a.slice(0,l);break}}return H.announce.of(`${n.state.phrase("current match")}. ${a} ${n.state.phrase("on line")} ${r.number}.`)}const h5=H.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"}}),d5=[En,dr.low(i5),h5];class wb{constructor(e,t,r,i){this.state=e,this.pos=t,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=nt(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),r=Math.max(t.from,this.pos-250),i=t.text.slice(r-t.from,this.pos-t.from),s=i.search(kb(e,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function Lf(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function u5(n){let e=Object.create(null),t=Object.create(null);for(let{label:i}of n){e[i[0]]=!0;for(let s=1;s<i.length;s++)t[i[s]]=!0}let r=Lf(e)+Lf(t)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function f5(n){let e=n.map(i=>typeof i=="string"?{label:i}:i),[t,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:u5(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:t}:null}}class If{constructor(e,t,r,i){this.completion=e,this.source=t,this.match=r,this.score=i}}function sr(n){return n.selection.main.from}function kb(n,e){var t;let{source:r}=n,i=e&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?n:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const Sb=ln.define();function p5(n,e,t,r){let{main:i}=n.selection,s=t-i.from,o=r-i.from;return{...n.changeByRange(a=>{if(a!=i&&t!=r&&n.sliceDoc(a.from+s,a.from+o)!=n.sliceDoc(t,r))return{range:a};let l=n.toText(e);return{changes:{from:a.from+s,to:r==i.from?a.to:a.from+o,insert:l},range:E.cursor(a.from+s+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const $f=new WeakMap;function m5(n){if(!Array.isArray(n))return n;let e=$f.get(n);return e||$f.set(n,e=f5(n)),e}const ja=ae.define(),Yi=ae.define();class g5{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let r=ct(e,t),i=Zt(r);this.chars.push(r);let s=e.slice(t,t+i),o=s.toUpperCase();this.folded.push(ct(o==s?s.toLowerCase():o,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:r,any:i,precise:s,byWord:o}=this;if(t.length==1){let v=ct(e,0),S=Zt(v),j=S==e.length?0:-100;if(v!=t[0])if(v==r[0])j+=-200;else return null;return this.ret(j,[0,S])}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=t.length,c=0;if(a<0){for(let v=0,S=Math.min(e.length,200);v<S&&c<l;){let j=ct(e,v);(j==t[c]||j==r[c])&&(i[c++]=v),v+=Zt(j)}if(c<l)return null}let d=0,u=0,f=!1,p=0,m=-1,b=-1,x=/[a-z]/.test(e),w=!0;for(let v=0,S=Math.min(e.length,200),j=0;v<S&&u<l;){let k=ct(e,v);a<0&&(d<l&&k==t[d]&&(s[d++]=v),p<l&&(k==t[p]||k==r[p]?(p==0&&(m=v),b=v+1,p++):p=0));let O,y=k<255?k>=48&&k<=57||k>=97&&k<=122?2:k>=65&&k<=90?1:0:(O=Oh(k))!=O.toLowerCase()?1:O!=O.toUpperCase()?2:0;(!v||y==1&&x||j==0&&y!=0)&&(t[u]==k||r[u]==k&&(f=!0)?o[u++]=v:o.length&&(w=!1)),j=y,v+=Zt(k)}return u==l&&o[0]==0&&w?this.result(-100+(f?-200:0),o,e):p==l&&m==0?this.ret(-200-e.length+(b==e.length?0:-100),[0,b]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):p==l?this.ret(-900-e.length,[m,b]):u==l?this.result(-100+(f?-200:0)+-700+(w?0:-1100),o,e):t.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,t,r){let i=[],s=0;for(let o of t){let a=o+(this.astral?Zt(ct(r,o)):1);s&&i[s-1]==o?i[s-1]=a:(i[s++]=o,i[s++]=a)}return this.ret(e-r.length,i)}}class b5{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),r=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,t.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const Ue=K.define({combine(n){return cn(n,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:x5,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>r=>Bf(e(r),t(r)),optionClass:(e,t)=>r=>Bf(e(r),t(r)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Bf(n,e){return n?e?n+" "+e:n:e}function x5(n,e,t,r,i,s){let o=n.textDirection==Pe.RTL,a=o,l=!1,c="top",d,u,f=e.left-i.left,p=i.right-e.right,m=r.right-r.left,b=r.bottom-r.top;if(a&&f<Math.min(m,p)?a=!1:!a&&p<Math.min(m,f)&&(a=!0),m<=(a?f:p))d=Math.max(i.top,Math.min(t.top,i.bottom-b))-e.top,u=Math.min(400,a?f:p);else{l=!0,u=Math.min(400,(o?e.right:i.right-e.left)-30);let v=i.bottom-e.bottom;v>=b||v>e.top?d=t.bottom-e.top:(c="bottom",d=e.bottom-t.top)}let x=(e.bottom-e.top)/s.offsetHeight,w=(e.right-e.left)/s.offsetWidth;return{style:`${c}: ${d/x}px; max-width: ${u/w}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function y5(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),t.type&&r.classList.add(...t.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(t,r,i,s){let o=document.createElement("span");o.className="cm-completionLabel";let a=t.displayLabel||t.label,l=0;for(let c=0;c<s.length;){let d=s[c++],u=s[c++];d>l&&o.appendChild(document.createTextNode(a.slice(l,d)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(a.slice(d,u))),f.className="cm-completionMatchedText",l=u}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(t){if(!t.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=t.detail,r},position:80}),e.sort((t,r)=>t.position-r.position).map(t=>t.render)}function El(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let i=Math.floor(e/t);return{from:i*t,to:(i+1)*t}}let r=Math.floor((n-e)/t);return{from:n-(r+1)*t,to:n-r*t}}class v5{constructor(e,t,r){this.view=e,this.stateField=t,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 i=e.state.field(t),{options:s,selected:o}=i.open,a=e.state.facet(Ue);this.optionContent=y5(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=El(s.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:c}=e.state.field(t).open;for(let d=l.target,u;d&&d!=this.dom;d=d.parentNode)if(d.nodeName=="LI"&&(u=/-(\d+)$/.exec(d.id))&&+u[1]<c.length){this.applyCompletion(e,c[+u[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(Ue).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Yi.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let r=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=i){let{options:s,selected:o,disabled:a}=r.open;(!i.open||i.open.options!=s)&&(this.range=El(s.length,o,e.state.facet(Ue).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),a!=((t=i.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of t.split(" "))r&&this.dom.classList.add(r);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=El(t.options.length,t.selected,this.view.state.facet(Ue).maxRenderedOptions),this.showOptions(t.options,e.id));let r=this.updateSelectedOption(t.selected);if(r){this.destroyInfo();let{completion:i}=t.options[t.selected],{info:s}=i;if(!s)return;let o=typeof s=="string"?document.createTextNode(s):s(i);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,i)}).catch(a=>ut(this.view.state,a,"completion info")):(this.addInfoPane(o,i),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){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:i,destroy:s}=e;r.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)r.nodeName!="LI"||!r.id?i--:i==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),t=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return t&&k5(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return i.top>Math.min(s.bottom,t.bottom)-10||i.bottom<Math.max(s.top,t.top)+10?null:this.view.state.facet(Ue).positionInfo(this.view,t,i,r,s,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,r){const i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",o=>{o.target==i&&o.preventDefault()});let s=null;for(let o=r.from;o<r.to;o++){let{completion:a,match:l}=e[o],{section:c}=a;if(c){let f=typeof c=="string"?c:c.name;if(f!=s&&(o>r.from||r.from==0))if(s=f,typeof c!="string"&&c.header)i.appendChild(c.header(c));else{let p=i.appendChild(document.createElement("completion-section"));p.textContent=f}}const d=i.appendChild(document.createElement("li"));d.id=t+"-"+o,d.setAttribute("role","option");let u=this.optionClass(a);u&&(d.className=u);for(let f of this.optionContent){let p=f(a,this.view.state,this.view,l);p&&d.appendChild(p)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function w5(n,e){return t=>new v5(t,n,e)}function k5(n,e){let t=n.getBoundingClientRect(),r=e.getBoundingClientRect(),i=t.height/n.offsetHeight;r.top<t.top?n.scrollTop-=(t.top-r.top)/i:r.bottom>t.bottom&&(n.scrollTop+=(r.bottom-t.bottom)/i)}function Ff(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function S5(n,e){let t=[],r=null,i=null,s=d=>{t.push(d);let{section:u}=d.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(Ue);for(let d of n)if(d.hasResult()){let u=d.result.getMatch;if(d.result.filter===!1)for(let f of d.result.options)s(new If(f,d.source,u?u(f):[],1e9-t.length));else{let f=e.sliceDoc(d.from,d.to),p,m=o.filterStrict?new b5(f):new g5(f);for(let b of d.result.options)if(p=m.match(b.label)){let x=b.displayLabel?u?u(b,p.matched):[]:p.matched,w=p.score+(b.boost||0);if(s(new If(b,d.source,x,w)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:v}=b.section;i||(i=Object.create(null)),i[v]=Math.max(w,i[v]||-1e9)}}}}if(r){let d=Object.create(null),u=0,f=(p,m)=>(p.rank==="dynamic"&&m.rank==="dynamic"?i[m.name]-i[p.name]:0)||(typeof p.rank=="number"?p.rank:1e9)-(typeof m.rank=="number"?m.rank:1e9)||(p.name<m.name?-1:1);for(let p of r.sort(f))u-=1e5,d[p.name]=u;for(let p of t){let{section:m}=p.completion;m&&(p.score+=d[typeof m=="string"?m:m.name])}}let a=[],l=null,c=o.compareCompletions;for(let d of t.sort((u,f)=>f.score-u.score||c(u.completion,f.completion))){let u=d.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(d):Ff(d.completion)>Ff(l)&&(a[a.length-1]=d),l=d.completion}return a}class Cr{constructor(e,t,r,i,s,o){this.options=e,this.attrs=t,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new Cr(this.options,Vf(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,r,i,s,o){if(i&&!o&&e.some(c=>c.isPending))return i.setDisabled();let a=S5(e,t);if(!a.length)return i&&e.some(c=>c.isPending)?i.setDisabled():null;let l=t.facet(Ue).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let c=i.options[i.selected].completion;for(let d=0;d<a.length;d++)if(a[d].completion==c){l=d;break}}return new Cr(a,Vf(r,l),{pos:e.reduce((c,d)=>d.hasResult()?Math.min(c,d.from):c,1e8),create:A5,above:s.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new Cr(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Cr(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Oa{constructor(e,t,r){this.active=e,this.id=t,this.open=r}static start(){return new Oa(P5,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,r=t.facet(Ue),s=(r.override||t.languageDataAt("autocomplete",sr(t)).map(m5)).map(l=>(this.active.find(d=>d.source==l)||new Tt(l,this.active.some(d=>d.state!=0)?1:0)).update(e,r));s.length==this.active.length&&s.every((l,c)=>l==this.active[c])&&(s=this.active);let o=this.open,a=e.effects.some(l=>l.is(Zh));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!C5(s,this.active)||a?o=Cr.build(s,t,this.id,o,r,a):o&&o.disabled&&!s.some(l=>l.isPending)&&(o=null),!o&&s.every(l=>!l.isPending)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new Tt(l.source,0):l));for(let l of e.effects)l.is(jb)&&(o=o&&o.setSelected(l.value,this.id));return s==this.active&&o==this.open?this:new Oa(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?j5:O5}}function C5(n,e){if(n==e)return!0;for(let t=0,r=0;;){for(;t<n.length&&!n[t].hasResult();)t++;for(;r<e.length&&!e[r].hasResult();)r++;let i=t==n.length,s=r==e.length;if(i||s)return i==s;if(n[t++].result!=e[r++].result)return!1}}const j5={"aria-autocomplete":"list"},O5={};function Vf(n,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":n};return e>-1&&(t["aria-activedescendant"]=n+"-"+e),t}const P5=[];function Cb(n,e){if(n.isUserEvent("input.complete")){let r=n.annotation(Sb);if(r&&e.activateOnCompletion(r))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class Tt{constructor(e,t,r=!1){this.source=e,this.state=t,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let r=Cb(e,t),i=this;(r&8||r&16&&this.touches(e))&&(i=new Tt(i.source,0)),r&4&&i.state==0&&(i=new Tt(this.source,1)),i=i.updateFor(e,r);for(let s of e.effects)if(s.is(ja))i=new Tt(i.source,1,s.value);else if(s.is(Yi))i=new Tt(i.source,0);else if(s.is(Zh))for(let o of s.value)o.source==i.source&&(i=o);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(sr(e.state))}}class Rr extends Tt{constructor(e,t,r,i,s,o){super(e,3,t),this.limit=r,this.result=i,this.from=s,this.to=o}hasResult(){return!0}updateFor(e,t){var r;if(!(t&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=sr(e.state);if(a>o||!i||t&2&&(sr(e.startState)==this.from||a<this.limit))return new Tt(this.source,t&4?1:0);let l=e.changes.mapPos(this.limit);return N5(i.validFor,e.state,s,o)?new Rr(this.source,this.explicit,l,i,s,o):i.update&&(i=i.update(i,s,o,new wb(e.state,a,!1)))?new Rr(this.source,this.explicit,l,i,i.from,(r=i.to)!==null&&r!==void 0?r:sr(e.state)):new Tt(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Rr(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Tt(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function N5(n,e,t,r){if(!n)return!1;let i=e.sliceDoc(t,r);return typeof n=="function"?n(i,t,r,e):kb(n,!0).test(i)}const Zh=ae.define({map(n,e){return n.map(t=>t.map(e))}}),jb=ae.define(),ht=Ye.define({create(){return Oa.start()},update(n,e){return n.update(e)},provide:n=>[_h.from(n,e=>e.tooltip),H.contentAttributes.from(n,e=>e.attrs)]});function ed(n,e){const t=e.completion.apply||e.completion.label;let r=n.state.field(ht).active.find(i=>i.source==e.source);return r instanceof Rr?(typeof t=="string"?n.dispatch({...p5(n.state,t,r.from,r.to),annotations:Sb.of(e.completion)}):t(n,e.completion,r.from,r.to),!0):!1}const A5=w5(ht,ed);function To(n,e="option"){return t=>{let r=t.state.field(ht,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<t.state.facet(Ue).interactionDelay)return!1;let i=1,s;e=="page"&&(s=p0(t,r.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,a=r.open.selected>-1?r.open.selected+i*(n?1:-1):n?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),t.dispatch({effects:jb.of(a)}),!0}}const M5=n=>{let e=n.state.field(ht,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<n.state.facet(Ue).interactionDelay?!1:ed(n,e.open.options[e.open.selected])},Rl=n=>n.state.field(ht,!1)?(n.dispatch({effects:ja.of(!0)}),!0):!1,D5=n=>{let e=n.state.field(ht,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:Yi.of(null)}),!0)};class T5{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const E5=50,R5=1e3,L5=Fe.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(ht).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(ht),t=n.state.facet(Ue);if(!n.selectionSet&&!n.docChanged&&n.startState.field(ht)==e)return;let r=n.transactions.some(s=>{let o=Cb(s,t);return o&8||(s.selection||s.docChanged)&&!(o&3)});for(let s=0;s<this.running.length;s++){let o=this.running[s];if(r||o.context.abortOnDocChange&&n.docChanged||o.updates.length+n.transactions.length>E5&&Date.now()-o.time>R5){for(let a of o.context.abortListeners)try{a()}catch(l){ut(this.view.state,l)}o.context.abortListeners=null,this.running.splice(s--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(s=>s.effects.some(o=>o.is(ja)))&&(this.pendingStart=!0);let i=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(o=>o.active.source==s.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let s of n.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(ht);for(let t of e.active)t.isPending&&!this.running.some(r=>r.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ue).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=sr(e),r=new wb(e,t,n.explicit,this.view),i=new T5(n,r);this.running.push(i),Promise.resolve(n.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:Yi.of(null)}),ut(this.view.state,s)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ue).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(Ue),r=this.view.state.field(ht);for(let i=0;i<this.running.length;i++){let s=this.running[i];if(s.done===void 0)continue;if(this.running.splice(i--,1),s.done){let a=sr(s.updates.length?s.updates[0].startState:this.view.state),l=Math.min(a,s.done.from+(s.active.explicit?0:1)),c=new Rr(s.active.source,s.active.explicit,l,s.done,s.done.from,(n=s.done.to)!==null&&n!==void 0?n:a);for(let d of s.updates)c=c.update(d,t);if(c.hasResult()){e.push(c);continue}}let o=r.active.find(a=>a.source==s.active.source);if(o&&o.isPending)if(s.done==null){let a=new Tt(s.active.source,0);for(let l of s.updates)a=a.update(l,t);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:Zh.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(ht,!1);if(e&&e.tooltip&&this.view.state.facet(Ue).closeOnBlur){let t=e.open&&p0(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Yi.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:ja.of(!1)}),20),this.composing=0}}}),I5=typeof navigator=="object"&&/Win/.test(navigator.platform),$5=dr.highest(H.domEventHandlers({keydown(n,e){let t=e.state.field(ht,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(I5&&n.altKey)||n.metaKey)return!1;let r=t.open.options[t.open.selected],i=t.active.find(o=>o.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(n.key)>-1&&ed(e,r),!1}})),B5=H.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"}}}),Qi={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},rr=ae.define({map(n,e){let t=e.mapPos(n,-1,ot.TrackAfter);return t??void 0}}),td=new class extends Ln{};td.startSide=1;td.endSide=-1;const Ob=Ye.define({create(){return pe.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:r=>r>=t.from&&r<=t.to})}for(let t of e.effects)t.is(rr)&&(n=n.update({add:[td.range(t.value,t.value+1)]}));return n}});function F5(){return[z5,Ob]}const Ll="()[]{}<>«»»«[]{}";function Pb(n){for(let e=0;e<Ll.length;e+=2)if(Ll.charCodeAt(e)==n)return Ll.charAt(e+1);return Oh(n<128?n:n+1)}function Nb(n,e){return n.languageDataAt("closeBrackets",e)[0]||Qi}const V5=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),z5=H.inputHandler.of((n,e,t,r)=>{if((V5?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let i=n.state.selection.main;if(r.length>2||r.length==2&&Zt(ct(r,0))==1||e!=i.from||t!=i.to)return!1;let s=W5(n.state,r);return s?(n.dispatch(s),!0):!1}),_5=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let r=Nb(n,n.selection.main.head).brackets||Qi.brackets,i=null,s=n.changeByRange(o=>{if(o.empty){let a=U5(n.doc,o.head);for(let l of r)if(l==a&&Ga(n.doc,o.head)==Pb(ct(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:E.cursor(o.head-l.length)}}return{range:i=o}});return i||e(n.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},H5=[{key:"Backspace",run:_5}];function W5(n,e){let t=Nb(n,n.selection.main.head),r=t.brackets||Qi.brackets;for(let i of r){let s=Pb(ct(i,0));if(e==i)return s==i?q5(n,i,r.indexOf(i+i+i)>-1,t):K5(n,i,s,t.before||Qi.before);if(e==s&&Ab(n,n.selection.main.from))return G5(n,i,s)}return null}function Ab(n,e){let t=!1;return n.field(Ob).between(0,n.doc.length,r=>{r==e&&(t=!0)}),t}function Ga(n,e){let t=n.sliceString(e,e+2);return t.slice(0,Zt(ct(t,0)))}function U5(n,e){let t=n.sliceString(e-2,e);return Zt(ct(t,0))==t.length?t:t.slice(1)}function K5(n,e,t,r){let i=null,s=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:rr.of(o.to+e.length),range:E.range(o.anchor+e.length,o.head+e.length)};let a=Ga(n.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+t,from:o.head},effects:rr.of(o.head+e.length),range:E.cursor(o.head+e.length)}:{range:i=o}});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function G5(n,e,t){let r=null,i=n.changeByRange(s=>s.empty&&Ga(n.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:E.cursor(s.head+t.length)}:r={range:s});return r?null:n.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function q5(n,e,t,r){let i=r.stringPrefixes||Qi.stringPrefixes,s=null,o=n.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:rr.of(a.to+e.length),range:E.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=Ga(n.doc,l),d;if(c==e){if(zf(n,l))return{changes:{insert:e+e,from:l},effects:rr.of(l+e.length),range:E.cursor(l+e.length)};if(Ab(n,l)){let f=t&&n.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+f.length,insert:f},range:E.cursor(l+f.length)}}}else{if(t&&n.sliceDoc(l-2*e.length,l)==e+e&&(d=_f(n,l-2*e.length,i))>-1&&zf(n,d))return{changes:{insert:e+e+e+e,from:l},effects:rr.of(l+e.length),range:E.cursor(l+e.length)};if(n.charCategorizer(l)(c)!=Te.Word&&_f(n,l,i)>-1&&!J5(n,l,e,i))return{changes:{insert:e+e,from:l},effects:rr.of(l+e.length),range:E.cursor(l+e.length)}}return{range:s=a}});return s?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function zf(n,e){let t=nt(n).resolveInner(e+1);return t.parent&&t.from==e}function J5(n,e,t,r){let i=nt(n).resolveInner(e,-1),s=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=n.sliceDoc(i.from,Math.min(i.to,i.from+t.length+s)),l=a.indexOf(t);if(!l||l>-1&&r.indexOf(a.slice(0,l))>-1){let d=i.firstChild;for(;d&&d.from==i.from&&d.to-d.from>t.length+l;){if(n.sliceDoc(d.to-t.length,d.to)==t)return!1;d=d.firstChild}return!0}let c=i.to==e&&i.parent;if(!c)break;i=c}return!1}function _f(n,e,t){let r=n.charCategorizer(e);if(r(n.sliceDoc(e-1,e))!=Te.Word)return e;for(let i of t){let s=e-i.length;if(n.sliceDoc(s,e)==i&&r(n.sliceDoc(s-1,s))!=Te.Word)return s}return-1}function Y5(n={}){return[$5,ht,Ue.of(n),L5,Q5,B5]}const Mb=[{key:"Ctrl-Space",run:Rl},{mac:"Alt-`",run:Rl},{mac:"Alt-i",run:Rl},{key:"Escape",run:D5},{key:"ArrowDown",run:To(!0)},{key:"ArrowUp",run:To(!1)},{key:"PageDown",run:To(!0,"page")},{key:"PageUp",run:To(!1,"page")},{key:"Enter",run:M5}],Q5=dr.highest(Ba.computeN([Ue],n=>n.facet(Ue).defaultKeymap?[Mb]:[]));class Hf{constructor(e,t,r){this.from=e,this.to=t,this.diagnostic=r}}class Qn{constructor(e,t,r){this.diagnostics=e,this.panel=t,this.selected=r}static init(e,t,r){let i=r.facet(Xi).markerFilter;i&&(e=i(e,r));let s=e.slice().sort((p,m)=>p.from-m.from||p.to-m.to),o=new xn,a=[],l=0,c=r.doc.iter(),d=0,u=r.doc.length;for(let p=0;;){let m=p==s.length?null:s[p];if(!m&&!a.length)break;let b,x;if(a.length)b=l,x=a.reduce((S,j)=>Math.min(S,j.to),m&&m.from>b?m.from:1e8);else{if(b=m.from,b>u)break;x=m.to,a.push(m),p++}for(;p<s.length;){let S=s[p];if(S.from==b&&(S.to>S.from||S.to==b))a.push(S),p++,x=Math.min(S.to,x);else{x=Math.min(S.from,x);break}}x=Math.min(x,u);let w=!1;if(a.some(S=>S.from==b&&(S.to==x||x==u))&&(w=b==x,!w&&x-b<10)){let S=b-(d+c.value.length);S>0&&(c.next(S),d=b);for(let j=b;;){if(j>=x){w=!0;break}if(!c.lineBreak&&d+c.value.length>j)break;j=d+c.value.length,d+=c.value.length,c.next()}}let v=hC(a);if(w)o.add(b,b,ne.widget({widget:new oC(v),diagnostics:a.slice()}));else{let S=a.reduce((j,k)=>k.markClass?j+" "+k.markClass:j,"");o.add(b,x,ne.mark({class:"cm-lintRange cm-lintRange-"+v+S,diagnostics:a.slice(),inclusiveEnd:a.some(j=>j.to>x)}))}if(l=x,l==u)break;for(let S=0;S<a.length;S++)a[S].to<=l&&a.splice(S--,1)}let f=o.finish();return new Qn(f,t,Hr(f))}}function Hr(n,e=null,t=0){let r=null;return n.between(t,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new Hf(i,s,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new Hf(r.from,s,r.diagnostic)}}),r}function X5(n,e){let t=e.pos,r=e.end||t,i=n.state.facet(Xi).hideOn(n,t,r);if(i!=null)return i;let s=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(Db))||n.changes.touchesRange(s.from,Math.max(s.to,r)))}function Z5(n,e){return n.field(wt,!1)?e:e.concat(ae.appendConfig.of(dC))}const Db=ae.define(),nd=ae.define(),Tb=ae.define(),wt=Ye.define({create(){return new Qn(ne.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),r=null,i=n.panel;if(n.selected){let s=e.changes.mapPos(n.selected.from,1);r=Hr(t,n.selected.diagnostic,s)||Hr(t,null,s)}!t.size&&i&&e.state.facet(Xi).autoPanel&&(i=null),n=new Qn(t,i,r)}for(let t of e.effects)if(t.is(Db)){let r=e.state.facet(Xi).autoPanel?t.value.length?Zi.open:null:n.panel;n=Qn.init(t.value,r,e.state)}else t.is(nd)?n=new Qn(n.diagnostics,t.value?Zi.open:null,n.selected):t.is(Tb)&&(n=new Qn(n.diagnostics,n.panel,t.value));return n},provide:n=>[Gi.from(n,e=>e.panel),H.decorations.from(n,e=>e.diagnostics)]}),eC=ne.mark({class:"cm-lintRange cm-lintRange-active"});function tC(n,e,t){let{diagnostics:r}=n.state.field(wt),i,s=-1,o=-1;r.between(e-(t<0?1:0),e+(t>0?1:0),(l,c,{spec:d})=>{if(e>=l&&e<=c&&(l==c||(e>l||t>0)&&(e<c||t<0)))return i=d.diagnostics,s=l,o=c,!1});let a=n.state.facet(Xi).tooltipFilter;return i&&a&&(i=a(i,n.state)),i?{pos:s,end:o,above:n.state.doc.lineAt(s).to<o,create(){return{dom:nC(n,i)}}}:null}function nC(n,e){return je("ul",{class:"cm-tooltip-lint"},e.map(t=>Rb(n,t,!1)))}const rC=n=>{let e=n.state.field(wt,!1);(!e||!e.panel)&&n.dispatch({effects:Z5(n.state,[nd.of(!0)])});let t=Ki(n,Zi.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},Wf=n=>{let e=n.state.field(wt,!1);return!e||!e.panel?!1:(n.dispatch({effects:nd.of(!1)}),!0)},iC=n=>{let e=n.state.field(wt,!1);if(!e)return!1;let t=n.state.selection.main,r=e.diagnostics.iter(t.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==t.from&&r.to==t.to)?!1:(n.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},sC=[{key:"Mod-Shift-m",run:rC,preventDefault:!0},{key:"F8",run:iC}],Xi=K.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...cn(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Uf,tooltipFilter:Uf,needsRefresh:(e,t)=>e?t?r=>e(r)||t(r):e:t,hideOn:(e,t)=>e?t?(r,i,s)=>e(r,i,s)||t(r,i,s):e:t,autoPanel:(e,t)=>e||t})}}});function Uf(n,e){return n?e?(t,r)=>e(n(t,r),r):n:e}function Eb(n){let e=[];if(n)e:for(let{name:t}of n){for(let r=0;r<t.length;r++){let i=t[r];if(/[a-zA-Z]/.test(i)&&!e.some(s=>s.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function Rb(n,e,t){var r;let i=t?Eb(e.actions):[];return je("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},je("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((s,o)=>{let a=!1,l=p=>{if(p.preventDefault(),a)return;a=!0;let m=Hr(n.state.field(wt).diagnostics,e);m&&s.apply(n,m.from,m.to)},{name:c}=s,d=i[o]?c.indexOf(i[o]):-1,u=d<0?c:[c.slice(0,d),je("u",c.slice(d,d+1)),c.slice(d+1)],f=s.markClass?" "+s.markClass:"";return je("button",{type:"button",class:"cm-diagnosticAction"+f,onclick:l,onmousedown:l,"aria-label":` Action: ${c}${d<0?"":` (access key "${i[o]})"`}.`},u)}),e.source&&je("div",{class:"cm-diagnosticSource"},e.source))}class oC extends hn{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return je("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Kf{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Rb(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Zi{constructor(e){this.view=e,this.items=[];let t=i=>{if(i.keyCode==27)Wf(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=Eb(s.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==i.keyCode){let l=Hr(this.view.state.field(wt).diagnostics,s);l&&s.actions[a].apply(e,l.from,l.to)}}else return;i.preventDefault()},r=i=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(i.target)&&this.moveSelection(s)};this.list=je("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:r}),this.dom=je("div",{class:"cm-panel-lint"},this.list,je("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Wf(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(wt).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(wt),r=0,i=!1,s=null,o=new Set;for(e.between(0,this.view.state.doc.length,(a,l,{spec:c})=>{for(let d of c.diagnostics){if(o.has(d))continue;o.add(d);let u=-1,f;for(let p=r;p<this.items.length;p++)if(this.items[p].diagnostic==d){u=p;break}u<0?(f=new Kf(this.view,d),this.items.splice(r,0,f),i=!0):(f=this.items[u],u>r&&(this.items.splice(r,u-r),i=!0)),t&&f.diagnostic==t.diagnostic?f.dom.hasAttribute("aria-selected")||(f.dom.setAttribute("aria-selected","true"),s=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);)i=!0,this.items.pop();this.items.length==0&&(this.items.push(new Kf(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let c=l.height/this.list.offsetHeight;a.top<l.top?this.list.scrollTop-=(l.top-a.top)/c:a.bottom>l.bottom&&(this.list.scrollTop+=(a.bottom-l.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function t(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)t();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(wt),r=Hr(t.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Tb.of(r)})}static open(e){return new Zi(e)}}function aC(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(n)}</svg>')`}function Eo(n){return aC(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${n}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const lC=H.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:Eo("#d11")},".cm-lintRange-warning":{backgroundImage:Eo("orange")},".cm-lintRange-info":{backgroundImage:Eo("#999")},".cm-lintRange-hint":{backgroundImage:Eo("#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 cC(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function hC(n){let e="hint",t=1;for(let r of n){let i=cC(r.severity);i>t&&(t=i,e=r.severity)}return e}const dC=[wt,H.decorations.compute([wt],n=>{let{selected:e,panel:t}=n.field(wt);return!e||!t||e.from==e.to?ne.none:ne.set([eC.range(e.from,e.to)])}),mS(tC,{hideOn:X5}),lC];var Gf=function(e){e===void 0&&(e={});var{crosshairCursor:t=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(H5)),e.defaultKeymap!==!1&&(r=r.concat(I4)),e.searchKeymap!==!1&&(r=r.concat(l5)),e.historyKeymap!==!1&&(r=r.concat(H3)),e.foldKeymap!==!1&&(r=r.concat(e3)),e.completionKeymap!==!1&&(r=r.concat(Mb)),e.lintKeymap!==!1&&(r=r.concat(sC));var i=[];return e.lineNumbers!==!1&&i.push(OS()),e.highlightActiveLineGutter!==!1&&i.push(AS()),e.highlightSpecialChars!==!1&&i.push(Wk()),e.history!==!1&&i.push(R3()),e.foldGutter!==!1&&i.push(i3()),e.drawSelection!==!1&&i.push(Ek()),e.dropCursor!==!1&&i.push(Bk()),e.allowMultipleSelections!==!1&&i.push(me.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&i.push(WS()),e.syntaxHighlighting!==!1&&i.push(Uh(l3,{fallback:!0})),e.bracketMatching!==!1&&i.push(m3()),e.closeBrackets!==!1&&i.push(F5()),e.autocompletion!==!1&&i.push(Y5()),e.rectangularSelection!==!1&&i.push(iS()),t!==!1&&i.push(aS()),e.highlightActiveLine!==!1&&i.push(Yk()),e.highlightSelectionMatches!==!1&&i.push(H4()),e.tabSize&&typeof e.tabSize=="number"&&i.push(Va.of(" ".repeat(e.tabSize))),i.concat([Ba.of(r.flat())]).filter(Boolean)};const uC="#e5c07b",qf="#e06c75",fC="#56b6c2",pC="#ffffff",Xo="#abb2bf",ah="#7d8799",mC="#61afef",gC="#98c379",Jf="#d19a66",bC="#c678dd",xC="#21252b",Yf="#2c313a",Qf="#282c34",Il="#353a42",yC="#3E4451",Xf="#528bff",vC=H.theme({"&":{color:Xo,backgroundColor:Qf},".cm-content":{caretColor:Xf},".cm-cursor, .cm-dropCursor":{borderLeftColor:Xf},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:yC},".cm-panels":{backgroundColor:xC,color:Xo},".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:Qf,color:ah,border:"none"},".cm-activeLineGutter":{backgroundColor:Yf},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Il},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Il,borderBottomColor:Il},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Yf,color:Xo}}},{dark:!0}),wC=Kr.define([{tag:T.keyword,color:bC},{tag:[T.name,T.deleted,T.character,T.propertyName,T.macroName],color:qf},{tag:[T.function(T.variableName),T.labelName],color:mC},{tag:[T.color,T.constant(T.name),T.standard(T.name)],color:Jf},{tag:[T.definition(T.name),T.separator],color:Xo},{tag:[T.typeName,T.className,T.number,T.changed,T.annotation,T.modifier,T.self,T.namespace],color:uC},{tag:[T.operator,T.operatorKeyword,T.url,T.escape,T.regexp,T.link,T.special(T.string)],color:fC},{tag:[T.meta,T.comment],color:ah},{tag:T.strong,fontWeight:"bold"},{tag:T.emphasis,fontStyle:"italic"},{tag:T.strikethrough,textDecoration:"line-through"},{tag:T.link,color:ah,textDecoration:"underline"},{tag:T.heading,fontWeight:"bold",color:qf},{tag:[T.atom,T.bool,T.special(T.variableName)],color:Jf},{tag:[T.processingInstruction,T.string,T.inserted],color:gC},{tag:T.invalid,color:pC}]),kC=[vC,Uh(wC)];var SC=H.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),CC=function(e){e===void 0&&(e={});var{indentWithTab:t=!0,editable:r=!0,readOnly:i=!1,theme:s="light",placeholder:o="",basicSetup:a=!0}=e,l=[];switch(t&&l.unshift(Ba.of([$4])),a&&(typeof a=="boolean"?l.unshift(Gf()):l.unshift(Gf(a))),o&&l.unshift(eS(o)),s){case"light":l.push(SC);break;case"dark":l.push(kC);break;case"none":break;default:l.push(s);break}return r===!1&&l.push(H.editable.of(!1)),i&&l.push(me.readOnly.of(!0)),[...l]},jC=n=>({line:n.state.doc.lineAt(n.state.selection.main.from),lineCount:n.state.doc.lines,lineBreak:n.state.lineBreak,length:n.state.doc.length,readOnly:n.state.readOnly,tabSize:n.state.tabSize,selection:n.state.selection,selectionAsSingle:n.state.selection.asSingle().main,ranges:n.state.selection.ranges,selectionCode:n.state.sliceDoc(n.state.selection.main.from,n.state.selection.main.to),selections:n.state.selection.ranges.map(e=>n.state.sliceDoc(e.from,e.to)),selectedText:n.state.selection.ranges.some(e=>!e.empty)});class OC{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(t=>{try{t()}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 Zf{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 $l=null,PC=()=>typeof window>"u"?new Zf:($l||($l=new Zf),$l),ep=ln.define(),NC=200,AC=[];function MC(n){var{value:e,selection:t,onChange:r,onStatistics:i,onCreateEditor:s,onUpdate:o,extensions:a=AC,autoFocus:l,theme:c="light",height:d=null,minHeight:u=null,maxHeight:f=null,width:p=null,minWidth:m=null,maxWidth:b=null,placeholder:x="",editable:w=!0,readOnly:v=!1,indentWithTab:S=!0,basicSetup:j=!0,root:k,initialState:O}=n,[y,D]=g.useState(),[A,R]=g.useState(),[N,L]=g.useState(),W=g.useState(()=>({current:null}))[0],F=g.useState(()=>({current:null}))[0],B=H.theme({"&":{height:d,minHeight:u,maxHeight:f,width:p,minWidth:m,maxWidth:b},"& .cm-scroller":{height:"100% !important"}}),q=H.updateListener.of(J=>{if(J.docChanged&&typeof r=="function"&&!J.transactions.some(fe=>fe.annotation(ep))){W.current?W.current.reset():(W.current=new OC(()=>{if(F.current){var fe=F.current;F.current=null,fe()}W.current=null},NC),PC().add(W.current));var ie=J.state.doc,le=ie.toString();r(le,J)}i&&i(jC(J))}),de=CC({theme:c,editable:w,readOnly:v,placeholder:x,indentWithTab:S,basicSetup:j}),z=[q,B,...de];return o&&typeof o=="function"&&z.push(H.updateListener.of(o)),z=z.concat(a),g.useLayoutEffect(()=>{if(y&&!N){var J={doc:e,selection:t,extensions:z},ie=O?me.fromJSON(O.json,J,O.fields):me.create(J);if(L(ie),!A){var le=new H({state:ie,parent:y,root:k});R(le),s&&s(le,ie)}}return()=>{A&&(L(void 0),R(void 0))}},[y,N]),g.useEffect(()=>{n.container&&D(n.container)},[n.container]),g.useEffect(()=>()=>{A&&(A.destroy(),R(void 0)),W.current&&(W.current.cancel(),W.current=null)},[A]),g.useEffect(()=>{l&&A&&A.focus()},[l,A]),g.useEffect(()=>{A&&A.dispatch({effects:ae.reconfigure.of(z)})},[c,a,d,u,f,p,m,b,x,w,v,S,j,r,o]),g.useEffect(()=>{if(e!==void 0){var J=A?A.state.doc.toString():"";if(A&&e!==J){var ie=W.current&&!W.current.isDone,le=()=>{A&&e!==A.state.doc.toString()&&A.dispatch({changes:{from:0,to:A.state.doc.toString().length,insert:e||""},annotations:[ep.of(!0)]})};ie?F.current=le:le()}}},[e,A]),{state:N,setState:L,view:A,setView:R,container:y,setContainer:D}}var DC=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Lb=g.forwardRef((n,e)=>{var{className:t,value:r="",selection:i,extensions:s=[],onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:c,autoFocus:d,theme:u="light",height:f,minHeight:p,maxHeight:m,width:b,minWidth:x,maxWidth:w,basicSetup:v,placeholder:S,indentWithTab:j,editable:k,readOnly:O,root:y,initialState:D}=n,A=C3(n,DC),R=g.useRef(null),{state:N,view:L,container:W,setContainer:F}=MC({root:y,value:r,autoFocus:d,theme:u,height:f,minHeight:p,maxHeight:m,width:b,minWidth:x,maxWidth:w,basicSetup:v,placeholder:S,indentWithTab:j,editable:k,readOnly:O,selection:i,onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:c,extensions:s,initialState:D});g.useImperativeHandle(e,()=>({editor:R.current,state:N,view:L}),[R,W,N,L]);var B=g.useCallback(de=>{R.current=de,F(de)},[F]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var q=typeof u=="string"?"cm-theme-"+u:"cm-theme";return h.jsx("div",eh({ref:B,className:""+q+(t?" "+t:"")},A))});Lb.displayName="CodeMirror";const TC=()=>{const n=H.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=Kr.define([{tag:T.propertyName,color:"var(--dash-accent)"},{tag:T.string,color:"color-mix(in srgb, var(--dash-accent) 70%, var(--dash-text))"},{tag:T.number,color:"var(--dash-accent-hover)"},{tag:T.bool,color:"var(--dash-accent-hover)"},{tag:T.null,color:"var(--dash-text-muted)"},{tag:T.punctuation,color:"var(--dash-text-secondary)"},{tag:T.brace,color:"var(--dash-text-secondary)"},{tag:T.bracket,color:"var(--dash-text-secondary)"}]);return[n,Uh(e)]},EC=({value:n,onChange:e,onCursorLineChange:t,height:r="100%",readOnly:i=!1,className:s})=>{const o=g.useMemo(()=>[S3(),H.lineWrapping,...TC()],[]),a=g.useMemo(()=>{if(t)return l=>{const c=l.state.selection.main.head,d=l.view.state.doc.lineAt(c).number-1;t(d)}},[t]);return h.jsx("div",{className:`h-full [&_.cm-editor]:h-full [&_.cm-editor]:outline-none [&_.cm-focused]:outline-none ${s??""}`.trim(),children:h.jsx(Lb,{value:n,height:r,extensions:o,onChange:e,onUpdate:a,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}})})},rd=({width:n,isLoading:e,jsonText:t,cursorLine:r,syntaxError:i,onChange:s,onCursorLineChange:o,readOnly:a=!1,headerTitle:l,headerPath:c,headerActions:d})=>{const{t:u}=ce(),f=p=>{if(a||!p.target.closest(".cm-editor"))return;const b=p.currentTarget;b.scrollHeight<=b.clientHeight||(b.scrollTop+=p.deltaY)};return h.jsxs("div",{style:{width:`${n}%`},className:"bg-dash-surface border border-dash-border rounded-xl overflow-hidden flex flex-col shadow-sm min-w-0 h-full",children:[h.jsx("div",{className:"p-3 border-b border-dash-border bg-dash-surface-hover/50 shrink-0",children:h.jsxs("div",{className:"flex items-end justify-between gap-3",children:[h.jsxs("div",{className:"min-w-0",children:[h.jsx("h3",{className:"text-xs font-bold text-dash-text-secondary uppercase tracking-widest",children:l??u("jsonTab")}),c&&h.jsx("p",{className:"mt-1 mono text-[11px] text-dash-text-muted truncate",children:c})]}),d&&h.jsx("div",{className:"flex items-center gap-2 shrink-0",children:d})]})}),h.jsx("div",{className:"flex-1 min-h-0 overflow-auto",onWheelCapture:f,children:e?h.jsx("div",{className:"h-full flex items-center justify-center",children:h.jsx("div",{className:"animate-pulse text-dash-text-muted text-sm",children:u("loading")})}):a?h.jsx("pre",{className:"h-full overflow-auto p-4 font-mono text-xs leading-4 text-dash-text whitespace-pre m-0",children:t}):h.jsx(EC,{value:t,onChange:s,onCursorLineChange:o,readOnly:a,className:"[&_.cm-content]:text-xs [&_.cm-content]:leading-4 [&_.cm-gutters]:text-xs [&_.cm-gutters]:leading-4"})}),h.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:[h.jsxs("div",{className:"flex gap-4",children:[h.jsx("span",{children:"UTF-8"}),h.jsx("span",{children:"JSON"}),h.jsxs("span",{children:["L:",r+1]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[a&&h.jsx("span",{children:u("readOnly")}),i?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),h.jsx("span",{className:"text-red-500 normal-case",children:i})]}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-dash-accent"}),u("syntaxValid")]})]})]})]})},tp=({label:n,value:e})=>h.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 bg-dash-bg border border-dash-border rounded-md",children:[h.jsxs("span",{className:"text-[9px] font-bold text-dash-text-muted uppercase",children:[n,":"]}),h.jsx("span",{className:"text-[10px] mono font-bold text-dash-text-secondary",children:e})]}),Ib=({width:n,fieldDoc:e,activeFieldPath:t,extraContent:r,overrideBadge:i})=>{const{t:s,lang:o}=ce();return h.jsxs("div",{style:{width:`${n}%`},className:"bg-dash-surface border border-dash-border rounded-xl flex flex-col shadow-sm overflow-hidden min-w-0",children:[h.jsx("div",{className:"p-3 border-b border-dash-border bg-dash-surface-hover/50 shrink-0",children:h.jsx("h3",{className:"text-xs font-bold text-dash-text-secondary uppercase tracking-widest",children:s("configurationHelp")})}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:e?h.jsxs("div",{className:"space-y-5 animate-in fade-in duration-500",children:[h.jsxs("header",{children:[h.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[h.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:s("field")}),h.jsx("h2",{className:"text-base font-bold text-dash-text mono break-all",children:e.path}),i]}),h.jsxs("div",{className:"flex flex-wrap gap-2 mt-2",children:[h.jsx(tp,{label:s("type"),value:e.type}),h.jsx(tp,{label:s("default"),value:e.default})]})]}),h.jsxs("section",{children:[h.jsx("h4",{className:"text-[10px] font-bold text-dash-text-muted uppercase tracking-widest mb-2",children:s("description")}),h.jsx("p",{className:"text-sm text-dash-text-secondary leading-relaxed italic",children:o==="vi"?e.descriptionVi:e.description})]}),e.validValues&&h.jsxs("section",{children:[h.jsx("h4",{className:"text-[10px] font-bold text-dash-text-muted uppercase tracking-widest mb-2",children:s("validValues")}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.validValues.map(a=>h.jsx("span",{className:"px-2 py-0.5 bg-dash-bg border border-dash-border rounded text-[11px] mono text-dash-text",children:a},a))})]}),e.effect&&h.jsxs("section",{className:"bg-dash-accent-subtle/30 p-3 rounded-lg border border-dash-accent/10",children:[h.jsx("h4",{className:"text-[10px] font-bold text-dash-accent uppercase tracking-widest mb-1",children:s("systemEffect")}),h.jsx("p",{className:"text-[12px] text-dash-text-secondary leading-normal",children:o==="vi"&&e.effectVi?e.effectVi:e.effect})]}),e.example&&h.jsxs("section",{children:[h.jsx("h4",{className:"text-[10px] font-bold text-dash-text-muted uppercase tracking-widest mb-2",children:s("exampleUsage")}),h.jsx("div",{className:"bg-dash-bg p-3 rounded-lg border border-dash-border overflow-hidden",children:h.jsx("pre",{className:"text-[11px] mono text-dash-text-secondary whitespace-pre overflow-x-auto",children:e.example})})]}),r]}):h.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center opacity-40 space-y-4",children:[h.jsx("div",{className:"w-10 h-10 rounded-full bg-dash-bg border border-dash-border flex items-center justify-center text-lg",children:"?"}),h.jsxs("div",{className:"max-w-[180px]",children:[h.jsx("p",{className:"text-sm font-bold text-dash-text mb-1 italic",children:s("knowledgeBase")}),h.jsx("p",{className:"text-xs text-dash-text-secondary",children:s("clickToSeeHelp")})]})]})}),e&&h.jsx("div",{className:"p-3 bg-dash-surface-hover/20 border-t border-dash-border shrink-0",children:h.jsxs("p",{className:"text-[10px] text-dash-text-muted font-medium flex items-center gap-1.5 italic",children:[h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:h.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"})}),s("extractedFrom")]})})]})},RC=({variant:n="development"})=>{const{t:e}=ce(),t={development:e("developmentFeature"),beta:e("betaFeature"),experimental:e("experimentalFeature")};return h.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:t[n]})},LC=({components:n,isChecking:e,isUpdating:t,onCheckAll:r,onUpdateAll:i,className:s})=>{const{t:o}=ce(),a=n.filter(d=>d.status==="update-available").length,l=n.length>0&&n.every(d=>d.status==="up-to-date"||d.status==="idle"),c=n.filter(d=>d.status==="up-to-date").length;return h.jsxs("div",{className:`flex flex-wrap items-center gap-2 ${s??""}`,children:[h.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:[h.jsx("output",{className:"inline-flex items-center gap-2","aria-live":"polite","aria-atomic":"true",children:e?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),h.jsx("span",{className:"text-dash-text-secondary",children:o("checkingAll")})]}):a>0?h.jsx("span",{className:"text-amber-500 font-semibold",children:o("updatesAvailable").replace("{count}",a.toString())}):l?h.jsx("span",{className:"text-emerald-500 font-semibold",children:o("allUpToDate")}):h.jsx("span",{className:"text-dash-text-secondary font-medium",children:o("readyToScan")})}),c>0&&h.jsx("span",{className:"mono text-dash-text-muted border-l border-dash-border pl-2",children:c})]}),h.jsx("button",{type:"button",onClick:r,disabled:e||t,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&&h.jsx("button",{type:"button",onClick:i,disabled:t,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")})]})},IC=({value:n,onChange:e,disabled:t=!1})=>{const{t:r}=ce();return h.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:[h.jsxs("label",{className:`dash-focus-ring px-3.5 py-2 text-xs font-semibold rounded-lg transition-colors cursor-pointer ${n==="stable"?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover"} ${t?"opacity-50 cursor-not-allowed":""}`,children:[h.jsx("input",{type:"radio",name:"channel",value:"stable",checked:n==="stable",onChange:()=>e("stable"),disabled:t,className:"sr-only"}),r("channelStable")]}),h.jsxs("label",{className:`dash-focus-ring px-3.5 py-2 text-xs font-semibold rounded-lg transition-colors cursor-pointer ${n==="beta"?"bg-amber-500/15 text-amber-500":"text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover"} ${t?"opacity-50 cursor-not-allowed":""}`,children:[h.jsx("input",{type:"radio",name:"channel",value:"beta",checked:n==="beta",onChange:()=>e("beta"),disabled:t,className:"sr-only"}),r("channelBeta")]})]})},$C={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}},$b=({status:n,ariaLabel:e,size:t="sm"})=>{const r=$C[n],i=t==="sm"?"w-2 h-2":"w-2.5 h-2.5";return h.jsx("span",{className:`
64
64
  inline-block rounded-full ${i} ${r.color}
65
65
  ${r.pulse?"animate-pulse motion-reduce:animate-none":""}
66
- `,role:"status","aria-label":e})},rd=({isOpen:n,onClose:e,target:t,kitName:r,targetVersion:i,onComplete:s,mode:o="single",components:a=[]})=>{const{t:l}=he(),[c,h]=g.useState("running"),[u,f]=g.useState([]),[p,m]=g.useState([]),[b,y]=g.useState(!1),[v,w]=g.useState(0),C=g.useRef(null),j=g.useRef(null);g.useEffect(()=>{b&&j.current&&j.current.scrollIntoView({behavior:"smooth"})},[b]);const k=g.useCallback(async()=>{if(a.length===0){h("success");return}for(let x=0;x<a.length;x++){w(x);const T=a[x];try{const A=T.id==="cli",R=new URLSearchParams({target:A?"cli":"kit"});A||R.set("kit",T.id);const N=new EventSource(`/api/system/update?${R}`);C.current=N,await new Promise((L,W)=>{N.onmessage=F=>{try{const B=JSON.parse(F.data);B.type==="phase"&&B.name&&f(q=>[...q,`[${T.name}] ${B.name}`]),B.type==="output"&&B.text&&m(q=>[...q,B.text]),B.type==="error"&&(h("error"),m(q=>[...q,`[ERROR ${T.name}] ${B.message||"Unknown error"}`]),N.close(),W()),B.type==="complete"&&(B.code===0?(N.close(),L()):(h("error"),N.close(),W()))}catch(B){console.error("Failed to parse SSE message:",B),N.close(),W(B)}},N.onerror=()=>{h("error"),m(F=>[...F,`[ERROR ${T.name}] Connection lost`]),N.close(),W()}})}catch(A){console.error(`Failed to update ${T.name}:`,A)}}h("success"),s()},[a,s]);g.useEffect(()=>{if(n)if(o==="batch")k();else{const x=new URLSearchParams({target:t});r&&x.set("kit",r),i&&x.set("version",i);const T=new EventSource(`/api/system/update?${x}`);return C.current=T,T.onmessage=A=>{try{const R=JSON.parse(A.data);R.type==="phase"&&R.name&&f(N=>[...N,R.name]),R.type==="output"&&R.text&&m(N=>[...N,R.text]),R.type==="error"&&(h("error"),m(N=>[...N,`[ERROR] ${R.message||"Unknown error"}`])),R.type==="complete"&&(h(R.code===0?"success":"error"),T.close(),R.code===0&&s())}catch(R){console.error("Failed to parse SSE message:",R)}},T.onerror=()=>{h("error"),m(A=>[...A,"[ERROR] Connection lost"]),T.close()},()=>{T.close()}}},[n,t,r,i,s,o,k]);const O=()=>{c!=="running"&&(h("running"),f([]),m([]),y(!1),w(0),e())};return n?d.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:d.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:[d.jsx("div",{className:"px-6 py-4 border-b border-dash-border",children:d.jsx("h2",{className:"text-lg font-bold text-dash-text",children:l(c==="running"?"updating":c==="success"?"updateSuccess":"updateFailed")})}),d.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[o==="batch"&&a.length>0&&d.jsxs("div",{className:"text-sm text-dash-text-secondary",children:[c==="running"&&d.jsxs("span",{children:["Updating ",v+1," of ",a.length,":"," ",a[v]?.name]}),c==="success"&&d.jsxs("span",{className:"text-emerald-500",children:["All ",a.length," components updated"]})]}),u.length>0&&d.jsx("div",{className:"space-y-2",children:u.map((x,T)=>d.jsxs("div",{className:"flex items-center gap-2 text-sm text-dash-text-secondary",children:[d.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-dash-accent"}),d.jsx("span",{children:x})]},`${x}-${T}`))}),c==="running"&&d.jsxs("div",{className:"flex items-center gap-2 text-sm text-dash-text-muted",children:[d.jsx("span",{className:"w-4 h-4 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),d.jsx("span",{children:l("updating")})]}),p.length>0&&d.jsxs("div",{children:[d.jsx("button",{type:"button",onClick:()=>y(!b),className:"text-xs text-dash-accent hover:text-dash-accent-hover transition-colors",children:l(b?"hideDetails":"showDetails")}),b&&d.jsxs("div",{className:"mt-2 bg-dash-bg border border-dash-border rounded p-3 max-h-64 overflow-y-auto",children:[d.jsx("pre",{className:"text-xs mono text-dash-text whitespace-pre-wrap",children:p.join(`
67
- `)}),d.jsx("div",{ref:j})]})]})]}),d.jsx("div",{className:"px-6 py-4 border-t border-dash-border flex justify-end",children:d.jsx("button",{type:"button",onClick:O,disabled:c==="running",className:`px-4 py-2 rounded text-sm font-medium transition-colors ${c==="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},$b=({target:n,kitName:e,currentVersion:t,latestVersion:r,onVersionSelect:i})=>{const{t:s}=he(),[o,a]=g.useState([]),[l,c]=g.useState(!1),[h,u]=g.useState(r);g.useEffect(()=>{(async()=>{c(!0);try{const m=new URLSearchParams({target:n});e&&m.set("kit",e);const y=await(await fetch(`/api/system/versions?${m}`)).json();y.versions&&a(y.versions)}catch(m){console.error("Failed to fetch versions:",m)}finally{c(!1)}})()},[n,e]);const f=p=>{u(p),i(p)};return l?d.jsxs("span",{className:"text-xs text-dash-text-muted flex items-center gap-1.5",children:[d.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),s("loadingVersions")]}):d.jsx("select",{value:h,onChange:p=>f(p.target.value),className:`text-xs text-amber-500 hover:text-amber-600 font-medium transition-colors
66
+ `,role:"status","aria-label":e})},id=({isOpen:n,onClose:e,target:t,kitName:r,targetVersion:i,onComplete:s,mode:o="single",components:a=[]})=>{const{t:l}=ce(),[c,d]=g.useState("running"),[u,f]=g.useState([]),[p,m]=g.useState([]),[b,x]=g.useState(!1),[w,v]=g.useState(0),S=g.useRef(null),j=g.useRef(null);g.useEffect(()=>{b&&j.current&&j.current.scrollIntoView({behavior:"smooth"})},[b]);const k=g.useCallback(async()=>{if(a.length===0){d("success");return}for(let y=0;y<a.length;y++){v(y);const D=a[y];try{const A=D.id==="cli",R=new URLSearchParams({target:A?"cli":"kit"});A||R.set("kit",D.id);const N=new EventSource(`/api/system/update?${R}`);S.current=N,await new Promise((L,W)=>{N.onmessage=F=>{try{const B=JSON.parse(F.data);B.type==="phase"&&B.name&&f(q=>[...q,`[${D.name}] ${B.name}`]),B.type==="output"&&B.text&&m(q=>[...q,B.text]),B.type==="error"&&(d("error"),m(q=>[...q,`[ERROR ${D.name}] ${B.message||"Unknown error"}`]),N.close(),W()),B.type==="complete"&&(B.code===0?(N.close(),L()):(d("error"),N.close(),W()))}catch(B){console.error("Failed to parse SSE message:",B),N.close(),W(B)}},N.onerror=()=>{d("error"),m(F=>[...F,`[ERROR ${D.name}] Connection lost`]),N.close(),W()}})}catch(A){console.error(`Failed to update ${D.name}:`,A)}}d("success"),s()},[a,s]);g.useEffect(()=>{if(n)if(o==="batch")k();else{const y=new URLSearchParams({target:t});r&&y.set("kit",r),i&&y.set("version",i);const D=new EventSource(`/api/system/update?${y}`);return S.current=D,D.onmessage=A=>{try{const R=JSON.parse(A.data);R.type==="phase"&&R.name&&f(N=>[...N,R.name]),R.type==="output"&&R.text&&m(N=>[...N,R.text]),R.type==="error"&&(d("error"),m(N=>[...N,`[ERROR] ${R.message||"Unknown error"}`])),R.type==="complete"&&(d(R.code===0?"success":"error"),D.close(),R.code===0&&s())}catch(R){console.error("Failed to parse SSE message:",R)}},D.onerror=()=>{d("error"),m(A=>[...A,"[ERROR] Connection lost"]),D.close()},()=>{D.close()}}},[n,t,r,i,s,o,k]);const O=()=>{c!=="running"&&(d("running"),f([]),m([]),x(!1),v(0),e())};return n?h.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:h.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:[h.jsx("div",{className:"px-6 py-4 border-b border-dash-border",children:h.jsx("h2",{className:"text-lg font-bold text-dash-text",children:l(c==="running"?"updating":c==="success"?"updateSuccess":"updateFailed")})}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[o==="batch"&&a.length>0&&h.jsxs("div",{className:"text-sm text-dash-text-secondary",children:[c==="running"&&h.jsxs("span",{children:["Updating ",w+1," of ",a.length,":"," ",a[w]?.name]}),c==="success"&&h.jsxs("span",{className:"text-emerald-500",children:["All ",a.length," components updated"]})]}),u.length>0&&h.jsx("div",{className:"space-y-2",children:u.map((y,D)=>h.jsxs("div",{className:"flex items-center gap-2 text-sm text-dash-text-secondary",children:[h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-dash-accent"}),h.jsx("span",{children:y})]},`${y}-${D}`))}),c==="running"&&h.jsxs("div",{className:"flex items-center gap-2 text-sm text-dash-text-muted",children:[h.jsx("span",{className:"w-4 h-4 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),h.jsx("span",{children:l("updating")})]}),p.length>0&&h.jsxs("div",{children:[h.jsx("button",{type:"button",onClick:()=>x(!b),className:"text-xs text-dash-accent hover:text-dash-accent-hover transition-colors",children:l(b?"hideDetails":"showDetails")}),b&&h.jsxs("div",{className:"mt-2 bg-dash-bg border border-dash-border rounded p-3 max-h-64 overflow-y-auto",children:[h.jsx("pre",{className:"text-xs mono text-dash-text whitespace-pre-wrap",children:p.join(`
67
+ `)}),h.jsx("div",{ref:j})]})]})]}),h.jsx("div",{className:"px-6 py-4 border-t border-dash-border flex justify-end",children:h.jsx("button",{type:"button",onClick:O,disabled:c==="running",className:`px-4 py-2 rounded text-sm font-medium transition-colors ${c==="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},Bb=({target:n,kitName:e,currentVersion:t,latestVersion:r,onVersionSelect:i})=>{const{t:s}=ce(),[o,a]=g.useState([]),[l,c]=g.useState(!1),[d,u]=g.useState(r);g.useEffect(()=>{(async()=>{c(!0);try{const m=new URLSearchParams({target:n});e&&m.set("kit",e);const x=await(await fetch(`/api/system/versions?${m}`)).json();x.versions&&a(x.versions)}catch(m){console.error("Failed to fetch versions:",m)}finally{c(!1)}})()},[n,e]);const f=p=>{u(p),i(p)};return l?h.jsxs("span",{className:"text-xs text-dash-text-muted flex items-center gap-1.5",children:[h.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),s("loadingVersions")]}):h.jsx("select",{value:d,onChange:p=>f(p.target.value),className:`text-xs text-amber-500 hover:text-amber-600 font-medium transition-colors
68
68
  bg-transparent border border-amber-500/30 rounded px-2 py-1
69
69
  focus:outline-none focus:ring-2 focus:ring-amber-500/50
70
- cursor-pointer appearance-none`,title:s("selectVersion"),children:o.map(p=>{const m=p.version===r,b=p.version===t,y=`v${p.version.replace(/^v/,"")}${m?` (${s("latestVersion")})`:""}${p.isPrerelease?` [${s("prereleaseLabel")}]`:""}${b?` - ${s("currentVersionLabel")}`:""}`;return d.jsx("option",{value:p.version,disabled:b,children:y},p.version)})})},IC=({version:n,installedAt:e,channel:t="stable",externalStatus:r,externalLatestVersion:i,onStatusChange:s,disabled:o})=>{const{t:a}=he(),[l,c]=g.useState("idle"),[h,u]=g.useState(null),[f,p]=g.useState(!1),[m,b]=g.useState(null),y=r??l,v=i??h,w=async()=>{const j=O=>{s||c(O)},k=O=>{s||u(O)};j("checking"),s&&s("checking",null);try{const x=await(await fetch(`/api/system/check-updates?target=cli&channel=${t}`)).json();x.updateAvailable?(j("update-available"),k(x.latest),s&&s("update-available",x.latest)):(j("up-to-date"),s&&s("up-to-date",null))}catch{j("idle"),s&&s("idle",null)}},C=async()=>{window.location.reload()};return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"dash-panel p-5 transition-colors hover:border-dash-accent/30",children:d.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[d.jsx(Ib,{status:y,ariaLabel:a(y==="up-to-date"?"upToDate":y==="update-available"?"updateAvailable":"checking")}),d.jsx("h3",{className:"text-base font-semibold text-dash-text",children:a("cliCard")}),t==="beta"&&d.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")})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-dash-text-secondary",children:[d.jsxs("span",{className:"px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70 mono",children:[a("currentVersionLabel"),": v",n.replace(/^v/,"")]}),e&&d.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()})]}),y==="update-available"&&v&&d.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",n.replace(/^v/,"")," ","->"," v",v.replace(/^v/,"")]})]}),d.jsx($C,{status:y,currentVersion:n,latestVersion:v,onCheck:w,onUpdate:()=>p(!0),onVersionSelect:b,disabled:o})]})}),d.jsx(rd,{isOpen:f,onClose:()=>p(!1),target:"cli",targetVersion:m??v??void 0,onComplete:C})]})},$C=({status:n,currentVersion:e,latestVersion:t,onCheck:r,onUpdate:i,onVersionSelect:s,disabled:o})=>{const{t:a}=he();return n==="checking"?d.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:[d.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),a("checking")]}):n==="up-to-date"?d.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")}):n==="update-available"&&t?d.jsx("div",{className:"flex items-center gap-2",children:d.jsx($b,{target:"cli",currentVersion:e,latestVersion:t,onVersionSelect:l=>{s(l),i()}})}):d.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")})},BC=({configPath:n,nodeVersion:e,bunVersion:t,os:r})=>{const{t:i}=he();return d.jsxs("div",{className:"dash-panel p-5",children:[d.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text mb-3",children:i("environment")}),d.jsxs("div",{className:"grid grid-cols-1 gap-2 text-sm md:grid-cols-2",children:[d.jsx(Ro,{label:i("claudeConfigPath"),value:n,mono:!0}),d.jsx(Ro,{label:i("osVersion"),value:r}),d.jsx(Ro,{label:i("nodeVersion"),value:e,mono:!0}),t&&d.jsx(Ro,{label:i("bunVersion"),value:t,mono:!0})]})]})},Ro=({label:n,value:e,mono:t})=>d.jsxs("div",{className:"rounded-lg border border-dash-border bg-dash-bg/70 p-2.5",children:[d.jsx("p",{className:"text-dash-text-muted text-[11px] uppercase tracking-wide mb-1",children:n}),d.jsx("p",{className:`text-dash-text-secondary break-all ${t?"mono text-xs":"text-sm"}`,children:e})]});function FC(n){let e=0,t=0,r=0;for(const i of n)i.ownership==="ck"?e++:i.ownership==="user"?t++:i.ownership==="ck-modified"&&r++;return{ck:e,user:t,modified:r}}function VC(n){const e={skills:0,commands:0,rules:0,hooks:0,settings:0,other:0};for(const t of n){const r=t.path;r.startsWith("skills/")?e.skills++:r.startsWith("commands/")?e.commands++:r.startsWith("rules/")?e.rules++:r.startsWith("hooks/")||r==="hooks.json"?e.hooks++:r.startsWith("settings/")||r==="settings.json"?e.settings++:e.other++}return e}const zC=({kitName:n,kit:e,channel:t="stable",externalStatus:r,externalLatestVersion:i,onStatusChange:s,disabled:o})=>{const{t:a}=he(),[l,c]=g.useState("idle"),[h,u]=g.useState(null),[f,p]=g.useState(!1),[m,b]=g.useState(null),y=r??l,v=i??h,w=e.files??[],C=FC(w),j=VC(w),k=async()=>{const x=A=>{s||c(A)},T=A=>{s||u(A)};x("checking"),s&&s("checking",null);try{const R=await(await fetch(`/api/system/check-updates?target=kit&kit=${n}&channel=${t}`)).json();R.updateAvailable?(x("update-available"),T(R.latest),s&&s("update-available",R.latest)):(x("up-to-date"),s&&s("up-to-date",null))}catch{x("idle"),s&&s("idle",null)}},O=async()=>{window.location.reload()};return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"dash-panel p-5 space-y-4 transition-colors hover:border-dash-accent/30",children:[d.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[d.jsx(Ib,{status:y,ariaLabel:a(y==="up-to-date"?"upToDate":y==="update-available"?"updateAvailable":"checking")}),d.jsxs("h3",{className:"text-base font-semibold text-dash-text capitalize",children:[n," Kit"]}),t==="beta"&&d.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")})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-dash-text-secondary",children:[d.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&&d.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()}),d.jsxs("span",{className:"px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70 mono",children:[a("components"),": ",w.length]})]}),y==="update-available"&&v&&d.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",v.replace(/^v/,"")]})]}),d.jsx(_C,{status:y,currentVersion:e.version??"0.0.0",latestVersion:v,kitName:n,onCheck:k,onUpdate:()=>p(!0),onVersionSelect:b,disabled:o})]}),w.length>0&&d.jsx("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-2 xl:grid-cols-3",children:Object.entries(j).filter(([,x])=>x>0).map(([x,T])=>d.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:[d.jsx("span",{className:"text-dash-text-secondary capitalize",children:x}),d.jsx("span",{className:"font-bold mono text-dash-text",children:T})]},x))}),w.length>0&&d.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-dash-text-muted",children:[d.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:[d.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-500 shrink-0"}),C.ck," ",a("ownershipCk")]}),C.user>0&&d.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:[d.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500 shrink-0"}),C.user," ",a("ownershipUser")]}),C.modified>0&&d.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:[d.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-500 shrink-0"}),C.modified," ",a("ownershipModified")]})]}),w.length===0&&d.jsx("p",{className:"text-xs text-dash-text-muted",children:a("noTrackedFiles")})]}),d.jsx(rd,{isOpen:f,onClose:()=>p(!1),target:"kit",kitName:n,targetVersion:m??v??void 0,onComplete:O})]})},_C=({status:n,currentVersion:e,latestVersion:t,kitName:r,onCheck:i,onUpdate:s,onVersionSelect:o,disabled:a})=>{const{t:l}=he();return n==="checking"?d.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:[d.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),l("checking")]}):n==="up-to-date"?d.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")}):n==="update-available"&&t?d.jsx("div",{className:"flex items-center gap-2",children:d.jsx($b,{target:"kit",kitName:r,currentVersion:e,latestVersion:t,onVersionSelect:c=>{o(c),s()}})}):d.jsx("button",{type:"button",onClick:i,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")})},tp="claudekit-update-channel",np="claudekit-system-filter",HC=n=>/-(alpha|beta|rc|dev|next)/.test(n),WC=n=>n==="all"||n==="updates"||n==="up-to-date"||n==="cli"||n==="kits"?n:"all",rp=n=>n==="update-available"?0:n==="checking"?1:n==="idle"?2:3,UC=({metadata:n})=>{const{t:e}=he(),[t,r]=g.useState(null),[i,s]=g.useState([]),[o,a]=g.useState(!1),[l,c]=g.useState(!1),[h,u]=g.useState(!1),[f,p]=g.useState("stable"),[m,b]=g.useState(()=>WC(localStorage.getItem(np))),y=g.useRef(!1),v=g.useRef(0),w=g.useMemo(()=>!n.kits||typeof n.kits!="object"?[]:Object.entries(n.kits),[n.kits]),C=w.length>0,j=n.name,k=n.version,O=n.installedAt,x=w.length>0||j;g.useEffect(()=>{if(!t)return;const Y=[];if(Y.push({id:"cli",type:"cli",status:"idle",currentVersion:t.cliVersion,latestVersion:null}),C&&w.length>0)for(const[Me,Se]of w){const Ie=Se;Y.push({id:Me,type:"kit",status:"idle",currentVersion:Ie.version??"?",latestVersion:null})}else j&&Y.push({id:j,type:"kit",status:"idle",currentVersion:k??"?",latestVersion:null});s(Y)},[t,C,w,j,k]),g.useEffect(()=>{fetch("/api/system/info").then(Y=>Y.json()).then(r).catch(()=>r(null))},[]),g.useEffect(()=>{const Y=localStorage.getItem(tp);Y==="stable"||Y==="beta"?p(Y):t?.cliVersion&&p(HC(t.cliVersion)?"beta":"stable")},[t?.cliVersion]);const T=Y=>{p(Y),localStorage.setItem(tp,Y)};g.useEffect(()=>{localStorage.setItem(np,m)},[m]);const A=(Y,Me,Se)=>{s(Ie=>Ie.map(ve=>ve.id===Y?{...ve,status:Me,latestVersion:Se}:ve))},R=g.useCallback(async()=>{if(i.length===0)return;const Y=v.current+1;v.current=Y,a(!0),s(Me=>Me.map(Se=>Se.status==="checking"&&Se.latestVersion===null?Se:{...Se,status:"checking",latestVersion:null}));try{const Me=i.map(async Ie=>{try{const ve=Ie.type==="cli"?`target=cli&channel=${f}`:`target=kit&kit=${Ie.id}&channel=${f}`,I=await(await fetch(`/api/system/check-updates?${ve}`)).json();return{id:Ie.id,status:I.updateAvailable?"update-available":"up-to-date",latestVersion:I.latest}}catch{return{id:Ie.id,status:"idle",latestVersion:null}}}),Se=await Promise.all(Me);if(v.current!==Y)return;s(Ie=>Ie.map(ve=>{const gt=Se.find(I=>I.id===ve.id);return gt?{...ve,status:gt.status,latestVersion:gt.latestVersion}:ve}))}finally{v.current===Y&&a(!1)}},[f,i]),N=Y=>{b(Y),(Y==="updates"||Y==="up-to-date")&&!o&&!l&&i.length>0&&i.every(Se=>Se.status==="idle")&&(y.current=!0,R())},L=()=>{u(!0)},W=()=>{window.location.reload()},F=i.filter(Y=>Y.status==="update-available").length,B=i.filter(Y=>Y.status==="up-to-date").length,q=i.filter(Y=>Y.status==="up-to-date"||Y.status==="update-available").length,de=i.some(Y=>Y.status==="checking"),z=C&&w.length>0?w.length:j?1:0,J=i.find(Y=>Y.id==="cli")?.status??"idle",ie=g.useMemo(()=>C&&w.length>0?w.map(([Y,Me])=>({id:Y,kitName:Y,kit:Me})):j?[{id:j,kitName:j,kit:{version:k,installedAt:O}}]:[],[C,w,j,k,O]),le=g.useMemo(()=>{const Me=[...ie.map(Se=>({...Se,status:i.find(Ie=>Ie.id===Se.id)?.status??"idle"}))].sort((Se,Ie)=>{const ve=rp(Se.status)-rp(Ie.status);return ve!==0?ve:Se.kitName.localeCompare(Ie.kitName)});return m==="updates"?Me.filter(Se=>Se.status==="update-available"):m==="up-to-date"?Me.filter(Se=>Se.status==="up-to-date"):m==="cli"?[]:Me},[ie,i,m]),fe=m==="all"||m==="cli"||m==="updates"&&J==="update-available"||m==="up-to-date"&&J==="up-to-date",we=(fe?1:0)+le.length;g.useEffect(()=>{if(!(!(m==="updates"||m==="up-to-date")||y.current)&&!(o||l||i.length===0)){if(!i.every(Me=>Me.status==="idle")){y.current=!0;return}y.current=!0,R()}},[R,o,l,i,m]);const ke=g.useMemo(()=>we!==0?"":(m==="updates"||m==="up-to-date")&&de?e("checkingAll"):(m==="updates"||m==="up-to-date")&&q===0?e("runCheckAllForFilter"):m==="updates"&&q>0&&F===0?e("noUpdatesFound"):m==="up-to-date"&&q>0&&B===0?e("noUpToDateYet"):e("noComponentsMatchFilter"),[we,m,de,q,F,B,e]),Ae=!x&&m!=="cli",Qe=e("componentFilterUpdatesCount").replace("{count}",F.toString()),mt=e("componentFilterUpToDateCount").replace("{count}",B.toString());return d.jsxs("div",{className:"relative",children:[d.jsxs("div",{className:"pointer-events-none absolute inset-0 -z-10 overflow-hidden",children:[d.jsx("div",{className:"absolute -top-20 -right-8 h-56 w-56 rounded-full bg-dash-accent/10 blur-3xl"}),d.jsx("div",{className:"absolute -bottom-24 -left-10 h-64 w-64 rounded-full bg-dash-accent/5 blur-3xl"})]}),d.jsxs("div",{className:"space-y-4",children:[d.jsx("section",{className:"dash-panel dash-sticky-glass p-4 md:p-5 sticky top-0 z-10",children:d.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx("p",{className:"mono text-[10px] uppercase tracking-[0.16em] text-dash-text-muted",children:e("systemControlTower")}),d.jsx("h2",{className:"text-xl md:text-2xl font-semibold text-dash-text",children:e("systemOverviewTitle")}),d.jsx("p",{className:"text-sm text-dash-text-secondary max-w-2xl",children:e("systemOverviewDesc")})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx(RC,{value:f,onChange:T,disabled:o||l}),i.length>0&&d.jsx(EC,{components:i,isChecking:o,isUpdating:l,onCheckAll:R,onUpdateAll:L})]})]})}),d.jsxs("section",{className:"grid grid-cols-2 gap-3 xl:grid-cols-5",children:[d.jsx(fi,{label:e("components"),value:i.length.toString()}),d.jsx(fi,{label:e("kitsLabel"),value:z.toString()}),d.jsx(fi,{label:e("updateAvailable"),value:F.toString(),tone:"accent"}),d.jsx(fi,{label:e("upToDate"),value:B.toString(),tone:"success"}),d.jsx(fi,{label:e("checkedComponents"),value:q.toString()})]}),d.jsxs("section",{className:"grid gap-4 xl:grid-cols-[minmax(0,1fr)_320px]",children:[d.jsxs("div",{className:"space-y-3 min-w-0",children:[d.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 px-1",children:[d.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text",children:e("installedComponentsHeading")}),d.jsxs("fieldset",{className:"flex items-center gap-2",children:[d.jsx("legend",{className:"sr-only",children:e("installedComponentsHeading")}),d.jsx(pi,{label:e("componentFilterAll"),value:m,activeValue:"all",onClick:()=>N("all")}),d.jsx(pi,{label:Qe,value:m,activeValue:"updates",onClick:()=>N("updates")}),d.jsx(pi,{label:mt,value:m,activeValue:"up-to-date",onClick:()=>N("up-to-date")}),d.jsx(pi,{label:e("componentFilterCli"),value:m,activeValue:"cli",onClick:()=>N("cli")}),d.jsx(pi,{label:e("componentFilterKits"),value:m,activeValue:"kits",onClick:()=>N("kits")})]})]}),fe&&d.jsx(IC,{version:t?.cliVersion??"...",installedAt:void 0,externalStatus:i.find(Y=>Y.id==="cli")?.status,externalLatestVersion:i.find(Y=>Y.id==="cli")?.latestVersion??null,onStatusChange:(Y,Me)=>A("cli",Y,Me),disabled:o||l,channel:f}),le.map(Y=>{const Me=i.find(Se=>Se.id===Y.id);return d.jsx(zC,{kitName:Y.kitName,kit:Y.kit,externalStatus:Me?.status,externalLatestVersion:Me?.latestVersion??null,onStatusChange:(Se,Ie)=>A(Y.id,Se,Ie),disabled:o||l,channel:f},Y.id)}),Ae&&d.jsx("div",{className:"dash-panel-muted p-6 text-center opacity-80",children:d.jsx("p",{className:"text-sm text-dash-text-secondary",children:e("noKitInstalled")})}),!Ae&&we===0&&d.jsx("div",{className:"dash-panel-muted p-6 text-center opacity-80",children:d.jsx("p",{className:"text-sm text-dash-text-secondary",children:ke})})]}),d.jsxs("aside",{className:"space-y-3 xl:sticky xl:top-20 self-start",children:[d.jsxs("div",{className:"dash-panel p-4 space-y-3",children:[d.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text",children:e("updateReadiness")}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Lo,{label:e("updateAvailable"),value:F.toString(),tone:F>0?"accent":"default"}),d.jsx(Lo,{label:e("upToDate"),value:B.toString(),tone:"success"}),d.jsx(Lo,{label:e("checkedComponents"),value:q.toString()}),d.jsx(Lo,{label:e("activeChannel"),value:e(f==="beta"?"channelBeta":"channelStable")})]})]}),t&&d.jsx(BC,{configPath:t.configPath,nodeVersion:t.nodeVersion,bunVersion:t.bunVersion,os:t.os})]})]})]}),d.jsx(rd,{isOpen:h,onClose:()=>u(!1),target:"cli",mode:"batch",components:i.filter(Y=>Y.status==="update-available").map(Y=>({id:Y.id,name:Y.id==="cli"?"CLI":`${Y.id} Kit`})),onComplete:W})]})},fi=({label:n,value:e,tone:t="default"})=>{const r=t==="accent"?"text-dash-accent":t==="success"?"text-emerald-500":"text-dash-text";return d.jsxs("div",{className:"dash-panel p-3",children:[d.jsx("p",{className:"text-[11px] uppercase tracking-wide text-dash-text-muted",children:n}),d.jsx("p",{className:`mt-1 mono text-xl font-semibold ${r}`,children:e})]})},Lo=({label:n,value:e,tone:t="default"})=>{const r=t==="accent"?"text-dash-accent":t==="success"?"text-emerald-500":"text-dash-text-secondary";return d.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-dash-border bg-dash-bg/70 px-3 py-2",children:[d.jsx("span",{className:"text-xs text-dash-text-muted",children:n}),d.jsx("span",{className:`mono text-xs font-semibold ${r}`,children:e})]})},pi=({label:n,value:e,activeValue:t,onClick:r})=>{const i=e===t;return d.jsx("button",{type:"button",onClick:r,"aria-pressed":i,className:`dash-focus-ring px-2.5 py-1.5 rounded-lg text-[11px] font-semibold border transition-colors ${i?"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:n})},Bl="~/.claude/settings.json",Io="{}",KC=()=>{const{t:n}=he(),[e,t]=g.useState(!0),[r,i]=g.useState(Bl),[s,o]=g.useState(Io),[a,l]=g.useState(Io),[c,h]=g.useState(0),[u,f]=g.useState(!1),[p,m]=g.useState(!1),[b,y]=g.useState("idle"),[v,w]=g.useState(null),[C,j]=g.useState(null);g.useEffect(()=>{let A=!1;return(async()=>{t(!0),m(!1);try{const N=await kv();if(A)return;const L=JSON.stringify(N.settings??{},null,2);i(N.path||Bl),f(!!N.exists),o(L),l(L),w(null)}catch{if(A)return;m(!0),f(!1),i(Bl),o(Io),l(Io)}finally{A||t(!1)}})(),()=>{A=!0}},[]);const k=A=>{l(A),j(null);try{JSON.parse(A),w(null)}catch(R){w(R instanceof Error?R.message:"Invalid JSON")}},O=()=>{l(s),w(null),j(null),y("idle")},x=async()=>{if(!(e||v)){y("saving"),j(null);try{const A=JSON.parse(a),R=JSON.stringify(A,null,2),N=await Sv(A);o(R),l(R),f(!0),y("saved"),j(N.backupPath?`${n("settingsBackupSaved")}: ${N.backupPath}`:n("saved")),setTimeout(()=>y("idle"),2e3)}catch(A){y("error"),j(A instanceof Error?A.message:n("saveFailed")),setTimeout(()=>y("idle"),3e3)}}},T=a!==s;return d.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:[d.jsxs("div",{className:"mb-2 flex items-end justify-between gap-3 px-1",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text",children:n("settingsJsonHeading")}),d.jsx("p",{className:"mono text-[11px] text-dash-text-muted truncate",children:r})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{type:"button",onClick:O,disabled:e||!T||b==="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:n("discard")}),d.jsx("button",{type:"button",onClick:x,disabled:e||b==="saving"||!!v||!T,className:`px-3 py-1.5 rounded-lg text-xs font-bold transition-all tracking-widest uppercase disabled:opacity-50 disabled:cursor-not-allowed ${b==="saved"?"bg-green-500 text-white shadow-lg shadow-green-500/20":b==="error"?"bg-red-500 text-white":"bg-dash-accent text-dash-bg hover:bg-dash-accent-hover shadow-lg shadow-dash-accent/20"}`,children:n(b==="saving"?"saving":b==="saved"?"saved":b==="error"?"saveFailed":"saveChanges")})]})]}),d.jsx("div",{className:"flex-1 min-h-0",children:d.jsx(nd,{width:100,isLoading:e,jsonText:a,cursorLine:c,syntaxError:v,onChange:k,onCursorLineChange:h})}),C&&d.jsx("p",{className:`mt-2 px-1 text-xs ${b==="error"?"text-red-500":"text-dash-text-muted"}`,children:C}),!e&&!p&&!u&&d.jsx("p",{className:"mt-2 px-1 text-xs text-dash-text-muted",children:n("settingsJsonMissing")}),!e&&p&&d.jsx("p",{className:"mt-2 px-1 text-xs text-red-500",children:n("settingsJsonLoadFailed")})]})},GC={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: 'auto' (always), 'prompt' (ask first), 'off' (skip). Questions focus on configured areas.",effectVi:"Chạy phỏng vấn xác thực dựa trên chế độ: 'auto' (luôn), 'prompt' (hỏi trước), 'off' (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:`{
70
+ cursor-pointer appearance-none`,title:s("selectVersion"),children:o.map(p=>{const m=p.version===r,b=p.version===t,x=`v${p.version.replace(/^v/,"")}${m?` (${s("latestVersion")})`:""}${p.isPrerelease?` [${s("prereleaseLabel")}]`:""}${b?` - ${s("currentVersionLabel")}`:""}`;return h.jsx("option",{value:p.version,disabled:b,children:x},p.version)})})},BC=({version:n,installedAt:e,channel:t="stable",externalStatus:r,externalLatestVersion:i,onStatusChange:s,disabled:o})=>{const{t:a}=ce(),[l,c]=g.useState("idle"),[d,u]=g.useState(null),[f,p]=g.useState(!1),[m,b]=g.useState(null),x=r??l,w=i??d,v=async()=>{const j=O=>{s||c(O)},k=O=>{s||u(O)};j("checking"),s&&s("checking",null);try{const y=await(await fetch(`/api/system/check-updates?target=cli&channel=${t}`)).json();y.updateAvailable?(j("update-available"),k(y.latest),s&&s("update-available",y.latest)):(j("up-to-date"),s&&s("up-to-date",null))}catch{j("idle"),s&&s("idle",null)}},S=async()=>{window.location.reload()};return h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"dash-panel p-5 transition-colors hover:border-dash-accent/30",children:h.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[h.jsx($b,{status:x,ariaLabel:a(x==="up-to-date"?"upToDate":x==="update-available"?"updateAvailable":"checking")}),h.jsx("h3",{className:"text-base font-semibold text-dash-text",children:a("cliCard")}),t==="beta"&&h.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")})]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-dash-text-secondary",children:[h.jsxs("span",{className:"px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70 mono",children:[a("currentVersionLabel"),": v",n.replace(/^v/,"")]}),e&&h.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()})]}),x==="update-available"&&w&&h.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",n.replace(/^v/,"")," ","->"," v",w.replace(/^v/,"")]})]}),h.jsx(FC,{status:x,currentVersion:n,latestVersion:w,onCheck:v,onUpdate:()=>p(!0),onVersionSelect:b,disabled:o})]})}),h.jsx(id,{isOpen:f,onClose:()=>p(!1),target:"cli",targetVersion:m??w??void 0,onComplete:S})]})},FC=({status:n,currentVersion:e,latestVersion:t,onCheck:r,onUpdate:i,onVersionSelect:s,disabled:o})=>{const{t:a}=ce();return n==="checking"?h.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:[h.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),a("checking")]}):n==="up-to-date"?h.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")}):n==="update-available"&&t?h.jsx("div",{className:"flex items-center gap-2",children:h.jsx(Bb,{target:"cli",currentVersion:e,latestVersion:t,onVersionSelect:l=>{s(l),i()}})}):h.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")})},VC=({configPath:n,nodeVersion:e,bunVersion:t,os:r})=>{const{t:i}=ce();return h.jsxs("div",{className:"dash-panel p-5",children:[h.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text mb-3",children:i("environment")}),h.jsxs("div",{className:"grid grid-cols-1 gap-2 text-sm md:grid-cols-2",children:[h.jsx(Ro,{label:i("claudeConfigPath"),value:n,mono:!0}),h.jsx(Ro,{label:i("osVersion"),value:r}),h.jsx(Ro,{label:i("nodeVersion"),value:e,mono:!0}),t&&h.jsx(Ro,{label:i("bunVersion"),value:t,mono:!0})]})]})},Ro=({label:n,value:e,mono:t})=>h.jsxs("div",{className:"rounded-lg border border-dash-border bg-dash-bg/70 p-2.5",children:[h.jsx("p",{className:"text-dash-text-muted text-[11px] uppercase tracking-wide mb-1",children:n}),h.jsx("p",{className:`text-dash-text-secondary break-all ${t?"mono text-xs":"text-sm"}`,children:e})]}),zC={ok:"bg-emerald-500/10 text-emerald-500 border-emerald-500/20",skip:"bg-slate-500/10 text-slate-300 border-slate-500/20",warn:"bg-amber-500/10 text-amber-400 border-amber-500/20",block:"bg-orange-500/10 text-orange-400 border-orange-500/20",error:"bg-red-500/10 text-red-400 border-red-500/20",crash:"bg-red-500/10 text-red-400 border-red-500/20"};function np(n,e){if(!n)return e;try{return new Intl.DateTimeFormat(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date(n))}catch{return n}}const _C=()=>{const{t:n}=ce(),[e,t]=g.useState([]),[r,i]=g.useState("global"),[s,o]=g.useState(null),[a,l]=g.useState(!0),[c,d]=g.useState(null),u=g.useRef(0),f=g.useRef(null),p=g.useCallback(async v=>{u.current+=1;const S=u.current;f.current?.abort();const j=new AbortController;f.current=j,l(!0),d(null);try{const k=await jv(v==="global"?{scope:"global",limit:40,signal:j.signal}:{scope:"project",projectId:v,limit:40,signal:j.signal});if(S!==u.current)return;o(k)}catch(k){if(j.signal.aborted||S!==u.current)return;o(null),d(k instanceof Error?k.message:n("hookDiagnosticsLoadFailed"))}finally{S===u.current&&(l(!1),f.current=null)}},[n]);g.useEffect(()=>{let v=!1;return wh().then(S=>{v||t(S.map(j=>({id:j.id,name:j.name})))}).catch(()=>{v||t([])}),()=>{v=!0}},[]),g.useEffect(()=>{p(r)},[p,r]),g.useEffect(()=>()=>{f.current?.abort()},[]);const m=s?.summary,b=m?.statusCounts??{},x=s?.entries??[],w=g.useMemo(()=>[{label:n("hookDiagnosticsEntries"),value:String(m?.total??0)},{label:n("hookDiagnosticsCrashes"),value:String(b.crash??0)},{label:n("hookDiagnosticsWarnings"),value:String(b.warn??0)},{label:n("hookDiagnosticsBlocks"),value:String(b.block??0)}],[m?.total,b.block,b.crash,b.warn,n]);return h.jsxs("section",{className:"dash-panel p-4 space-y-4",children:[h.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[h.jsxs("div",{className:"space-y-1 min-w-0",children:[h.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text",children:n("hookDiagnosticsTitle")}),h.jsx("p",{className:"text-xs text-dash-text-secondary",children:n("hookDiagnosticsDesc")}),h.jsx("p",{className:"mono text-[11px] text-dash-text-muted break-all",children:s?.path??n("hookDiagnosticsPathPending")})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("select",{value:r,onChange:v=>i(v.target.value),className:"rounded-lg border border-dash-border bg-dash-bg px-3 py-2 text-xs text-dash-text",children:[h.jsx("option",{value:"global",children:n("hookDiagnosticsScopeGlobal")}),e.map(v=>h.jsx("option",{value:v.id,children:v.name},v.id))]}),h.jsx("button",{type:"button",onClick:()=>void p(r),className:"rounded-lg border border-dash-border bg-dash-surface px-3 py-2 text-xs font-semibold text-dash-text-secondary hover:bg-dash-surface-hover",children:n("refresh")})]})]}),h.jsx("div",{className:"grid grid-cols-2 gap-3 xl:grid-cols-4",children:w.map(v=>h.jsxs("div",{className:"rounded-lg border border-dash-border bg-dash-bg/60 px-3 py-2",children:[h.jsx("p",{className:"text-[11px] uppercase tracking-wide text-dash-text-muted",children:v.label}),h.jsx("p",{className:"mono mt-1 text-lg font-semibold text-dash-text",children:v.value})]},v.label))}),m?.lastEventAt&&h.jsxs("p",{className:"text-xs text-dash-text-muted",children:[n("hookDiagnosticsLastEvent"),":"," ",np(m.lastEventAt,n("hookDiagnosticsUnknown"))]}),m&&(m.parseErrors>0||m.truncated)&&h.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-200",children:[m.parseErrors>0&&h.jsx("p",{children:n("hookDiagnosticsParseErrorsNotice").replace("{count}",String(m.parseErrors))}),m.truncated&&h.jsx("p",{children:n("hookDiagnosticsTruncatedNotice")})]}),a&&h.jsx("p",{className:"text-sm text-dash-text-muted",children:n("hookDiagnosticsLoading")}),c&&h.jsx("p",{className:"text-sm text-red-400",children:c}),!a&&!c&&s&&!s.exists&&h.jsx("p",{className:"text-sm text-dash-text-muted",children:n("hookDiagnosticsMissing")}),!a&&!c&&s?.exists&&h.jsx("div",{className:"space-y-2",children:x.length===0?h.jsx("p",{className:"text-sm text-dash-text-muted",children:n("hookDiagnosticsEmpty")}):x.map((v,S)=>h.jsxs("div",{className:"rounded-lg border border-dash-border bg-dash-bg/70 px-3 py-3",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h.jsx("span",{className:"mono text-[11px] text-dash-text-muted",children:np(v.ts,n("hookDiagnosticsUnknown"))}),h.jsx("span",{className:`rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase ${zC[v.status]??"bg-dash-surface text-dash-text border-dash-border"}`,children:v.status}),h.jsx("span",{className:"text-sm font-medium text-dash-text",children:v.hook}),v.event&&h.jsx("span",{className:"text-xs text-dash-text-muted",children:v.event}),v.tool&&h.jsxs("span",{className:"text-xs text-dash-text-muted",children:[n("hookDiagnosticsToolLabel"),": ",v.tool]})]}),(v.note||v.target||v.error)&&h.jsxs("div",{className:"mt-2 space-y-1 text-xs text-dash-text-secondary",children:[v.note&&h.jsx("p",{children:v.note}),v.target&&h.jsxs("p",{className:"mono",children:[n("hookDiagnosticsTargetLabel"),": ",v.target]}),v.error&&h.jsx("p",{className:"text-red-400",children:v.error})]})]},`${v.ts}-${v.hook}-${S}`))})]})};function HC(n){let e=0,t=0,r=0;for(const i of n)i.ownership==="ck"?e++:i.ownership==="user"?t++:i.ownership==="ck-modified"&&r++;return{ck:e,user:t,modified:r}}function WC(n){const e={skills:0,commands:0,rules:0,hooks:0,settings:0,other:0};for(const t of n){const r=t.path;r.startsWith("skills/")?e.skills++:r.startsWith("commands/")?e.commands++:r.startsWith("rules/")?e.rules++:r.startsWith("hooks/")||r==="hooks.json"?e.hooks++:r.startsWith("settings/")||r==="settings.json"?e.settings++:e.other++}return e}const UC=({kitName:n,kit:e,channel:t="stable",externalStatus:r,externalLatestVersion:i,onStatusChange:s,disabled:o})=>{const{t:a}=ce(),[l,c]=g.useState("idle"),[d,u]=g.useState(null),[f,p]=g.useState(!1),[m,b]=g.useState(null),x=r??l,w=i??d,v=e.files??[],S=HC(v),j=WC(v),k=async()=>{const y=A=>{s||c(A)},D=A=>{s||u(A)};y("checking"),s&&s("checking",null);try{const R=await(await fetch(`/api/system/check-updates?target=kit&kit=${n}&channel=${t}`)).json();R.updateAvailable?(y("update-available"),D(R.latest),s&&s("update-available",R.latest)):(y("up-to-date"),s&&s("up-to-date",null))}catch{y("idle"),s&&s("idle",null)}},O=async()=>{window.location.reload()};return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"dash-panel p-5 space-y-4 transition-colors hover:border-dash-accent/30",children:[h.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[h.jsx($b,{status:x,ariaLabel:a(x==="up-to-date"?"upToDate":x==="update-available"?"updateAvailable":"checking")}),h.jsxs("h3",{className:"text-base font-semibold text-dash-text capitalize",children:[n," Kit"]}),t==="beta"&&h.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")})]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-dash-text-secondary",children:[h.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&&h.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()}),h.jsxs("span",{className:"px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70 mono",children:[a("components"),": ",v.length]})]}),x==="update-available"&&w&&h.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",w.replace(/^v/,"")]})]}),h.jsx(KC,{status:x,currentVersion:e.version??"0.0.0",latestVersion:w,kitName:n,onCheck:k,onUpdate:()=>p(!0),onVersionSelect:b,disabled:o})]}),v.length>0&&h.jsx("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-2 xl:grid-cols-3",children:Object.entries(j).filter(([,y])=>y>0).map(([y,D])=>h.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:[h.jsx("span",{className:"text-dash-text-secondary capitalize",children:y}),h.jsx("span",{className:"font-bold mono text-dash-text",children:D})]},y))}),v.length>0&&h.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-dash-text-muted",children:[h.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:[h.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-500 shrink-0"}),S.ck," ",a("ownershipCk")]}),S.user>0&&h.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:[h.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500 shrink-0"}),S.user," ",a("ownershipUser")]}),S.modified>0&&h.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:[h.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-500 shrink-0"}),S.modified," ",a("ownershipModified")]})]}),v.length===0&&h.jsx("p",{className:"text-xs text-dash-text-muted",children:a("noTrackedFiles")})]}),h.jsx(id,{isOpen:f,onClose:()=>p(!1),target:"kit",kitName:n,targetVersion:m??w??void 0,onComplete:O})]})},KC=({status:n,currentVersion:e,latestVersion:t,kitName:r,onCheck:i,onUpdate:s,onVersionSelect:o,disabled:a})=>{const{t:l}=ce();return n==="checking"?h.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:[h.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),l("checking")]}):n==="up-to-date"?h.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")}):n==="update-available"&&t?h.jsx("div",{className:"flex items-center gap-2",children:h.jsx(Bb,{target:"kit",kitName:r,currentVersion:e,latestVersion:t,onVersionSelect:c=>{o(c),s()}})}):h.jsx("button",{type:"button",onClick:i,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")})},rp="claudekit-update-channel",ip="claudekit-system-filter",GC=n=>/-(alpha|beta|rc|dev|next)/.test(n),qC=n=>n==="all"||n==="updates"||n==="up-to-date"||n==="cli"||n==="kits"?n:"all",sp=n=>n==="update-available"?0:n==="checking"?1:n==="idle"?2:3,JC=({metadata:n})=>{const{t:e}=ce(),[t,r]=g.useState(null),[i,s]=g.useState([]),[o,a]=g.useState(!1),[l,c]=g.useState(!1),[d,u]=g.useState(!1),[f,p]=g.useState("stable"),[m,b]=g.useState(()=>qC(localStorage.getItem(ip))),x=g.useRef(!1),w=g.useRef(0),v=g.useMemo(()=>!n.kits||typeof n.kits!="object"?[]:Object.entries(n.kits),[n.kits]),S=v.length>0,j=n.name,k=n.version,O=n.installedAt,y=v.length>0||j;g.useEffect(()=>{if(!t)return;const Y=[];if(Y.push({id:"cli",type:"cli",status:"idle",currentVersion:t.cliVersion,latestVersion:null}),S&&v.length>0)for(const[Me,Se]of v){const Ie=Se;Y.push({id:Me,type:"kit",status:"idle",currentVersion:Ie.version??"?",latestVersion:null})}else j&&Y.push({id:j,type:"kit",status:"idle",currentVersion:k??"?",latestVersion:null});s(Y)},[t,S,v,j,k]),g.useEffect(()=>{fetch("/api/system/info").then(Y=>Y.json()).then(r).catch(()=>r(null))},[]),g.useEffect(()=>{const Y=localStorage.getItem(rp);Y==="stable"||Y==="beta"?p(Y):t?.cliVersion&&p(GC(t.cliVersion)?"beta":"stable")},[t?.cliVersion]);const D=Y=>{p(Y),localStorage.setItem(rp,Y)};g.useEffect(()=>{localStorage.setItem(ip,m)},[m]);const A=(Y,Me,Se)=>{s(Ie=>Ie.map(ve=>ve.id===Y?{...ve,status:Me,latestVersion:Se}:ve))},R=g.useCallback(async()=>{if(i.length===0)return;const Y=w.current+1;w.current=Y,a(!0),s(Me=>Me.map(Se=>Se.status==="checking"&&Se.latestVersion===null?Se:{...Se,status:"checking",latestVersion:null}));try{const Me=i.map(async Ie=>{try{const ve=Ie.type==="cli"?`target=cli&channel=${f}`:`target=kit&kit=${Ie.id}&channel=${f}`,I=await(await fetch(`/api/system/check-updates?${ve}`)).json();return{id:Ie.id,status:I.updateAvailable?"update-available":"up-to-date",latestVersion:I.latest}}catch{return{id:Ie.id,status:"idle",latestVersion:null}}}),Se=await Promise.all(Me);if(w.current!==Y)return;s(Ie=>Ie.map(ve=>{const gt=Se.find(I=>I.id===ve.id);return gt?{...ve,status:gt.status,latestVersion:gt.latestVersion}:ve}))}finally{w.current===Y&&a(!1)}},[f,i]),N=Y=>{b(Y),(Y==="updates"||Y==="up-to-date")&&!o&&!l&&i.length>0&&i.every(Se=>Se.status==="idle")&&(x.current=!0,R())},L=()=>{u(!0)},W=()=>{window.location.reload()},F=i.filter(Y=>Y.status==="update-available").length,B=i.filter(Y=>Y.status==="up-to-date").length,q=i.filter(Y=>Y.status==="up-to-date"||Y.status==="update-available").length,de=i.some(Y=>Y.status==="checking"),z=S&&v.length>0?v.length:j?1:0,J=i.find(Y=>Y.id==="cli")?.status??"idle",ie=g.useMemo(()=>S&&v.length>0?v.map(([Y,Me])=>({id:Y,kitName:Y,kit:Me})):j?[{id:j,kitName:j,kit:{version:k,installedAt:O}}]:[],[S,v,j,k,O]),le=g.useMemo(()=>{const Me=[...ie.map(Se=>({...Se,status:i.find(Ie=>Ie.id===Se.id)?.status??"idle"}))].sort((Se,Ie)=>{const ve=sp(Se.status)-sp(Ie.status);return ve!==0?ve:Se.kitName.localeCompare(Ie.kitName)});return m==="updates"?Me.filter(Se=>Se.status==="update-available"):m==="up-to-date"?Me.filter(Se=>Se.status==="up-to-date"):m==="cli"?[]:Me},[ie,i,m]),fe=m==="all"||m==="cli"||m==="updates"&&J==="update-available"||m==="up-to-date"&&J==="up-to-date",we=(fe?1:0)+le.length;g.useEffect(()=>{if(!(!(m==="updates"||m==="up-to-date")||x.current)&&!(o||l||i.length===0)){if(!i.every(Me=>Me.status==="idle")){x.current=!0;return}x.current=!0,R()}},[R,o,l,i,m]);const ke=g.useMemo(()=>we!==0?"":(m==="updates"||m==="up-to-date")&&de?e("checkingAll"):(m==="updates"||m==="up-to-date")&&q===0?e("runCheckAllForFilter"):m==="updates"&&q>0&&F===0?e("noUpdatesFound"):m==="up-to-date"&&q>0&&B===0?e("noUpToDateYet"):e("noComponentsMatchFilter"),[we,m,de,q,F,B,e]),Ae=!y&&m!=="cli",Qe=e("componentFilterUpdatesCount").replace("{count}",F.toString()),mt=e("componentFilterUpToDateCount").replace("{count}",B.toString());return h.jsxs("div",{className:"relative",children:[h.jsxs("div",{className:"pointer-events-none absolute inset-0 -z-10 overflow-hidden",children:[h.jsx("div",{className:"absolute -top-20 -right-8 h-56 w-56 rounded-full bg-dash-accent/10 blur-3xl"}),h.jsx("div",{className:"absolute -bottom-24 -left-10 h-64 w-64 rounded-full bg-dash-accent/5 blur-3xl"})]}),h.jsxs("div",{className:"space-y-4",children:[h.jsx("section",{className:"dash-panel dash-sticky-glass p-4 md:p-5 sticky top-0 z-10",children:h.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"mono text-[10px] uppercase tracking-[0.16em] text-dash-text-muted",children:e("systemControlTower")}),h.jsx("h2",{className:"text-xl md:text-2xl font-semibold text-dash-text",children:e("systemOverviewTitle")}),h.jsx("p",{className:"text-sm text-dash-text-secondary max-w-2xl",children:e("systemOverviewDesc")})]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h.jsx(IC,{value:f,onChange:D,disabled:o||l}),i.length>0&&h.jsx(LC,{components:i,isChecking:o,isUpdating:l,onCheckAll:R,onUpdateAll:L})]})]})}),h.jsxs("section",{className:"grid grid-cols-2 gap-3 xl:grid-cols-5",children:[h.jsx(fi,{label:e("components"),value:i.length.toString()}),h.jsx(fi,{label:e("kitsLabel"),value:z.toString()}),h.jsx(fi,{label:e("updateAvailable"),value:F.toString(),tone:"accent"}),h.jsx(fi,{label:e("upToDate"),value:B.toString(),tone:"success"}),h.jsx(fi,{label:e("checkedComponents"),value:q.toString()})]}),h.jsxs("section",{className:"grid gap-4 xl:grid-cols-[minmax(0,1fr)_320px]",children:[h.jsxs("div",{className:"space-y-3 min-w-0",children:[h.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 px-1",children:[h.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text",children:e("installedComponentsHeading")}),h.jsxs("fieldset",{className:"flex items-center gap-2",children:[h.jsx("legend",{className:"sr-only",children:e("installedComponentsHeading")}),h.jsx(pi,{label:e("componentFilterAll"),value:m,activeValue:"all",onClick:()=>N("all")}),h.jsx(pi,{label:Qe,value:m,activeValue:"updates",onClick:()=>N("updates")}),h.jsx(pi,{label:mt,value:m,activeValue:"up-to-date",onClick:()=>N("up-to-date")}),h.jsx(pi,{label:e("componentFilterCli"),value:m,activeValue:"cli",onClick:()=>N("cli")}),h.jsx(pi,{label:e("componentFilterKits"),value:m,activeValue:"kits",onClick:()=>N("kits")})]})]}),fe&&h.jsx(BC,{version:t?.cliVersion??"...",installedAt:void 0,externalStatus:i.find(Y=>Y.id==="cli")?.status,externalLatestVersion:i.find(Y=>Y.id==="cli")?.latestVersion??null,onStatusChange:(Y,Me)=>A("cli",Y,Me),disabled:o||l,channel:f}),le.map(Y=>{const Me=i.find(Se=>Se.id===Y.id);return h.jsx(UC,{kitName:Y.kitName,kit:Y.kit,externalStatus:Me?.status,externalLatestVersion:Me?.latestVersion??null,onStatusChange:(Se,Ie)=>A(Y.id,Se,Ie),disabled:o||l,channel:f},Y.id)}),Ae&&h.jsx("div",{className:"dash-panel-muted p-6 text-center opacity-80",children:h.jsx("p",{className:"text-sm text-dash-text-secondary",children:e("noKitInstalled")})}),!Ae&&we===0&&h.jsx("div",{className:"dash-panel-muted p-6 text-center opacity-80",children:h.jsx("p",{className:"text-sm text-dash-text-secondary",children:ke})})]}),h.jsxs("aside",{className:"space-y-3 xl:sticky xl:top-20 self-start",children:[h.jsxs("div",{className:"dash-panel p-4 space-y-3",children:[h.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text",children:e("updateReadiness")}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Lo,{label:e("updateAvailable"),value:F.toString(),tone:F>0?"accent":"default"}),h.jsx(Lo,{label:e("upToDate"),value:B.toString(),tone:"success"}),h.jsx(Lo,{label:e("checkedComponents"),value:q.toString()}),h.jsx(Lo,{label:e("activeChannel"),value:e(f==="beta"?"channelBeta":"channelStable")})]})]}),t&&h.jsx(VC,{configPath:t.configPath,nodeVersion:t.nodeVersion,bunVersion:t.bunVersion,os:t.os}),h.jsx(_C,{})]})]})]}),h.jsx(id,{isOpen:d,onClose:()=>u(!1),target:"cli",mode:"batch",components:i.filter(Y=>Y.status==="update-available").map(Y=>({id:Y.id,name:Y.id==="cli"?"CLI":`${Y.id} Kit`})),onComplete:W})]})},fi=({label:n,value:e,tone:t="default"})=>{const r=t==="accent"?"text-dash-accent":t==="success"?"text-emerald-500":"text-dash-text";return h.jsxs("div",{className:"dash-panel p-3",children:[h.jsx("p",{className:"text-[11px] uppercase tracking-wide text-dash-text-muted",children:n}),h.jsx("p",{className:`mt-1 mono text-xl font-semibold ${r}`,children:e})]})},Lo=({label:n,value:e,tone:t="default"})=>{const r=t==="accent"?"text-dash-accent":t==="success"?"text-emerald-500":"text-dash-text-secondary";return h.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-dash-border bg-dash-bg/70 px-3 py-2",children:[h.jsx("span",{className:"text-xs text-dash-text-muted",children:n}),h.jsx("span",{className:`mono text-xs font-semibold ${r}`,children:e})]})},pi=({label:n,value:e,activeValue:t,onClick:r})=>{const i=e===t;return h.jsx("button",{type:"button",onClick:r,"aria-pressed":i,className:`dash-focus-ring px-2.5 py-1.5 rounded-lg text-[11px] font-semibold border transition-colors ${i?"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:n})},Bl="~/.claude/settings.json",Io="{}",YC=()=>{const{t:n}=ce(),[e,t]=g.useState(!0),[r,i]=g.useState(Bl),[s,o]=g.useState(Io),[a,l]=g.useState(Io),[c,d]=g.useState(0),[u,f]=g.useState(!1),[p,m]=g.useState(!1),[b,x]=g.useState("idle"),[w,v]=g.useState(null),[S,j]=g.useState(null);g.useEffect(()=>{let A=!1;return(async()=>{t(!0),m(!1);try{const N=await Sv();if(A)return;const L=JSON.stringify(N.settings??{},null,2);i(N.path||Bl),f(!!N.exists),o(L),l(L),v(null)}catch{if(A)return;m(!0),f(!1),i(Bl),o(Io),l(Io)}finally{A||t(!1)}})(),()=>{A=!0}},[]);const k=A=>{l(A),j(null);try{JSON.parse(A),v(null)}catch(R){v(R instanceof Error?R.message:"Invalid JSON")}},O=()=>{l(s),v(null),j(null),x("idle")},y=async()=>{if(!(e||w)){x("saving"),j(null);try{const A=JSON.parse(a),R=JSON.stringify(A,null,2),N=await Cv(A);o(R),l(R),f(!0),x("saved"),j(N.backupPath?`${n("settingsBackupSaved")}: ${N.backupPath}`:n("saved")),setTimeout(()=>x("idle"),2e3)}catch(A){x("error"),j(A instanceof Error?A.message:n("saveFailed")),setTimeout(()=>x("idle"),3e3)}}},D=a!==s;return h.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:[h.jsxs("div",{className:"mb-2 flex items-end justify-between gap-3 px-1",children:[h.jsxs("div",{className:"min-w-0",children:[h.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text",children:n("settingsJsonHeading")}),h.jsx("p",{className:"mono text-[11px] text-dash-text-muted truncate",children:r})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("button",{type:"button",onClick:O,disabled:e||!D||b==="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:n("discard")}),h.jsx("button",{type:"button",onClick:y,disabled:e||b==="saving"||!!w||!D,className:`px-3 py-1.5 rounded-lg text-xs font-bold transition-all tracking-widest uppercase disabled:opacity-50 disabled:cursor-not-allowed ${b==="saved"?"bg-green-500 text-white shadow-lg shadow-green-500/20":b==="error"?"bg-red-500 text-white":"bg-dash-accent text-dash-bg hover:bg-dash-accent-hover shadow-lg shadow-dash-accent/20"}`,children:n(b==="saving"?"saving":b==="saved"?"saved":b==="error"?"saveFailed":"saveChanges")})]})]}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(rd,{width:100,isLoading:e,jsonText:a,cursorLine:c,syntaxError:w,onChange:k,onCursorLineChange:d})}),S&&h.jsx("p",{className:`mt-2 px-1 text-xs ${b==="error"?"text-red-500":"text-dash-text-muted"}`,children:S}),!e&&!p&&!u&&h.jsx("p",{className:"mt-2 px-1 text-xs text-dash-text-muted",children:n("settingsJsonMissing")}),!e&&p&&h.jsx("p",{className:"mt-2 px-1 text-xs text-red-500",children:n("settingsJsonLoadFailed")})]})},QC={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: 'auto' (always), 'prompt' (ask first), 'off' (skip). Questions focus on configured areas.",effectVi:"Chạy phỏng vấn xác thực dựa trên chế độ: 'auto' (luôn), 'prompt' (hỏi trước), 'off' (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:`{
71
71
  "codingLevel": 1
72
72
  }`},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:`{
73
73
  "privacyBlock": false
@@ -211,9 +211,11 @@ Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}
211
211
  }
212
212
  }`},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:`{
213
213
  "statusline": "compact"
214
+ }`},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:`{
215
+ "statuslineColors": false
214
216
  }`},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:`{
215
217
  "assertions": ["Use strict mode", "No console.logs"]
216
- }`}},qC=(n,e)=>{const[t,r]=g.useState(null);return g.useEffect(()=>{const i=n.split(`
217
- `),s=[];let o=null;for(let a=0;a<=Math.min(e,i.length-1);a++){const l=i[a].trim(),c=l.match(/"([^"]+)"\s*:\s*{/);if(c){s.push(c[1]),a===e&&(o=s.join("."));continue}if(l==="}"||l==="},"){s.pop();continue}const h=l.match(/"([^"]+)"\s*:/);if(h){const u=h[1];if(a===e){o=s.length>0?`${s.join(".")}.${u}`:u;break}}}r(o)},[n,e]),t};function Bb(n){const{scope:e,fetchConfig:t,fetchSchema:r,saveConfig:i,onReset:s}=n,[o,a]=g.useState("{}"),[l,c]=g.useState(0),[h,u]=g.useState(null),[f,p]=g.useState(null),[m,b]=g.useState({}),[y,v]=g.useState({}),[w,C]=g.useState({}),[j,k]=g.useState(!0),[O,x]=g.useState("idle"),[T,A]=g.useState(!1),[R,N]=g.useState(null),L=qC(o,l),W=L?GC[L]:null;g.useEffect(()=>{(async()=>{try{const[J,ie]=await Promise.all([t(),r()]),le=J.local??J.config;b(le),v(J.global??{}),C(J.sources),p(ie),a(JSON.stringify(le,null,2))}catch(J){console.error("Failed to load config data:",J)}finally{k(!1)}})()},[t,r]),g.useEffect(()=>{try{JSON.parse(o),u(null)}catch(z){u(z instanceof Error?z.message:"Invalid JSON")}},[o]),g.useEffect(()=>{if(R==="json")try{const z=JSON.parse(o);b(z)}catch{}},[o,R]);const F=g.useCallback(z=>{N("json"),a(z)},[]),B=g.useCallback((z,J)=>{N("form"),b(ie=>{const le=Ev(ie,z,J);return a(JSON.stringify(le,null,2)),le}),C(ie=>({...ie,[z]:e}))},[e]),q=g.useCallback(async()=>{if(!h){x("saving");try{const z=JSON.parse(o);await i(z),b(z),x("saved"),setTimeout(()=>x("idle"),2e3)}catch{x("error"),setTimeout(()=>x("idle"),3e3)}}},[o,h,i]),de=g.useCallback(async()=>{if(A(!1),s){k(!0);try{const z=await s(),J=z.local??z.config;b(J),C(z.sources),a(JSON.stringify(J,null,2))}catch(z){console.error("Failed to reset:",z)}finally{k(!1)}}else{const z={};b(z),a(JSON.stringify(z,null,2))}},[s]);return{jsonText:o,config:m,globalConfig:y,sources:w,schema:f,isLoading:j,saveStatus:O,syntaxError:h,cursorLine:l,showResetConfirm:T,activeFieldPath:L,fieldDoc:W,handleJsonChange:F,handleFormChange:B,handleSave:q,handleReset:de,setCursorLine:c,setShowResetConfirm:A}}function lh({storageKey:n,defaultSizes:e,minSizes:t}){const[r,i]=g.useState(()=>{if(typeof window>"u")return e;const c=localStorage.getItem(n);if(c)try{const h=JSON.parse(c);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}),[s,o]=g.useState(!1);g.useEffect(()=>{localStorage.setItem(n,JSON.stringify(r))},[r,n]);const a=g.useCallback((c,h)=>{h.preventDefault(),o(!0);const u=h.target.parentElement;if(!u)return;const p=u.getBoundingClientRect().width,m=h.clientX,b=[...r],y=w=>{const j=(w.clientX-m)/p*100,k=[...b],O=c,x=c+1;let T=b[O]+j,A=b[x]-j;T<t[O]&&(T=t[O],A=b[O]+b[x]-T),A<t[x]&&(A=t[x],T=b[O]+b[x]-A),k[O]=T,k[x]=A,i(k)},v=()=>{o(!1),document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",v),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",y),document.addEventListener("mouseup",v),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[r,t]),l=g.useCallback(()=>{i(e)},[e]);return{sizes:r,isDragging:s,startDrag:a,reset:l}}const qa="/api";async function ip(n){const e=`${qa}/ck-config`,t=await fetch(e);if(!t.ok)throw new Error(`Failed to fetch ck-config: ${t.status}`);return t.json()}async function sp(n,e){const t=new URLSearchParams({scope:n});e&&t.set("projectId",e);const r=await fetch(`${qa}/ck-config?${t}`);if(!r.ok)throw new Error(`Failed to fetch ck-config: ${r.status}`);return r.json()}async function Fb(n){const e=await fetch(`${qa}/ck-config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok){const t=await e.json().catch(()=>({error:"Unknown error"}));throw new Error(t.error||`Failed to save ck-config: ${e.status}`)}return e.json()}async function Vb(){const n=await fetch(`${qa}/ck-config/schema`);if(!n.ok)throw new Error(`Failed to fetch schema: ${n.status}`);return n.json()}const JC=()=>{const{t:n}=he(),e=an(),[t,r]=g.useState("config"),[i,s]=g.useState({}),{sizes:o,isDragging:a,startDrag:l}=lh({storageKey:"claudekit-global-config-panels",defaultSizes:[35,40,25],minSizes:[20,25,15]}),{sizes:c,isDragging:h,startDrag:u}=lh({storageKey:"claudekit-global-system-panels",defaultSizes:[70,30],minSizes:[45,20]}),f=g.useCallback(async()=>{const[w,C]=await Promise.all([ip(),Ov()]);return s(C),w},[]),p=g.useCallback(async w=>{await Fb({scope:"global",config:w})},[]),m=g.useCallback(async()=>await ip(),[]),b=Bb({scope:"global",fetchConfig:f,fetchSchema:Vb,saveConfig:p,onReset:m}),y=g.useMemo(()=>[{id:"general",title:n("sectionGeneral"),fields:[{path:"codingLevel",label:n("fieldCodingLevel"),description:n("fieldCodingLevelDesc")},{path:"statusline",label:n("fieldStatusline"),description:n("fieldStatuslineDesc")},{path:"locale.thinkingLanguage",label:n("fieldThinkingLanguage"),description:n("fieldThinkingLanguageDesc")},{path:"locale.responseLanguage",label:n("fieldResponseLanguage"),description:n("fieldResponseLanguageDesc")}]},{id:"paths",title:n("sectionPaths"),fields:[{path:"paths.docs",label:n("fieldDocsPath"),description:n("fieldDocsPathDesc")},{path:"paths.plans",label:n("fieldPlansPath"),description:n("fieldPlansPathDesc")}]},{id:"privacy",title:n("sectionPrivacy"),defaultCollapsed:!0,fields:[{path:"privacyBlock",label:n("fieldPrivacyBlock"),description:n("fieldPrivacyBlockDesc")},{path:"trust.enabled",label:n("fieldTrustEnabled"),description:n("fieldTrustEnabledDesc")},{path:"trust.passphrase",label:n("fieldTrustPassphrase"),description:n("fieldTrustPassphraseDesc")}]},{id:"project",title:n("sectionProject"),defaultCollapsed:!0,fields:[{path:"project.type",label:n("fieldProjectType"),description:n("fieldProjectTypeDesc")},{path:"project.packageManager",label:n("fieldPackageManager"),description:n("fieldPackageManagerDesc")},{path:"project.framework",label:n("fieldFramework"),description:n("fieldFrameworkDesc")}]},{id:"integrations",title:n("sectionIntegrations"),defaultCollapsed:!0,fields:[{path:"gemini.model",label:n("fieldGeminiModel"),description:n("fieldGeminiModelDesc")},{path:"skills.research.useGemini",label:n("fieldResearchUseGemini"),description:n("fieldResearchUseGeminiDesc")}]},{id:"hooks",title:n("sectionHooks"),defaultCollapsed:!0,fields:[{path:"hooks.session-init",label:n("fieldHookSessionInit"),description:n("fieldHookSessionInitDesc")},{path:"hooks.subagent-init",label:n("fieldHookSubagentInit"),description:n("fieldHookSubagentInitDesc")},{path:"hooks.descriptive-name",label:n("fieldHookDescriptiveName"),description:n("fieldHookDescriptiveNameDesc")},{path:"hooks.dev-rules-reminder",label:n("fieldHookDevRulesReminder"),description:n("fieldHookDevRulesReminderDesc")},{path:"hooks.usage-context-awareness",label:n("fieldHookUsageContextAwareness"),description:n("fieldHookUsageContextAwarenessDesc")},{path:"hooks.context-tracking",label:n("fieldHookContextTracking"),description:n("fieldHookContextTrackingDesc")},{path:"hooks.scout-block",label:n("fieldHookScoutBlock"),description:n("fieldHookScoutBlockDesc")},{path:"hooks.privacy-block",label:n("fieldHookPrivacyBlock"),description:n("fieldHookPrivacyBlockDesc")},{path:"hooks.post-edit-simplify-reminder",label:n("fieldHookPostEditSimplify"),description:n("fieldHookPostEditSimplifyDesc")}]},{id:"advanced",title:n("sectionAdvanced"),defaultCollapsed:!0,fields:[{path:"docs.maxLoc",label:n("fieldDocsMaxLoc"),description:n("fieldDocsMaxLocDesc")},{path:"plan.namingFormat",label:n("fieldPlanNamingFormat"),description:n("fieldPlanNamingFormatDesc")},{path:"plan.dateFormat",label:n("fieldPlanDateFormat"),description:n("fieldPlanDateFormatDesc")},{path:"plan.validation.mode",label:n("fieldPlanValidationMode"),description:n("fieldPlanValidationModeDesc")},{path:"plan.validation.minQuestions",label:n("fieldPlanMinQuestions"),description:n("fieldPlanMinQuestionsDesc")},{path:"plan.validation.maxQuestions",label:n("fieldPlanMaxQuestions"),description:n("fieldPlanMaxQuestionsDesc")},{path:"assertions",label:n("fieldAssertions"),description:n("fieldAssertionsDesc")}]}],[n]),v=b.showResetConfirm?d.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:[d.jsx("span",{className:"text-xs text-red-500 font-medium",children:n("confirmReset")}),d.jsx("button",{type:"button",onClick:b.handleReset,className:"px-2 py-0.5 rounded bg-red-500 text-white text-xs font-bold hover:bg-red-600 transition-colors",children:n("confirm")}),d.jsx("button",{type:"button",onClick:()=>b.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:n("cancel")})]}):d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",onClick:()=>b.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:n("resetToDefault")}),d.jsx("button",{type:"button",onClick:b.handleSave,disabled:!!b.syntaxError||b.saveStatus==="saving",className:`px-3 py-1.5 rounded-lg text-xs font-bold transition-all tracking-widest uppercase ${b.syntaxError?"bg-dash-surface text-dash-text-muted cursor-not-allowed border border-dash-border":b.saveStatus==="saved"?"bg-green-500 text-white shadow-lg shadow-green-500/20":b.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:b.saveStatus==="saving"?n("saving"):b.saveStatus==="saved"?n("saved"):b.saveStatus==="error"?n("saveFailed"):n("saveChanges")})]});return d.jsxs("div",{className:"animate-in fade-in duration-300 w-full h-full flex flex-col transition-colors",children:[d.jsx(Fm,{title:n("globalConfig"),filePath:"~/.claude/.ck.json",onBack:()=>e(-1),onSave:b.handleSave,onReset:b.handleReset,saveStatus:b.saveStatus,syntaxError:b.syntaxError,showResetConfirm:b.showResetConfirm,setShowResetConfirm:b.setShowResetConfirm,showActions:!1,showFilePath:!1}),d.jsxs("div",{className:"mb-3 shrink-0 flex items-center justify-between gap-3",children:[d.jsxs("div",{role:"tablist","aria-label":n("globalConfig"),className:"inline-flex items-center rounded-xl border border-dash-border bg-dash-surface p-1 shadow-sm",children:[d.jsx("button",{role:"tab","aria-selected":t==="config",onClick:()=>r("config"),className:`dash-focus-ring px-4 py-2 rounded-lg text-sm font-semibold transition-colors ${t==="config"?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-muted hover:text-dash-text hover:bg-dash-surface-hover"}`,children:n("configTab")}),d.jsx("button",{role:"tab","aria-selected":t==="metadata",onClick:()=>r("metadata"),className:`dash-focus-ring px-4 py-2 rounded-lg text-sm font-semibold transition-colors ${t==="metadata"?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-muted hover:text-dash-text hover:bg-dash-surface-hover"}`,children:n("systemTab")})]}),d.jsx("p",{className:"hidden lg:block text-xs text-dash-text-muted",children:n("configWorkspaceHint")})]}),d.jsxs("div",{className:"flex-1 flex min-h-0",children:[t==="config"&&d.jsxs(d.Fragment,{children:[d.jsx(Vm,{width:o[0],isLoading:b.isLoading,schema:b.schema,config:b.config,sources:b.sources,sections:y,onChange:b.handleFormChange}),d.jsx(Pr,{direction:"horizontal",isDragging:a,onMouseDown:w=>l(0,w)}),d.jsx(nd,{width:o[1],isLoading:b.isLoading,jsonText:b.jsonText,cursorLine:b.cursorLine,syntaxError:b.syntaxError,onChange:b.handleJsonChange,onCursorLineChange:b.setCursorLine,headerPath:"~/.claude/.ck.json",headerActions:v}),d.jsx(Pr,{direction:"horizontal",isDragging:a,onMouseDown:w=>l(1,w)}),d.jsx(Lb,{width:o[2],fieldDoc:b.fieldDoc,activeFieldPath:b.activeFieldPath})]}),t==="metadata"&&d.jsxs("div",{className:"flex-1 min-h-0 flex",children:[d.jsx("div",{style:{width:`${c[0]}%`},className:"min-w-0 h-full overflow-auto pr-1",children:b.isLoading?d.jsx("div",{className:"dash-panel h-full flex items-center justify-center",children:d.jsx("div",{className:"animate-pulse text-dash-text-muted text-sm",children:n("loading")})}):d.jsx(UC,{metadata:i})}),d.jsx(Pr,{direction:"horizontal",isDragging:h,onMouseDown:w=>u(0,w)}),d.jsx("div",{style:{width:`${c[1]}%`},className:"min-w-0 h-full overflow-hidden",children:d.jsx(KC,{})})]})]})]})};function YC({phase:n}){const e=n.status==="completed"?"border-green-500":n.status==="in-progress"?"border-blue-500":"border-amber-400";return d.jsx("div",{className:`rounded border-l-4 ${e} bg-white dark:bg-gray-800 p-3 shadow-sm`,children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-xs font-mono text-gray-400 dark:text-gray-500",children:n.phaseId}),d.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:n.name})]})})}function Fl({title:n,phases:e,borderColor:t}){return d.jsxs("div",{className:"flex flex-1 flex-col gap-3 min-w-0","aria-label":`${n} phases`,children:[d.jsxs("div",{className:`rounded-t border-t-2 ${t} bg-gray-50 dark:bg-gray-900 px-3 py-2`,children:[d.jsx("span",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:n}),d.jsx("span",{className:"ml-2 text-xs text-gray-400",children:e.length})]}),d.jsx("div",{className:"flex flex-col gap-2 px-1",children:e.map((r,i)=>d.jsx(YC,{phase:r},`${r.phaseId}-${i}`))})]})}function QC({completed:n,total:e}){const{t}=he(),r=e===0?0:Math.round(n/e*100);return d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsxs("div",{className:"flex justify-between text-xs text-gray-500 dark:text-gray-400",children:[d.jsx("span",{children:t("kanbanProgress")}),d.jsxs("span",{children:[n,"/",e," ",t("kanbanPhases")," — ",r,"% ",t("kanbanComplete")]})]}),d.jsx("div",{className:"h-2 w-full rounded bg-gray-200 dark:bg-gray-700",children:d.jsx("div",{className:"h-2 rounded bg-green-500 transition-all",style:{width:`${r}%`}})})]})}function XC(){const{t:n}=he(),[e]=iv(),t=e.get("file")??"",[r,i]=g.useState([]),[s,o]=g.useState(!1),[a,l]=g.useState(null);if(g.useEffect(()=>{t&&(o(!0),l(null),i([]),fetch(`/api/plan/parse?file=${encodeURIComponent(t)}`).then(p=>{if(!p.ok){const m={400:"kanbanError400",403:"kanbanError403",404:"kanbanError404"};throw new Error(m[p.status]??`error:HTTP:${p.status}`)}return p.json()}).then(p=>i(p.phases)).catch(p=>l(p instanceof Error?p.message:String(p))).finally(()=>o(!1)))},[t]),!t)return d.jsx("div",{className:"flex h-full items-center justify-center text-gray-400 dark:text-gray-500",children:n("kanbanNoFile")});let c=[],h=[],u=[],f=null;try{c=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?d.jsx("div",{className:"flex h-full items-center justify-center text-red-500 dark:text-red-400",children:n("kanbanLoadError")}):d.jsxs("div",{className:"flex h-full flex-col gap-4 p-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-white",children:n("kanbanTitle")}),d.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 truncate max-w-xs",title:t,children:t.replaceAll("\\","/")})]}),r.length>0&&d.jsx(QC,{completed:u.length,total:r.length}),s&&d.jsx("div",{className:"flex flex-1 items-center justify-center text-gray-400",children:n("loading")}),a&&d.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:[n("error"),":"," ",a in{kanbanError400:"",kanbanError403:"",kanbanError404:""}?n(a):a]}),!s&&!a&&r.length===0&&d.jsx("div",{className:"flex flex-1 items-center justify-center text-gray-400 dark:text-gray-500",children:n("kanbanNoPhases")}),!s&&!a&&r.length>0&&d.jsxs("section",{"aria-label":n("kanbanTitle"),className:"flex flex-1 flex-col gap-4 overflow-auto md:flex-row",children:[d.jsx(Fl,{title:n("kanbanStatus_pending"),phases:c,borderColor:"border-amber-400"}),d.jsx(Fl,{title:n("kanbanStatus_in-progress"),phases:h,borderColor:"border-blue-500"}),d.jsx(Fl,{title:n("kanbanStatus_completed"),phases:u,borderColor:"border-green-500"})]})]})}const op=[{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"}],ZC=new Set([8203,8204,8205,8288,65279,8232,8233,8234,8235,8236,8237,8238,8294,8295,8296,8297]);function ej(n){return n===9||n===10||n===13?!0:n>=0&&n<=8||n>=11&&n<=31||n>=127&&n<=159||ZC.has(n)}function Xn(n){let e="";for(const t of n){const r=t.codePointAt(0);r!==void 0&&(ej(r)||(e+=t))}return e}function ap(n){if(!n)return"-";const e=n.replace(/\\/g,"/"),t=e.match(/.*\/(\.[^/]+\/)/);if(t?.[1]){const i=(t.index??0)+t[0].length-t[1].length;return e.slice(i)}const r=e.split("/");return r.length>3?`.../${r.slice(-3).join("/")}`:e}function jr(n){return n.success?n.skipped?"skipped":"installed":"failed"}function tj(n){const e={installed:0,skipped:0,failed:0};for(const t of n){const r=jr(t);r==="installed"?e.installed+=1:r==="skipped"?e.skipped+=1:e.failed+=1}return e}function zb(n){switch(n){case"agent":case"command":case"skill":case"config":case"rules":case"hooks":case"unknown":return n;default:return"unknown"}}function nj(n,e){switch(n){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 rj(n){const e=new Map;for(const t of n){const r=zb(t.portableType),i=e.get(r)||[];i.push(t),e.set(r,i)}return e}function ij(n){return[zb(n.portableType),n.provider,n.providerDisplayName,n.itemName,n.path,n.success,n.skipped,n.overwritten,n.error,n.skipReason].map(t=>t===void 0?"":String(t)).join("|")}function sj(n){if(n.length===0)return!0;const e=n[0].provider;return n.every(t=>t.provider===e)}const Lr=({label:n,count:e,className:t})=>e<=0?null:d.jsxs("span",{className:`inline-flex items-center gap-1 rounded-md border px-2.5 py-1 text-xs ${t}`,children:[d.jsx("span",{className:"font-semibold",children:e}),d.jsx("span",{children:n})]}),lp=({labelKey:n,badgeClass:e,items:t,isExpanded:r,onToggle:i,singleProvider:s})=>{const{t:o}=he(),a=t.filter(f=>jr(f)==="installed").length,l=t.filter(f=>jr(f)==="skipped").length,c=t.filter(f=>jr(f)==="failed").length,h=s?"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 d.jsxs("div",{className:"rounded-xl border border-dash-border bg-dash-surface overflow-hidden",children:[d.jsxs("button",{type:"button",onClick:i,className:"w-full flex flex-wrap items-center gap-2 px-4 py-3 text-left hover:bg-dash-surface-hover transition-colors",children:[d.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:d.jsx("path",{d:"M9 5l7 7-7 7"})}),d.jsx("p",{className:"text-sm font-semibold text-dash-text",children:o(n)}),d.jsx("span",{className:`inline-flex items-center rounded-full border px-2 py-0.5 text-[11px] font-semibold ${e}`,children:t.length}),d.jsx("span",{className:"hidden sm:block flex-1"}),d.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[11px]",children:[d.jsx(Lr,{label:o("migrateStatusInstalled"),count:a,className:"border-green-500/30 bg-green-500/10 text-green-400"}),d.jsx(Lr,{label:o("migrateStatusSkipped"),count:l,className:"border-yellow-500/30 bg-yellow-500/10 text-yellow-400"}),d.jsx(Lr,{label:o("migrateStatusFailed"),count:c,className:"border-red-500/30 bg-red-500/10 text-red-400"})]})]}),r&&d.jsxs("div",{className:"border-t border-dash-border/80",children:[d.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:[d.jsx("p",{children:o("migrateItem")}),!s&&d.jsx("p",{children:o("migrateProvider")}),d.jsx("p",{children:o("migratePath")}),d.jsx("p",{children:o("migrateStatus")}),d.jsx("p",{children:o("migrateError")})]}),d.jsx("div",{className:"divide-y divide-dash-border/70",children:t.map(f=>{const p=ij(f),m=u.get(p)??0;u.set(p,m+1);const b=m===0?p:`${p}#${m}`,y=jr(f),v=nj(y,o),w=Xn(f.itemName||ap(f.path)),C=Xn(f.providerDisplayName||f.provider||""),j=Xn(f.path||""),k=Xn(ap(f.path)),O=Xn(f.error||f.skipReason||"");return d.jsxs("div",{className:`grid gap-1.5 ${h} items-start px-4 py-2.5 hover:bg-dash-bg/60 transition-colors`,children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("p",{className:"text-xs font-semibold text-dash-text truncate",title:w,children:w}),d.jsxs("div",{className:"mt-0.5 space-y-0.5 md:hidden",children:[!s&&d.jsx("p",{className:"text-[11px] text-dash-text-secondary truncate",children:C}),d.jsx("p",{className:"font-mono text-[11px] text-dash-text-muted truncate",title:j,children:k}),O&&d.jsx("p",{className:"text-[11px] text-red-400/80 line-clamp-2",title:O,children:O})]})]}),!s&&d.jsx("p",{className:"hidden md:block text-[11px] text-dash-text-secondary truncate",children:C}),d.jsx("p",{className:"hidden md:block font-mono text-[11px] text-dash-text-muted truncate",title:j,children:k}),d.jsx("span",{className:`inline-flex w-fit items-center rounded-full border px-2 py-0.5 text-[11px] font-medium ${v.className}`,children:v.label}),d.jsx("p",{className:`hidden md:block text-[11px] truncate ${O?"text-red-400/80":"text-dash-text-muted"}`,title:O,children:O||"-"})]},b)})})]})]})},oj=({results:n,onReset:e})=>{const{t}=he(),[r,i]=g.useState(""),s=g.useDeferredValue(r),[o,a]=g.useState("all"),[l,c]=g.useState(()=>new Set(op.map(j=>j.key))),h=g.useMemo(()=>{const j=s.trim().toLowerCase();return n.results.filter(k=>{if(o!=="all"&&jr(k)!==o)return!1;if(!j)return!0;const O=(k.itemName||"").toLowerCase(),x=(k.path||"").toLowerCase(),T=(k.providerDisplayName||k.provider||"").toLowerCase();return O.includes(j)||x.includes(j)||T.includes(j)})},[n.results,s,o]),u=g.useMemo(()=>sj(h),[h]),f=g.useMemo(()=>{if(!u||h.length===0)return"";const j=Array.from(new Set(h.map(k=>k.providerDisplayName?.trim()||"").filter(k=>k.length>0)));return j.length===1?j[0]:h[0]?.provider||""},[h,u]),p=g.useMemo(()=>rj(h),[h]),m=g.useMemo(()=>tj(n.results),[n.results]),b=g.useMemo(()=>[...p.keys()],[p]),y=m.installed+m.skipped+m.failed,v=b.length>0&&b.every(j=>l.has(j)),w=j=>{c(k=>{const O=new Set(k);return O.has(j)?O.delete(j):O.add(j),O})},C=()=>{if(v){c(new Set);return}c(new Set(b))};return d.jsxs("div",{className:"dash-panel p-4 md:p-5 space-y-4",children:[d.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-start md:justify-between",children:[d.jsxs("div",{children:[d.jsxs("h2",{className:"text-base font-semibold text-dash-text",children:[t("migrateSummaryTitle"),u&&f&&d.jsxs("span",{className:"text-dash-text-muted font-normal",children:[" ","· ",Xn(f)]})]}),d.jsxs("p",{className:"text-xs text-dash-text-muted mt-1",children:[y," ",t("migrateSummarySubtitle")]})]}),d.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:t("migrateSummaryNewMigration")})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[d.jsx(Lr,{label:t("migrateStatusInstalled"),count:m.installed,className:"border-green-500/30 bg-green-500/10 text-green-400"}),d.jsx(Lr,{label:t("migrateStatusSkipped"),count:m.skipped,className:"border-yellow-500/30 bg-yellow-500/10 text-yellow-400"}),d.jsx(Lr,{label:t("migrateStatusFailed"),count:m.failed,className:"border-red-500/30 bg-red-500/10 text-red-400"})]}),n.warnings.length>0&&d.jsx("div",{className:"space-y-2",children:n.warnings.map((j,k)=>d.jsx("div",{className:"px-3 py-2 border border-yellow-500/30 bg-yellow-500/10 rounded-md text-xs text-yellow-400",children:Xn(j)},k))}),d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsxs("div",{className:"relative",children:[d.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:[d.jsx("circle",{cx:"11",cy:"11",r:"8"}),d.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),d.jsx("input",{type:"text",value:r,onChange:j=>i(j.target.value),placeholder:t("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"})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[["all","installed","skipped","failed"].map(j=>{const k=j==="all"?"migrateSummaryFilterAll":j==="installed"?"migrateStatusInstalled":j==="skipped"?"migrateStatusSkipped":"migrateStatusFailed";return d.jsx("button",{type:"button",onClick:()=>a(j),className:`dash-focus-ring px-3 py-1 text-xs font-medium rounded-full border transition-colors ${o===j?"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:t(k)},j)}),d.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:t(v?"migrateSummaryCollapseAll":"migrateSummaryExpandAll")})]})]}),h.length===0?d.jsx("div",{className:"text-center py-8 text-sm text-dash-text-muted",children:t("migrateSummaryNoResults")}):d.jsxs("div",{className:"space-y-2.5",children:[op.map(j=>{const k=p.get(j.key);return!k||k.length===0?null:d.jsx(lp,{labelKey:j.labelKey,badgeClass:j.badgeClass,items:k,isExpanded:l.has(j.key),onToggle:()=>w(j.key),singleProvider:u},j.key)}),(()=>{const j=p.get("unknown");return!j||j.length===0?null:d.jsx(lp,{labelKey:"migrateTypeUnknown",badgeClass:"border-dash-border text-dash-text-muted",items:j,isExpanded:l.has("unknown"),onToggle:()=>w("unknown"),singleProvider:u})})()]})]})},aj=500;function lj(n){return n>=0&&n<=8||n>=11&&n<=31||n>=127&&n<=159}function cj(n){let e="";for(const t of n){const r=t.codePointAt(0);r!==void 0&&(lj(r)||(e+=t))}return e}const hj=({diff:n,className:e=""})=>{const t=n.split(`
218
- `),r=t.slice(0,aj),i=t.length-r.length;return d.jsxs("pre",{className:`text-xs font-mono overflow-x-auto p-3 rounded bg-dash-bg border border-dash-border ${e}`,children:[r.map((s,o)=>{const a=cj(s);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"),d.jsx("div",{className:l,children:a},`${o}:${a.slice(0,24)}`)}),i>0&&d.jsxs("div",{className:"text-dash-text-muted",children:["... truncated ",i," additional line(s)"]})]})};function dj(n){return n>=0&&n<=8||n>=11&&n<=31||n>=127&&n<=159}function mi(n){let e="";for(const t of n){const r=t.codePointAt(0);r!==void 0&&(dj(r)||(e+=t))}return e}const uj=({action:n,resolution:e,onResolve:t})=>{const{t:r}=he(),[i,s]=g.useState(!1),o=n.ownedSections&&n.ownedSections.length>0;return d.jsxs("div",{className:"border border-dash-border rounded-lg p-4 mb-3 bg-dash-surface",children:[d.jsxs("div",{className:"flex justify-between items-start gap-4",children:[d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"font-mono text-sm text-dash-text truncate",children:[mi(n.provider),"/",mi(n.type),"/",mi(n.item)]}),d.jsx("p",{className:"text-xs text-dash-text-muted mt-1",children:mi(n.reason)}),n.targetPath&&d.jsx("p",{className:"text-xs text-dash-text-secondary mt-1 font-mono truncate",children:mi(n.targetPath)})]}),d.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[d.jsx("button",{type:"button",onClick:()=>t({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")}),d.jsx("button",{type:"button",onClick:()=>t({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&&d.jsx("button",{type:"button",onClick:()=>t({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")}),n.diff&&d.jsx("button",{type:"button",onClick:()=>s(!i),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(i?"migrateConflictHideDiff":"migrateConflictShowDiff")})]})]}),i&&n.diff&&d.jsx(hj,{diff:n.diff,className:"mt-3"}),e&&d.jsxs("div",{className:"mt-2 text-xs text-green-400 flex items-center gap-1.5",children:[d.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 20 20",children:d.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"})}),d.jsxs("span",{children:[r("migrateConflictResolved"),": ",fj(e.type,r)]})]})]})};function fj(n,e){switch(n){case"overwrite":return e("migrateConflictUseCK");case"keep":return e("migrateConflictKeepMine");case"smart-merge":return e("migrateConflictSmartMerge");case"resolved":return e("migrateConflictManual");default:return String(n)}}const pj=[{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"}],cp=["agent","command","skill","config","rules","hooks"],mj={agent:"migrateTypeAgents",command:"migrateTypeCommands",skill:"migrateTypeSkills",config:"migrateTypeConfig",rules:"migrateTypeRules",hooks:"migrateTypeHooks"},gj={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"},mr=200;function bj(n){return n>=0&&n<=8||n>=11&&n<=31||n>=127&&n<=159}function $o(n){let e="";for(const t of n){const r=t.codePointAt(0);r!==void 0&&(bj(r)||(e+=t))}return e}function yj(n){const e={install:[],update:[],skip:[],conflict:[],delete:[]};for(const t of n)e[t.action].push(t);return e}function xj(n){const e=new Map;for(const t of n){const r=e.get(t.type)||[];r.push(t),e.set(t.type,r)}return e}const vj=({plan:n,resolutions:e,onResolve:t,actionKey:r})=>{const{t:i}=he(),s=g.useMemo(()=>yj(n.actions),[n.actions]),o=g.useMemo(()=>pj.filter(f=>s[f.key].length>0),[s]),[a,l]=g.useState(()=>s.conflict.length>0?"conflict":s.install.length>0?"install":o[0]?.key??"install");g.useEffect(()=>{s[a]?.length===0&&o.length>0&&l(o[0].key)},[s,a,o]);const c=g.useMemo(()=>s[a]??[],[s,a]),h=g.useMemo(()=>xj(c),[c]),u=f=>{for(const p of s.conflict)t(p,{type:f})};return d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[n.summary.install>0&&d.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-green-500/10 border border-green-500/30 text-green-400",children:[n.summary.install," ",i("migrateActionInstall")]}),n.summary.update>0&&d.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-yellow-500/10 border border-yellow-500/30 text-yellow-400",children:[n.summary.update," ",i("migrateActionUpdate")]}),n.summary.skip>0&&d.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-dash-bg border border-dash-border text-dash-text-muted",children:[n.summary.skip," ",i("migrateActionSkip")]}),n.summary.conflict>0&&d.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-red-500/10 border border-red-500/30 text-red-400",children:[n.summary.conflict," ",i("migrateActionConflict")]}),n.summary.delete>0&&d.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-dash-bg border border-dash-border text-dash-text-secondary",children:[n.summary.delete," ",i("migrateActionDelete")]})]}),o.length>1&&d.jsx("div",{className:"flex gap-1 border-b border-dash-border",children:o.map(f=>{const p=a===f.key;return d.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:[i(f.labelKey)," ",d.jsx("span",{className:`ml-1 px-1.5 py-0.5 rounded text-[10px] border ${f.badgeClass}`,children:s[f.key].length})]},f.key)})}),a==="conflict"&&s.conflict.length>0&&d.jsxs("div",{className:"flex items-center justify-between gap-3",children:[d.jsxs("h3",{className:"text-sm font-semibold text-red-400",children:[i("migrateConflictSectionTitle")," (",s.conflict.length,")"]}),d.jsxs("div",{className:"flex gap-2",children:[d.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:i("migrateConflictOverwriteAll")}),d.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:i("migrateConflictKeepAll")})]})]}),a==="conflict"?cp.map(f=>{const p=h.get(f);return!p||p.length===0?null:d.jsxs(hp,{type:f,count:p.length,children:[p.slice(0,mr).map(m=>d.jsx(uj,{action:m,resolution:e.get(r(m))||null,onResolve:b=>t(m,b)},r(m))),p.length>mr&&d.jsxs("div",{className:"text-xs text-dash-text-muted",children:["... ",p.length-mr," more"]})]},`${a}:${f}`)}):cp.map(f=>{const p=h.get(f);return!p||p.length===0?null:d.jsxs(hp,{type:f,count:p.length,defaultExpanded:a!=="skip",children:[p.slice(0,mr).map(m=>d.jsx(wj,{action:m},`${m.provider}:${m.type}:${m.item}:${m.global}:${m.action}`)),p.length>mr&&d.jsxs("div",{className:"text-xs text-dash-text-muted",children:["... ",p.length-mr," more"]})]},`${a}:${f}`)})]})},hp=({type:n,count:e,defaultExpanded:t=!0,children:r})=>{const{t:i}=he(),[s,o]=g.useState(t),a=gj[n],l=i(mj[n]);return d.jsxs("div",{className:"border border-dash-border rounded-lg bg-dash-surface",children:[d.jsxs("button",{type:"button","aria-expanded":s,onClick:()=>o(!s),className:"w-full px-4 py-2.5 flex items-center justify-between text-left hover:bg-dash-surface-hover transition-colors",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("h4",{className:"text-sm font-semibold text-dash-text",children:l}),d.jsx("span",{className:`px-2 py-0.5 text-xs rounded-md border ${a}`,children:e})]}),d.jsx("svg",{"aria-hidden":"true",className:`w-4 h-4 text-dash-text-muted transition-transform ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),s&&d.jsx("div",{className:"px-4 pt-1 pb-4 space-y-2",children:r})]})},wj=({action:n})=>d.jsxs("div",{className:"px-3 py-2 bg-dash-bg rounded-md border border-dash-border",children:[d.jsxs("div",{className:"font-mono text-xs text-dash-text",children:[$o(n.provider),"/",$o(n.item)]}),d.jsx("div",{className:"text-xs text-dash-text-muted mt-1",children:$o(n.reason)}),n.targetPath&&d.jsx("div",{className:"text-xs text-dash-text-secondary mt-0.5 font-mono truncate",children:$o(n.targetPath)})]});var kj=function(e){return typeof window<"u"?matchMedia&&matchMedia("(prefers-color-scheme: ".concat(e,")")):{matches:!1}},Vl,Sj=g.createContext({appearance:"light",setAppearance:function(){},isDarkMode:!1,themeMode:"light",setThemeMode:function(){},browserPrefers:(Vl=kj("dark"))!==null&&Vl!==void 0&&Vl.matches?"dark":"light"}),Cj=function(){return g.useContext(Sj)};const _b=(n,e)=>{if(e)return"row";switch(n){case"horizontal":return"row";case"horizontal-reverse":return"row-reverse";case"vertical":default:return"column";case"vertical-reverse":return"column-reverse"}},jj=n=>{if(n)return["space-between","space-around","space-evenly"].includes(n)},Oj=(n,e)=>_b(n,e)==="row",gr=n=>typeof n=="number"?`${n}px`:n,Pj=({visible:n,flex:e,gap:t,direction:r,horizontal:i,align:s,justify:o,distribution:a,height:l,width:c,padding:h,paddingInline:u,paddingBlock:f,prefixCls:p,as:m="div",className:b,style:y,children:v,wrap:w,ref:C,...j})=>{const k=o||a,x=Oj(r,i)&&!c&&jj(k)?"100%":gr(c),T={...e!==void 0?{"--lobe-flex":String(e)}:{},...r||i?{"--lobe-flex-direction":_b(r,i)}:{},...w!==void 0?{"--lobe-flex-wrap":w}:{},...k!==void 0?{"--lobe-flex-justify":k}:{},...s!==void 0?{"--lobe-flex-align":s}:{},...x!==void 0?{"--lobe-flex-width":x}:{},...l!==void 0?{"--lobe-flex-height":gr(l)}:{},...h!==void 0?{"--lobe-flex-padding":gr(h)}:{},...u!==void 0?{"--lobe-flex-padding-inline":gr(u)}:{},...f!==void 0?{"--lobe-flex-padding-block":gr(f)}:{},...t!==void 0?{"--lobe-flex-gap":gr(t)}:{},...y},A="lobe-flex",R=[A,n===!1?`${A}--hidden`:void 0,p?`${p}-flex`:void 0,b].filter(Boolean).join(" ");return d.jsx(m,{ref:C,...j,className:R,style:T,children:v})};var Hb=g.memo(Pj);const Nj=({children:n,ref:e,...t})=>d.jsx(Hb,{...t,align:"center",justify:"center",ref:e,children:n});var Aj=Nj;const Mj=/\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;function Tj(n){return Array.from(n.match(Mj)??[])}function Dj(n){return Tj(n).map(t=>t.toLowerCase()).join("-")}g.createContext(null);var Ej=function(e,t){if(t){if(e&&t==="#000")return"0 0 0 1px rgba(255,255,255,0.1) inset";if(!e&&t==="#fff")return"0 0 0 1px rgba(0,0,0,0.05) inset"}};function es(n){"@babel/helpers - typeof";return es=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},es(n)}var Rj=["shape","color","background","size","style","iconMultiple","Icon","iconStyle","iconClassName"];function dp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Bo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?dp(Object(t),!0).forEach(function(r){Lj(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):dp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Lj(n,e,t){return e=Ij(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ij(n){var e=$j(n,"string");return es(e)=="symbol"?e:String(e)}function $j(n,e){if(es(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(es(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Bj(n,e){if(n==null)return{};var t=Fj(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function Fj(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var _n=g.memo(function(n){var e=n.shape,t=e===void 0?"circle":e,r=n.color,i=r===void 0?"#fff":r,s=n.background,o=n.size,a=n.style,l=n.iconMultiple,c=l===void 0?.75:l,h=n.Icon,u=n.iconStyle,f=n.iconClassName,p=Bj(n,Rj),m=Cj(),b=m.isDarkMode;return d.jsx(Aj,Bo(Bo({flex:"none",style:Bo({background:s,borderRadius:t==="circle"?"50%":Math.floor(o*.1),boxShadow:Ej(b,s),color:i,height:o,width:o},a)},p),{},{children:h&&d.jsx(h,{className:f,color:i,size:o,style:Bo({transform:"scale(".concat(c,")")},u)})}))});function ts(n){"@babel/helpers - typeof";return ts=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},ts(n)}var Vj=["Icon","style","Text","color","size","spaceMultiple","textMultiple","extra","extraStyle","showText","showLogo","extraClassName","iconProps","inverse"];function up(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function kn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?up(Object(t),!0).forEach(function(r){zj(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):up(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function zj(n,e,t){return e=_j(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _j(n){var e=Hj(n,"string");return ts(e)=="symbol"?e:String(e)}function Hj(n,e){if(ts(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ts(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Wj(n,e){if(n==null)return{};var t=Uj(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function Uj(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var Hn=g.memo(function(n){var e=n.Icon,t=n.style,r=n.Text,i=n.color,s=n.size,o=s===void 0?24:s,a=n.spaceMultiple,l=a===void 0?1:a,c=n.textMultiple,h=c===void 0?1:c,u=n.extra,f=n.extraStyle,p=n.showText,m=p===void 0?!0:p,b=n.showLogo,y=b===void 0?!0:b,v=n.extraClassName,w=n.iconProps,C=n.inverse,j=Wj(n,Vj),k=e&&y&&d.jsx(e,kn(kn({size:o},w),{},{style:kn(C?{marginLeft:o*l}:{marginRight:o*l},w?.style)})),O=m&&r&&d.jsx(r,{size:o*h});return d.jsxs(Hb,kn(kn({align:"center",flex:"none",horizontal:!0,justify:"flex-start",style:kn({color:i},t)},j),{},{children:[C?d.jsxs(d.Fragment,{children:[O,k]}):d.jsxs(d.Fragment,{children:[k,O]}),u&&d.jsx("span",{className:v,style:kn({fontSize:o*h*.95,lineHeight:1},f),children:u})]}))}),Kj=function(e,t){return g.useMemo(function(){var r=Array.from({length:t},function(i,s){var o="lobe-icons-".concat(Dj(e),"-fill-").concat(s);return{fill:"url(#".concat(o,")"),id:o}});return r},[e,t])},Jr="Claude",Gj=.8,qj=.1,Wb="#D97757",Jj=Wb,Yj="#fff",Qj=.75;function ns(n){"@babel/helpers - typeof";return ns=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},ns(n)}var Xj=["size","style"];function fp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function zl(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fp(Object(t),!0).forEach(function(r){Zj(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):fp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Zj(n,e,t){return e=e6(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function e6(n){var e=t6(n,"string");return ns(e)=="symbol"?e:String(e)}function t6(n,e){if(ns(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ns(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function n6(n,e){if(n==null)return{};var t=r6(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function r6(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var id=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=n6(n,Xj);return d.jsxs("svg",zl(zl({fill:"currentColor",fillRule:"evenodd",height:t,style:zl({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:t,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Jr}),d.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 rs(n){"@babel/helpers - typeof";return rs=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},rs(n)}function pp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function i6(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?pp(Object(t),!0).forEach(function(r){s6(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):pp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function s6(n,e,t){return e=o6(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function o6(n){var e=a6(n,"string");return rs(e)=="symbol"?e:String(e)}function a6(n,e){if(rs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(rs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function l6(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var c6=g.memo(function(n){var e=Object.assign({},(l6(n),n));return d.jsx(_n,i6({Icon:id,"aria-label":Jr,background:Jj,color:Yj,iconMultiple:Qj},e))});function is(n){"@babel/helpers - typeof";return is=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},is(n)}var h6=["size","style"];function mp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function _l(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?mp(Object(t),!0).forEach(function(r){d6(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):mp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function d6(n,e,t){return e=u6(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function u6(n){var e=f6(n,"string");return is(e)=="symbol"?e:String(e)}function f6(n,e){if(is(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(is(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function p6(n,e){if(n==null)return{};var t=m6(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function m6(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var Ub=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=p6(n,h6);return d.jsxs("svg",_l(_l({height:t,style:_l({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:t,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Jr}),d.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 ss(n){"@babel/helpers - typeof";return ss=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},ss(n)}var g6=["size","style"];function gp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Hl(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?gp(Object(t),!0).forEach(function(r){b6(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):gp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function b6(n,e,t){return e=y6(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function y6(n){var e=x6(n,"string");return ss(e)=="symbol"?e:String(e)}function x6(n,e){if(ss(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ss(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function v6(n,e){if(n==null)return{};var t=w6(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function w6(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var Kb=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=v6(n,g6);return d.jsxs("svg",Hl(Hl({fill:"currentColor",fillRule:"nonzero",height:t,style:Hl({flex:"none",lineHeight:1},r),viewBox:"0 0 97 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Jr}),d.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 os(n){"@babel/helpers - typeof";return os=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},os(n)}var k6=["type"];function bp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function S6(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bp(Object(t),!0).forEach(function(r){C6(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):bp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function C6(n,e,t){return e=j6(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function j6(n){var e=O6(n,"string");return os(e)=="symbol"?e:String(e)}function O6(n,e){if(os(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(os(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function P6(n,e){if(n==null)return{};var t=N6(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function N6(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var A6=g.memo(function(n){var e=n.type,t=e===void 0?"mono":e,r=P6(n,k6),i=t==="color"?Ub:id;return d.jsx(Hn,S6({Icon:i,Text:Kb,"aria-label":Jr,spaceMultiple:qj,textMultiple:Gj},r))}),ur=id;ur.Color=Ub;ur.Text=Kb;ur.Combine=A6;ur.Avatar=c6;ur.colorPrimary=Wb;ur.title=Jr;var Gs="OpenAI",M6=.75,T6=.1,Gb="#000",qb="#19C37D",Jb="#AB68FF",Yb="#F86AA4",sd="#F9C322",Qb="#0099FF",Xb="#0000FE",D6=Gb,E6="#fff",R6=.75;function as(n){"@babel/helpers - typeof";return as=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},as(n)}var L6=["size","style"];function yp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Wl(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?yp(Object(t),!0).forEach(function(r){I6(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):yp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function I6(n,e,t){return e=$6(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $6(n){var e=B6(n,"string");return as(e)=="symbol"?e:String(e)}function B6(n,e){if(as(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(as(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function F6(n,e){if(n==null)return{};var t=V6(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function V6(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var od=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=F6(n,L6);return d.jsxs("svg",Wl(Wl({fill:"currentColor",fillRule:"evenodd",height:t,style:Wl({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:t,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Gs}),d.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"})]}))}),cr="Gemini",z6=.8,_6=.2,Zb="#fff",H6=Zb,W6="#fff",U6=.8;function ls(n){"@babel/helpers - typeof";return ls=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},ls(n)}var K6=["size","style"];function xp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ul(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xp(Object(t),!0).forEach(function(r){G6(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):xp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function G6(n,e,t){return e=q6(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function q6(n){var e=J6(n,"string");return ls(e)=="symbol"?e:String(e)}function J6(n,e){if(ls(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ls(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Y6(n,e){return eO(n)||Z6(n,e)||X6(n,e)||Q6()}function Q6(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
219
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function X6(n,e){if(n){if(typeof n=="string")return vp(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return vp(n,e)}}function vp(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function Z6(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(n)).next,e!==0)for(;!(l=(r=s.call(t)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(h){c=!0,i=h}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function eO(n){if(Array.isArray(n))return n}function tO(n,e){if(n==null)return{};var t=nO(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function nO(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var ad=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=tO(n,K6),s=Kj(cr,3),o=Y6(s,3),a=o[0],l=o[1],c=o[2];return d.jsxs("svg",Ul(Ul({height:t,style:Ul({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:t,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:cr}),d.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"}),d.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}),d.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}),d.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:c.fill}),d.jsxs("defs",{children:[d.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:a.id,x1:"7",x2:"11",y1:"15.5",y2:"12",children:[d.jsx("stop",{stopColor:"#08B962"}),d.jsx("stop",{offset:"1",stopColor:"#08B962",stopOpacity:"0"})]}),d.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:l.id,x1:"8",x2:"11.5",y1:"5.5",y2:"11",children:[d.jsx("stop",{stopColor:"#F94543"}),d.jsx("stop",{offset:"1",stopColor:"#F94543",stopOpacity:"0"})]}),d.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:c.id,x1:"3.5",x2:"17.5",y1:"13.5",y2:"12",children:[d.jsx("stop",{stopColor:"#FABC12"}),d.jsx("stop",{offset:".46",stopColor:"#FABC12",stopOpacity:"0"})]})]})]}))});function cs(n){"@babel/helpers - typeof";return cs=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},cs(n)}function wp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function rO(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wp(Object(t),!0).forEach(function(r){iO(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):wp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function iO(n,e,t){return e=sO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sO(n){var e=oO(n,"string");return cs(e)=="symbol"?e:String(e)}function oO(n,e){if(cs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(cs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function aO(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var lO=g.memo(function(n){var e=Object.assign({},(aO(n),n));return d.jsx(_n,rO({Icon:ad,"aria-label":cr,background:H6,color:W6,iconMultiple:U6},e))});function hs(n){"@babel/helpers - typeof";return hs=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},hs(n)}var cO=["size","style"];function kp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Kl(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?kp(Object(t),!0).forEach(function(r){hO(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):kp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function hO(n,e,t){return e=dO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function dO(n){var e=uO(n,"string");return hs(e)=="symbol"?e:String(e)}function uO(n,e){if(hs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(hs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function fO(n,e){if(n==null)return{};var t=pO(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function pO(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var ey=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=fO(n,cO);return d.jsxs("svg",Kl(Kl({fill:"currentColor",fillRule:"evenodd",height:t,style:Kl({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:t,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:cr}),d.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 ds(n){"@babel/helpers - typeof";return ds=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},ds(n)}var mO=["size","style"];function Sp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Gl(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Sp(Object(t),!0).forEach(function(r){gO(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Sp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function gO(n,e,t){return e=bO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bO(n){var e=yO(n,"string");return ds(e)=="symbol"?e:String(e)}function yO(n,e){if(ds(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ds(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function xO(n,e){if(n==null)return{};var t=vO(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function vO(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var ty=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=xO(n,mO);return d.jsxs("svg",Gl(Gl({fill:"currentColor",fillRule:"evenodd",height:t,style:Gl({flex:"none",lineHeight:1},r),viewBox:"0 0 98 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:cr}),d.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 us(n){"@babel/helpers - typeof";return us=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},us(n)}var wO=["type"];function Cp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function kO(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Cp(Object(t),!0).forEach(function(r){SO(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Cp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function SO(n,e,t){return e=CO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function CO(n){var e=jO(n,"string");return us(e)=="symbol"?e:String(e)}function jO(n,e){if(us(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(us(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function OO(n,e){if(n==null)return{};var t=PO(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function PO(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var NO=g.memo(function(n){var e=n.type,t=e===void 0?"mono":e,r=OO(n,wO),i=t==="color"?ad:ey;return d.jsx(Hn,kO({Icon:i,Text:ty,"aria-label":cr,spaceMultiple:_6,textMultiple:z6},r))}),fr=ey;fr.Color=ad;fr.Text=ty;fr.Combine=NO;fr.Avatar=lO;fr.colorPrimary=Zb;fr.title=cr;function fs(n){"@babel/helpers - typeof";return fs=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},fs(n)}var AO=["type"];function jp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function MO(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?jp(Object(t),!0).forEach(function(r){TO(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):jp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function TO(n,e,t){return e=DO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function DO(n){var e=EO(n,"string");return fs(e)=="symbol"?e:String(e)}function EO(n,e){if(fs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(fs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function RO(n,e){if(n==null)return{};var t=LO(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function LO(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var IO=g.memo(function(n){var e=n.type,t=e===void 0?"normal":e,r=RO(n,AO),i=g.useMemo(function(){switch(t){case"gpt3":return qb;case"gpt4":return Jb;case"gpt5":return Yb;case"o3":case"o1":return sd;case"oss":return Qb;case"platform":return Xb;default:return D6}},[t]);return d.jsx(_n,MO({Icon:od,"aria-label":Gs,background:i,color:E6,iconMultiple:R6},r))});function ps(n){"@babel/helpers - typeof";return ps=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},ps(n)}var $O=["size","style"];function Op(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ql(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Op(Object(t),!0).forEach(function(r){BO(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Op(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function BO(n,e,t){return e=FO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function FO(n){var e=VO(n,"string");return ps(e)=="symbol"?e:String(e)}function VO(n,e){if(ps(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ps(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function zO(n,e){if(n==null)return{};var t=_O(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function _O(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var ny=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=zO(n,$O);return d.jsxs("svg",ql(ql({fill:"currentColor",fillRule:"evenodd",height:t,style:ql({flex:"none",lineHeight:1},r),viewBox:"0 0 84 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Gs}),d.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 ms(n){"@babel/helpers - typeof";return ms=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},ms(n)}var HO=["extraStyle"];function Pp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Np(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Pp(Object(t),!0).forEach(function(r){WO(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Pp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function WO(n,e,t){return e=UO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function UO(n){var e=KO(n,"string");return ms(e)=="symbol"?e:String(e)}function KO(n,e){if(ms(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ms(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function GO(n,e){if(n==null)return{};var t=qO(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function qO(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var JO=g.memo(function(n){var e=n.extraStyle,t=GO(n,HO);return d.jsx(Hn,Np({Icon:od,Text:ny,"aria-label":Gs,extraStyle:Np({fontWeight:600},e),spaceMultiple:T6,textMultiple:M6},t))}),St=od;St.Text=ny;St.Combine=JO;St.Avatar=IO;St.colorPrimary=Gb;St.colorGpt3=qb;St.colorGpt4=Jb;St.colorGpt5=Yb;St.colorO1=sd;St.colorO3=sd;St.colorOss=Qb;St.colorPlatform=Xb;St.title=Gs;var qs="GithubCopilot",YO=.75,QO=.3,ry="#000",XO=ry,ZO="#fff",eP=.75;function gs(n){"@babel/helpers - typeof";return gs=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},gs(n)}var tP=["size","style"];function Ap(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Jl(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ap(Object(t),!0).forEach(function(r){nP(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ap(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function nP(n,e,t){return e=rP(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function rP(n){var e=iP(n,"string");return gs(e)=="symbol"?e:String(e)}function iP(n,e){if(gs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(gs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function sP(n,e){if(n==null)return{};var t=oP(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function oP(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var ld=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=sP(n,tP);return d.jsxs("svg",Jl(Jl({fill:"currentColor",fillRule:"evenodd",height:t,style:Jl({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:t,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:qs}),d.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 bs(n){"@babel/helpers - typeof";return bs=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},bs(n)}function Mp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function aP(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Mp(Object(t),!0).forEach(function(r){lP(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Mp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function lP(n,e,t){return e=cP(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cP(n){var e=hP(n,"string");return bs(e)=="symbol"?e:String(e)}function hP(n,e){if(bs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(bs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function dP(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var uP=g.memo(function(n){var e=Object.assign({},(dP(n),n));return d.jsx(_n,aP({Icon:ld,"aria-label":qs,background:XO,color:ZO,iconMultiple:eP},e))});function ys(n){"@babel/helpers - typeof";return ys=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},ys(n)}var fP=["size","style"];function Tp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Yl(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Tp(Object(t),!0).forEach(function(r){pP(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Tp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function pP(n,e,t){return e=mP(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mP(n){var e=gP(n,"string");return ys(e)=="symbol"?e:String(e)}function gP(n,e){if(ys(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ys(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function bP(n,e){if(n==null)return{};var t=yP(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function yP(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var iy=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=bP(n,fP);return d.jsxs("svg",Yl(Yl({fill:"currentColor",fillRule:"evenodd",height:t,style:Yl({flex:"none",lineHeight:1},r),viewBox:"0 0 154 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:qs}),d.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 xs(n){"@babel/helpers - typeof";return xs=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},xs(n)}function Dp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function xP(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Dp(Object(t),!0).forEach(function(r){vP(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Dp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function vP(n,e,t){return e=wP(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wP(n){var e=kP(n,"string");return xs(e)=="symbol"?e:String(e)}function kP(n,e){if(xs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(xs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function SP(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var CP=g.memo(function(n){var e=Object.assign({},(SP(n),n));return d.jsx(Hn,xP({Icon:ld,Text:iy,"aria-label":qs,spaceMultiple:QO,textMultiple:YO},e))}),Yr=ld;Yr.Text=iy;Yr.Combine=CP;Yr.Avatar=uP;Yr.colorPrimary=ry;Yr.title=qs;var Js="Cline",jP=.7,OP=.2,sy="#323B43",PP=sy,NP="#fff",AP=.6;function vs(n){"@babel/helpers - typeof";return vs=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},vs(n)}var MP=["size","style"];function Ep(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ql(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ep(Object(t),!0).forEach(function(r){TP(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ep(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function TP(n,e,t){return e=DP(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function DP(n){var e=EP(n,"string");return vs(e)=="symbol"?e:String(e)}function EP(n,e){if(vs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(vs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function RP(n,e){if(n==null)return{};var t=LP(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function LP(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var cd=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=RP(n,MP);return d.jsxs("svg",Ql(Ql({fill:"currentColor",fillRule:"evenodd",height:t,style:Ql({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:t,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Js}),d.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"}),d.jsx("path",{d:"M12.054 5.558a2.779 2.779 0 100-5.558 2.779 2.779 0 000 5.558z"})]}))});function ws(n){"@babel/helpers - typeof";return ws=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},ws(n)}function Rp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function IP(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Rp(Object(t),!0).forEach(function(r){$P(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Rp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function $P(n,e,t){return e=BP(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function BP(n){var e=FP(n,"string");return ws(e)=="symbol"?e:String(e)}function FP(n,e){if(ws(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ws(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function VP(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var zP=g.memo(function(n){var e=Object.assign({},(VP(n),n));return d.jsx(_n,IP({Icon:cd,"aria-label":Js,background:PP,color:NP,iconMultiple:AP},e))});function ks(n){"@babel/helpers - typeof";return ks=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},ks(n)}var _P=["size","style"];function Lp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Xl(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Lp(Object(t),!0).forEach(function(r){HP(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Lp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function HP(n,e,t){return e=WP(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function WP(n){var e=UP(n,"string");return ks(e)=="symbol"?e:String(e)}function UP(n,e){if(ks(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ks(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function KP(n,e){if(n==null)return{};var t=GP(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function GP(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var oy=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=KP(n,_P);return d.jsxs("svg",Xl(Xl({fill:"currentColor",fillRule:"evenodd",height:t,style:Xl({flex:"none",lineHeight:1},r),viewBox:"0 0 88 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Js}),d.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 Ss(n){"@babel/helpers - typeof";return Ss=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},Ss(n)}function Ip(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function qP(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ip(Object(t),!0).forEach(function(r){JP(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ip(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function JP(n,e,t){return e=YP(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function YP(n){var e=QP(n,"string");return Ss(e)=="symbol"?e:String(e)}function QP(n,e){if(Ss(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Ss(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function XP(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var ZP=g.memo(function(n){var e=Object.assign({},(XP(n),n));return d.jsx(Hn,qP({Icon:cd,Text:oy,"aria-label":Js,iconProps:{shape:"square"},spaceMultiple:OP,textMultiple:jP},e))}),Qr=cd;Qr.Text=oy;Qr.Combine=ZP;Qr.Avatar=zP;Qr.colorPrimary=sy;Qr.title=Js;var Ys="Cursor",e7=.7,t7=.1,ay="#000",n7=ay,r7="#fff",i7=.6;function Cs(n){"@babel/helpers - typeof";return Cs=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},Cs(n)}var s7=["size","style"];function $p(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Zl(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?$p(Object(t),!0).forEach(function(r){o7(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):$p(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function o7(n,e,t){return e=a7(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function a7(n){var e=l7(n,"string");return Cs(e)=="symbol"?e:String(e)}function l7(n,e){if(Cs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Cs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function c7(n,e){if(n==null)return{};var t=h7(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function h7(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var hd=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=c7(n,s7);return d.jsxs("svg",Zl(Zl({fill:"currentColor",fillRule:"evenodd",height:t,style:Zl({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:t,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Ys}),d.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 js(n){"@babel/helpers - typeof";return js=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},js(n)}function Bp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function d7(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Bp(Object(t),!0).forEach(function(r){u7(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Bp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function u7(n,e,t){return e=f7(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function f7(n){var e=p7(n,"string");return js(e)=="symbol"?e:String(e)}function p7(n,e){if(js(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(js(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function m7(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var g7=g.memo(function(n){var e=Object.assign({},(m7(n),n));return d.jsx(_n,d7({Icon:hd,"aria-label":Ys,background:n7,color:r7,iconMultiple:i7},e))});function Os(n){"@babel/helpers - typeof";return Os=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},Os(n)}var b7=["size","style"];function Fp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ec(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fp(Object(t),!0).forEach(function(r){y7(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Fp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function y7(n,e,t){return e=x7(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function x7(n){var e=v7(n,"string");return Os(e)=="symbol"?e:String(e)}function v7(n,e){if(Os(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Os(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function w7(n,e){if(n==null)return{};var t=k7(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function k7(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var ly=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=w7(n,b7);return d.jsxs("svg",ec(ec({fill:"currentColor",fillRule:"evenodd",height:t,style:ec({flex:"none",lineHeight:1},r),viewBox:"0 0 123 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Ys}),d.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 Ps(n){"@babel/helpers - typeof";return Ps=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},Ps(n)}function Vp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function S7(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Vp(Object(t),!0).forEach(function(r){C7(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Vp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function C7(n,e,t){return e=j7(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function j7(n){var e=O7(n,"string");return Ps(e)=="symbol"?e:String(e)}function O7(n,e){if(Ps(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Ps(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function P7(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var N7=g.memo(function(n){var e=Object.assign({},(P7(n),n));return d.jsx(Hn,S7({Icon:hd,Text:ly,"aria-label":Ys,spaceMultiple:t7,textMultiple:e7},e))}),Xr=hd;Xr.Text=ly;Xr.Combine=N7;Xr.Avatar=g7;Xr.colorPrimary=ay;Xr.title=Ys;var Qs="Goose",A7=.7,M7=.2,cy="#fff",T7=cy,D7="#000",E7=.65;function Ns(n){"@babel/helpers - typeof";return Ns=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},Ns(n)}var R7=["size","style"];function zp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function tc(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?zp(Object(t),!0).forEach(function(r){L7(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):zp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function L7(n,e,t){return e=I7(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function I7(n){var e=$7(n,"string");return Ns(e)=="symbol"?e:String(e)}function $7(n,e){if(Ns(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Ns(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function B7(n,e){if(n==null)return{};var t=F7(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function F7(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var dd=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=B7(n,R7);return d.jsxs("svg",tc(tc({fill:"currentColor",fillRule:"evenodd",height:t,style:tc({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:t,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Qs}),d.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 As(n){"@babel/helpers - typeof";return As=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},As(n)}function _p(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function V7(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_p(Object(t),!0).forEach(function(r){z7(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):_p(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function z7(n,e,t){return e=_7(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _7(n){var e=H7(n,"string");return As(e)=="symbol"?e:String(e)}function H7(n,e){if(As(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(As(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function W7(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var U7=g.memo(function(n){var e=Object.assign({},(W7(n),n));return d.jsx(_n,V7({Icon:dd,"aria-label":Qs,background:T7,color:D7,iconMultiple:E7},e))});function Ms(n){"@babel/helpers - typeof";return Ms=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},Ms(n)}var K7=["size","style"];function Hp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function nc(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Hp(Object(t),!0).forEach(function(r){G7(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Hp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function G7(n,e,t){return e=q7(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function q7(n){var e=J7(n,"string");return Ms(e)=="symbol"?e:String(e)}function J7(n,e){if(Ms(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Ms(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Y7(n,e){if(n==null)return{};var t=Q7(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function Q7(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var hy=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=Y7(n,K7);return d.jsxs("svg",nc(nc({fill:"currentColor",fillRule:"evenodd",height:t,style:nc({flex:"none",lineHeight:1},r),viewBox:"0 0 87 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Qs}),d.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 Ts(n){"@babel/helpers - typeof";return Ts=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},Ts(n)}function Wp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function X7(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Wp(Object(t),!0).forEach(function(r){Z7(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Wp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Z7(n,e,t){return e=e8(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function e8(n){var e=t8(n,"string");return Ts(e)=="symbol"?e:String(e)}function t8(n,e){if(Ts(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Ts(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function n8(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var r8=g.memo(function(n){var e=Object.assign({},(n8(n),n));return d.jsx(Hn,X7({Icon:dd,Text:hy,"aria-label":Qs,iconProps:{shape:"square"},spaceMultiple:M7,textMultiple:A7},e))}),Zr=dd;Zr.Text=hy;Zr.Combine=r8;Zr.Avatar=U7;Zr.colorPrimary=cy;Zr.title=Qs;var Xs="Windsurf",i8=.7,s8=.2,dy="#fff",o8=dy,a8="#000",l8=.75;function Ds(n){"@babel/helpers - typeof";return Ds=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},Ds(n)}var c8=["size","style"];function Up(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function rc(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Up(Object(t),!0).forEach(function(r){h8(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Up(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function h8(n,e,t){return e=d8(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function d8(n){var e=u8(n,"string");return Ds(e)=="symbol"?e:String(e)}function u8(n,e){if(Ds(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Ds(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function f8(n,e){if(n==null)return{};var t=p8(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function p8(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var ud=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=f8(n,c8);return d.jsxs("svg",rc(rc({fill:"currentColor",fillRule:"evenodd",height:t,style:rc({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:t,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Xs}),d.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 Es(n){"@babel/helpers - typeof";return Es=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},Es(n)}function Kp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function m8(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Kp(Object(t),!0).forEach(function(r){g8(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Kp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function g8(n,e,t){return e=b8(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function b8(n){var e=y8(n,"string");return Es(e)=="symbol"?e:String(e)}function y8(n,e){if(Es(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Es(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function x8(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var v8=g.memo(function(n){var e=Object.assign({},(x8(n),n));return d.jsx(_n,m8({Icon:ud,"aria-label":Xs,background:o8,color:a8,iconMultiple:l8},e))});function Rs(n){"@babel/helpers - typeof";return Rs=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},Rs(n)}var w8=["size","style"];function Gp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ic(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Gp(Object(t),!0).forEach(function(r){k8(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Gp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function k8(n,e,t){return e=S8(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function S8(n){var e=C8(n,"string");return Rs(e)=="symbol"?e:String(e)}function C8(n,e){if(Rs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Rs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function j8(n,e){if(n==null)return{};var t=O8(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function O8(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var uy=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=j8(n,w8);return d.jsxs("svg",ic(ic({fill:"currentColor",fillRule:"evenodd",height:t,style:ic({flex:"none",lineHeight:1},r),viewBox:"0 0 111 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Xs}),d.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 Ls(n){"@babel/helpers - typeof";return Ls=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},Ls(n)}function qp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function P8(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qp(Object(t),!0).forEach(function(r){N8(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):qp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function N8(n,e,t){return e=A8(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function A8(n){var e=M8(n,"string");return Ls(e)=="symbol"?e:String(e)}function M8(n,e){if(Ls(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Ls(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function T8(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var D8=g.memo(function(n){var e=Object.assign({},(T8(n),n));return d.jsx(Hn,P8({Icon:ud,Text:uy,"aria-label":Xs,iconProps:{shape:"square"},spaceMultiple:s8,textMultiple:i8},e))}),ei=ud;ei.Text=uy;ei.Combine=D8;ei.Avatar=v8;ei.colorPrimary=dy;ei.title=Xs;const E8={"claude-code":ur.Avatar,cursor:Xr.Avatar,codex:St.Avatar,"gemini-cli":fr.Avatar,goose:Zr.Avatar,"github-copilot":Yr.Avatar,windsurf:ei.Avatar,cline:Qr.Avatar},R8={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 L8(n){return n.split(/\s+/).map(e=>e[0]).join("").toUpperCase().slice(0,2)}const fy=({agentName:n,displayName:e,size:t=20})=>{const r=E8[n];if(r)return d.jsx(r,{size:t});const i=R8[n];return i?d.jsx("img",{src:i,alt:e,className:"rounded object-contain",style:{width:t,height:t}}):d.jsx("div",{className:"flex items-center justify-center rounded bg-dash-surface-hover text-dash-text-muted font-semibold",style:{width:t,height:t,fontSize:t*.45},children:L8(e)})};function sc(n){return JSON.stringify([n.provider,n.type,n.item,n.global])}function I8(n){if(typeof n=="string"){const e=n.trim();return e.length>0?e:null}if(typeof n=="object"&&n!==null){const e=n;for(const t of["message","error","detail","details","reason"]){const r=e[t];if(typeof r=="string"&&r.trim().length>0)return r.trim()}}return null}async function Jp(n,e){const r=(await n.text().catch(()=>"")).trim();if(!r)return e;try{const i=JSON.parse(r);return I8(i)||e}catch{return r}}function $8(){const[n,e]=g.useState("idle"),[t,r]=g.useState(null),[i,s]=g.useState(new Map),[o,a]=g.useState(null),[l,c]=g.useState(null),h=g.useRef(0),u=g.useRef(0),f=g.useRef(null),p=g.useRef(null),m=g.useCallback(async C=>{e("reconciling"),c(null),a(null),h.current+=1;const j=h.current;f.current?.abort();const k=new AbortController;f.current=k;try{const O=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&&O.set("source",C.source);const x=await fetch(`/api/migrate/reconcile?${O.toString()}`,{signal:k.signal});if(!x.ok){const A=await Jp(x,"Failed to reconcile migration plan");throw new Error(A)}const T=await x.json();if(j!==h.current)return;r(T.plan),s(new Map),e("reviewing")}catch(O){if(k.signal.aborted||O instanceof DOMException&&O.name==="AbortError"||j!==h.current)return;c(O instanceof Error?O.message:"Failed to reconcile"),e("error")}},[]),b=g.useCallback((C,j)=>{s(k=>{const O=new Map(k);return O.set(sc(C),j),O})},[]),y=g.useCallback(async()=>{if(!t)return c("No plan to execute"),e("error"),!1;e("executing"),c(null),u.current+=1;const C=u.current;p.current?.abort();const j=new AbortController;p.current=j;try{const k=Object.fromEntries(i.entries()),O=await fetch("/api/migrate/execute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:t,resolutions:k}),signal:j.signal});if(C!==u.current)return!1;if(!O.ok){const T=await Jp(O,"Failed to execute migration");if(O.status===501)return c(T||"Plan execution is not available in this server build"),e("reviewing"),!1;throw new Error(T)}const x=await O.json();return C!==u.current?!1:(a({results:x.results,counts:x.counts,warnings:x.warnings??[],discovery:x.discovery}),e("complete"),!0)}catch(k){return j.signal.aborted||k instanceof DOMException&&k.name==="AbortError"||C!==u.current||(c(k instanceof Error?k.message:"Failed to execute migration"),e("error")),!1}},[t,i]),v=g.useCallback(()=>{f.current?.abort(),p.current?.abort(),e("idle"),r(null),s(new Map),a(null),c(null)},[]),w=g.useMemo(()=>t?t.actions.filter(C=>C.action==="conflict").every(C=>i.has(sc(C))):!0,[t,i]);return{phase:n,plan:t,resolutions:i,results:o,error:l,reconcile:m,resolve:b,execute:y,reset:v,allConflictsResolved:w,actionKey:sc}}const B8={agents:!0,commands:!0,skills:!0,config:!0,rules:!0,hooks:!0},Pt=["agents","commands","skills","config","rules","hooks"],Zn={agents:"migrateTypeAgents",commands:"migrateTypeCommands",skills:"migrateTypeSkills",config:"migrateTypeConfig",rules:"migrateTypeRules",hooks:"migrateTypeHooks"},Yp={detected:"#D4A574","not-detected":"#8B9DC3"},lt=({label:n,value:e,tone:t="default"})=>{const r=t==="accent"?"text-dash-accent":t==="success"?"text-green-400":"text-dash-text";return d.jsxs("div",{className:"rounded-lg border border-dash-border bg-dash-bg/70 px-3 py-2.5",children:[d.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-dash-text-muted",children:n}),d.jsx("p",{className:`mt-1 text-lg font-semibold ${r}`,children:e})]})};function Qp(n,e){return n.success?n.skipped?{label:e("migrateStatusSkipped"),className:"text-yellow-400"}:{label:e("migrateStatusInstalled"),className:"text-green-400"}:{label:e("migrateStatusFailed"),className:"text-red-400"}}const F8=new Set([8203,8204,8205,8288,65279,8232,8233,8234,8235,8236,8237,8238,8294,8295,8296,8297]);function V8(n){return n===9||n===10||n===13?!0:n>=0&&n<=8||n>=11&&n<=31||n>=127&&n<=159||F8.has(n)}function Xp(n){let e="";for(const t of n){const r=t.codePointAt(0);r!==void 0&&(V8(r)||(e+=t))}return e}const z8=({provider:n,include:e,isSelected:t,cardClickToggles:r,onToggleSelect:i,onOpenDetails:s,t:o})=>{const a=Pt.filter(c=>n.capabilities[c]).length,l=Pt.some(c=>e[c]&&!n.capabilities[c]);return d.jsxs("div",{className:`relative rounded-xl border px-4 py-3 cursor-pointer transition-all ${t?"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:[d.jsx("button",{type:"button",onClick:()=>r?i(n.name):s(n.name),"aria-label":r?`${n.displayName} deselect`:`${n.displayName} details`,className:"absolute inset-0 z-10 rounded-xl dash-focus-ring"}),d.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:[d.jsxs("div",{className:"min-w-0 space-y-1.5",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx(fy,{agentName:n.name,displayName:n.displayName,size:18}),d.jsx("span",{className:"text-sm font-semibold text-dash-text truncate",children:n.displayName}),n.recommended&&d.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")}),n.commandsGlobalOnly&&d.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")})]}),d.jsxs("div",{className:"text-xs text-dash-text-muted truncate",children:[n.name," · ",a,"/",Pt.length," ",o("migrateCapabilitiesLabel")]})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[11px] lg:flex-col lg:items-start lg:gap-1",children:[d.jsx("span",{className:n.detected?"text-dash-accent":"text-dash-text-muted",children:n.detected?o("migrateDetectedTag"):o("migrateNotDetectedTag")}),d.jsx("span",{className:"text-dash-text-muted",children:n.recommended?o("migrateFilterRecommended"):"-"})]}),d.jsx("div",{className:"flex flex-wrap gap-1",children:Pt.map(c=>{const h=n.capabilities[c],u=e[c];return d.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(Zn[c])},c)})}),d.jsx("div",{className:"relative z-20 flex justify-start lg:justify-end",children:d.jsx("button",{type:"button",onClick:c=>{c.stopPropagation(),i(n.name)},className:`dash-focus-ring px-4 py-1.5 text-xs font-semibold rounded-md transition-colors ${t?"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(t?"migrateSelectedButton":"migrateSelectButton")})})]})]})},_8=({provider:n,include:e,isSelected:t,latestResult:r,onToggleSelect:i,onClose:s,t:o})=>{const a=g.useRef(null),l=g.useRef(null),c=g.useCallback(()=>{const f=l.current;l.current=null,f&&document.contains(f)&&f.focus()},[]),h=g.useCallback(()=>{s(),c()},[s,c]),u=g.useCallback(()=>{const f=a.current;if(f?.open){f.close();return}s(),c()},[s,c]);return g.useEffect(()=>{const f=a.current;if(f){if(!f.open){l.current=document.activeElement instanceof HTMLElement?document.activeElement:null;try{f.showModal()}catch{c(),s()}}return()=>{if(f.open){f.close();return}c()}}},[s,c]),d.jsx("dialog",{ref:a,"aria-label":n.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:d.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:[d.jsx("div",{className:"px-6 py-5 border-b border-dash-border",children:d.jsxs("div",{className:"flex items-start justify-between gap-3",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2.5",children:[d.jsx(fy,{agentName:n.name,displayName:n.displayName,size:22}),d.jsx("h2",{className:"text-xl font-bold text-dash-text truncate",children:n.displayName})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mt-2",children:[d.jsx("span",{className:"text-[11px] text-dash-text-muted font-mono",children:n.name}),d.jsx("span",{className:`text-[10px] uppercase tracking-wide px-2 py-0.5 rounded border ${n.detected?"border-dash-accent/30 text-dash-accent":"border-dash-border text-dash-text-muted"}`,children:n.detected?o("migrateDetectedTag"):o("migrateNotDetectedTag")}),n.recommended&&d.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")})]})]}),d.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:d.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[d.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18",strokeWidth:2}),d.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18",strokeWidth:2})]})})]})}),d.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-6",children:[d.jsxs("div",{children:[d.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wide text-dash-text-muted mb-2.5",children:o("migrateCapabilitiesSection")}),d.jsx("div",{className:"space-y-1.5",children:Pt.map(f=>{const p=n.capabilities[f],m=e[f];return d.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-dash-bg rounded-md",children:[d.jsx("span",{className:"text-sm text-dash-text",children:o(Zn[f])}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:`text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded border ${m?"border-dash-accent/35 text-dash-accent":"border-dash-border text-dash-text-muted"}`,children:o(m?"migrateIncludedEnabled":"migrateIncludedDisabled")}),d.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)})})]}),n.commandsGlobalOnly&&e.commands&&d.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")}),d.jsxs("div",{children:[d.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wide text-dash-text-muted mb-2.5",children:o("migrateLatestTarget")}),r?d.jsxs("div",{className:"px-3 py-2 bg-dash-bg rounded-md border border-dash-border space-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-xs text-dash-text-muted",children:o("migrateStatus")}),d.jsx("span",{className:`text-xs font-semibold ${Qp(r,o).className}`,children:Qp(r,o).label})]}),d.jsx("p",{className:"text-xs font-mono text-dash-text break-all",children:Xp(r.path||"-")}),(r.error||r.skipReason)&&d.jsx("p",{className:"text-xs text-red-400 break-words",children:Xp(r.error||r.skipReason||"-")})]}):d.jsx("p",{className:"text-sm text-dash-text-muted",children:o("migrateNoResultForProvider")})]})]}),d.jsxs("div",{className:"px-6 py-4 border-t border-dash-border flex items-center justify-between gap-2",children:[d.jsx("button",{type:"button",onClick:()=>i(n.name),className:`px-4 py-2 text-sm font-semibold rounded-md transition-colors ${t?"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(t?"migrateUnselectProvider":"migrateSelectProviderAction")}),d.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")})]})]})})},H8=()=>{const{t:n}=he(),e=$8(),[t,r]=g.useState([]),[i,s]=g.useState(null),[o,a]=g.useState([]),[l,c]=g.useState(B8),[h,u]=g.useState(!0),[f,p]=g.useState(!0),[m,b]=g.useState(!1),[y,v]=g.useState(null),[w,C]=g.useState(""),j=g.useDeferredValue(w),[k,O]=g.useState("all"),[x,T]=g.useState(null),A=g.useRef(0),R=g.useCallback(async(I=!1)=>{A.current+=1;const G=A.current;try{I?b(!0):p(!0),v(null);const[oe,Te]=await Promise.all([Pv(),tu()]);if(G!==A.current)return;r(oe.providers),s(Te),a(Ut=>{if(Ut.length===0)return[];const Zs=oe.providers.map(ti=>ti.name);return Ut.filter(ti=>Zs.includes(ti))})}catch(oe){if(G!==A.current)return;v(oe instanceof Error?oe.message:n("migrateDetectFailed"))}finally{G===A.current&&(p(!1),b(!1))}},[n]);g.useEffect(()=>{R()},[R]);const N=g.useMemo(()=>{const I=new Map;for(const G of t)I.set(G.name,G);return I},[t]),L=g.useMemo(()=>x&&N.get(x)||null,[x,N]);g.useEffect(()=>{x&&!N.has(x)&&T(null)},[x,N]);const W=g.useCallback(()=>{T(null)},[]),F=g.useMemo(()=>new Set(o),[o]),B=g.useMemo(()=>t.filter(I=>I.detected).length,[t]),q=o.length,de=g.useMemo(()=>t.filter(I=>I.recommended).length,[t]),z=g.useMemo(()=>Pt.filter(I=>l[I]).length,[l]),J=g.useMemo(()=>{const I=[];l.commands&&o.includes("codex")&&!h&&N.get("codex")?.commandsGlobalOnly&&I.push(n("migrateGlobalForced"));for(const G of Pt){if(!l[G])continue;const oe=o.filter(Te=>!N.get(Te)?.capabilities[G]).map(Te=>N.get(Te)?.displayName||Te);oe.length>0&&I.push(`${n("migrateUnsupported")}: ${n(Zn[G])} -> ${oe.join(", ")}`)}return I},[l,h,N,o,n]),ie=g.useCallback(I=>{if(I==="codex"){a(["codex"]);return}if(I==="antigravity"){a(["antigravity"]);return}if(I==="core"){const oe=["codex","antigravity","droid"].filter(Te=>t.some(Ut=>Ut.name===Te));a(oe);return}const G=t.filter(oe=>oe.detected).map(oe=>oe.name);a(G)},[t]),le=g.useCallback(I=>{a(G=>G.includes(I)?G.filter(oe=>oe!==I):[...G,I])},[]),fe=g.useCallback(I=>{c(G=>({...G,[I]:!G[I]}))},[]),we=g.useMemo(()=>{const I=[...t];return I.sort((G,oe)=>{const Te=F.has(G.name),Ut=F.has(oe.name);return Te!==Ut?Te?-1:1:G.detected!==oe.detected?G.detected?-1:1:G.recommended!==oe.recommended?G.recommended?-1:1:G.displayName.localeCompare(oe.displayName)}),I},[t,F]),ke=g.useMemo(()=>{const I=j.trim().toLowerCase();return we.filter(G=>{if(k==="selected"&&!F.has(G.name)||k==="detected"&&!G.detected||k==="recommended"&&!G.recommended||k==="not-detected"&&G.detected)return!1;if(!I)return!0;const oe=Pt.filter(Te=>G.capabilities[Te]).map(Te=>n(Zn[Te]).toLowerCase());return G.displayName.toLowerCase().includes(I)||G.name.toLowerCase().includes(I)||oe.some(Te=>Te.includes(I))})},[j,k,F,we,n]),Ae=g.useMemo(()=>{const I=ke.filter(Te=>Te.detected),G=ke.filter(Te=>!Te.detected),oe=[];return I.length>0&&oe.push({key:"detected",label:n("migrateDetectedTag"),providers:I}),G.length>0&&oe.push({key:"not-detected",label:n("migrateNotDetectedTag"),providers:G}),oe},[ke,n]),Qe=g.useMemo(()=>({all:t.length,selected:q,detected:t.filter(I=>I.detected).length,recommended:t.filter(I=>I.recommended).length,"not-detected":t.filter(I=>!I.detected).length}),[t,q]),mt=g.useMemo(()=>ke.map(I=>I.name),[ke]),Y=g.useCallback(()=>{a(I=>{const G=new Set(I);for(const oe of mt)G.add(oe);return Array.from(G)})},[mt]),Me=g.useCallback(()=>{a([])},[]),Se=g.useCallback(async()=>{if(o.length===0){v(n("migrateSelectProvider"));return}if(z===0){v(n("migrateNoTypesEnabled"));return}await e.reconcile({providers:o,global:h,include:l})},[z,l,h,o,n,e]),Ie=g.useCallback(async()=>{if(v(null),!!await e.execute())try{const G=await tu();s(G)}catch(G){console.error("Failed to refresh discovery:",G)}},[e]),ve=g.useMemo(()=>{const I=new Map;if(!e.results)return I;for(const G of e.results.results)I.set(G.provider,G);return I},[e.results]);g.useEffect(()=>{const I=G=>{const oe=G.target,Te=!!(oe&&(oe instanceof HTMLInputElement||oe instanceof HTMLTextAreaElement||oe.isContentEditable||oe.closest('[contenteditable="true"], [role="textbox"]'))),Ut=G.metaKey||G.ctrlKey||G.altKey;G.key==="/"&&!Te&&!Ut&&(G.preventDefault(),document.getElementById("migrate-search")?.focus())};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[]);const gt=e.phase==="idle"&&o.length>0&&z>0;return f?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"w-8 h-8 border-4 border-dash-accent border-t-transparent rounded-full animate-spin mx-auto mb-3"}),d.jsx("p",{className:"text-dash-text-muted",children:n("migrateDiscovering")})]})}):d.jsxs("div",{className:"relative h-full overflow-hidden",children:[d.jsxs("div",{className:"pointer-events-none absolute inset-0 -z-10 overflow-hidden",children:[d.jsx("div",{className:"absolute -top-24 -right-8 h-64 w-64 rounded-full bg-dash-accent/10 blur-3xl"}),d.jsx("div",{className:"absolute -bottom-28 -left-10 h-72 w-72 rounded-full bg-dash-accent/5 blur-3xl"})]}),d.jsxs("div",{className:"h-full overflow-y-auto space-y-4 pb-8",children:[d.jsx("section",{className:"dash-panel dash-sticky-glass sticky top-0 z-20 px-4 py-4 md:px-6 md:py-5",children:d.jsxs("div",{className:"flex flex-col gap-4 xl:flex-row xl:items-end xl:justify-between",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx("p",{className:"mono text-[10px] uppercase tracking-[0.16em] text-dash-text-muted",children:n("migrate")}),d.jsx("h1",{className:"text-xl md:text-2xl font-semibold text-dash-text",children:n("migrateTitle")}),d.jsx("p",{className:"text-sm text-dash-text-secondary max-w-3xl",children:n("migrateSubtitle")})]}),e.phase==="complete"&&e.results?d.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:[d.jsx(lt,{label:n("migrateInstalled"),value:e.results.counts.installed,tone:"success"}),d.jsx(lt,{label:n("migrateSkipped"),value:e.results.counts.skipped}),d.jsx(lt,{label:n("migrateFailed"),value:e.results.counts.failed})]}):d.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[d.jsx(lt,{label:n("migrateTypeAgents"),value:i?.counts.agents??0}),d.jsx(lt,{label:n("migrateDetectedProviders"),value:B,tone:"success"}),d.jsx(lt,{label:n("migrateSelectedProviders"),value:q,tone:"accent"}),d.jsx(lt,{label:n("migrateTypes"),value:z})]})]})}),y&&d.jsx("div",{className:"px-4 py-3 border border-red-500/30 bg-red-500/10 rounded-lg text-sm text-red-400",children:y}),d.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1.55fr)_minmax(0,340px)]",children:[d.jsxs("section",{className:"order-2 xl:order-1 space-y-4",children:[e.phase==="reviewing"&&e.plan&&d.jsxs("div",{className:"dash-panel flex flex-col max-h-[calc(100vh-200px)]",children:[d.jsxs("div",{className:"flex items-center justify-between p-5 pb-4",children:[d.jsx("h2",{className:"text-lg font-semibold text-dash-text",children:n("migrateReviewPlan")}),d.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:n("cancel")})]}),d.jsxs("div",{className:"flex-1 overflow-y-auto px-5 pb-4",children:[d.jsx(vj,{plan:e.plan,resolutions:e.resolutions,onResolve:e.resolve,actionKey:e.actionKey}),e.error&&d.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})]}),d.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&&d.jsx("p",{className:"text-xs text-yellow-400",children:n("migrateResolveConflicts")}),d.jsx("button",{type:"button",onClick:Ie,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:n("migrateExecutePlan")})]})]}),e.phase==="complete"&&e.results&&d.jsx(oj,{results:e.results,onReset:e.reset}),e.phase==="error"&&e.error&&d.jsxs("div",{className:"dash-panel p-5",children:[d.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}),d.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:n("tryAgain")})]}),(e.phase==="reconciling"||e.phase==="executing")&&d.jsx("div",{className:"dash-panel p-5",children:d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"w-8 h-8 border-4 border-dash-accent border-t-transparent rounded-full animate-spin mx-auto mb-3"}),d.jsx("p",{className:"text-dash-text-muted",children:e.phase==="reconciling"?n("migrateReconciling"):n("migrateExecuting")})]})})}),e.phase==="idle"&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"dash-panel p-4 md:p-5 space-y-4",children:[d.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center",children:[d.jsxs("div",{className:"relative flex-1",children:[d.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:[d.jsx("circle",{cx:"11",cy:"11",r:"8"}),d.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),d.jsx("input",{id:"migrate-search",type:"text",value:w,onChange:I=>C(I.target.value),placeholder:n("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"}),d.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:n("searchShortcut")})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx("button",{type:"button",onClick:()=>R(!0),disabled:m,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:n(m?"checking":"migrateRefresh")}),d.jsx("button",{type:"button",onClick:Y,disabled:mt.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:n("migrateSelectVisible")}),d.jsx("button",{type:"button",onClick:Me,disabled:q===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:n("migrateClearSelection")})]})]}),d.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{key:"all",label:n("categoryAll")},{key:"selected",label:n("migrateSelectedProviders")},{key:"detected",label:n("migrateDetectedProviders")},{key:"recommended",label:n("migrateFilterRecommended")},{key:"not-detected",label:n("migrateNotDetectedTag")}].map(I=>d.jsxs("button",{type:"button",onClick:()=>O(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,d.jsx("span",{className:"opacity-60 ml-1 text-[10px]",children:Qe[I.key]})]},I.key))}),d.jsxs("div",{children:[d.jsx("p",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wide text-dash-text-muted",children:n("migrateTypes")}),d.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Pt.map(I=>d.jsx("button",{type:"button",onClick:()=>fe(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:n(Zn[I])},I))})]})]}),d.jsxs("div",{className:"dash-panel p-4 md:p-5",children:[d.jsx("h2",{className:"text-sm font-semibold text-dash-text mb-4",children:n("migrateSourceSummary")}),d.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 xl:grid-cols-6 gap-3",children:Pt.map(I=>d.jsxs("div",{className:"px-3 py-2 bg-dash-bg border border-dash-border rounded-md text-center",children:[d.jsx("p",{className:"text-[11px] uppercase tracking-wide text-dash-text-muted",children:n(Zn[I])}),d.jsx("p",{className:"text-lg font-semibold text-dash-text",children:i?.counts[I]??0})]},I))})]}),d.jsxs("div",{className:"dash-panel p-4 md:p-5",children:[d.jsxs("div",{className:"flex items-center justify-between mb-4",children:[d.jsx("h2",{className:"text-sm font-semibold text-dash-text",children:n("migrateProvidersHeading")}),d.jsxs("p",{className:"text-xs text-dash-text-muted",children:[ke.length," ",n("migrateProvidersCountSuffix")]})]}),t.length===0?d.jsx("div",{className:"text-sm text-dash-text-muted",children:n("migrateNoProviders")}):ke.length===0?d.jsx("div",{className:"text-sm text-dash-text-muted",children:n("migrateNoProvidersMatch")}):d.jsx("div",{className:"space-y-5",children:Ae.map(I=>d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center gap-2.5 mb-3",children:[d.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:Yp[I.key]}}),d.jsx("h2",{className:"text-[13px] font-semibold uppercase tracking-wide",style:{color:Yp[I.key]},children:I.label}),d.jsxs("span",{className:"text-[11px] text-dash-text-muted ml-auto",children:[I.providers.length," ",n("migrateProvidersCountSuffix")]}),d.jsx("div",{className:"flex-1 h-px bg-dash-border ml-3"})]}),d.jsx("div",{className:"space-y-2",children:I.providers.map(G=>d.jsx(z8,{provider:G,include:l,isSelected:F.has(G.name),cardClickToggles:k==="selected",onToggleSelect:le,onOpenDetails:T,t:n},G.name))})]},I.key))})]})]})]}),d.jsx("aside",{className:"order-1 xl:order-2 space-y-4 self-start xl:sticky xl:top-[84px]",children:e.phase==="complete"&&e.results?d.jsxs("div",{className:"dash-panel p-4 md:p-5 space-y-4",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-sm font-semibold text-dash-text",children:n("migrateSummaryTitle")}),d.jsxs("p",{className:"text-xs text-dash-text-muted mt-1",children:[e.results.counts.installed+e.results.counts.skipped+e.results.counts.failed," ",n("migrateSummarySubtitle")]})]}),d.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[d.jsx(lt,{label:n("migrateInstalled"),value:e.results.counts.installed,tone:"success"}),d.jsx(lt,{label:n("migrateSkipped"),value:e.results.counts.skipped}),d.jsx(lt,{label:n("migrateFailed"),value:e.results.counts.failed})]}),e.results.discovery&&d.jsxs("div",{className:"space-y-1.5",children:[d.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-dash-text-muted",children:n("migrateTypes")}),Pt.map(I=>{const G=e.results?.discovery?.[I]??0;return G===0?null:d.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-dash-bg rounded-md text-xs",children:[d.jsx("span",{className:"text-dash-text-secondary",children:n(Zn[I])}),d.jsx("span",{className:"font-semibold text-dash-text",children:G})]},I)})]}),o.length>0&&d.jsxs("div",{className:"space-y-1.5",children:[d.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-dash-text-muted",children:n("migrateSummaryProviders")}),d.jsx("div",{className:"flex flex-wrap gap-1.5",children:o.map(I=>{const G=N.get(I);return d.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded border border-dash-accent/30 text-dash-accent",children:G?.displayName||I},I)})})]}),d.jsx("div",{className:"text-[10px] px-3 py-1.5 bg-dash-bg rounded-md text-dash-text-muted",children:n(h?"migrateScopeGlobal":"migrateScopeProject")}),d.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:n("migrateSummaryNewMigration")})]}):d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"dash-panel p-4 md:p-5 space-y-4",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-sm font-semibold text-dash-text",children:n("migrateActionSummaryTitle")}),d.jsxs("p",{className:"text-xs text-dash-text-muted mt-1",children:[q," ",n("migrateProvidersCountSuffix")," ·"," ",z,"/",Pt.length," ",n("migrateTypes")]})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[d.jsx(lt,{label:n("migrateSelectedProviders"),value:q,tone:"accent"}),d.jsx(lt,{label:n("migrateDetectedProviders"),value:B}),d.jsx(lt,{label:n("migrateTypes"),value:z}),d.jsx(lt,{label:n("migrateFilterRecommended"),value:de,tone:"success"})]}),d.jsxs("div",{className:"inline-flex w-full rounded-md border border-dash-border overflow-hidden",children:[d.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:n("migrateScopeProject")}),d.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:n("migrateScopeGlobal")})]}),d.jsx("button",{type:"button",onClick:Se,disabled:!gt,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"?n("migrateRunning"):n("migrateRun")}),J.length>0&&d.jsx("div",{className:"space-y-2",children:J.map((I,G)=>d.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}-${G}`))})]}),d.jsxs("div",{className:"dash-panel-muted p-4",children:[d.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-wide text-dash-text-muted",children:n("migrateSelectProviderAction")}),d.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[d.jsx("button",{type:"button",onClick:()=>ie("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:n("migratePresetCodex")}),d.jsx("button",{type:"button",onClick:()=>ie("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:n("migratePresetAntigravity")}),d.jsx("button",{type:"button",onClick:()=>ie("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:n("migratePresetCore")}),d.jsx("button",{type:"button",onClick:()=>ie("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:n("migratePresetDetected")})]})]})]})})]})]}),L&&d.jsx(_8,{provider:L,include:l,isSelected:F.has(L.name),latestResult:ve.get(L.name)||null,onToggleSelect:le,onClose:W,t:n})]})},W8=({featureId:n,name:e,description:t,included:r})=>{const{t:i}=he();return d.jsxs("div",{"data-testid":`feature-card-${n}`,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:[d.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r?d.jsx("svg",{className:"w-5 h-5 text-[var(--dash-accent)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):d.jsx("svg",{className:"w-5 h-5 text-[var(--dash-text-muted)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),d.jsx("h4",{className:"font-medium text-[var(--dash-text)]",children:i(e)})]}),d.jsx("p",{className:"text-sm text-[var(--dash-text-muted)] leading-relaxed",children:i(t)})]})},U8=({selectedKit:n,onKitSelect:e,onInstall:t,installing:r})=>{const{t:i}=he(),[s,o]=g.useState(1);return d.jsxs("div",{className:"space-y-6","data-testid":"install-wizard",children:[d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx(oc,{number:1,active:s===1,label:i("stepChooseKit")}),d.jsx("div",{className:"flex-1 h-px bg-[var(--dash-border)]"}),d.jsx(oc,{number:2,active:s===2,label:i("stepConfigure")}),d.jsx("div",{className:"flex-1 h-px bg-[var(--dash-border)]"}),d.jsx(oc,{number:3,active:s===3,label:i("stepInstall")})]}),d.jsxs("div",{className:"min-h-[200px]",children:[s===1&&d.jsx(K8,{onSelect:e,selected:n}),s===2&&n&&d.jsx(G8,{kit:n}),s===3&&d.jsx(q8,{installing:r})]}),d.jsxs("div",{className:"flex justify-between pt-4 border-t border-[var(--dash-border)]",children:[s>1?d.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:i("back")}):d.jsx("div",{}),s<3&&n&&d.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:i("next")}),s===3&&d.jsx("button",{onClick:t,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:i("install")})]})]})},oc=({number:n,active:e,label:t})=>d.jsxs("div",{className:"flex items-center gap-2",children:[d.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:n}),d.jsx("span",{className:`text-sm font-medium ${e?"text-[var(--dash-text)]":"text-[var(--dash-text-muted)]"}`,children:t})]}),K8=({onSelect:n,selected:e})=>{const{t}=he();return d.jsxs("div",{className:"space-y-4",children:[d.jsx("p",{className:"text-[var(--dash-text-muted)]",children:e?`Selected: ${e===Qt.ENGINEER?t("kitEngineerName"):t("kitMarketingName")}`:"Please select a kit above"}),e&&d.jsxs("button",{type:"button",onClick:()=>n(e===Qt.ENGINEER?Qt.MARKETING:Qt.ENGINEER),className:"text-sm text-[var(--dash-accent)] hover:underline",children:["Switch to ",e===Qt.ENGINEER?t("kitMarketingName"):t("kitEngineerName")]})]})},G8=()=>d.jsx("div",{className:"text-[var(--dash-text-muted)]",children:"Configuration preview placeholder"}),q8=({installing:n})=>d.jsx("div",{className:"text-[var(--dash-text-muted)]",children:n?"Installing...":"Ready to install"}),J8=({kit:n,onGetStarted:e})=>{const{t}=he(),r=an(),i=n===Qt.ENGINEER?"kitEngineerName":n===Qt.MARKETING?"kitMarketingName":"kitEngineerName";return d.jsxs("div",{className:"text-center py-12 space-y-6","data-testid":"success-screen",children:[d.jsx("div",{className:"w-16 h-16 mx-auto bg-green-100 rounded-full flex items-center justify-center",children:d.jsx("svg",{className:"w-10 h-10 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.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"})})}),d.jsx("h2",{className:"text-2xl font-bold text-[var(--dash-text)]",children:t("installSuccess")}),d.jsx("p",{className:"text-[var(--dash-text-muted)] max-w-md mx-auto",children:t("installSuccessDesc").replace("{kit}",t(i))}),d.jsxs("div",{className:"flex gap-4 justify-center pt-4",children:[d.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:t("getStarted")}),d.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:t("goToDashboard")})]})]})},Y8=[{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}],py={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 Q8(n){const e=py[n];return e?Y8.filter(t=>e.features.includes(t.id)):(console.warn(`Unknown kit type: ${n}`),[])}const X8=({kit:n,selected:e,onSelect:t,features:r})=>{const{t:i}=he();return d.jsxs("button",{type:"button",onClick:t,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:[d.jsx("h3",{className:`text-xl font-bold ${n.primaryColor}`,children:i(n.name)}),d.jsx("p",{className:"text-[var(--dash-text-muted)] mt-1",children:i(n.tagline)}),d.jsx("div",{className:"mt-4 space-y-2",children:r.slice(0,3).map(s=>d.jsx(W8,{featureId:s.id,name:s.name,description:s.description,included:!0},s.id))})]})},Z8=()=>{const{t:n}=he(),e=an(),[t,r]=g.useState(null),[i,s]=g.useState(!1),[o,a]=g.useState(!1),[l,c]=g.useState(null),h=async()=>{if(t){s(!0),c(null);try{const f=await fetch("/api/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kit:t})});if(!f.ok)throw new Error(`Installation failed: ${f.statusText}`);a(!0)}catch(f){const p=f instanceof Error?f.message:"Unknown error occurred";c(p),console.error("Install failed:",f)}finally{s(!1)}}};if(o&&t)return d.jsx(J8,{kit:t,onGetStarted:()=>e("/")});const u=f=>f==="engineer"?Qt.ENGINEER:Qt.MARKETING;return d.jsxs("div",{className:"max-w-4xl mx-auto py-8 px-4",children:[d.jsxs("header",{className:"text-center mb-8",children:[d.jsx("h1",{className:"text-3xl font-bold text-[var(--dash-text)]",children:n("onboardingTitle")}),d.jsx("p",{className:"mt-2 text-[var(--dash-text-muted)]",children:n("onboardingSubtitle")})]}),d.jsx("section",{className:"grid md:grid-cols-2 gap-6 mb-8",children:Object.values(py).map(f=>{const p=u(f.id);return d.jsx(X8,{kit:f,selected:t===p,onSelect:()=>r(p),features:Q8(f.id)},f.id)})}),l&&d.jsxs("div",{className:"mb-6 p-4 rounded-lg bg-red-100 border border-red-300 text-red-800",children:[d.jsx("p",{className:"font-medium",children:"Installation Error"}),d.jsx("p",{className:"text-sm mt-1",children:l}),d.jsx("button",{type:"button",onClick:()=>c(null),className:"mt-2 text-sm underline hover:no-underline",children:"Dismiss"})]}),t&&d.jsx(U8,{selectedKit:t,onKitSelect:r,onInstall:h,installing:i})]})},eN=()=>{const{t:n}=he(),e=an(),{projectId:t}=Nm(),[r,i]=g.useState(null),{sizes:s,isDragging:o,startDrag:a}=lh({storageKey:"claudekit-project-config-panels",defaultSizes:[35,40,25],minSizes:[20,25,15]}),l=g.useCallback(async()=>{if(!t)throw new Error("No project ID");const[b,y,v]=await Promise.all([sp("project",t),sp("global"),$m()]),w=v.find(C=>C.id===t);return w&&i(w.path),{...b,global:y.config??{}}},[t]),c=g.useCallback(async b=>{t&&await Fb({scope:"project",projectId:t,config:b})},[t]),h=Bb({scope:"project",fetchConfig:l,fetchSchema:Vb,saveConfig:c}),u=g.useCallback(b=>{const y=fc(h.config,b),v=fc(h.globalConfig,b);return y!==void 0&&v!==void 0&&y!==v},[h.config,h.globalConfig]),f=g.useMemo(()=>[{id:"paths",title:n("sectionPaths"),fields:[{path:"paths.docs",label:n("fieldDocsPath"),description:n("fieldDocsPathDesc")},{path:"paths.plans",label:n("fieldPlansPath"),description:n("fieldPlansPathDesc")}]},{id:"project",title:n("sectionProject"),fields:[{path:"project.type",label:n("fieldProjectType"),description:n("fieldProjectTypeDesc")},{path:"project.packageManager",label:n("fieldPackageManager"),description:n("fieldPackageManagerDesc")},{path:"project.framework",label:n("fieldFramework"),description:n("fieldFrameworkDesc")}]},{id:"privacy",title:n("sectionPrivacy"),defaultCollapsed:!0,fields:[{path:"privacyBlock",label:n("fieldPrivacyBlock"),description:n("fieldPrivacyBlockDesc")}]},{id:"advanced",title:n("sectionAdvanced"),defaultCollapsed:!0,fields:[{path:"docs.maxLoc",label:n("fieldDocsMaxLoc"),description:n("fieldDocsMaxLocDesc")},{path:"plan.namingFormat",label:n("fieldPlanNamingFormat"),description:n("fieldPlanNamingFormatDesc")}]}],[n]),p=h.activeFieldPath&&u(h.activeFieldPath)?d.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:n("localOverride")}):null,m=h.fieldDoc?d.jsxs("section",{className:"bg-blue-500/5 p-3 rounded-lg border border-blue-500/20",children:[d.jsx("h4",{className:"text-[10px] font-bold text-blue-500 uppercase tracking-widest mb-1",children:n("inheritedFromGlobal")}),d.jsxs("p",{className:"text-[12px] text-dash-text-secondary leading-normal",children:[n("viewGlobalConfig")," ",d.jsx("button",{onClick:()=>e("/config/global"),className:"text-dash-accent hover:underline font-medium",children:n("globalConfig")})]})]}):null;return d.jsxs("div",{className:"animate-in fade-in duration-300 w-full h-full flex flex-col transition-colors",children:[d.jsx(Fm,{title:n("projectConfig"),filePath:r?`${r}/.claude/.ck.json`:".claude/.ck.json",onBack:()=>e(`/project/${t}`),onSave:h.handleSave,onReset:h.handleReset,saveStatus:h.saveStatus,syntaxError:h.syntaxError,showResetConfirm:h.showResetConfirm,setShowResetConfirm:h.setShowResetConfirm}),d.jsxs("div",{className:"flex-1 flex min-h-0",children:[d.jsx(Vm,{width:s[0],isLoading:h.isLoading,schema:h.schema,config:h.config,sources:h.sources,sections:f,onChange:h.handleFormChange}),d.jsx(Pr,{direction:"horizontal",isDragging:o,onMouseDown:b=>a(0,b)}),d.jsx(nd,{width:s[1],isLoading:h.isLoading,jsonText:h.jsonText,cursorLine:h.cursorLine,syntaxError:h.syntaxError,onChange:h.handleJsonChange,onCursorLineChange:h.setCursorLine}),d.jsx(Pr,{direction:"horizontal",isDragging:o,onMouseDown:b=>a(1,b)}),d.jsx(Lb,{width:s[2],fieldDoc:h.fieldDoc,activeFieldPath:h.activeFieldPath,overrideBadge:p,extraContent:m})]})]})},jt="__global__",tN=({project:n})=>{const{t:e}=he(),t=an(),{skills:r,loading:i}=Nv(),{sessions:s,loading:o}=Av(n.id),[a,l]=g.useState(null),[c,h]=g.useState(!0),[u,f]=g.useState(null),[p,m]=g.useState(jt),[b,y]=g.useState(jt),v=async(N,L)=>{try{await wv(N,n.path,L,n.id)}catch(W){alert(`${e("actionFailed")}: ${W instanceof Error?W.message:N}`)}},w=g.useCallback(()=>{const N=new AbortController;return h(!0),f(null),vv(n.id,N.signal).then(L=>{l(L),m(L.preferences.project.terminalApp||jt),y(L.preferences.project.editorApp||jt)}).catch(L=>{L instanceof DOMException&&L.name==="AbortError"||(l(null),m(jt),y(jt),f(e("actionOptionsLoadFailed")))}).finally(()=>{N.signal.aborted||h(!1)}),N},[n.id,e]);g.useEffect(()=>{const N=w();return()=>{N.abort()}},[w]);const C=r.filter(N=>n.skills.includes(N.id)),j=a?.terminals||[],k=a?.editors||[],O=j.find(N=>N.id===a?.defaults.terminalApp)?.label||a?.defaults.terminalApp,x=k.find(N=>N.id===a?.defaults.editorApp)?.label||a?.defaults.editorApp,T=g.useMemo(()=>j.find(N=>p===jt?N.id===a?.defaults.terminalApp:N.id===p),[j,p,a?.defaults.terminalApp]),A=g.useMemo(()=>k.find(N=>b===jt?N.id===a?.defaults.editorApp:N.id===b),[k,b,a?.defaults.editorApp]),R=async(N,L)=>{if(!n.id.startsWith("discovered-"))try{await Bm(n.id,{preferences:{[N]:L===jt?null:L}})}catch(W){const F=W instanceof Error?W.message:"Failed to save preference";alert(`${e("actionFailed")}: ${F}`)}};return d.jsxs("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-500 transition-colors flex flex-col h-full",children:[d.jsx("section",{className:"mb-6 shrink-0",children:d.jsxs("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-4",children:[d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[d.jsx("h1",{className:"text-3xl font-bold tracking-tight text-dash-text",children:n.name}),d.jsx(nN,{status:n.health}),d.jsx(DC,{variant:"beta"})]}),d.jsxs("p",{className:"text-dash-text-secondary mono text-sm flex items-center gap-2 italic",children:[d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.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"})}),n.path]})]}),d.jsx("div",{className:"flex items-center gap-3",children:d.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:s.length>0?`${s.length} ${e("sessions")}`:e("noSessions")})})]})}),d.jsxs("section",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6 shrink-0",children:[u?d.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:[d.jsx("span",{children:u}),d.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,d.jsx(Zp,{icon:"📟",label:e("terminal"),sub:T?`${T.openMode==="open-app"?e("openAppOnly"):e("openAtPath")} • ${T.label}`:e("terminalSub"),onClick:()=>v("terminal",p===jt?void 0:p),disabled:c||!T&&j.length>0,options:j,value:p,fallbackLabel:a?`${e("useGlobalFallback")} (${O})`:e("useGlobalFallback"),onChange:async N=>{m(N),await R("terminalApp",N)}}),d.jsx(Zp,{icon:"💻",label:e("editor"),sub:A?`${A.openMode==="open-app"?e("openAppOnly"):e("openAtPath")} • ${A.label}`:e("editorSub"),onClick:()=>v("editor",b===jt?void 0:b),disabled:c||!A&&k.length>0,options:k,value:b,fallbackLabel:a?`${e("useGlobalFallback")} (${x})`:e("useGlobalFallback"),onChange:async N=>{y(N),await R("editorApp",N)}}),d.jsx(ch,{icon:"🤖",label:e("launch"),sub:e("launchSub"),highlight:!0,onClick:()=>v("launch")}),d.jsx(ch,{icon:"⚙️",label:e("config"),sub:e("configSub"),onClick:()=>t(`/config/project/${n.id}`)})]}),d.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 flex-1 min-h-0",children:[d.jsx("div",{className:"lg:col-span-2 flex flex-col gap-6 min-h-0",children:d.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:[d.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:d.jsx("h3",{className:"text-sm font-bold text-dash-text-secondary uppercase tracking-widest",children:e("recentSessions")})}),d.jsx("div",{className:"divide-y divide-dash-border overflow-y-auto flex-1",children:o?d.jsx("div",{className:"p-4 text-center text-dash-text-muted animate-pulse",children:e("loadingSessions")}):s.length===0?d.jsx("div",{className:"p-4 text-center text-dash-text-muted",children:e("noSessionsFound")}):s.map(N=>d.jsxs("div",{className:"p-4 hover:bg-dash-surface-hover transition-colors group cursor-pointer",children:[d.jsxs("div",{className:"flex items-center justify-between mb-1",children:[d.jsx("span",{className:"text-xs font-bold text-dash-accent",children:N.timestamp}),d.jsx("span",{className:"text-[10px] text-dash-text-muted font-medium group-hover:text-dash-text-secondary transition-colors",children:N.duration})]}),d.jsx("p",{className:"text-sm text-dash-text-secondary leading-relaxed truncate",children:N.summary})]},N.id))})]})}),d.jsxs("div",{className:"flex flex-col gap-6 min-h-0",children:[d.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-xl p-6 shadow-sm shrink-0",children:[d.jsxs("h3",{className:"text-sm font-bold text-dash-text-secondary uppercase tracking-widest mb-4 flex items-center gap-2",children:[e("configuration"),d.jsx("span",{className:"text-[10px] font-normal text-dash-text-muted normal-case",children:e("globalSettings")})]}),d.jsxs("div",{className:"space-y-4",children:[d.jsx(Fo,{label:e("activeKit"),value:n.kitType}),d.jsx(Fo,{label:e("aiModel"),value:n.model}),d.jsx(Fo,{label:e("hooks"),value:`${n.activeHooks} ${e("active")}`}),d.jsx(Fo,{label:e("mcpServers"),value:`${n.mcpServers} ${e("connected")}`})]}),d.jsx("button",{onClick:()=>t(`/config/project/${n.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")})]}),d.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-xl shadow-sm flex flex-col flex-1 min-h-0",children:[d.jsx("div",{className:"p-4 pb-2 border-b border-dash-border shrink-0",children:d.jsxs("h3",{className:"text-sm font-bold text-dash-text-secondary uppercase tracking-widest flex items-center justify-between",children:[e("globalSkills"),d.jsx("span",{className:"text-[10px] bg-dash-accent-subtle text-dash-accent px-1.5 py-0.5 rounded-full",children:i?"...":r.length})]})}),d.jsx("div",{className:"overflow-y-auto flex-1 px-4 py-2 space-y-2",children:i?d.jsx("div",{className:"text-center text-dash-text-muted animate-pulse py-4",children:e("loadingSkills")}):(C.length>0?C:r).map(N=>d.jsxs("div",{className:"flex flex-col gap-0.5 border-l-2 border-dash-accent/20 pl-3 py-1",children:[d.jsx("span",{className:"text-sm font-semibold text-dash-text",children:N.name}),d.jsx("p",{className:"text-[10px] text-dash-text-muted leading-tight line-clamp-1",children:N.description||e("noDescription")})]},N.id))}),d.jsx("div",{className:"p-4 pt-2 border-t border-dash-border shrink-0",children:d.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")," →"]})})]})]})]})]})},nN=({status:n})=>{const e={[Pn.HEALTHY]:"bg-dash-accent-subtle text-dash-accent border-dash-accent/20",[Pn.WARNING]:"bg-orange-500/10 text-orange-600 border-orange-500/20",[Pn.ERROR]:"bg-red-500/10 text-red-600 border-red-500/20",[Pn.LOADING]:"bg-dash-border/20 text-dash-text-muted border-dash-border",[Pn.UNKNOWN]:"bg-dash-border/20 text-dash-text-muted border-dash-border"};return d.jsx("span",{className:`px-2 py-0.5 rounded-full text-[10px] font-bold border uppercase tracking-widest ${e[n]}`,children:n})},Zp=({icon:n,label:e,sub:t,disabled:r,options:i,value:s,fallbackLabel:o,onClick:a,onChange:l})=>d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsx(ch,{icon:n,label:e,sub:t,onClick:a,disabled:r}),d.jsxs("select",{value:s,onChange:c=>void l(c.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:[d.jsx("option",{value:jt,children:o}),i.map(c=>d.jsx("option",{value:c.id,disabled:!c.available,children:`${c.label} • ${c.detected?"Detected":"Not detected"}`},c.id))]})]}),ch=({icon:n,label:e,sub:t,highlight:r,onClick:i,disabled:s})=>d.jsxs("button",{onClick:i,disabled:s,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"} ${s?"opacity-50 cursor-not-allowed":""}`,children:[d.jsx("span",{className:"text-2xl mb-1 group-hover:scale-110 transition-transform",children:n}),d.jsx("span",{className:"text-sm font-bold text-dash-text",children:e}),d.jsx("span",{className:"text-[10px] text-dash-text-muted font-medium truncate italic",children:t})]}),Fo=({label:n,value:e})=>d.jsxs("div",{className:"flex items-center justify-between text-xs py-1.5 border-b border-dash-border/50 last:border-0",children:[d.jsx("span",{className:"text-dash-text-muted font-medium",children:n}),d.jsx("span",{className:"text-dash-text font-bold mono uppercase text-[10px] tracking-tight",children:e})]}),rN=()=>{const{t:n}=he(),{project:e}=nx();return e?d.jsx(tN,{project:e}):d.jsxs("div",{className:"flex flex-col items-center justify-center h-full space-y-4 opacity-50",children:[d.jsx("div",{className:"w-16 h-16 rounded-full bg-dash-surface border border-dash-border flex items-center justify-center",children:d.jsx("span",{className:"text-2xl text-dash-text-muted",children:"📂"})}),d.jsx("p",{className:"text-lg text-dash-text-secondary font-bold",children:n("selectProject")})]})},iN=Qx([{path:"/",element:d.jsx(Dv,{}),children:[{index:!0,element:d.jsx(il,{to:"/config/global",replace:!0})},{path:"config/global",element:d.jsx(JC,{})},{path:"config/project/:projectId",element:d.jsx(eN,{})},{path:"project/:projectId",element:d.jsx(rN,{})},{path:"onboarding",element:d.jsx(Z8,{})},{path:"migrate",element:d.jsx(H8,{})},{path:"kanban",element:d.jsx(XC,{})},{path:"skills",element:d.jsx(il,{to:"/migrate",replace:!0})},{path:"*",element:d.jsx(il,{to:"/",replace:!0})}]}]),my=document.getElementById("root");if(!my)throw document.body.innerHTML='<div style="padding:20px;color:red;">Fatal: Root element not found</div>',new Error("Root element #root not found");ac.createRoot(my).render(d.jsx(My.StrictMode,{children:d.jsx(fv,{children:d.jsx(pv,{children:d.jsx(hv,{router:iN})})})}));
218
+ }`}},XC=(n,e)=>{const[t,r]=g.useState(null);return g.useEffect(()=>{const i=n.split(`
219
+ `),s=[];let o=null;for(let a=0;a<=Math.min(e,i.length-1);a++){const l=i[a].trim(),c=l.match(/"([^"]+)"\s*:\s*{/);if(c){s.push(c[1]),a===e&&(o=s.join("."));continue}if(l==="}"||l==="},"){s.pop();continue}const d=l.match(/"([^"]+)"\s*:/);if(d){const u=d[1];if(a===e){o=s.length>0?`${s.join(".")}.${u}`:u;break}}}r(o)},[n,e]),t};function Fb(n){const{scope:e,fetchConfig:t,fetchSchema:r,saveConfig:i,onReset:s}=n,[o,a]=g.useState("{}"),[l,c]=g.useState(0),[d,u]=g.useState(null),[f,p]=g.useState(null),[m,b]=g.useState({}),[x,w]=g.useState({}),[v,S]=g.useState({}),[j,k]=g.useState(!0),[O,y]=g.useState("idle"),[D,A]=g.useState(!1),[R,N]=g.useState(null),L=XC(o,l),W=L?QC[L]:null;g.useEffect(()=>{(async()=>{try{const[J,ie]=await Promise.all([t(),r()]),le=J.local??J.config;b(le),w(J.global??{}),S(J.sources),p(ie),a(JSON.stringify(le,null,2))}catch(J){console.error("Failed to load config data:",J)}finally{k(!1)}})()},[t,r]),g.useEffect(()=>{try{JSON.parse(o),u(null)}catch(z){u(z instanceof Error?z.message:"Invalid JSON")}},[o]),g.useEffect(()=>{if(R==="json")try{const z=JSON.parse(o);b(z)}catch{}},[o,R]);const F=g.useCallback(z=>{N("json"),a(z)},[]),B=g.useCallback((z,J)=>{N("form"),b(ie=>{const le=Lv(ie,z,J);return a(JSON.stringify(le,null,2)),le}),S(ie=>({...ie,[z]:e}))},[e]),q=g.useCallback(async()=>{if(!d){y("saving");try{const z=JSON.parse(o);await i(z),b(z),y("saved"),setTimeout(()=>y("idle"),2e3)}catch{y("error"),setTimeout(()=>y("idle"),3e3)}}},[o,d,i]),de=g.useCallback(async()=>{if(A(!1),s){k(!0);try{const z=await s(),J=z.local??z.config;b(J),S(z.sources),a(JSON.stringify(J,null,2))}catch(z){console.error("Failed to reset:",z)}finally{k(!1)}}else{const z={};b(z),a(JSON.stringify(z,null,2))}},[s]);return{jsonText:o,config:m,globalConfig:x,sources:v,schema:f,isLoading:j,saveStatus:O,syntaxError:d,cursorLine:l,showResetConfirm:D,activeFieldPath:L,fieldDoc:W,handleJsonChange:F,handleFormChange:B,handleSave:q,handleReset:de,setCursorLine:c,setShowResetConfirm:A}}function lh({storageKey:n,defaultSizes:e,minSizes:t}){const[r,i]=g.useState(()=>{if(typeof window>"u")return e;const c=localStorage.getItem(n);if(c)try{const d=JSON.parse(c);if(Array.isArray(d)&&d.length===e.length){const u=d.reduce((f,p)=>f+p,0);if(Math.abs(u-100)<1)return d}}catch{}return e}),[s,o]=g.useState(!1);g.useEffect(()=>{localStorage.setItem(n,JSON.stringify(r))},[r,n]);const a=g.useCallback((c,d)=>{d.preventDefault(),o(!0);const u=d.target.parentElement;if(!u)return;const p=u.getBoundingClientRect().width,m=d.clientX,b=[...r],x=v=>{const j=(v.clientX-m)/p*100,k=[...b],O=c,y=c+1;let D=b[O]+j,A=b[y]-j;D<t[O]&&(D=t[O],A=b[O]+b[y]-D),A<t[y]&&(A=t[y],D=b[O]+b[y]-A),k[O]=D,k[y]=A,i(k)},w=()=>{o(!1),document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",w),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",x),document.addEventListener("mouseup",w),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[r,t]),l=g.useCallback(()=>{i(e)},[e]);return{sizes:r,isDragging:s,startDrag:a,reset:l}}const qa="/api";async function op(n){const e=`${qa}/ck-config`,t=await fetch(e);if(!t.ok)throw new Error(`Failed to fetch ck-config: ${t.status}`);return t.json()}async function ap(n,e){const t=new URLSearchParams({scope:n});e&&t.set("projectId",e);const r=await fetch(`${qa}/ck-config?${t}`);if(!r.ok)throw new Error(`Failed to fetch ck-config: ${r.status}`);return r.json()}async function Vb(n){const e=await fetch(`${qa}/ck-config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok){const t=await e.json().catch(()=>({error:"Unknown error"}));throw new Error(t.error||`Failed to save ck-config: ${e.status}`)}return e.json()}async function zb(){const n=await fetch(`${qa}/ck-config/schema`);if(!n.ok)throw new Error(`Failed to fetch schema: ${n.status}`);return n.json()}const ZC=()=>{const{t:n}=ce(),e=an(),[t,r]=g.useState("config"),[i,s]=g.useState({}),{sizes:o,isDragging:a,startDrag:l}=lh({storageKey:"claudekit-global-config-panels",defaultSizes:[35,40,25],minSizes:[20,25,15]}),{sizes:c,isDragging:d,startDrag:u}=lh({storageKey:"claudekit-global-system-panels",defaultSizes:[70,30],minSizes:[45,20]}),f=g.useCallback(async()=>{const[v,S]=await Promise.all([op(),Nv()]);return s(S),v},[]),p=g.useCallback(async v=>{await Vb({scope:"global",config:v})},[]),m=g.useCallback(async()=>await op(),[]),b=Fb({scope:"global",fetchConfig:f,fetchSchema:zb,saveConfig:p,onReset:m}),x=g.useMemo(()=>[{id:"general",title:n("sectionGeneral"),fields:[{path:"codingLevel",label:n("fieldCodingLevel"),description:n("fieldCodingLevelDesc")},{path:"statusline",label:n("fieldStatusline"),description:n("fieldStatuslineDesc")},{path:"statuslineColors",label:n("fieldStatuslineColors"),description:n("fieldStatuslineColorsDesc")},{path:"locale.thinkingLanguage",label:n("fieldThinkingLanguage"),description:n("fieldThinkingLanguageDesc")},{path:"locale.responseLanguage",label:n("fieldResponseLanguage"),description:n("fieldResponseLanguageDesc")}]},{id:"paths",title:n("sectionPaths"),fields:[{path:"paths.docs",label:n("fieldDocsPath"),description:n("fieldDocsPathDesc")},{path:"paths.plans",label:n("fieldPlansPath"),description:n("fieldPlansPathDesc")}]},{id:"privacy",title:n("sectionPrivacy"),defaultCollapsed:!0,fields:[{path:"privacyBlock",label:n("fieldPrivacyBlock"),description:n("fieldPrivacyBlockDesc")},{path:"trust.enabled",label:n("fieldTrustEnabled"),description:n("fieldTrustEnabledDesc")},{path:"trust.passphrase",label:n("fieldTrustPassphrase"),description:n("fieldTrustPassphraseDesc")}]},{id:"project",title:n("sectionProject"),defaultCollapsed:!0,fields:[{path:"project.type",label:n("fieldProjectType"),description:n("fieldProjectTypeDesc")},{path:"project.packageManager",label:n("fieldPackageManager"),description:n("fieldPackageManagerDesc")},{path:"project.framework",label:n("fieldFramework"),description:n("fieldFrameworkDesc")}]},{id:"integrations",title:n("sectionIntegrations"),defaultCollapsed:!0,fields:[{path:"gemini.model",label:n("fieldGeminiModel"),description:n("fieldGeminiModelDesc")},{path:"skills.research.useGemini",label:n("fieldResearchUseGemini"),description:n("fieldResearchUseGeminiDesc")}]},{id:"hooks",title:n("sectionHooks"),defaultCollapsed:!0,fields:[{path:"hooks.session-init",label:n("fieldHookSessionInit"),description:n("fieldHookSessionInitDesc")},{path:"hooks.subagent-init",label:n("fieldHookSubagentInit"),description:n("fieldHookSubagentInitDesc")},{path:"hooks.descriptive-name",label:n("fieldHookDescriptiveName"),description:n("fieldHookDescriptiveNameDesc")},{path:"hooks.dev-rules-reminder",label:n("fieldHookDevRulesReminder"),description:n("fieldHookDevRulesReminderDesc")},{path:"hooks.usage-context-awareness",label:n("fieldHookUsageContextAwareness"),description:n("fieldHookUsageContextAwarenessDesc")},{path:"hooks.context-tracking",label:n("fieldHookContextTracking"),description:n("fieldHookContextTrackingDesc")},{path:"hooks.scout-block",label:n("fieldHookScoutBlock"),description:n("fieldHookScoutBlockDesc")},{path:"hooks.privacy-block",label:n("fieldHookPrivacyBlock"),description:n("fieldHookPrivacyBlockDesc")},{path:"hooks.post-edit-simplify-reminder",label:n("fieldHookPostEditSimplify"),description:n("fieldHookPostEditSimplifyDesc")}]},{id:"advanced",title:n("sectionAdvanced"),defaultCollapsed:!0,fields:[{path:"docs.maxLoc",label:n("fieldDocsMaxLoc"),description:n("fieldDocsMaxLocDesc")},{path:"plan.namingFormat",label:n("fieldPlanNamingFormat"),description:n("fieldPlanNamingFormatDesc")},{path:"plan.dateFormat",label:n("fieldPlanDateFormat"),description:n("fieldPlanDateFormatDesc")},{path:"plan.validation.mode",label:n("fieldPlanValidationMode"),description:n("fieldPlanValidationModeDesc")},{path:"plan.validation.minQuestions",label:n("fieldPlanMinQuestions"),description:n("fieldPlanMinQuestionsDesc")},{path:"plan.validation.maxQuestions",label:n("fieldPlanMaxQuestions"),description:n("fieldPlanMaxQuestionsDesc")},{path:"assertions",label:n("fieldAssertions"),description:n("fieldAssertionsDesc")}]}],[n]),w=b.showResetConfirm?h.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:[h.jsx("span",{className:"text-xs text-red-500 font-medium",children:n("confirmReset")}),h.jsx("button",{type:"button",onClick:b.handleReset,className:"px-2 py-0.5 rounded bg-red-500 text-white text-xs font-bold hover:bg-red-600 transition-colors",children:n("confirm")}),h.jsx("button",{type:"button",onClick:()=>b.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:n("cancel")})]}):h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button",onClick:()=>b.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:n("resetToDefault")}),h.jsx("button",{type:"button",onClick:b.handleSave,disabled:!!b.syntaxError||b.saveStatus==="saving",className:`px-3 py-1.5 rounded-lg text-xs font-bold transition-all tracking-widest uppercase ${b.syntaxError?"bg-dash-surface text-dash-text-muted cursor-not-allowed border border-dash-border":b.saveStatus==="saved"?"bg-green-500 text-white shadow-lg shadow-green-500/20":b.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:b.saveStatus==="saving"?n("saving"):b.saveStatus==="saved"?n("saved"):b.saveStatus==="error"?n("saveFailed"):n("saveChanges")})]});return h.jsxs("div",{className:"animate-in fade-in duration-300 w-full h-full flex flex-col transition-colors",children:[h.jsx(Vm,{title:n("globalConfig"),filePath:"~/.claude/.ck.json",onBack:()=>e(-1),onSave:b.handleSave,onReset:b.handleReset,saveStatus:b.saveStatus,syntaxError:b.syntaxError,showResetConfirm:b.showResetConfirm,setShowResetConfirm:b.setShowResetConfirm,showActions:!1,showFilePath:!1}),h.jsxs("div",{className:"mb-3 shrink-0 flex items-center justify-between gap-3",children:[h.jsxs("div",{role:"tablist","aria-label":n("globalConfig"),className:"inline-flex items-center rounded-xl border border-dash-border bg-dash-surface p-1 shadow-sm",children:[h.jsx("button",{role:"tab","aria-selected":t==="config",onClick:()=>r("config"),className:`dash-focus-ring px-4 py-2 rounded-lg text-sm font-semibold transition-colors ${t==="config"?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-muted hover:text-dash-text hover:bg-dash-surface-hover"}`,children:n("configTab")}),h.jsx("button",{role:"tab","aria-selected":t==="metadata",onClick:()=>r("metadata"),className:`dash-focus-ring px-4 py-2 rounded-lg text-sm font-semibold transition-colors ${t==="metadata"?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-muted hover:text-dash-text hover:bg-dash-surface-hover"}`,children:n("systemTab")})]}),h.jsx("p",{className:"hidden lg:block text-xs text-dash-text-muted",children:n("configWorkspaceHint")})]}),h.jsxs("div",{className:"flex-1 flex min-h-0",children:[t==="config"&&h.jsxs(h.Fragment,{children:[h.jsx(zm,{width:o[0],isLoading:b.isLoading,schema:b.schema,config:b.config,sources:b.sources,sections:x,onChange:b.handleFormChange}),h.jsx(Pr,{direction:"horizontal",isDragging:a,onMouseDown:v=>l(0,v)}),h.jsx(rd,{width:o[1],isLoading:b.isLoading,jsonText:b.jsonText,cursorLine:b.cursorLine,syntaxError:b.syntaxError,onChange:b.handleJsonChange,onCursorLineChange:b.setCursorLine,headerPath:"~/.claude/.ck.json",headerActions:w}),h.jsx(Pr,{direction:"horizontal",isDragging:a,onMouseDown:v=>l(1,v)}),h.jsx(Ib,{width:o[2],fieldDoc:b.fieldDoc,activeFieldPath:b.activeFieldPath})]}),t==="metadata"&&h.jsxs("div",{className:"flex-1 min-h-0 flex",children:[h.jsx("div",{style:{width:`${c[0]}%`},className:"min-w-0 h-full overflow-auto pr-1",children:b.isLoading?h.jsx("div",{className:"dash-panel h-full flex items-center justify-center",children:h.jsx("div",{className:"animate-pulse text-dash-text-muted text-sm",children:n("loading")})}):h.jsx(JC,{metadata:i})}),h.jsx(Pr,{direction:"horizontal",isDragging:d,onMouseDown:v=>u(0,v)}),h.jsx("div",{style:{width:`${c[1]}%`},className:"min-w-0 h-full overflow-hidden",children:h.jsx(YC,{})})]})]})]})};function ej({phase:n}){const e=n.status==="completed"?"border-green-500":n.status==="in-progress"?"border-blue-500":"border-amber-400";return h.jsx("div",{className:`rounded border-l-4 ${e} bg-white dark:bg-gray-800 p-3 shadow-sm`,children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-xs font-mono text-gray-400 dark:text-gray-500",children:n.phaseId}),h.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:n.name})]})})}function Fl({title:n,phases:e,borderColor:t}){return h.jsxs("div",{className:"flex flex-1 flex-col gap-3 min-w-0","aria-label":`${n} phases`,children:[h.jsxs("div",{className:`rounded-t border-t-2 ${t} bg-gray-50 dark:bg-gray-900 px-3 py-2`,children:[h.jsx("span",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:n}),h.jsx("span",{className:"ml-2 text-xs text-gray-400",children:e.length})]}),h.jsx("div",{className:"flex flex-col gap-2 px-1",children:e.map((r,i)=>h.jsx(ej,{phase:r},`${r.phaseId}-${i}`))})]})}function tj({completed:n,total:e}){const{t}=ce(),r=e===0?0:Math.round(n/e*100);return h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsxs("div",{className:"flex justify-between text-xs text-gray-500 dark:text-gray-400",children:[h.jsx("span",{children:t("kanbanProgress")}),h.jsxs("span",{children:[n,"/",e," ",t("kanbanPhases")," — ",r,"% ",t("kanbanComplete")]})]}),h.jsx("div",{className:"h-2 w-full rounded bg-gray-200 dark:bg-gray-700",children:h.jsx("div",{className:"h-2 rounded bg-green-500 transition-all",style:{width:`${r}%`}})})]})}function nj(){const{t:n}=ce(),[e]=sv(),t=e.get("file")??"",[r,i]=g.useState([]),[s,o]=g.useState(!1),[a,l]=g.useState(null);if(g.useEffect(()=>{t&&(o(!0),l(null),i([]),fetch(`/api/plan/parse?file=${encodeURIComponent(t)}`).then(p=>{if(!p.ok){const m={400:"kanbanError400",403:"kanbanError403",404:"kanbanError404"};throw new Error(m[p.status]??`error:HTTP:${p.status}`)}return p.json()}).then(p=>i(p.phases)).catch(p=>l(p instanceof Error?p.message:String(p))).finally(()=>o(!1)))},[t]),!t)return h.jsx("div",{className:"flex h-full items-center justify-center text-gray-400 dark:text-gray-500",children:n("kanbanNoFile")});let c=[],d=[],u=[],f=null;try{c=r.filter(p=>p.status==="pending"),d=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?h.jsx("div",{className:"flex h-full items-center justify-center text-red-500 dark:text-red-400",children:n("kanbanLoadError")}):h.jsxs("div",{className:"flex h-full flex-col gap-4 p-6",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-white",children:n("kanbanTitle")}),h.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 truncate max-w-xs",title:t,children:t.replaceAll("\\","/")})]}),r.length>0&&h.jsx(tj,{completed:u.length,total:r.length}),s&&h.jsx("div",{className:"flex flex-1 items-center justify-center text-gray-400",children:n("loading")}),a&&h.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:[n("error"),":"," ",a in{kanbanError400:"",kanbanError403:"",kanbanError404:""}?n(a):a]}),!s&&!a&&r.length===0&&h.jsx("div",{className:"flex flex-1 items-center justify-center text-gray-400 dark:text-gray-500",children:n("kanbanNoPhases")}),!s&&!a&&r.length>0&&h.jsxs("section",{"aria-label":n("kanbanTitle"),className:"flex flex-1 flex-col gap-4 overflow-auto md:flex-row",children:[h.jsx(Fl,{title:n("kanbanStatus_pending"),phases:c,borderColor:"border-amber-400"}),h.jsx(Fl,{title:n("kanbanStatus_in-progress"),phases:d,borderColor:"border-blue-500"}),h.jsx(Fl,{title:n("kanbanStatus_completed"),phases:u,borderColor:"border-green-500"})]})]})}const lp=[{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"}],rj=new Set([8203,8204,8205,8288,65279,8232,8233,8234,8235,8236,8237,8238,8294,8295,8296,8297]);function ij(n){return n===9||n===10||n===13?!0:n>=0&&n<=8||n>=11&&n<=31||n>=127&&n<=159||rj.has(n)}function Xn(n){let e="";for(const t of n){const r=t.codePointAt(0);r!==void 0&&(ij(r)||(e+=t))}return e}function cp(n){if(!n)return"-";const e=n.replace(/\\/g,"/"),t=e.match(/.*\/(\.[^/]+\/)/);if(t?.[1]){const i=(t.index??0)+t[0].length-t[1].length;return e.slice(i)}const r=e.split("/");return r.length>3?`.../${r.slice(-3).join("/")}`:e}function jr(n){return n.success?n.skipped?"skipped":"installed":"failed"}function sj(n){const e={installed:0,skipped:0,failed:0};for(const t of n){const r=jr(t);r==="installed"?e.installed+=1:r==="skipped"?e.skipped+=1:e.failed+=1}return e}function _b(n){switch(n){case"agent":case"command":case"skill":case"config":case"rules":case"hooks":case"unknown":return n;default:return"unknown"}}function oj(n,e){switch(n){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 aj(n){const e=new Map;for(const t of n){const r=_b(t.portableType),i=e.get(r)||[];i.push(t),e.set(r,i)}return e}function lj(n){return[_b(n.portableType),n.provider,n.providerDisplayName,n.itemName,n.path,n.success,n.skipped,n.overwritten,n.error,n.skipReason].map(t=>t===void 0?"":String(t)).join("|")}function cj(n){if(n.length===0)return!0;const e=n[0].provider;return n.every(t=>t.provider===e)}const Lr=({label:n,count:e,className:t})=>e<=0?null:h.jsxs("span",{className:`inline-flex items-center gap-1 rounded-md border px-2.5 py-1 text-xs ${t}`,children:[h.jsx("span",{className:"font-semibold",children:e}),h.jsx("span",{children:n})]}),hp=({labelKey:n,badgeClass:e,items:t,isExpanded:r,onToggle:i,singleProvider:s})=>{const{t:o}=ce(),a=t.filter(f=>jr(f)==="installed").length,l=t.filter(f=>jr(f)==="skipped").length,c=t.filter(f=>jr(f)==="failed").length,d=s?"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 h.jsxs("div",{className:"rounded-xl border border-dash-border bg-dash-surface overflow-hidden",children:[h.jsxs("button",{type:"button",onClick:i,className:"w-full flex flex-wrap items-center gap-2 px-4 py-3 text-left hover:bg-dash-surface-hover transition-colors",children:[h.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:h.jsx("path",{d:"M9 5l7 7-7 7"})}),h.jsx("p",{className:"text-sm font-semibold text-dash-text",children:o(n)}),h.jsx("span",{className:`inline-flex items-center rounded-full border px-2 py-0.5 text-[11px] font-semibold ${e}`,children:t.length}),h.jsx("span",{className:"hidden sm:block flex-1"}),h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[11px]",children:[h.jsx(Lr,{label:o("migrateStatusInstalled"),count:a,className:"border-green-500/30 bg-green-500/10 text-green-400"}),h.jsx(Lr,{label:o("migrateStatusSkipped"),count:l,className:"border-yellow-500/30 bg-yellow-500/10 text-yellow-400"}),h.jsx(Lr,{label:o("migrateStatusFailed"),count:c,className:"border-red-500/30 bg-red-500/10 text-red-400"})]})]}),r&&h.jsxs("div",{className:"border-t border-dash-border/80",children:[h.jsxs("div",{className:`hidden md:grid ${d} 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:[h.jsx("p",{children:o("migrateItem")}),!s&&h.jsx("p",{children:o("migrateProvider")}),h.jsx("p",{children:o("migratePath")}),h.jsx("p",{children:o("migrateStatus")}),h.jsx("p",{children:o("migrateError")})]}),h.jsx("div",{className:"divide-y divide-dash-border/70",children:t.map(f=>{const p=lj(f),m=u.get(p)??0;u.set(p,m+1);const b=m===0?p:`${p}#${m}`,x=jr(f),w=oj(x,o),v=Xn(f.itemName||cp(f.path)),S=Xn(f.providerDisplayName||f.provider||""),j=Xn(f.path||""),k=Xn(cp(f.path)),O=Xn(f.error||f.skipReason||"");return h.jsxs("div",{className:`grid gap-1.5 ${d} items-start px-4 py-2.5 hover:bg-dash-bg/60 transition-colors`,children:[h.jsxs("div",{className:"min-w-0",children:[h.jsx("p",{className:"text-xs font-semibold text-dash-text truncate",title:v,children:v}),h.jsxs("div",{className:"mt-0.5 space-y-0.5 md:hidden",children:[!s&&h.jsx("p",{className:"text-[11px] text-dash-text-secondary truncate",children:S}),h.jsx("p",{className:"font-mono text-[11px] text-dash-text-muted truncate",title:j,children:k}),O&&h.jsx("p",{className:"text-[11px] text-red-400/80 line-clamp-2",title:O,children:O})]})]}),!s&&h.jsx("p",{className:"hidden md:block text-[11px] text-dash-text-secondary truncate",children:S}),h.jsx("p",{className:"hidden md:block font-mono text-[11px] text-dash-text-muted truncate",title:j,children:k}),h.jsx("span",{className:`inline-flex w-fit items-center rounded-full border px-2 py-0.5 text-[11px] font-medium ${w.className}`,children:w.label}),h.jsx("p",{className:`hidden md:block text-[11px] truncate ${O?"text-red-400/80":"text-dash-text-muted"}`,title:O,children:O||"-"})]},b)})})]})]})},hj=({results:n,onReset:e})=>{const{t}=ce(),[r,i]=g.useState(""),s=g.useDeferredValue(r),[o,a]=g.useState("all"),[l,c]=g.useState(()=>new Set(lp.map(j=>j.key))),d=g.useMemo(()=>{const j=s.trim().toLowerCase();return n.results.filter(k=>{if(o!=="all"&&jr(k)!==o)return!1;if(!j)return!0;const O=(k.itemName||"").toLowerCase(),y=(k.path||"").toLowerCase(),D=(k.providerDisplayName||k.provider||"").toLowerCase();return O.includes(j)||y.includes(j)||D.includes(j)})},[n.results,s,o]),u=g.useMemo(()=>cj(d),[d]),f=g.useMemo(()=>{if(!u||d.length===0)return"";const j=Array.from(new Set(d.map(k=>k.providerDisplayName?.trim()||"").filter(k=>k.length>0)));return j.length===1?j[0]:d[0]?.provider||""},[d,u]),p=g.useMemo(()=>aj(d),[d]),m=g.useMemo(()=>sj(n.results),[n.results]),b=g.useMemo(()=>[...p.keys()],[p]),x=m.installed+m.skipped+m.failed,w=b.length>0&&b.every(j=>l.has(j)),v=j=>{c(k=>{const O=new Set(k);return O.has(j)?O.delete(j):O.add(j),O})},S=()=>{if(w){c(new Set);return}c(new Set(b))};return h.jsxs("div",{className:"dash-panel p-4 md:p-5 space-y-4",children:[h.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-start md:justify-between",children:[h.jsxs("div",{children:[h.jsxs("h2",{className:"text-base font-semibold text-dash-text",children:[t("migrateSummaryTitle"),u&&f&&h.jsxs("span",{className:"text-dash-text-muted font-normal",children:[" ","· ",Xn(f)]})]}),h.jsxs("p",{className:"text-xs text-dash-text-muted mt-1",children:[x," ",t("migrateSummarySubtitle")]})]}),h.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:t("migrateSummaryNewMigration")})]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[h.jsx(Lr,{label:t("migrateStatusInstalled"),count:m.installed,className:"border-green-500/30 bg-green-500/10 text-green-400"}),h.jsx(Lr,{label:t("migrateStatusSkipped"),count:m.skipped,className:"border-yellow-500/30 bg-yellow-500/10 text-yellow-400"}),h.jsx(Lr,{label:t("migrateStatusFailed"),count:m.failed,className:"border-red-500/30 bg-red-500/10 text-red-400"})]}),n.warnings.length>0&&h.jsx("div",{className:"space-y-2",children:n.warnings.map((j,k)=>h.jsx("div",{className:"px-3 py-2 border border-yellow-500/30 bg-yellow-500/10 rounded-md text-xs text-yellow-400",children:Xn(j)},k))}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsxs("div",{className:"relative",children:[h.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:[h.jsx("circle",{cx:"11",cy:"11",r:"8"}),h.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),h.jsx("input",{type:"text",value:r,onChange:j=>i(j.target.value),placeholder:t("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"})]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[["all","installed","skipped","failed"].map(j=>{const k=j==="all"?"migrateSummaryFilterAll":j==="installed"?"migrateStatusInstalled":j==="skipped"?"migrateStatusSkipped":"migrateStatusFailed";return h.jsx("button",{type:"button",onClick:()=>a(j),className:`dash-focus-ring px-3 py-1 text-xs font-medium rounded-full border transition-colors ${o===j?"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:t(k)},j)}),h.jsx("button",{type:"button",onClick:S,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:t(w?"migrateSummaryCollapseAll":"migrateSummaryExpandAll")})]})]}),d.length===0?h.jsx("div",{className:"text-center py-8 text-sm text-dash-text-muted",children:t("migrateSummaryNoResults")}):h.jsxs("div",{className:"space-y-2.5",children:[lp.map(j=>{const k=p.get(j.key);return!k||k.length===0?null:h.jsx(hp,{labelKey:j.labelKey,badgeClass:j.badgeClass,items:k,isExpanded:l.has(j.key),onToggle:()=>v(j.key),singleProvider:u},j.key)}),(()=>{const j=p.get("unknown");return!j||j.length===0?null:h.jsx(hp,{labelKey:"migrateTypeUnknown",badgeClass:"border-dash-border text-dash-text-muted",items:j,isExpanded:l.has("unknown"),onToggle:()=>v("unknown"),singleProvider:u})})()]})]})},dj=500;function uj(n){return n>=0&&n<=8||n>=11&&n<=31||n>=127&&n<=159}function fj(n){let e="";for(const t of n){const r=t.codePointAt(0);r!==void 0&&(uj(r)||(e+=t))}return e}const pj=({diff:n,className:e=""})=>{const t=n.split(`
220
+ `),r=t.slice(0,dj),i=t.length-r.length;return h.jsxs("pre",{className:`text-xs font-mono overflow-x-auto p-3 rounded bg-dash-bg border border-dash-border ${e}`,children:[r.map((s,o)=>{const a=fj(s);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"),h.jsx("div",{className:l,children:a},`${o}:${a.slice(0,24)}`)}),i>0&&h.jsxs("div",{className:"text-dash-text-muted",children:["... truncated ",i," additional line(s)"]})]})};function mj(n){return n>=0&&n<=8||n>=11&&n<=31||n>=127&&n<=159}function mi(n){let e="";for(const t of n){const r=t.codePointAt(0);r!==void 0&&(mj(r)||(e+=t))}return e}const gj=({action:n,resolution:e,onResolve:t})=>{const{t:r}=ce(),[i,s]=g.useState(!1),o=n.ownedSections&&n.ownedSections.length>0;return h.jsxs("div",{className:"border border-dash-border rounded-lg p-4 mb-3 bg-dash-surface",children:[h.jsxs("div",{className:"flex justify-between items-start gap-4",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"font-mono text-sm text-dash-text truncate",children:[mi(n.provider),"/",mi(n.type),"/",mi(n.item)]}),h.jsx("p",{className:"text-xs text-dash-text-muted mt-1",children:mi(n.reason)}),n.targetPath&&h.jsx("p",{className:"text-xs text-dash-text-secondary mt-1 font-mono truncate",children:mi(n.targetPath)})]}),h.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[h.jsx("button",{type:"button",onClick:()=>t({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")}),h.jsx("button",{type:"button",onClick:()=>t({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&&h.jsx("button",{type:"button",onClick:()=>t({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")}),n.diff&&h.jsx("button",{type:"button",onClick:()=>s(!i),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(i?"migrateConflictHideDiff":"migrateConflictShowDiff")})]})]}),i&&n.diff&&h.jsx(pj,{diff:n.diff,className:"mt-3"}),e&&h.jsxs("div",{className:"mt-2 text-xs text-green-400 flex items-center gap-1.5",children:[h.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 20 20",children:h.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"})}),h.jsxs("span",{children:[r("migrateConflictResolved"),": ",bj(e.type,r)]})]})]})};function bj(n,e){switch(n){case"overwrite":return e("migrateConflictUseCK");case"keep":return e("migrateConflictKeepMine");case"smart-merge":return e("migrateConflictSmartMerge");case"resolved":return e("migrateConflictManual");default:return String(n)}}const xj=[{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"}],dp=["agent","command","skill","config","rules","hooks"],yj={agent:"migrateTypeAgents",command:"migrateTypeCommands",skill:"migrateTypeSkills",config:"migrateTypeConfig",rules:"migrateTypeRules",hooks:"migrateTypeHooks"},vj={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"},mr=200;function wj(n){return n>=0&&n<=8||n>=11&&n<=31||n>=127&&n<=159}function $o(n){let e="";for(const t of n){const r=t.codePointAt(0);r!==void 0&&(wj(r)||(e+=t))}return e}function kj(n){const e={install:[],update:[],skip:[],conflict:[],delete:[]};for(const t of n)e[t.action].push(t);return e}function Sj(n){const e=new Map;for(const t of n){const r=e.get(t.type)||[];r.push(t),e.set(t.type,r)}return e}const Cj=({plan:n,resolutions:e,onResolve:t,actionKey:r})=>{const{t:i}=ce(),s=g.useMemo(()=>kj(n.actions),[n.actions]),o=g.useMemo(()=>xj.filter(f=>s[f.key].length>0),[s]),[a,l]=g.useState(()=>s.conflict.length>0?"conflict":s.install.length>0?"install":o[0]?.key??"install");g.useEffect(()=>{s[a]?.length===0&&o.length>0&&l(o[0].key)},[s,a,o]);const c=g.useMemo(()=>s[a]??[],[s,a]),d=g.useMemo(()=>Sj(c),[c]),u=f=>{for(const p of s.conflict)t(p,{type:f})};return h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[n.summary.install>0&&h.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-green-500/10 border border-green-500/30 text-green-400",children:[n.summary.install," ",i("migrateActionInstall")]}),n.summary.update>0&&h.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-yellow-500/10 border border-yellow-500/30 text-yellow-400",children:[n.summary.update," ",i("migrateActionUpdate")]}),n.summary.skip>0&&h.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-dash-bg border border-dash-border text-dash-text-muted",children:[n.summary.skip," ",i("migrateActionSkip")]}),n.summary.conflict>0&&h.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-red-500/10 border border-red-500/30 text-red-400",children:[n.summary.conflict," ",i("migrateActionConflict")]}),n.summary.delete>0&&h.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-dash-bg border border-dash-border text-dash-text-secondary",children:[n.summary.delete," ",i("migrateActionDelete")]})]}),o.length>1&&h.jsx("div",{className:"flex gap-1 border-b border-dash-border",children:o.map(f=>{const p=a===f.key;return h.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:[i(f.labelKey)," ",h.jsx("span",{className:`ml-1 px-1.5 py-0.5 rounded text-[10px] border ${f.badgeClass}`,children:s[f.key].length})]},f.key)})}),a==="conflict"&&s.conflict.length>0&&h.jsxs("div",{className:"flex items-center justify-between gap-3",children:[h.jsxs("h3",{className:"text-sm font-semibold text-red-400",children:[i("migrateConflictSectionTitle")," (",s.conflict.length,")"]}),h.jsxs("div",{className:"flex gap-2",children:[h.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:i("migrateConflictOverwriteAll")}),h.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:i("migrateConflictKeepAll")})]})]}),a==="conflict"?dp.map(f=>{const p=d.get(f);return!p||p.length===0?null:h.jsxs(up,{type:f,count:p.length,children:[p.slice(0,mr).map(m=>h.jsx(gj,{action:m,resolution:e.get(r(m))||null,onResolve:b=>t(m,b)},r(m))),p.length>mr&&h.jsxs("div",{className:"text-xs text-dash-text-muted",children:["... ",p.length-mr," more"]})]},`${a}:${f}`)}):dp.map(f=>{const p=d.get(f);return!p||p.length===0?null:h.jsxs(up,{type:f,count:p.length,defaultExpanded:a!=="skip",children:[p.slice(0,mr).map(m=>h.jsx(jj,{action:m},`${m.provider}:${m.type}:${m.item}:${m.global}:${m.action}`)),p.length>mr&&h.jsxs("div",{className:"text-xs text-dash-text-muted",children:["... ",p.length-mr," more"]})]},`${a}:${f}`)})]})},up=({type:n,count:e,defaultExpanded:t=!0,children:r})=>{const{t:i}=ce(),[s,o]=g.useState(t),a=vj[n],l=i(yj[n]);return h.jsxs("div",{className:"border border-dash-border rounded-lg bg-dash-surface",children:[h.jsxs("button",{type:"button","aria-expanded":s,onClick:()=>o(!s),className:"w-full px-4 py-2.5 flex items-center justify-between text-left hover:bg-dash-surface-hover transition-colors",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h4",{className:"text-sm font-semibold text-dash-text",children:l}),h.jsx("span",{className:`px-2 py-0.5 text-xs rounded-md border ${a}`,children:e})]}),h.jsx("svg",{"aria-hidden":"true",className:`w-4 h-4 text-dash-text-muted transition-transform ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),s&&h.jsx("div",{className:"px-4 pt-1 pb-4 space-y-2",children:r})]})},jj=({action:n})=>h.jsxs("div",{className:"px-3 py-2 bg-dash-bg rounded-md border border-dash-border",children:[h.jsxs("div",{className:"font-mono text-xs text-dash-text",children:[$o(n.provider),"/",$o(n.item)]}),h.jsx("div",{className:"text-xs text-dash-text-muted mt-1",children:$o(n.reason)}),n.targetPath&&h.jsx("div",{className:"text-xs text-dash-text-secondary mt-0.5 font-mono truncate",children:$o(n.targetPath)})]});var Oj=function(e){return typeof window<"u"?matchMedia&&matchMedia("(prefers-color-scheme: ".concat(e,")")):{matches:!1}},Vl,Pj=g.createContext({appearance:"light",setAppearance:function(){},isDarkMode:!1,themeMode:"light",setThemeMode:function(){},browserPrefers:(Vl=Oj("dark"))!==null&&Vl!==void 0&&Vl.matches?"dark":"light"}),Nj=function(){return g.useContext(Pj)};const Hb=(n,e)=>{if(e)return"row";switch(n){case"horizontal":return"row";case"horizontal-reverse":return"row-reverse";case"vertical":default:return"column";case"vertical-reverse":return"column-reverse"}},Aj=n=>{if(n)return["space-between","space-around","space-evenly"].includes(n)},Mj=(n,e)=>Hb(n,e)==="row",gr=n=>typeof n=="number"?`${n}px`:n,Dj=({visible:n,flex:e,gap:t,direction:r,horizontal:i,align:s,justify:o,distribution:a,height:l,width:c,padding:d,paddingInline:u,paddingBlock:f,prefixCls:p,as:m="div",className:b,style:x,children:w,wrap:v,ref:S,...j})=>{const k=o||a,y=Mj(r,i)&&!c&&Aj(k)?"100%":gr(c),D={...e!==void 0?{"--lobe-flex":String(e)}:{},...r||i?{"--lobe-flex-direction":Hb(r,i)}:{},...v!==void 0?{"--lobe-flex-wrap":v}:{},...k!==void 0?{"--lobe-flex-justify":k}:{},...s!==void 0?{"--lobe-flex-align":s}:{},...y!==void 0?{"--lobe-flex-width":y}:{},...l!==void 0?{"--lobe-flex-height":gr(l)}:{},...d!==void 0?{"--lobe-flex-padding":gr(d)}:{},...u!==void 0?{"--lobe-flex-padding-inline":gr(u)}:{},...f!==void 0?{"--lobe-flex-padding-block":gr(f)}:{},...t!==void 0?{"--lobe-flex-gap":gr(t)}:{},...x},A="lobe-flex",R=[A,n===!1?`${A}--hidden`:void 0,p?`${p}-flex`:void 0,b].filter(Boolean).join(" ");return h.jsx(m,{ref:S,...j,className:R,style:D,children:w})};var Wb=g.memo(Dj);const Tj=({children:n,ref:e,...t})=>h.jsx(Wb,{...t,align:"center",justify:"center",ref:e,children:n});var Ej=Tj;const Rj=/\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;function Lj(n){return Array.from(n.match(Rj)??[])}function Ij(n){return Lj(n).map(t=>t.toLowerCase()).join("-")}g.createContext(null);var $j=function(e,t){if(t){if(e&&t==="#000")return"0 0 0 1px rgba(255,255,255,0.1) inset";if(!e&&t==="#fff")return"0 0 0 1px rgba(0,0,0,0.05) inset"}};function es(n){"@babel/helpers - typeof";return es=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},es(n)}var Bj=["shape","color","background","size","style","iconMultiple","Icon","iconStyle","iconClassName"];function fp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Bo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fp(Object(t),!0).forEach(function(r){Fj(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):fp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Fj(n,e,t){return e=Vj(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Vj(n){var e=zj(n,"string");return es(e)=="symbol"?e:String(e)}function zj(n,e){if(es(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(es(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function _j(n,e){if(n==null)return{};var t=Hj(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function Hj(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var _n=g.memo(function(n){var e=n.shape,t=e===void 0?"circle":e,r=n.color,i=r===void 0?"#fff":r,s=n.background,o=n.size,a=n.style,l=n.iconMultiple,c=l===void 0?.75:l,d=n.Icon,u=n.iconStyle,f=n.iconClassName,p=_j(n,Bj),m=Nj(),b=m.isDarkMode;return h.jsx(Ej,Bo(Bo({flex:"none",style:Bo({background:s,borderRadius:t==="circle"?"50%":Math.floor(o*.1),boxShadow:$j(b,s),color:i,height:o,width:o},a)},p),{},{children:d&&h.jsx(d,{className:f,color:i,size:o,style:Bo({transform:"scale(".concat(c,")")},u)})}))});function ts(n){"@babel/helpers - typeof";return ts=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},ts(n)}var Wj=["Icon","style","Text","color","size","spaceMultiple","textMultiple","extra","extraStyle","showText","showLogo","extraClassName","iconProps","inverse"];function pp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function kn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?pp(Object(t),!0).forEach(function(r){Uj(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):pp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Uj(n,e,t){return e=Kj(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kj(n){var e=Gj(n,"string");return ts(e)=="symbol"?e:String(e)}function Gj(n,e){if(ts(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ts(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function qj(n,e){if(n==null)return{};var t=Jj(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function Jj(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var Hn=g.memo(function(n){var e=n.Icon,t=n.style,r=n.Text,i=n.color,s=n.size,o=s===void 0?24:s,a=n.spaceMultiple,l=a===void 0?1:a,c=n.textMultiple,d=c===void 0?1:c,u=n.extra,f=n.extraStyle,p=n.showText,m=p===void 0?!0:p,b=n.showLogo,x=b===void 0?!0:b,w=n.extraClassName,v=n.iconProps,S=n.inverse,j=qj(n,Wj),k=e&&x&&h.jsx(e,kn(kn({size:o},v),{},{style:kn(S?{marginLeft:o*l}:{marginRight:o*l},v?.style)})),O=m&&r&&h.jsx(r,{size:o*d});return h.jsxs(Wb,kn(kn({align:"center",flex:"none",horizontal:!0,justify:"flex-start",style:kn({color:i},t)},j),{},{children:[S?h.jsxs(h.Fragment,{children:[O,k]}):h.jsxs(h.Fragment,{children:[k,O]}),u&&h.jsx("span",{className:w,style:kn({fontSize:o*d*.95,lineHeight:1},f),children:u})]}))}),Yj=function(e,t){return g.useMemo(function(){var r=Array.from({length:t},function(i,s){var o="lobe-icons-".concat(Ij(e),"-fill-").concat(s);return{fill:"url(#".concat(o,")"),id:o}});return r},[e,t])},Jr="Claude",Qj=.8,Xj=.1,Ub="#D97757",Zj=Ub,e6="#fff",t6=.75;function ns(n){"@babel/helpers - typeof";return ns=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},ns(n)}var n6=["size","style"];function mp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function zl(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?mp(Object(t),!0).forEach(function(r){r6(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):mp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function r6(n,e,t){return e=i6(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function i6(n){var e=s6(n,"string");return ns(e)=="symbol"?e:String(e)}function s6(n,e){if(ns(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ns(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function o6(n,e){if(n==null)return{};var t=a6(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function a6(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var sd=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=o6(n,n6);return h.jsxs("svg",zl(zl({fill:"currentColor",fillRule:"evenodd",height:t,style:zl({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:t,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Jr}),h.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 rs(n){"@babel/helpers - typeof";return rs=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},rs(n)}function gp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function l6(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?gp(Object(t),!0).forEach(function(r){c6(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):gp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function c6(n,e,t){return e=h6(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function h6(n){var e=d6(n,"string");return rs(e)=="symbol"?e:String(e)}function d6(n,e){if(rs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(rs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function u6(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var f6=g.memo(function(n){var e=Object.assign({},(u6(n),n));return h.jsx(_n,l6({Icon:sd,"aria-label":Jr,background:Zj,color:e6,iconMultiple:t6},e))});function is(n){"@babel/helpers - typeof";return is=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},is(n)}var p6=["size","style"];function bp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function _l(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bp(Object(t),!0).forEach(function(r){m6(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):bp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function m6(n,e,t){return e=g6(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function g6(n){var e=b6(n,"string");return is(e)=="symbol"?e:String(e)}function b6(n,e){if(is(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(is(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function x6(n,e){if(n==null)return{};var t=y6(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function y6(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var Kb=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=x6(n,p6);return h.jsxs("svg",_l(_l({height:t,style:_l({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:t,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Jr}),h.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 ss(n){"@babel/helpers - typeof";return ss=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},ss(n)}var v6=["size","style"];function xp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Hl(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xp(Object(t),!0).forEach(function(r){w6(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):xp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function w6(n,e,t){return e=k6(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function k6(n){var e=S6(n,"string");return ss(e)=="symbol"?e:String(e)}function S6(n,e){if(ss(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ss(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function C6(n,e){if(n==null)return{};var t=j6(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function j6(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var Gb=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=C6(n,v6);return h.jsxs("svg",Hl(Hl({fill:"currentColor",fillRule:"nonzero",height:t,style:Hl({flex:"none",lineHeight:1},r),viewBox:"0 0 97 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Jr}),h.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 os(n){"@babel/helpers - typeof";return os=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},os(n)}var O6=["type"];function yp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function P6(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?yp(Object(t),!0).forEach(function(r){N6(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):yp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function N6(n,e,t){return e=A6(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function A6(n){var e=M6(n,"string");return os(e)=="symbol"?e:String(e)}function M6(n,e){if(os(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(os(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function D6(n,e){if(n==null)return{};var t=T6(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function T6(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var E6=g.memo(function(n){var e=n.type,t=e===void 0?"mono":e,r=D6(n,O6),i=t==="color"?Kb:sd;return h.jsx(Hn,P6({Icon:i,Text:Gb,"aria-label":Jr,spaceMultiple:Xj,textMultiple:Qj},r))}),ur=sd;ur.Color=Kb;ur.Text=Gb;ur.Combine=E6;ur.Avatar=f6;ur.colorPrimary=Ub;ur.title=Jr;var Gs="OpenAI",R6=.75,L6=.1,qb="#000",Jb="#19C37D",Yb="#AB68FF",Qb="#F86AA4",od="#F9C322",Xb="#0099FF",Zb="#0000FE",I6=qb,$6="#fff",B6=.75;function as(n){"@babel/helpers - typeof";return as=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},as(n)}var F6=["size","style"];function vp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Wl(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vp(Object(t),!0).forEach(function(r){V6(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):vp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function V6(n,e,t){return e=z6(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function z6(n){var e=_6(n,"string");return as(e)=="symbol"?e:String(e)}function _6(n,e){if(as(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(as(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function H6(n,e){if(n==null)return{};var t=W6(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function W6(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var ad=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=H6(n,F6);return h.jsxs("svg",Wl(Wl({fill:"currentColor",fillRule:"evenodd",height:t,style:Wl({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:t,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Gs}),h.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"})]}))}),cr="Gemini",U6=.8,K6=.2,ex="#fff",G6=ex,q6="#fff",J6=.8;function ls(n){"@babel/helpers - typeof";return ls=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},ls(n)}var Y6=["size","style"];function wp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ul(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wp(Object(t),!0).forEach(function(r){Q6(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):wp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Q6(n,e,t){return e=X6(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function X6(n){var e=Z6(n,"string");return ls(e)=="symbol"?e:String(e)}function Z6(n,e){if(ls(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ls(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function eO(n,e){return iO(n)||rO(n,e)||nO(n,e)||tO()}function tO(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
221
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nO(n,e){if(n){if(typeof n=="string")return kp(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return kp(n,e)}}function kp(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function rO(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(n)).next,e!==0)for(;!(l=(r=s.call(t)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function iO(n){if(Array.isArray(n))return n}function sO(n,e){if(n==null)return{};var t=oO(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function oO(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var ld=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=sO(n,Y6),s=Yj(cr,3),o=eO(s,3),a=o[0],l=o[1],c=o[2];return h.jsxs("svg",Ul(Ul({height:t,style:Ul({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:t,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:cr}),h.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"}),h.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}),h.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}),h.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:c.fill}),h.jsxs("defs",{children:[h.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:a.id,x1:"7",x2:"11",y1:"15.5",y2:"12",children:[h.jsx("stop",{stopColor:"#08B962"}),h.jsx("stop",{offset:"1",stopColor:"#08B962",stopOpacity:"0"})]}),h.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:l.id,x1:"8",x2:"11.5",y1:"5.5",y2:"11",children:[h.jsx("stop",{stopColor:"#F94543"}),h.jsx("stop",{offset:"1",stopColor:"#F94543",stopOpacity:"0"})]}),h.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:c.id,x1:"3.5",x2:"17.5",y1:"13.5",y2:"12",children:[h.jsx("stop",{stopColor:"#FABC12"}),h.jsx("stop",{offset:".46",stopColor:"#FABC12",stopOpacity:"0"})]})]})]}))});function cs(n){"@babel/helpers - typeof";return cs=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},cs(n)}function Sp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function aO(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Sp(Object(t),!0).forEach(function(r){lO(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Sp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function lO(n,e,t){return e=cO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cO(n){var e=hO(n,"string");return cs(e)=="symbol"?e:String(e)}function hO(n,e){if(cs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(cs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function dO(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var uO=g.memo(function(n){var e=Object.assign({},(dO(n),n));return h.jsx(_n,aO({Icon:ld,"aria-label":cr,background:G6,color:q6,iconMultiple:J6},e))});function hs(n){"@babel/helpers - typeof";return hs=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},hs(n)}var fO=["size","style"];function Cp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Kl(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Cp(Object(t),!0).forEach(function(r){pO(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Cp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function pO(n,e,t){return e=mO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mO(n){var e=gO(n,"string");return hs(e)=="symbol"?e:String(e)}function gO(n,e){if(hs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(hs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function bO(n,e){if(n==null)return{};var t=xO(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function xO(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var tx=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=bO(n,fO);return h.jsxs("svg",Kl(Kl({fill:"currentColor",fillRule:"evenodd",height:t,style:Kl({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:t,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:cr}),h.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 ds(n){"@babel/helpers - typeof";return ds=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},ds(n)}var yO=["size","style"];function jp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Gl(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?jp(Object(t),!0).forEach(function(r){vO(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):jp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function vO(n,e,t){return e=wO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wO(n){var e=kO(n,"string");return ds(e)=="symbol"?e:String(e)}function kO(n,e){if(ds(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ds(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function SO(n,e){if(n==null)return{};var t=CO(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function CO(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var nx=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=SO(n,yO);return h.jsxs("svg",Gl(Gl({fill:"currentColor",fillRule:"evenodd",height:t,style:Gl({flex:"none",lineHeight:1},r),viewBox:"0 0 98 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:cr}),h.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 us(n){"@babel/helpers - typeof";return us=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},us(n)}var jO=["type"];function Op(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function OO(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Op(Object(t),!0).forEach(function(r){PO(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Op(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function PO(n,e,t){return e=NO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function NO(n){var e=AO(n,"string");return us(e)=="symbol"?e:String(e)}function AO(n,e){if(us(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(us(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function MO(n,e){if(n==null)return{};var t=DO(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function DO(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var TO=g.memo(function(n){var e=n.type,t=e===void 0?"mono":e,r=MO(n,jO),i=t==="color"?ld:tx;return h.jsx(Hn,OO({Icon:i,Text:nx,"aria-label":cr,spaceMultiple:K6,textMultiple:U6},r))}),fr=tx;fr.Color=ld;fr.Text=nx;fr.Combine=TO;fr.Avatar=uO;fr.colorPrimary=ex;fr.title=cr;function fs(n){"@babel/helpers - typeof";return fs=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},fs(n)}var EO=["type"];function Pp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function RO(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Pp(Object(t),!0).forEach(function(r){LO(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Pp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function LO(n,e,t){return e=IO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function IO(n){var e=$O(n,"string");return fs(e)=="symbol"?e:String(e)}function $O(n,e){if(fs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(fs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function BO(n,e){if(n==null)return{};var t=FO(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function FO(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var VO=g.memo(function(n){var e=n.type,t=e===void 0?"normal":e,r=BO(n,EO),i=g.useMemo(function(){switch(t){case"gpt3":return Jb;case"gpt4":return Yb;case"gpt5":return Qb;case"o3":case"o1":return od;case"oss":return Xb;case"platform":return Zb;default:return I6}},[t]);return h.jsx(_n,RO({Icon:ad,"aria-label":Gs,background:i,color:$6,iconMultiple:B6},r))});function ps(n){"@babel/helpers - typeof";return ps=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},ps(n)}var zO=["size","style"];function Np(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ql(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Np(Object(t),!0).forEach(function(r){_O(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Np(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function _O(n,e,t){return e=HO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function HO(n){var e=WO(n,"string");return ps(e)=="symbol"?e:String(e)}function WO(n,e){if(ps(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ps(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function UO(n,e){if(n==null)return{};var t=KO(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function KO(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var rx=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=UO(n,zO);return h.jsxs("svg",ql(ql({fill:"currentColor",fillRule:"evenodd",height:t,style:ql({flex:"none",lineHeight:1},r),viewBox:"0 0 84 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Gs}),h.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 ms(n){"@babel/helpers - typeof";return ms=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},ms(n)}var GO=["extraStyle"];function Ap(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Mp(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ap(Object(t),!0).forEach(function(r){qO(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ap(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function qO(n,e,t){return e=JO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function JO(n){var e=YO(n,"string");return ms(e)=="symbol"?e:String(e)}function YO(n,e){if(ms(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ms(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function QO(n,e){if(n==null)return{};var t=XO(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function XO(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var ZO=g.memo(function(n){var e=n.extraStyle,t=QO(n,GO);return h.jsx(Hn,Mp({Icon:ad,Text:rx,"aria-label":Gs,extraStyle:Mp({fontWeight:600},e),spaceMultiple:L6,textMultiple:R6},t))}),Ct=ad;Ct.Text=rx;Ct.Combine=ZO;Ct.Avatar=VO;Ct.colorPrimary=qb;Ct.colorGpt3=Jb;Ct.colorGpt4=Yb;Ct.colorGpt5=Qb;Ct.colorO1=od;Ct.colorO3=od;Ct.colorOss=Xb;Ct.colorPlatform=Zb;Ct.title=Gs;var qs="GithubCopilot",eP=.75,tP=.3,ix="#000",nP=ix,rP="#fff",iP=.75;function gs(n){"@babel/helpers - typeof";return gs=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},gs(n)}var sP=["size","style"];function Dp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Jl(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Dp(Object(t),!0).forEach(function(r){oP(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Dp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function oP(n,e,t){return e=aP(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function aP(n){var e=lP(n,"string");return gs(e)=="symbol"?e:String(e)}function lP(n,e){if(gs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(gs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function cP(n,e){if(n==null)return{};var t=hP(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function hP(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var cd=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=cP(n,sP);return h.jsxs("svg",Jl(Jl({fill:"currentColor",fillRule:"evenodd",height:t,style:Jl({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:t,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:qs}),h.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 bs(n){"@babel/helpers - typeof";return bs=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},bs(n)}function Tp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function dP(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Tp(Object(t),!0).forEach(function(r){uP(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Tp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function uP(n,e,t){return e=fP(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fP(n){var e=pP(n,"string");return bs(e)=="symbol"?e:String(e)}function pP(n,e){if(bs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(bs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function mP(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var gP=g.memo(function(n){var e=Object.assign({},(mP(n),n));return h.jsx(_n,dP({Icon:cd,"aria-label":qs,background:nP,color:rP,iconMultiple:iP},e))});function xs(n){"@babel/helpers - typeof";return xs=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},xs(n)}var bP=["size","style"];function Ep(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Yl(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ep(Object(t),!0).forEach(function(r){xP(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ep(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function xP(n,e,t){return e=yP(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yP(n){var e=vP(n,"string");return xs(e)=="symbol"?e:String(e)}function vP(n,e){if(xs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(xs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function wP(n,e){if(n==null)return{};var t=kP(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function kP(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var sx=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=wP(n,bP);return h.jsxs("svg",Yl(Yl({fill:"currentColor",fillRule:"evenodd",height:t,style:Yl({flex:"none",lineHeight:1},r),viewBox:"0 0 154 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:qs}),h.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 ys(n){"@babel/helpers - typeof";return ys=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},ys(n)}function Rp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function SP(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Rp(Object(t),!0).forEach(function(r){CP(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Rp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function CP(n,e,t){return e=jP(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jP(n){var e=OP(n,"string");return ys(e)=="symbol"?e:String(e)}function OP(n,e){if(ys(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ys(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function PP(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var NP=g.memo(function(n){var e=Object.assign({},(PP(n),n));return h.jsx(Hn,SP({Icon:cd,Text:sx,"aria-label":qs,spaceMultiple:tP,textMultiple:eP},e))}),Yr=cd;Yr.Text=sx;Yr.Combine=NP;Yr.Avatar=gP;Yr.colorPrimary=ix;Yr.title=qs;var Js="Cline",AP=.7,MP=.2,ox="#323B43",DP=ox,TP="#fff",EP=.6;function vs(n){"@babel/helpers - typeof";return vs=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},vs(n)}var RP=["size","style"];function Lp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ql(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Lp(Object(t),!0).forEach(function(r){LP(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Lp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function LP(n,e,t){return e=IP(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function IP(n){var e=$P(n,"string");return vs(e)=="symbol"?e:String(e)}function $P(n,e){if(vs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(vs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function BP(n,e){if(n==null)return{};var t=FP(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function FP(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var hd=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=BP(n,RP);return h.jsxs("svg",Ql(Ql({fill:"currentColor",fillRule:"evenodd",height:t,style:Ql({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:t,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Js}),h.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"}),h.jsx("path",{d:"M12.054 5.558a2.779 2.779 0 100-5.558 2.779 2.779 0 000 5.558z"})]}))});function ws(n){"@babel/helpers - typeof";return ws=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},ws(n)}function Ip(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function VP(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ip(Object(t),!0).forEach(function(r){zP(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ip(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function zP(n,e,t){return e=_P(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _P(n){var e=HP(n,"string");return ws(e)=="symbol"?e:String(e)}function HP(n,e){if(ws(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ws(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function WP(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var UP=g.memo(function(n){var e=Object.assign({},(WP(n),n));return h.jsx(_n,VP({Icon:hd,"aria-label":Js,background:DP,color:TP,iconMultiple:EP},e))});function ks(n){"@babel/helpers - typeof";return ks=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},ks(n)}var KP=["size","style"];function $p(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Xl(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?$p(Object(t),!0).forEach(function(r){GP(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):$p(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function GP(n,e,t){return e=qP(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qP(n){var e=JP(n,"string");return ks(e)=="symbol"?e:String(e)}function JP(n,e){if(ks(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ks(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function YP(n,e){if(n==null)return{};var t=QP(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function QP(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var ax=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=YP(n,KP);return h.jsxs("svg",Xl(Xl({fill:"currentColor",fillRule:"evenodd",height:t,style:Xl({flex:"none",lineHeight:1},r),viewBox:"0 0 88 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Js}),h.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 Ss(n){"@babel/helpers - typeof";return Ss=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},Ss(n)}function Bp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function XP(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Bp(Object(t),!0).forEach(function(r){ZP(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Bp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ZP(n,e,t){return e=e7(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function e7(n){var e=t7(n,"string");return Ss(e)=="symbol"?e:String(e)}function t7(n,e){if(Ss(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Ss(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function n7(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var r7=g.memo(function(n){var e=Object.assign({},(n7(n),n));return h.jsx(Hn,XP({Icon:hd,Text:ax,"aria-label":Js,iconProps:{shape:"square"},spaceMultiple:MP,textMultiple:AP},e))}),Qr=hd;Qr.Text=ax;Qr.Combine=r7;Qr.Avatar=UP;Qr.colorPrimary=ox;Qr.title=Js;var Ys="Cursor",i7=.7,s7=.1,lx="#000",o7=lx,a7="#fff",l7=.6;function Cs(n){"@babel/helpers - typeof";return Cs=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},Cs(n)}var c7=["size","style"];function Fp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Zl(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fp(Object(t),!0).forEach(function(r){h7(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Fp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function h7(n,e,t){return e=d7(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function d7(n){var e=u7(n,"string");return Cs(e)=="symbol"?e:String(e)}function u7(n,e){if(Cs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Cs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function f7(n,e){if(n==null)return{};var t=p7(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function p7(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var dd=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=f7(n,c7);return h.jsxs("svg",Zl(Zl({fill:"currentColor",fillRule:"evenodd",height:t,style:Zl({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:t,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Ys}),h.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 js(n){"@babel/helpers - typeof";return js=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},js(n)}function Vp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function m7(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Vp(Object(t),!0).forEach(function(r){g7(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Vp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function g7(n,e,t){return e=b7(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function b7(n){var e=x7(n,"string");return js(e)=="symbol"?e:String(e)}function x7(n,e){if(js(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(js(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function y7(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var v7=g.memo(function(n){var e=Object.assign({},(y7(n),n));return h.jsx(_n,m7({Icon:dd,"aria-label":Ys,background:o7,color:a7,iconMultiple:l7},e))});function Os(n){"@babel/helpers - typeof";return Os=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},Os(n)}var w7=["size","style"];function zp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ec(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?zp(Object(t),!0).forEach(function(r){k7(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):zp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function k7(n,e,t){return e=S7(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function S7(n){var e=C7(n,"string");return Os(e)=="symbol"?e:String(e)}function C7(n,e){if(Os(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Os(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function j7(n,e){if(n==null)return{};var t=O7(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function O7(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var cx=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=j7(n,w7);return h.jsxs("svg",ec(ec({fill:"currentColor",fillRule:"evenodd",height:t,style:ec({flex:"none",lineHeight:1},r),viewBox:"0 0 123 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Ys}),h.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 Ps(n){"@babel/helpers - typeof";return Ps=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},Ps(n)}function _p(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function P7(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_p(Object(t),!0).forEach(function(r){N7(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):_p(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function N7(n,e,t){return e=A7(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function A7(n){var e=M7(n,"string");return Ps(e)=="symbol"?e:String(e)}function M7(n,e){if(Ps(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Ps(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function D7(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var T7=g.memo(function(n){var e=Object.assign({},(D7(n),n));return h.jsx(Hn,P7({Icon:dd,Text:cx,"aria-label":Ys,spaceMultiple:s7,textMultiple:i7},e))}),Xr=dd;Xr.Text=cx;Xr.Combine=T7;Xr.Avatar=v7;Xr.colorPrimary=lx;Xr.title=Ys;var Qs="Goose",E7=.7,R7=.2,hx="#fff",L7=hx,I7="#000",$7=.65;function Ns(n){"@babel/helpers - typeof";return Ns=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},Ns(n)}var B7=["size","style"];function Hp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function tc(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Hp(Object(t),!0).forEach(function(r){F7(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Hp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function F7(n,e,t){return e=V7(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function V7(n){var e=z7(n,"string");return Ns(e)=="symbol"?e:String(e)}function z7(n,e){if(Ns(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Ns(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function _7(n,e){if(n==null)return{};var t=H7(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function H7(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var ud=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=_7(n,B7);return h.jsxs("svg",tc(tc({fill:"currentColor",fillRule:"evenodd",height:t,style:tc({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:t,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Qs}),h.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 As(n){"@babel/helpers - typeof";return As=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},As(n)}function Wp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function W7(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Wp(Object(t),!0).forEach(function(r){U7(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Wp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function U7(n,e,t){return e=K7(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function K7(n){var e=G7(n,"string");return As(e)=="symbol"?e:String(e)}function G7(n,e){if(As(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(As(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function q7(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var J7=g.memo(function(n){var e=Object.assign({},(q7(n),n));return h.jsx(_n,W7({Icon:ud,"aria-label":Qs,background:L7,color:I7,iconMultiple:$7},e))});function Ms(n){"@babel/helpers - typeof";return Ms=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},Ms(n)}var Y7=["size","style"];function Up(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function nc(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Up(Object(t),!0).forEach(function(r){Q7(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Up(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Q7(n,e,t){return e=X7(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function X7(n){var e=Z7(n,"string");return Ms(e)=="symbol"?e:String(e)}function Z7(n,e){if(Ms(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Ms(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function e8(n,e){if(n==null)return{};var t=t8(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function t8(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var dx=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=e8(n,Y7);return h.jsxs("svg",nc(nc({fill:"currentColor",fillRule:"evenodd",height:t,style:nc({flex:"none",lineHeight:1},r),viewBox:"0 0 87 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Qs}),h.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 Ds(n){"@babel/helpers - typeof";return Ds=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},Ds(n)}function Kp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function n8(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Kp(Object(t),!0).forEach(function(r){r8(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Kp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function r8(n,e,t){return e=i8(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function i8(n){var e=s8(n,"string");return Ds(e)=="symbol"?e:String(e)}function s8(n,e){if(Ds(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Ds(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function o8(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var a8=g.memo(function(n){var e=Object.assign({},(o8(n),n));return h.jsx(Hn,n8({Icon:ud,Text:dx,"aria-label":Qs,iconProps:{shape:"square"},spaceMultiple:R7,textMultiple:E7},e))}),Zr=ud;Zr.Text=dx;Zr.Combine=a8;Zr.Avatar=J7;Zr.colorPrimary=hx;Zr.title=Qs;var Xs="Windsurf",l8=.7,c8=.2,ux="#fff",h8=ux,d8="#000",u8=.75;function Ts(n){"@babel/helpers - typeof";return Ts=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},Ts(n)}var f8=["size","style"];function Gp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function rc(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Gp(Object(t),!0).forEach(function(r){p8(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Gp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function p8(n,e,t){return e=m8(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function m8(n){var e=g8(n,"string");return Ts(e)=="symbol"?e:String(e)}function g8(n,e){if(Ts(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Ts(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function b8(n,e){if(n==null)return{};var t=x8(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function x8(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var fd=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=b8(n,f8);return h.jsxs("svg",rc(rc({fill:"currentColor",fillRule:"evenodd",height:t,style:rc({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:t,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Xs}),h.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 Es(n){"@babel/helpers - typeof";return Es=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},Es(n)}function qp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function y8(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qp(Object(t),!0).forEach(function(r){v8(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):qp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function v8(n,e,t){return e=w8(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function w8(n){var e=k8(n,"string");return Es(e)=="symbol"?e:String(e)}function k8(n,e){if(Es(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Es(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function S8(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var C8=g.memo(function(n){var e=Object.assign({},(S8(n),n));return h.jsx(_n,y8({Icon:fd,"aria-label":Xs,background:h8,color:d8,iconMultiple:u8},e))});function Rs(n){"@babel/helpers - typeof";return Rs=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},Rs(n)}var j8=["size","style"];function Jp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ic(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Jp(Object(t),!0).forEach(function(r){O8(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Jp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function O8(n,e,t){return e=P8(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function P8(n){var e=N8(n,"string");return Rs(e)=="symbol"?e:String(e)}function N8(n,e){if(Rs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Rs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function A8(n,e){if(n==null)return{};var t=M8(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function M8(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var fx=g.memo(function(n){var e=n.size,t=e===void 0?"1em":e,r=n.style,i=A8(n,j8);return h.jsxs("svg",ic(ic({fill:"currentColor",fillRule:"evenodd",height:t,style:ic({flex:"none",lineHeight:1},r),viewBox:"0 0 111 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Xs}),h.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 Ls(n){"@babel/helpers - typeof";return Ls=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},Ls(n)}function Yp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function D8(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Yp(Object(t),!0).forEach(function(r){T8(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Yp(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function T8(n,e,t){return e=E8(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function E8(n){var e=R8(n,"string");return Ls(e)=="symbol"?e:String(e)}function R8(n,e){if(Ls(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Ls(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function L8(n){if(n==null)throw new TypeError("Cannot destructure "+n)}var I8=g.memo(function(n){var e=Object.assign({},(L8(n),n));return h.jsx(Hn,D8({Icon:fd,Text:fx,"aria-label":Xs,iconProps:{shape:"square"},spaceMultiple:c8,textMultiple:l8},e))}),ei=fd;ei.Text=fx;ei.Combine=I8;ei.Avatar=C8;ei.colorPrimary=ux;ei.title=Xs;const $8={"claude-code":ur.Avatar,cursor:Xr.Avatar,codex:Ct.Avatar,"gemini-cli":fr.Avatar,goose:Zr.Avatar,"github-copilot":Yr.Avatar,windsurf:ei.Avatar,cline:Qr.Avatar},B8={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 F8(n){return n.split(/\s+/).map(e=>e[0]).join("").toUpperCase().slice(0,2)}const px=({agentName:n,displayName:e,size:t=20})=>{const r=$8[n];if(r)return h.jsx(r,{size:t});const i=B8[n];return i?h.jsx("img",{src:i,alt:e,className:"rounded object-contain",style:{width:t,height:t}}):h.jsx("div",{className:"flex items-center justify-center rounded bg-dash-surface-hover text-dash-text-muted font-semibold",style:{width:t,height:t,fontSize:t*.45},children:F8(e)})};function sc(n){return JSON.stringify([n.provider,n.type,n.item,n.global])}function V8(n){if(typeof n=="string"){const e=n.trim();return e.length>0?e:null}if(typeof n=="object"&&n!==null){const e=n;for(const t of["message","error","detail","details","reason"]){const r=e[t];if(typeof r=="string"&&r.trim().length>0)return r.trim()}}return null}async function Qp(n,e){const r=(await n.text().catch(()=>"")).trim();if(!r)return e;try{const i=JSON.parse(r);return V8(i)||e}catch{return r}}function z8(){const[n,e]=g.useState("idle"),[t,r]=g.useState(null),[i,s]=g.useState(new Map),[o,a]=g.useState(null),[l,c]=g.useState(null),d=g.useRef(0),u=g.useRef(0),f=g.useRef(null),p=g.useRef(null),m=g.useCallback(async S=>{e("reconciling"),c(null),a(null),d.current+=1;const j=d.current;f.current?.abort();const k=new AbortController;f.current=k;try{const O=new URLSearchParams({providers:S.providers.join(","),global:String(S.global),agents:String(S.include.agents??!0),commands:String(S.include.commands??!0),skills:String(S.include.skills??!0),config:String(S.include.config??!0),rules:String(S.include.rules??!0),hooks:String(S.include.hooks??!0)});S.source&&O.set("source",S.source);const y=await fetch(`/api/migrate/reconcile?${O.toString()}`,{signal:k.signal});if(!y.ok){const A=await Qp(y,"Failed to reconcile migration plan");throw new Error(A)}const D=await y.json();if(j!==d.current)return;r(D.plan),s(new Map),e("reviewing")}catch(O){if(k.signal.aborted||O instanceof DOMException&&O.name==="AbortError"||j!==d.current)return;c(O instanceof Error?O.message:"Failed to reconcile"),e("error")}},[]),b=g.useCallback((S,j)=>{s(k=>{const O=new Map(k);return O.set(sc(S),j),O})},[]),x=g.useCallback(async()=>{if(!t)return c("No plan to execute"),e("error"),!1;e("executing"),c(null),u.current+=1;const S=u.current;p.current?.abort();const j=new AbortController;p.current=j;try{const k=Object.fromEntries(i.entries()),O=await fetch("/api/migrate/execute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:t,resolutions:k}),signal:j.signal});if(S!==u.current)return!1;if(!O.ok){const D=await Qp(O,"Failed to execute migration");if(O.status===501)return c(D||"Plan execution is not available in this server build"),e("reviewing"),!1;throw new Error(D)}const y=await O.json();return S!==u.current?!1:(a({results:y.results,counts:y.counts,warnings:y.warnings??[],discovery:y.discovery}),e("complete"),!0)}catch(k){return j.signal.aborted||k instanceof DOMException&&k.name==="AbortError"||S!==u.current||(c(k instanceof Error?k.message:"Failed to execute migration"),e("error")),!1}},[t,i]),w=g.useCallback(()=>{f.current?.abort(),p.current?.abort(),e("idle"),r(null),s(new Map),a(null),c(null)},[]),v=g.useMemo(()=>t?t.actions.filter(S=>S.action==="conflict").every(S=>i.has(sc(S))):!0,[t,i]);return{phase:n,plan:t,resolutions:i,results:o,error:l,reconcile:m,resolve:b,execute:x,reset:w,allConflictsResolved:v,actionKey:sc}}const _8={agents:!0,commands:!0,skills:!0,config:!0,rules:!0,hooks:!0},Nt=["agents","commands","skills","config","rules","hooks"],Zn={agents:"migrateTypeAgents",commands:"migrateTypeCommands",skills:"migrateTypeSkills",config:"migrateTypeConfig",rules:"migrateTypeRules",hooks:"migrateTypeHooks"},Xp={detected:"#D4A574","not-detected":"#8B9DC3"},lt=({label:n,value:e,tone:t="default"})=>{const r=t==="accent"?"text-dash-accent":t==="success"?"text-green-400":"text-dash-text";return h.jsxs("div",{className:"rounded-lg border border-dash-border bg-dash-bg/70 px-3 py-2.5",children:[h.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-dash-text-muted",children:n}),h.jsx("p",{className:`mt-1 text-lg font-semibold ${r}`,children:e})]})};function Zp(n,e){return n.success?n.skipped?{label:e("migrateStatusSkipped"),className:"text-yellow-400"}:{label:e("migrateStatusInstalled"),className:"text-green-400"}:{label:e("migrateStatusFailed"),className:"text-red-400"}}const H8=new Set([8203,8204,8205,8288,65279,8232,8233,8234,8235,8236,8237,8238,8294,8295,8296,8297]);function W8(n){return n===9||n===10||n===13?!0:n>=0&&n<=8||n>=11&&n<=31||n>=127&&n<=159||H8.has(n)}function em(n){let e="";for(const t of n){const r=t.codePointAt(0);r!==void 0&&(W8(r)||(e+=t))}return e}const U8=({provider:n,include:e,isSelected:t,cardClickToggles:r,onToggleSelect:i,onOpenDetails:s,t:o})=>{const a=Nt.filter(c=>n.capabilities[c]).length,l=Nt.some(c=>e[c]&&!n.capabilities[c]);return h.jsxs("div",{className:`relative rounded-xl border px-4 py-3 cursor-pointer transition-all ${t?"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:[h.jsx("button",{type:"button",onClick:()=>r?i(n.name):s(n.name),"aria-label":r?`${n.displayName} deselect`:`${n.displayName} details`,className:"absolute inset-0 z-10 rounded-xl dash-focus-ring"}),h.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:[h.jsxs("div",{className:"min-w-0 space-y-1.5",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h.jsx(px,{agentName:n.name,displayName:n.displayName,size:18}),h.jsx("span",{className:"text-sm font-semibold text-dash-text truncate",children:n.displayName}),n.recommended&&h.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")}),n.commandsGlobalOnly&&h.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")})]}),h.jsxs("div",{className:"text-xs text-dash-text-muted truncate",children:[n.name," · ",a,"/",Nt.length," ",o("migrateCapabilitiesLabel")]})]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[11px] lg:flex-col lg:items-start lg:gap-1",children:[h.jsx("span",{className:n.detected?"text-dash-accent":"text-dash-text-muted",children:n.detected?o("migrateDetectedTag"):o("migrateNotDetectedTag")}),h.jsx("span",{className:"text-dash-text-muted",children:n.recommended?o("migrateFilterRecommended"):"-"})]}),h.jsx("div",{className:"flex flex-wrap gap-1",children:Nt.map(c=>{const d=n.capabilities[c],u=e[c];return h.jsx("span",{className:`text-[10px] uppercase px-1.5 py-0.5 rounded border ${d&&u?"border-dash-accent/45 text-dash-accent":d?"border-dash-border text-dash-text-secondary":"border-dash-border text-dash-text-muted opacity-60"}`,children:o(Zn[c])},c)})}),h.jsx("div",{className:"relative z-20 flex justify-start lg:justify-end",children:h.jsx("button",{type:"button",onClick:c=>{c.stopPropagation(),i(n.name)},className:`dash-focus-ring px-4 py-1.5 text-xs font-semibold rounded-md transition-colors ${t?"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(t?"migrateSelectedButton":"migrateSelectButton")})})]})]})},K8=({provider:n,include:e,isSelected:t,latestResult:r,onToggleSelect:i,onClose:s,t:o})=>{const a=g.useRef(null),l=g.useRef(null),c=g.useCallback(()=>{const f=l.current;l.current=null,f&&document.contains(f)&&f.focus()},[]),d=g.useCallback(()=>{s(),c()},[s,c]),u=g.useCallback(()=>{const f=a.current;if(f?.open){f.close();return}s(),c()},[s,c]);return g.useEffect(()=>{const f=a.current;if(f){if(!f.open){l.current=document.activeElement instanceof HTMLElement?document.activeElement:null;try{f.showModal()}catch{c(),s()}}return()=>{if(f.open){f.close();return}c()}}},[s,c]),h.jsx("dialog",{ref:a,"aria-label":n.displayName,onClose:d,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:h.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:[h.jsx("div",{className:"px-6 py-5 border-b border-dash-border",children:h.jsxs("div",{className:"flex items-start justify-between gap-3",children:[h.jsxs("div",{className:"min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2.5",children:[h.jsx(px,{agentName:n.name,displayName:n.displayName,size:22}),h.jsx("h2",{className:"text-xl font-bold text-dash-text truncate",children:n.displayName})]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mt-2",children:[h.jsx("span",{className:"text-[11px] text-dash-text-muted font-mono",children:n.name}),h.jsx("span",{className:`text-[10px] uppercase tracking-wide px-2 py-0.5 rounded border ${n.detected?"border-dash-accent/30 text-dash-accent":"border-dash-border text-dash-text-muted"}`,children:n.detected?o("migrateDetectedTag"):o("migrateNotDetectedTag")}),n.recommended&&h.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")})]})]}),h.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:h.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[h.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18",strokeWidth:2}),h.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18",strokeWidth:2})]})})]})}),h.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-6",children:[h.jsxs("div",{children:[h.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wide text-dash-text-muted mb-2.5",children:o("migrateCapabilitiesSection")}),h.jsx("div",{className:"space-y-1.5",children:Nt.map(f=>{const p=n.capabilities[f],m=e[f];return h.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-dash-bg rounded-md",children:[h.jsx("span",{className:"text-sm text-dash-text",children:o(Zn[f])}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:`text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded border ${m?"border-dash-accent/35 text-dash-accent":"border-dash-border text-dash-text-muted"}`,children:o(m?"migrateIncludedEnabled":"migrateIncludedDisabled")}),h.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)})})]}),n.commandsGlobalOnly&&e.commands&&h.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")}),h.jsxs("div",{children:[h.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wide text-dash-text-muted mb-2.5",children:o("migrateLatestTarget")}),r?h.jsxs("div",{className:"px-3 py-2 bg-dash-bg rounded-md border border-dash-border space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-xs text-dash-text-muted",children:o("migrateStatus")}),h.jsx("span",{className:`text-xs font-semibold ${Zp(r,o).className}`,children:Zp(r,o).label})]}),h.jsx("p",{className:"text-xs font-mono text-dash-text break-all",children:em(r.path||"-")}),(r.error||r.skipReason)&&h.jsx("p",{className:"text-xs text-red-400 break-words",children:em(r.error||r.skipReason||"-")})]}):h.jsx("p",{className:"text-sm text-dash-text-muted",children:o("migrateNoResultForProvider")})]})]}),h.jsxs("div",{className:"px-6 py-4 border-t border-dash-border flex items-center justify-between gap-2",children:[h.jsx("button",{type:"button",onClick:()=>i(n.name),className:`px-4 py-2 text-sm font-semibold rounded-md transition-colors ${t?"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(t?"migrateUnselectProvider":"migrateSelectProviderAction")}),h.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")})]})]})})},G8=()=>{const{t:n}=ce(),e=z8(),[t,r]=g.useState([]),[i,s]=g.useState(null),[o,a]=g.useState([]),[l,c]=g.useState(_8),[d,u]=g.useState(!0),[f,p]=g.useState(!0),[m,b]=g.useState(!1),[x,w]=g.useState(null),[v,S]=g.useState(""),j=g.useDeferredValue(v),[k,O]=g.useState("all"),[y,D]=g.useState(null),A=g.useRef(0),R=g.useCallback(async(I=!1)=>{A.current+=1;const G=A.current;try{I?b(!0):p(!0),w(null);const[oe,De]=await Promise.all([Av(),nu()]);if(G!==A.current)return;r(oe.providers),s(De),a(Ut=>{if(Ut.length===0)return[];const Zs=oe.providers.map(ti=>ti.name);return Ut.filter(ti=>Zs.includes(ti))})}catch(oe){if(G!==A.current)return;w(oe instanceof Error?oe.message:n("migrateDetectFailed"))}finally{G===A.current&&(p(!1),b(!1))}},[n]);g.useEffect(()=>{R()},[R]);const N=g.useMemo(()=>{const I=new Map;for(const G of t)I.set(G.name,G);return I},[t]),L=g.useMemo(()=>y&&N.get(y)||null,[y,N]);g.useEffect(()=>{y&&!N.has(y)&&D(null)},[y,N]);const W=g.useCallback(()=>{D(null)},[]),F=g.useMemo(()=>new Set(o),[o]),B=g.useMemo(()=>t.filter(I=>I.detected).length,[t]),q=o.length,de=g.useMemo(()=>t.filter(I=>I.recommended).length,[t]),z=g.useMemo(()=>Nt.filter(I=>l[I]).length,[l]),J=g.useMemo(()=>{const I=[];l.commands&&o.includes("codex")&&!d&&N.get("codex")?.commandsGlobalOnly&&I.push(n("migrateGlobalForced"));for(const G of Nt){if(!l[G])continue;const oe=o.filter(De=>!N.get(De)?.capabilities[G]).map(De=>N.get(De)?.displayName||De);oe.length>0&&I.push(`${n("migrateUnsupported")}: ${n(Zn[G])} -> ${oe.join(", ")}`)}return I},[l,d,N,o,n]),ie=g.useCallback(I=>{if(I==="codex"){a(["codex"]);return}if(I==="antigravity"){a(["antigravity"]);return}if(I==="core"){const oe=["codex","antigravity","droid"].filter(De=>t.some(Ut=>Ut.name===De));a(oe);return}const G=t.filter(oe=>oe.detected).map(oe=>oe.name);a(G)},[t]),le=g.useCallback(I=>{a(G=>G.includes(I)?G.filter(oe=>oe!==I):[...G,I])},[]),fe=g.useCallback(I=>{c(G=>({...G,[I]:!G[I]}))},[]),we=g.useMemo(()=>{const I=[...t];return I.sort((G,oe)=>{const De=F.has(G.name),Ut=F.has(oe.name);return De!==Ut?De?-1:1:G.detected!==oe.detected?G.detected?-1:1:G.recommended!==oe.recommended?G.recommended?-1:1:G.displayName.localeCompare(oe.displayName)}),I},[t,F]),ke=g.useMemo(()=>{const I=j.trim().toLowerCase();return we.filter(G=>{if(k==="selected"&&!F.has(G.name)||k==="detected"&&!G.detected||k==="recommended"&&!G.recommended||k==="not-detected"&&G.detected)return!1;if(!I)return!0;const oe=Nt.filter(De=>G.capabilities[De]).map(De=>n(Zn[De]).toLowerCase());return G.displayName.toLowerCase().includes(I)||G.name.toLowerCase().includes(I)||oe.some(De=>De.includes(I))})},[j,k,F,we,n]),Ae=g.useMemo(()=>{const I=ke.filter(De=>De.detected),G=ke.filter(De=>!De.detected),oe=[];return I.length>0&&oe.push({key:"detected",label:n("migrateDetectedTag"),providers:I}),G.length>0&&oe.push({key:"not-detected",label:n("migrateNotDetectedTag"),providers:G}),oe},[ke,n]),Qe=g.useMemo(()=>({all:t.length,selected:q,detected:t.filter(I=>I.detected).length,recommended:t.filter(I=>I.recommended).length,"not-detected":t.filter(I=>!I.detected).length}),[t,q]),mt=g.useMemo(()=>ke.map(I=>I.name),[ke]),Y=g.useCallback(()=>{a(I=>{const G=new Set(I);for(const oe of mt)G.add(oe);return Array.from(G)})},[mt]),Me=g.useCallback(()=>{a([])},[]),Se=g.useCallback(async()=>{if(o.length===0){w(n("migrateSelectProvider"));return}if(z===0){w(n("migrateNoTypesEnabled"));return}await e.reconcile({providers:o,global:d,include:l})},[z,l,d,o,n,e]),Ie=g.useCallback(async()=>{if(w(null),!!await e.execute())try{const G=await nu();s(G)}catch(G){console.error("Failed to refresh discovery:",G)}},[e]),ve=g.useMemo(()=>{const I=new Map;if(!e.results)return I;for(const G of e.results.results)I.set(G.provider,G);return I},[e.results]);g.useEffect(()=>{const I=G=>{const oe=G.target,De=!!(oe&&(oe instanceof HTMLInputElement||oe instanceof HTMLTextAreaElement||oe.isContentEditable||oe.closest('[contenteditable="true"], [role="textbox"]'))),Ut=G.metaKey||G.ctrlKey||G.altKey;G.key==="/"&&!De&&!Ut&&(G.preventDefault(),document.getElementById("migrate-search")?.focus())};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[]);const gt=e.phase==="idle"&&o.length>0&&z>0;return f?h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsxs("div",{className:"text-center",children:[h.jsx("div",{className:"w-8 h-8 border-4 border-dash-accent border-t-transparent rounded-full animate-spin mx-auto mb-3"}),h.jsx("p",{className:"text-dash-text-muted",children:n("migrateDiscovering")})]})}):h.jsxs("div",{className:"relative h-full overflow-hidden",children:[h.jsxs("div",{className:"pointer-events-none absolute inset-0 -z-10 overflow-hidden",children:[h.jsx("div",{className:"absolute -top-24 -right-8 h-64 w-64 rounded-full bg-dash-accent/10 blur-3xl"}),h.jsx("div",{className:"absolute -bottom-28 -left-10 h-72 w-72 rounded-full bg-dash-accent/5 blur-3xl"})]}),h.jsxs("div",{className:"h-full overflow-y-auto space-y-4 pb-8",children:[h.jsx("section",{className:"dash-panel dash-sticky-glass sticky top-0 z-20 px-4 py-4 md:px-6 md:py-5",children:h.jsxs("div",{className:"flex flex-col gap-4 xl:flex-row xl:items-end xl:justify-between",children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"mono text-[10px] uppercase tracking-[0.16em] text-dash-text-muted",children:n("migrate")}),h.jsx("h1",{className:"text-xl md:text-2xl font-semibold text-dash-text",children:n("migrateTitle")}),h.jsx("p",{className:"text-sm text-dash-text-secondary max-w-3xl",children:n("migrateSubtitle")})]}),e.phase==="complete"&&e.results?h.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:[h.jsx(lt,{label:n("migrateInstalled"),value:e.results.counts.installed,tone:"success"}),h.jsx(lt,{label:n("migrateSkipped"),value:e.results.counts.skipped}),h.jsx(lt,{label:n("migrateFailed"),value:e.results.counts.failed})]}):h.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[h.jsx(lt,{label:n("migrateTypeAgents"),value:i?.counts.agents??0}),h.jsx(lt,{label:n("migrateDetectedProviders"),value:B,tone:"success"}),h.jsx(lt,{label:n("migrateSelectedProviders"),value:q,tone:"accent"}),h.jsx(lt,{label:n("migrateTypes"),value:z})]})]})}),x&&h.jsx("div",{className:"px-4 py-3 border border-red-500/30 bg-red-500/10 rounded-lg text-sm text-red-400",children:x}),h.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1.55fr)_minmax(0,340px)]",children:[h.jsxs("section",{className:"order-2 xl:order-1 space-y-4",children:[e.phase==="reviewing"&&e.plan&&h.jsxs("div",{className:"dash-panel flex flex-col max-h-[calc(100vh-200px)]",children:[h.jsxs("div",{className:"flex items-center justify-between p-5 pb-4",children:[h.jsx("h2",{className:"text-lg font-semibold text-dash-text",children:n("migrateReviewPlan")}),h.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:n("cancel")})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto px-5 pb-4",children:[h.jsx(Cj,{plan:e.plan,resolutions:e.resolutions,onResolve:e.resolve,actionKey:e.actionKey}),e.error&&h.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})]}),h.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&&h.jsx("p",{className:"text-xs text-yellow-400",children:n("migrateResolveConflicts")}),h.jsx("button",{type:"button",onClick:Ie,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:n("migrateExecutePlan")})]})]}),e.phase==="complete"&&e.results&&h.jsx(hj,{results:e.results,onReset:e.reset}),e.phase==="error"&&e.error&&h.jsxs("div",{className:"dash-panel p-5",children:[h.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}),h.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:n("tryAgain")})]}),(e.phase==="reconciling"||e.phase==="executing")&&h.jsx("div",{className:"dash-panel p-5",children:h.jsx("div",{className:"flex items-center justify-center py-8",children:h.jsxs("div",{className:"text-center",children:[h.jsx("div",{className:"w-8 h-8 border-4 border-dash-accent border-t-transparent rounded-full animate-spin mx-auto mb-3"}),h.jsx("p",{className:"text-dash-text-muted",children:e.phase==="reconciling"?n("migrateReconciling"):n("migrateExecuting")})]})})}),e.phase==="idle"&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"dash-panel p-4 md:p-5 space-y-4",children:[h.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center",children:[h.jsxs("div",{className:"relative flex-1",children:[h.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:[h.jsx("circle",{cx:"11",cy:"11",r:"8"}),h.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),h.jsx("input",{id:"migrate-search",type:"text",value:v,onChange:I=>S(I.target.value),placeholder:n("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"}),h.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:n("searchShortcut")})]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h.jsx("button",{type:"button",onClick:()=>R(!0),disabled:m,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:n(m?"checking":"migrateRefresh")}),h.jsx("button",{type:"button",onClick:Y,disabled:mt.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:n("migrateSelectVisible")}),h.jsx("button",{type:"button",onClick:Me,disabled:q===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:n("migrateClearSelection")})]})]}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{key:"all",label:n("categoryAll")},{key:"selected",label:n("migrateSelectedProviders")},{key:"detected",label:n("migrateDetectedProviders")},{key:"recommended",label:n("migrateFilterRecommended")},{key:"not-detected",label:n("migrateNotDetectedTag")}].map(I=>h.jsxs("button",{type:"button",onClick:()=>O(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,h.jsx("span",{className:"opacity-60 ml-1 text-[10px]",children:Qe[I.key]})]},I.key))}),h.jsxs("div",{children:[h.jsx("p",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wide text-dash-text-muted",children:n("migrateTypes")}),h.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Nt.map(I=>h.jsx("button",{type:"button",onClick:()=>fe(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:n(Zn[I])},I))})]})]}),h.jsxs("div",{className:"dash-panel p-4 md:p-5",children:[h.jsx("h2",{className:"text-sm font-semibold text-dash-text mb-4",children:n("migrateSourceSummary")}),h.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 xl:grid-cols-6 gap-3",children:Nt.map(I=>h.jsxs("div",{className:"px-3 py-2 bg-dash-bg border border-dash-border rounded-md text-center",children:[h.jsx("p",{className:"text-[11px] uppercase tracking-wide text-dash-text-muted",children:n(Zn[I])}),h.jsx("p",{className:"text-lg font-semibold text-dash-text",children:i?.counts[I]??0})]},I))})]}),h.jsxs("div",{className:"dash-panel p-4 md:p-5",children:[h.jsxs("div",{className:"flex items-center justify-between mb-4",children:[h.jsx("h2",{className:"text-sm font-semibold text-dash-text",children:n("migrateProvidersHeading")}),h.jsxs("p",{className:"text-xs text-dash-text-muted",children:[ke.length," ",n("migrateProvidersCountSuffix")]})]}),t.length===0?h.jsx("div",{className:"text-sm text-dash-text-muted",children:n("migrateNoProviders")}):ke.length===0?h.jsx("div",{className:"text-sm text-dash-text-muted",children:n("migrateNoProvidersMatch")}):h.jsx("div",{className:"space-y-5",children:Ae.map(I=>h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-2.5 mb-3",children:[h.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:Xp[I.key]}}),h.jsx("h2",{className:"text-[13px] font-semibold uppercase tracking-wide",style:{color:Xp[I.key]},children:I.label}),h.jsxs("span",{className:"text-[11px] text-dash-text-muted ml-auto",children:[I.providers.length," ",n("migrateProvidersCountSuffix")]}),h.jsx("div",{className:"flex-1 h-px bg-dash-border ml-3"})]}),h.jsx("div",{className:"space-y-2",children:I.providers.map(G=>h.jsx(U8,{provider:G,include:l,isSelected:F.has(G.name),cardClickToggles:k==="selected",onToggleSelect:le,onOpenDetails:D,t:n},G.name))})]},I.key))})]})]})]}),h.jsx("aside",{className:"order-1 xl:order-2 space-y-4 self-start xl:sticky xl:top-[84px]",children:e.phase==="complete"&&e.results?h.jsxs("div",{className:"dash-panel p-4 md:p-5 space-y-4",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-sm font-semibold text-dash-text",children:n("migrateSummaryTitle")}),h.jsxs("p",{className:"text-xs text-dash-text-muted mt-1",children:[e.results.counts.installed+e.results.counts.skipped+e.results.counts.failed," ",n("migrateSummarySubtitle")]})]}),h.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[h.jsx(lt,{label:n("migrateInstalled"),value:e.results.counts.installed,tone:"success"}),h.jsx(lt,{label:n("migrateSkipped"),value:e.results.counts.skipped}),h.jsx(lt,{label:n("migrateFailed"),value:e.results.counts.failed})]}),e.results.discovery&&h.jsxs("div",{className:"space-y-1.5",children:[h.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-dash-text-muted",children:n("migrateTypes")}),Nt.map(I=>{const G=e.results?.discovery?.[I]??0;return G===0?null:h.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-dash-bg rounded-md text-xs",children:[h.jsx("span",{className:"text-dash-text-secondary",children:n(Zn[I])}),h.jsx("span",{className:"font-semibold text-dash-text",children:G})]},I)})]}),o.length>0&&h.jsxs("div",{className:"space-y-1.5",children:[h.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-dash-text-muted",children:n("migrateSummaryProviders")}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:o.map(I=>{const G=N.get(I);return h.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded border border-dash-accent/30 text-dash-accent",children:G?.displayName||I},I)})})]}),h.jsx("div",{className:"text-[10px] px-3 py-1.5 bg-dash-bg rounded-md text-dash-text-muted",children:n(d?"migrateScopeGlobal":"migrateScopeProject")}),h.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:n("migrateSummaryNewMigration")})]}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"dash-panel p-4 md:p-5 space-y-4",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-sm font-semibold text-dash-text",children:n("migrateActionSummaryTitle")}),h.jsxs("p",{className:"text-xs text-dash-text-muted mt-1",children:[q," ",n("migrateProvidersCountSuffix")," ·"," ",z,"/",Nt.length," ",n("migrateTypes")]})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h.jsx(lt,{label:n("migrateSelectedProviders"),value:q,tone:"accent"}),h.jsx(lt,{label:n("migrateDetectedProviders"),value:B}),h.jsx(lt,{label:n("migrateTypes"),value:z}),h.jsx(lt,{label:n("migrateFilterRecommended"),value:de,tone:"success"})]}),h.jsxs("div",{className:"inline-flex w-full rounded-md border border-dash-border overflow-hidden",children:[h.jsx("button",{type:"button",onClick:()=>u(!1),className:`dash-focus-ring flex-1 px-3 py-2 text-sm ${d?"bg-dash-bg text-dash-text-secondary":"bg-dash-accent-subtle text-dash-accent"}`,children:n("migrateScopeProject")}),h.jsx("button",{type:"button",onClick:()=>u(!0),className:`dash-focus-ring flex-1 px-3 py-2 text-sm border-l border-dash-border ${d?"bg-dash-accent-subtle text-dash-accent":"bg-dash-bg text-dash-text-secondary"}`,children:n("migrateScopeGlobal")})]}),h.jsx("button",{type:"button",onClick:Se,disabled:!gt,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"?n("migrateRunning"):n("migrateRun")}),J.length>0&&h.jsx("div",{className:"space-y-2",children:J.map((I,G)=>h.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}-${G}`))})]}),h.jsxs("div",{className:"dash-panel-muted p-4",children:[h.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-wide text-dash-text-muted",children:n("migrateSelectProviderAction")}),h.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h.jsx("button",{type:"button",onClick:()=>ie("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:n("migratePresetCodex")}),h.jsx("button",{type:"button",onClick:()=>ie("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:n("migratePresetAntigravity")}),h.jsx("button",{type:"button",onClick:()=>ie("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:n("migratePresetCore")}),h.jsx("button",{type:"button",onClick:()=>ie("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:n("migratePresetDetected")})]})]})]})})]})]}),L&&h.jsx(K8,{provider:L,include:l,isSelected:F.has(L.name),latestResult:ve.get(L.name)||null,onToggleSelect:le,onClose:W,t:n})]})},q8=({featureId:n,name:e,description:t,included:r})=>{const{t:i}=ce();return h.jsxs("div",{"data-testid":`feature-card-${n}`,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:[h.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r?h.jsx("svg",{className:"w-5 h-5 text-[var(--dash-accent)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):h.jsx("svg",{className:"w-5 h-5 text-[var(--dash-text-muted)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),h.jsx("h4",{className:"font-medium text-[var(--dash-text)]",children:i(e)})]}),h.jsx("p",{className:"text-sm text-[var(--dash-text-muted)] leading-relaxed",children:i(t)})]})},J8=({selectedKit:n,onKitSelect:e,onInstall:t,installing:r})=>{const{t:i}=ce(),[s,o]=g.useState(1);return h.jsxs("div",{className:"space-y-6","data-testid":"install-wizard",children:[h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx(oc,{number:1,active:s===1,label:i("stepChooseKit")}),h.jsx("div",{className:"flex-1 h-px bg-[var(--dash-border)]"}),h.jsx(oc,{number:2,active:s===2,label:i("stepConfigure")}),h.jsx("div",{className:"flex-1 h-px bg-[var(--dash-border)]"}),h.jsx(oc,{number:3,active:s===3,label:i("stepInstall")})]}),h.jsxs("div",{className:"min-h-[200px]",children:[s===1&&h.jsx(Y8,{onSelect:e,selected:n}),s===2&&n&&h.jsx(Q8,{kit:n}),s===3&&h.jsx(X8,{installing:r})]}),h.jsxs("div",{className:"flex justify-between pt-4 border-t border-[var(--dash-border)]",children:[s>1?h.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:i("back")}):h.jsx("div",{}),s<3&&n&&h.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:i("next")}),s===3&&h.jsx("button",{onClick:t,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:i("install")})]})]})},oc=({number:n,active:e,label:t})=>h.jsxs("div",{className:"flex items-center gap-2",children:[h.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:n}),h.jsx("span",{className:`text-sm font-medium ${e?"text-[var(--dash-text)]":"text-[var(--dash-text-muted)]"}`,children:t})]}),Y8=({onSelect:n,selected:e})=>{const{t}=ce();return h.jsxs("div",{className:"space-y-4",children:[h.jsx("p",{className:"text-[var(--dash-text-muted)]",children:e?`Selected: ${e===Qt.ENGINEER?t("kitEngineerName"):t("kitMarketingName")}`:"Please select a kit above"}),e&&h.jsxs("button",{type:"button",onClick:()=>n(e===Qt.ENGINEER?Qt.MARKETING:Qt.ENGINEER),className:"text-sm text-[var(--dash-accent)] hover:underline",children:["Switch to ",e===Qt.ENGINEER?t("kitMarketingName"):t("kitEngineerName")]})]})},Q8=()=>h.jsx("div",{className:"text-[var(--dash-text-muted)]",children:"Configuration preview placeholder"}),X8=({installing:n})=>h.jsx("div",{className:"text-[var(--dash-text-muted)]",children:n?"Installing...":"Ready to install"}),Z8=({kit:n,onGetStarted:e})=>{const{t}=ce(),r=an(),i=n===Qt.ENGINEER?"kitEngineerName":n===Qt.MARKETING?"kitMarketingName":"kitEngineerName";return h.jsxs("div",{className:"text-center py-12 space-y-6","data-testid":"success-screen",children:[h.jsx("div",{className:"w-16 h-16 mx-auto bg-green-100 rounded-full flex items-center justify-center",children:h.jsx("svg",{className:"w-10 h-10 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:h.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"})})}),h.jsx("h2",{className:"text-2xl font-bold text-[var(--dash-text)]",children:t("installSuccess")}),h.jsx("p",{className:"text-[var(--dash-text-muted)] max-w-md mx-auto",children:t("installSuccessDesc").replace("{kit}",t(i))}),h.jsxs("div",{className:"flex gap-4 justify-center pt-4",children:[h.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:t("getStarted")}),h.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:t("goToDashboard")})]})]})},eN=[{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}],mx={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 tN(n){const e=mx[n];return e?eN.filter(t=>e.features.includes(t.id)):(console.warn(`Unknown kit type: ${n}`),[])}const nN=({kit:n,selected:e,onSelect:t,features:r})=>{const{t:i}=ce();return h.jsxs("button",{type:"button",onClick:t,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:[h.jsx("h3",{className:`text-xl font-bold ${n.primaryColor}`,children:i(n.name)}),h.jsx("p",{className:"text-[var(--dash-text-muted)] mt-1",children:i(n.tagline)}),h.jsx("div",{className:"mt-4 space-y-2",children:r.slice(0,3).map(s=>h.jsx(q8,{featureId:s.id,name:s.name,description:s.description,included:!0},s.id))})]})},rN=()=>{const{t:n}=ce(),e=an(),[t,r]=g.useState(null),[i,s]=g.useState(!1),[o,a]=g.useState(!1),[l,c]=g.useState(null),d=async()=>{if(t){s(!0),c(null);try{const f=await fetch("/api/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kit:t})});if(!f.ok)throw new Error(`Installation failed: ${f.statusText}`);a(!0)}catch(f){const p=f instanceof Error?f.message:"Unknown error occurred";c(p),console.error("Install failed:",f)}finally{s(!1)}}};if(o&&t)return h.jsx(Z8,{kit:t,onGetStarted:()=>e("/")});const u=f=>f==="engineer"?Qt.ENGINEER:Qt.MARKETING;return h.jsxs("div",{className:"max-w-4xl mx-auto py-8 px-4",children:[h.jsxs("header",{className:"text-center mb-8",children:[h.jsx("h1",{className:"text-3xl font-bold text-[var(--dash-text)]",children:n("onboardingTitle")}),h.jsx("p",{className:"mt-2 text-[var(--dash-text-muted)]",children:n("onboardingSubtitle")})]}),h.jsx("section",{className:"grid md:grid-cols-2 gap-6 mb-8",children:Object.values(mx).map(f=>{const p=u(f.id);return h.jsx(nN,{kit:f,selected:t===p,onSelect:()=>r(p),features:tN(f.id)},f.id)})}),l&&h.jsxs("div",{className:"mb-6 p-4 rounded-lg bg-red-100 border border-red-300 text-red-800",children:[h.jsx("p",{className:"font-medium",children:"Installation Error"}),h.jsx("p",{className:"text-sm mt-1",children:l}),h.jsx("button",{type:"button",onClick:()=>c(null),className:"mt-2 text-sm underline hover:no-underline",children:"Dismiss"})]}),t&&h.jsx(J8,{selectedKit:t,onKitSelect:r,onInstall:d,installing:i})]})},iN=()=>{const{t:n}=ce(),e=an(),{projectId:t}=Mm(),[r,i]=g.useState(null),{sizes:s,isDragging:o,startDrag:a}=lh({storageKey:"claudekit-project-config-panels",defaultSizes:[35,40,25],minSizes:[20,25,15]}),l=g.useCallback(async()=>{if(!t)throw new Error("No project ID");const[b,x,w]=await Promise.all([ap("project",t),ap("global"),wh()]),v=w.find(S=>S.id===t);return v&&i(v.path),{...b,global:x.config??{}}},[t]),c=g.useCallback(async b=>{t&&await Vb({scope:"project",projectId:t,config:b})},[t]),d=Fb({scope:"project",fetchConfig:l,fetchSchema:zb,saveConfig:c}),u=g.useCallback(b=>{const x=fc(d.config,b),w=fc(d.globalConfig,b);return x!==void 0&&w!==void 0&&x!==w},[d.config,d.globalConfig]),f=g.useMemo(()=>[{id:"paths",title:n("sectionPaths"),fields:[{path:"paths.docs",label:n("fieldDocsPath"),description:n("fieldDocsPathDesc")},{path:"paths.plans",label:n("fieldPlansPath"),description:n("fieldPlansPathDesc")}]},{id:"project",title:n("sectionProject"),fields:[{path:"project.type",label:n("fieldProjectType"),description:n("fieldProjectTypeDesc")},{path:"project.packageManager",label:n("fieldPackageManager"),description:n("fieldPackageManagerDesc")},{path:"project.framework",label:n("fieldFramework"),description:n("fieldFrameworkDesc")}]},{id:"privacy",title:n("sectionPrivacy"),defaultCollapsed:!0,fields:[{path:"privacyBlock",label:n("fieldPrivacyBlock"),description:n("fieldPrivacyBlockDesc")}]},{id:"advanced",title:n("sectionAdvanced"),defaultCollapsed:!0,fields:[{path:"docs.maxLoc",label:n("fieldDocsMaxLoc"),description:n("fieldDocsMaxLocDesc")},{path:"plan.namingFormat",label:n("fieldPlanNamingFormat"),description:n("fieldPlanNamingFormatDesc")}]}],[n]),p=d.activeFieldPath&&u(d.activeFieldPath)?h.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:n("localOverride")}):null,m=d.fieldDoc?h.jsxs("section",{className:"bg-blue-500/5 p-3 rounded-lg border border-blue-500/20",children:[h.jsx("h4",{className:"text-[10px] font-bold text-blue-500 uppercase tracking-widest mb-1",children:n("inheritedFromGlobal")}),h.jsxs("p",{className:"text-[12px] text-dash-text-secondary leading-normal",children:[n("viewGlobalConfig")," ",h.jsx("button",{onClick:()=>e("/config/global"),className:"text-dash-accent hover:underline font-medium",children:n("globalConfig")})]})]}):null;return h.jsxs("div",{className:"animate-in fade-in duration-300 w-full h-full flex flex-col transition-colors",children:[h.jsx(Vm,{title:n("projectConfig"),filePath:r?`${r}/.claude/.ck.json`:".claude/.ck.json",onBack:()=>e(`/project/${t}`),onSave:d.handleSave,onReset:d.handleReset,saveStatus:d.saveStatus,syntaxError:d.syntaxError,showResetConfirm:d.showResetConfirm,setShowResetConfirm:d.setShowResetConfirm}),h.jsxs("div",{className:"flex-1 flex min-h-0",children:[h.jsx(zm,{width:s[0],isLoading:d.isLoading,schema:d.schema,config:d.config,sources:d.sources,sections:f,onChange:d.handleFormChange}),h.jsx(Pr,{direction:"horizontal",isDragging:o,onMouseDown:b=>a(0,b)}),h.jsx(rd,{width:s[1],isLoading:d.isLoading,jsonText:d.jsonText,cursorLine:d.cursorLine,syntaxError:d.syntaxError,onChange:d.handleJsonChange,onCursorLineChange:d.setCursorLine}),h.jsx(Pr,{direction:"horizontal",isDragging:o,onMouseDown:b=>a(1,b)}),h.jsx(Ib,{width:s[2],fieldDoc:d.fieldDoc,activeFieldPath:d.activeFieldPath,overrideBadge:p,extraContent:m})]})]})},Ot="__global__",sN=({project:n})=>{const{t:e}=ce(),t=an(),{skills:r,loading:i}=Mv(),{sessions:s,loading:o}=Dv(n.id),[a,l]=g.useState(null),[c,d]=g.useState(!0),[u,f]=g.useState(null),[p,m]=g.useState(Ot),[b,x]=g.useState(Ot),w=async(N,L)=>{try{await kv(N,n.path,L,n.id)}catch(W){alert(`${e("actionFailed")}: ${W instanceof Error?W.message:N}`)}},v=g.useCallback(()=>{const N=new AbortController;return d(!0),f(null),wv(n.id,N.signal).then(L=>{l(L),m(L.preferences.project.terminalApp||Ot),x(L.preferences.project.editorApp||Ot)}).catch(L=>{L instanceof DOMException&&L.name==="AbortError"||(l(null),m(Ot),x(Ot),f(e("actionOptionsLoadFailed")))}).finally(()=>{N.signal.aborted||d(!1)}),N},[n.id,e]);g.useEffect(()=>{const N=v();return()=>{N.abort()}},[v]);const S=r.filter(N=>n.skills.includes(N.id)),j=a?.terminals||[],k=a?.editors||[],O=j.find(N=>N.id===a?.defaults.terminalApp)?.label||a?.defaults.terminalApp,y=k.find(N=>N.id===a?.defaults.editorApp)?.label||a?.defaults.editorApp,D=g.useMemo(()=>j.find(N=>p===Ot?N.id===a?.defaults.terminalApp:N.id===p),[j,p,a?.defaults.terminalApp]),A=g.useMemo(()=>k.find(N=>b===Ot?N.id===a?.defaults.editorApp:N.id===b),[k,b,a?.defaults.editorApp]),R=async(N,L)=>{if(!n.id.startsWith("discovered-"))try{await Fm(n.id,{preferences:{[N]:L===Ot?null:L}})}catch(W){const F=W instanceof Error?W.message:"Failed to save preference";alert(`${e("actionFailed")}: ${F}`)}};return h.jsxs("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-500 transition-colors flex flex-col h-full",children:[h.jsx("section",{className:"mb-6 shrink-0",children:h.jsxs("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-4",children:[h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[h.jsx("h1",{className:"text-3xl font-bold tracking-tight text-dash-text",children:n.name}),h.jsx(oN,{status:n.health}),h.jsx(RC,{variant:"beta"})]}),h.jsxs("p",{className:"text-dash-text-secondary mono text-sm flex items-center gap-2 italic",children:[h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:h.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"})}),n.path]})]}),h.jsx("div",{className:"flex items-center gap-3",children:h.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:s.length>0?`${s.length} ${e("sessions")}`:e("noSessions")})})]})}),h.jsxs("section",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6 shrink-0",children:[u?h.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:[h.jsx("span",{children:u}),h.jsx("button",{onClick:()=>void v(),className:"rounded border border-orange-500/40 px-2 py-1 font-semibold hover:bg-orange-500/10 transition-colors",children:e("tryAgain")})]}):null,h.jsx(tm,{icon:"📟",label:e("terminal"),sub:D?`${D.openMode==="open-app"?e("openAppOnly"):e("openAtPath")} • ${D.label}`:e("terminalSub"),onClick:()=>w("terminal",p===Ot?void 0:p),disabled:c||!D&&j.length>0,options:j,value:p,fallbackLabel:a?`${e("useGlobalFallback")} (${O})`:e("useGlobalFallback"),onChange:async N=>{m(N),await R("terminalApp",N)}}),h.jsx(tm,{icon:"💻",label:e("editor"),sub:A?`${A.openMode==="open-app"?e("openAppOnly"):e("openAtPath")} • ${A.label}`:e("editorSub"),onClick:()=>w("editor",b===Ot?void 0:b),disabled:c||!A&&k.length>0,options:k,value:b,fallbackLabel:a?`${e("useGlobalFallback")} (${y})`:e("useGlobalFallback"),onChange:async N=>{x(N),await R("editorApp",N)}}),h.jsx(ch,{icon:"🤖",label:e("launch"),sub:e("launchSub"),highlight:!0,onClick:()=>w("launch")}),h.jsx(ch,{icon:"⚙️",label:e("config"),sub:e("configSub"),onClick:()=>t(`/config/project/${n.id}`)})]}),h.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 flex-1 min-h-0",children:[h.jsx("div",{className:"lg:col-span-2 flex flex-col gap-6 min-h-0",children:h.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:[h.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:h.jsx("h3",{className:"text-sm font-bold text-dash-text-secondary uppercase tracking-widest",children:e("recentSessions")})}),h.jsx("div",{className:"divide-y divide-dash-border overflow-y-auto flex-1",children:o?h.jsx("div",{className:"p-4 text-center text-dash-text-muted animate-pulse",children:e("loadingSessions")}):s.length===0?h.jsx("div",{className:"p-4 text-center text-dash-text-muted",children:e("noSessionsFound")}):s.map(N=>h.jsxs("div",{className:"p-4 hover:bg-dash-surface-hover transition-colors group cursor-pointer",children:[h.jsxs("div",{className:"flex items-center justify-between mb-1",children:[h.jsx("span",{className:"text-xs font-bold text-dash-accent",children:N.timestamp}),h.jsx("span",{className:"text-[10px] text-dash-text-muted font-medium group-hover:text-dash-text-secondary transition-colors",children:N.duration})]}),h.jsx("p",{className:"text-sm text-dash-text-secondary leading-relaxed truncate",children:N.summary})]},N.id))})]})}),h.jsxs("div",{className:"flex flex-col gap-6 min-h-0",children:[h.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-xl p-6 shadow-sm shrink-0",children:[h.jsxs("h3",{className:"text-sm font-bold text-dash-text-secondary uppercase tracking-widest mb-4 flex items-center gap-2",children:[e("configuration"),h.jsx("span",{className:"text-[10px] font-normal text-dash-text-muted normal-case",children:e("globalSettings")})]}),h.jsxs("div",{className:"space-y-4",children:[h.jsx(Fo,{label:e("activeKit"),value:n.kitType}),h.jsx(Fo,{label:e("aiModel"),value:n.model}),h.jsx(Fo,{label:e("hooks"),value:`${n.activeHooks} ${e("active")}`}),h.jsx(Fo,{label:e("mcpServers"),value:`${n.mcpServers} ${e("connected")}`})]}),h.jsx("button",{onClick:()=>t(`/config/project/${n.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")})]}),h.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-xl shadow-sm flex flex-col flex-1 min-h-0",children:[h.jsx("div",{className:"p-4 pb-2 border-b border-dash-border shrink-0",children:h.jsxs("h3",{className:"text-sm font-bold text-dash-text-secondary uppercase tracking-widest flex items-center justify-between",children:[e("globalSkills"),h.jsx("span",{className:"text-[10px] bg-dash-accent-subtle text-dash-accent px-1.5 py-0.5 rounded-full",children:i?"...":r.length})]})}),h.jsx("div",{className:"overflow-y-auto flex-1 px-4 py-2 space-y-2",children:i?h.jsx("div",{className:"text-center text-dash-text-muted animate-pulse py-4",children:e("loadingSkills")}):(S.length>0?S:r).map(N=>h.jsxs("div",{className:"flex flex-col gap-0.5 border-l-2 border-dash-accent/20 pl-3 py-1",children:[h.jsx("span",{className:"text-sm font-semibold text-dash-text",children:N.name}),h.jsx("p",{className:"text-[10px] text-dash-text-muted leading-tight line-clamp-1",children:N.description||e("noDescription")})]},N.id))}),h.jsx("div",{className:"p-4 pt-2 border-t border-dash-border shrink-0",children:h.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")," →"]})})]})]})]})]})},oN=({status:n})=>{const e={[Pn.HEALTHY]:"bg-dash-accent-subtle text-dash-accent border-dash-accent/20",[Pn.WARNING]:"bg-orange-500/10 text-orange-600 border-orange-500/20",[Pn.ERROR]:"bg-red-500/10 text-red-600 border-red-500/20",[Pn.LOADING]:"bg-dash-border/20 text-dash-text-muted border-dash-border",[Pn.UNKNOWN]:"bg-dash-border/20 text-dash-text-muted border-dash-border"};return h.jsx("span",{className:`px-2 py-0.5 rounded-full text-[10px] font-bold border uppercase tracking-widest ${e[n]}`,children:n})},tm=({icon:n,label:e,sub:t,disabled:r,options:i,value:s,fallbackLabel:o,onClick:a,onChange:l})=>h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx(ch,{icon:n,label:e,sub:t,onClick:a,disabled:r}),h.jsxs("select",{value:s,onChange:c=>void l(c.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:[h.jsx("option",{value:Ot,children:o}),i.map(c=>h.jsx("option",{value:c.id,disabled:!c.available,children:`${c.label} • ${c.detected?"Detected":"Not detected"}`},c.id))]})]}),ch=({icon:n,label:e,sub:t,highlight:r,onClick:i,disabled:s})=>h.jsxs("button",{onClick:i,disabled:s,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"} ${s?"opacity-50 cursor-not-allowed":""}`,children:[h.jsx("span",{className:"text-2xl mb-1 group-hover:scale-110 transition-transform",children:n}),h.jsx("span",{className:"text-sm font-bold text-dash-text",children:e}),h.jsx("span",{className:"text-[10px] text-dash-text-muted font-medium truncate italic",children:t})]}),Fo=({label:n,value:e})=>h.jsxs("div",{className:"flex items-center justify-between text-xs py-1.5 border-b border-dash-border/50 last:border-0",children:[h.jsx("span",{className:"text-dash-text-muted font-medium",children:n}),h.jsx("span",{className:"text-dash-text font-bold mono uppercase text-[10px] tracking-tight",children:e})]}),aN=()=>{const{t:n}=ce(),{project:e}=r1();return e?h.jsx(sN,{project:e}):h.jsxs("div",{className:"flex flex-col items-center justify-center h-full space-y-4 opacity-50",children:[h.jsx("div",{className:"w-16 h-16 rounded-full bg-dash-surface border border-dash-border flex items-center justify-center",children:h.jsx("span",{className:"text-2xl text-dash-text-muted",children:"📂"})}),h.jsx("p",{className:"text-lg text-dash-text-secondary font-bold",children:n("selectProject")})]})},lN=X1([{path:"/",element:h.jsx(Rv,{}),children:[{index:!0,element:h.jsx(il,{to:"/config/global",replace:!0})},{path:"config/global",element:h.jsx(ZC,{})},{path:"config/project/:projectId",element:h.jsx(iN,{})},{path:"project/:projectId",element:h.jsx(aN,{})},{path:"onboarding",element:h.jsx(rN,{})},{path:"migrate",element:h.jsx(G8,{})},{path:"kanban",element:h.jsx(nj,{})},{path:"skills",element:h.jsx(il,{to:"/migrate",replace:!0})},{path:"*",element:h.jsx(il,{to:"/",replace:!0})}]}]),gx=document.getElementById("root");if(!gx)throw document.body.innerHTML='<div style="padding:20px;color:red;">Fatal: Root element not found</div>',new Error("Root element #root not found");ac.createRoot(gx).render(h.jsx(Dx.StrictMode,{children:h.jsx(pv,{children:h.jsx(mv,{children:h.jsx(dv,{router:lN})})})}));