claudekit-cli 3.39.3-dev.6 → 3.39.3-dev.8

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.
@@ -6,7 +6,7 @@ var Bx=Object.defineProperty;var Fx=(t,e,n)=>e in t?Bx(t,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 _x=g,Hx=Symbol.for("react.element"),Wx=Symbol.for("react.fragment"),Ux=Object.prototype.hasOwnProperty,Kx=_x.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Gx={key:!0,ref:!0,__self:!0,__source:!0};function dm(t,e,n){var r,i={},s=null,o=null;n!==void 0&&(s=""+n),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)Ux.call(e,r)&&!Gx.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:Hx,type:t,key:s,ref:o,props:i,_owner:Kx.current}}Aa.Fragment=Wx;Aa.jsx=dm;Aa.jsxs=dm;hm.exports=Aa;var h=hm.exports,cc={},Ad=cm;cc.createRoot=Ad.createRoot,cc.hydrateRoot=Ad.hydrateRoot;/**
9
+ */var Hx=g,_x=Symbol.for("react.element"),Wx=Symbol.for("react.fragment"),Ux=Object.prototype.hasOwnProperty,Kx=Hx.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Gx={key:!0,ref:!0,__self:!0,__source:!0};function dm(t,e,n){var r,i={},s=null,o=null;n!==void 0&&(s=""+n),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)Ux.call(e,r)&&!Gx.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:_x,type:t,key:s,ref:o,props:i,_owner:Kx.current}}Aa.Fragment=Wx;Aa.jsx=dm;Aa.jsxs=dm;hm.exports=Aa;var h=hm.exports,cc={},Ad=cm;cc.createRoot=Ad.createRoot,cc.hydrateRoot=Ad.hydrateRoot;/**
10
10
  * react-router v7.11.0
11
11
  *
12
12
  * Copyright (c) Remix Software Inc.
@@ -15,10 +15,10 @@ var Bx=Object.defineProperty;var Fx=(t,e,n)=>e in t?Bx(t,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 um=t=>{throw TypeError(t)},qx=(t,e,n)=>e.has(t)||um("Cannot "+n),tl=(t,e,n)=>(qx(t,e,"read from private field"),n?n.call(t):e.get(t)),Jx=(t,e,n)=>e.has(t)?um("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Md="popstate";function Yx(t={}){function e(r,i){let{pathname:s,search:o,hash:a}=r.location;return Ei("",{pathname:s,search:o,hash:a},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:on(i)}return Xx(e,n,null,t)}function de(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Ee(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function Qx(){return Math.random().toString(36).substring(2,10)}function Dd(t,e){return{usr:t.state,key:t.key,idx:e}}function Ei(t,e,n=null,r){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?Vn(e):e,state:n,key:e&&e.key||r||Qx()}}function on({pathname:t="/",search:e="",hash:n=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function Vn(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substring(n),t=t.substring(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substring(r),t=t.substring(0,r)),t&&(e.pathname=t)}return e}function Xx(t,e,n,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=Ei(b.location,x,w);c=d()+1;let S=Dd(v,c),C=b.createHref(v);try{o.pushState(S,"",C)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;i.location.assign(C)}s&&l&&l({action:a,location:b.location,delta:1})}function p(x,w){a="REPLACE";let v=Ei(b.location,x,w);c=d();let S=Dd(v,c),C=b.createHref(v);o.replaceState(S,"",C),s&&l&&l({action:a,location:b.location,delta:0})}function m(x){return fm(x)}let b={get action(){return a},get location(){return t(i,o)},listen(x){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(Md,u),l=x,()=>{i.removeEventListener(Md,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 fm(t,e=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),de(n,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:on(t);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=n+r),new URL(r,n)}var xi,Td=class{constructor(t){if(Jx(this,xi,new Map),t)for(let[e,n]of t)this.set(e,n)}get(t){if(tl(this,xi).has(t))return tl(this,xi).get(t);if(t.defaultValue!==void 0)return t.defaultValue;throw new Error("No value found for context")}set(t,e){tl(this,xi).set(t,e)}};xi=new WeakMap;var Zx=new Set(["lazy","caseSensitive","path","id","index","children"]);function ey(t){return Zx.has(t)}var ty=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function ny(t){return ty.has(t)}function ry(t){return t.index===!0}function Ri(t,e,n=[],r={},i=!1){return t.map((s,o)=>{let a=[...n,String(o)],l=typeof s.id=="string"?s.id:a.join("-");if(de(s.index!==!0||!s.children,"Cannot specify children on an index route"),de(i||!r[l],`Found a route id collision on id "${l}". Route id's must be globally unique within Data Router usages`),ry(s)){let c={...s,id:l};return r[l]=Ed(c,e(c)),c}else{let c={...s,id:l,children:void 0};return r[l]=Ed(c,e(c)),s.children&&(c.children=Ri(s.children,e,a,r,i)),c}})}function Ed(t,e){return Object.assign(t,{...e,...typeof e.lazy=="object"&&e.lazy!=null?{lazy:{...t.lazy,...e.lazy}}:{}})}function jn(t,e,n="/"){return yi(t,e,n,!1)}function yi(t,e,n,r){let i=typeof e=="string"?Vn(e):e,s=Rt(i.pathname||"/",n);if(s==null)return null;let o=pm(t);sy(o);let a=null;for(let l=0;a==null&&l<o.length;++l){let c=gy(s);a=py(o[l],c,r)}return a}function iy(t,e){let{route:n,pathname:r,params:i}=t;return{id:n.id,pathname:r,params:i,data:e[n.id],loaderData:e[n.id],handle:n.handle}}function pm(t,e=[],n=[],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;de(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=n.concat(d);o.children&&o.children.length>0&&(de(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),pm(o.children,e,f,u,l)),!(o.path==null&&!o.index)&&e.push({path:u,score:uy(u,o.index),routesMeta:f})};return t.forEach((o,a)=>{if(o.path===""||!o.path?.includes("?"))s(o,a);else for(let l of mm(o.path))s(o,a,!0,l)}),e}function mm(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=mm(r.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function sy(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:fy(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var oy=/^:[\w-]+$/,ay=3,ly=2,cy=1,hy=10,dy=-2,Rd=t=>t==="*";function uy(t,e){let n=t.split("/"),r=n.length;return n.some(Rd)&&(r+=dy),e&&(r+=ly),n.filter(i=>!Rd(i)).reduce((i,s)=>i+(oy.test(s)?ay:s===""?cy:hy),r)}function fy(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function py(t,e,n=!1){let{routesMeta:r}=t,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=ta({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},d),f=l.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=ta({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:yy(rn([s,u.pathnameBase])),route:f}),u.pathnameBase!=="/"&&(s=rn([s,u.pathnameBase]))}return o}function ta(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=my(t.path,t.caseSensitive,t.end),i=e.match(n);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:t}}function my(t,e=!1,n=!0){Ee(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function gy(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Ee(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function Rt(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}function by({basename:t,pathname:e}){return e==="/"?t:rn([t,e])}var gm=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ma=t=>gm.test(t);function xy(t,e="/"){let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?Vn(t):t,s;if(n)if(Ma(n))s=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),Ee(!1,`Pathnames cannot have embedded double slashes - normalizing ${o} -> ${n}`)}n.startsWith("/")?s=Ld(n.substring(1),"/"):s=Ld(n,e)}else s=e;return{pathname:s,search:vy(r),hash:wy(i)}}function Ld(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function nl(t,e,n,r){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function bm(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Da(t){let e=bm(t);return e.map((n,r)=>r===e.length-1?n.pathname:n.pathnameBase)}function Ta(t,e,n,r=!1){let i;typeof t=="string"?i=Vn(t):(i={...t},de(!i.pathname||!i.pathname.includes("?"),nl("?","pathname","search",i)),de(!i.pathname||!i.pathname.includes("#"),nl("#","pathname","hash",i)),de(!i.search||!i.search.includes("#"),nl("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=n;else{let u=e.length-1;if(!r&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),u-=1;i.pathname=f.join("/")}a=u>=0?e[u]:"/"}let l=xy(i,a),c=o&&o!=="/"&&o.endsWith("/"),d=(s||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||d)&&(l.pathname+="/"),l}var rn=t=>t.join("/").replace(/\/\/+/g,"/"),yy=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),vy=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,wy=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,Bs=class{constructor(t,e,n,r=!1){this.status=t,this.statusText=e||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Li(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Fs(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var xm=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ym(t,e){let n=t;if(typeof n!="string"||!gm.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(xm)try{let s=new URL(window.location.href),o=n.startsWith("//")?new URL(s.protocol+n):new URL(n),a=Rt(o.pathname,e);o.origin===s.origin&&a!=null?n=a+o.search+o.hash:i=!0}catch{Ee(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var An=Symbol("Uninstrumented");function ky(t,e){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};t.forEach(i=>i({id:e.id,index:e.index,path:e.path,instrument(s){let o=Object.keys(n);for(let a of o)s[a]&&n[a].push(s[a])}}));let r={};if(typeof e.lazy=="function"&&n.lazy.length>0){let i=wr(n.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=n[`lazy.${s}`];if(typeof o=="function"&&a.length>0){let l=wr(a,o,()=>{});l&&(r.lazy=Object.assign(r.lazy||{},{[s]:l}))}})}return["loader","action"].forEach(i=>{let s=e[i];if(typeof s=="function"&&n[i].length>0){let o=s[An]??s,a=wr(n[i],o,(...l)=>Id(l[0]));a&&(a[An]=o,r[i]=a)}}),e.middleware&&e.middleware.length>0&&n.middleware.length>0&&(r.middleware=e.middleware.map(i=>{let s=i[An]??i,o=wr(n.middleware,s,(...a)=>Id(a[0]));return o?(o[An]=s,o):i})),r}function Sy(t,e){let n={navigate:[],fetch:[]};if(e.forEach(r=>r({instrument(i){let s=Object.keys(i);for(let o of s)i[o]&&n[o].push(i[o])}})),n.navigate.length>0){let r=t.navigate[An]??t.navigate,i=wr(n.navigate,r,(...s)=>{let[o,a]=s;return{to:typeof o=="number"||typeof o=="string"?o:o?on(o):".",...$d(t,a??{})}});i&&(i[An]=r,t.navigate=i)}if(n.fetch.length>0){let r=t.fetch[An]??t.fetch,i=wr(n.fetch,r,(...s)=>{let[o,,a,l]=s;return{href:a??".",fetcherKey:o,...$d(t,l??{})}});i&&(i[An]=r,t.fetch=i)}return t}function wr(t,e,n){return t.length===0?null:async(...r)=>{let i=await vm(t,n(...r),()=>e(...r),t.length-1);if(i.type==="error")throw i.value;return i.value}}async function vm(t,e,n,r){let i=t[r],s;if(i){let o,a=async()=>(o?console.error("You cannot call instrumented handlers more than once"):o=vm(t,e,n,r-1),s=await o,de(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 n()}}catch(o){s={type:"error",value:o}}return s||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function Id(t){let{request:e,context:n,params:r,unstable_pattern:i}=t;return{request:Cy(e),params:{...r},unstable_pattern:i,context:jy(n)}}function $d(t,e){return{currentUrl:on(t.state.location),..."formMethod"in e?{formMethod:e.formMethod}:{},..."formEncType"in e?{formEncType:e.formEncType}:{},..."formData"in e?{formData:e.formData}:{},..."body"in e?{body:e.body}:{}}}function Cy(t){return{method:t.method,url:t.url,headers:{get:(...e)=>t.headers.get(...e)}}}function jy(t){if(Py(t)){let e={...t};return Object.freeze(e),e}else return{get:e=>t.get(e)}}var Oy=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Py(t){if(t===null||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||e===null||Object.getOwnPropertyNames(e).sort().join("\0")===Oy}var wm=["POST","PUT","PATCH","DELETE"],Ny=new Set(wm),Ay=["GET",...wm],My=new Set(Ay),km=new Set([301,302,303,307,308]),Dy=new Set([307,308]),rl={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Ty={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},Ey=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),Sm="remix-router-transitions",Cm=Symbol("ResetLoaderData");function Ry(t){const e=t.window?t.window:typeof window<"u"?window:void 0,n=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u";de(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=t.hydrationRouteProperties||[],i=t.mapRouteProperties||Ey,s=i;if(t.unstable_instrumentations){let j=t.unstable_instrumentations;s=P=>({...i(P),...ky(j.map(D=>D.route).filter(Boolean),P)})}let o={},a=Ri(t.routes,s,void 0,o),l,c=t.basename||"/";c.startsWith("/")||(c=`/${c}`);let d=t.dataStrategy||Fy,u={...t.future},f=null,p=new Set,m=null,b=null,x=null,w=t.hydrationData!=null,v=jn(a,t.history.location,c),S=!1,C=null,k;if(v==null&&!t.patchRoutesOnNavigation){let j=Pt(404,{pathname:t.history.location.pathname}),{matches:P,route:D}=lo(a);k=!0,v=P,C={[D.id]:j}}else if(v&&!t.hydrationData&&ro(v,a,t.history.location.pathname).active&&(v=null),v)if(v.some(j=>j.route.lazy))k=!1;else if(!v.some(j=>fh(j.route)))k=!0;else{let j=t.hydrationData?t.hydrationData.loaderData:null,P=t.hydrationData?t.hydrationData.errors:null;if(P){let D=v.findIndex(B=>P[B.route.id]!==void 0);k=v.slice(0,D+1).every(B=>!dc(B.route,j,P))}else k=v.every(D=>!dc(D.route,j,P))}else{k=!1,v=[];let j=ro(null,a,t.history.location.pathname);j.active&&j.matches&&(S=!0,v=j.matches)}let O,y={historyAction:t.history.action,location:t.history.location,matches:v,initialized:k,navigation:rl,restoreScrollPosition:t.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:t.hydrationData&&t.hydrationData.loaderData||{},actionData:t.hydrationData&&t.hydrationData.actionData||null,errors:t.hydrationData&&t.hydrationData.errors||C,fetchers:new Map,blockers:new Map},M="POP",A=null,R=!1,N,L=!1,H=new Map,$=null,F=!1,G=!1,ue=new Set,X=new Map,te=0,oe=-1,pe=new Map,Y=new Set,le=new Map,me=new Map,ke=new Set,Qe=new Map,mt,q=null;function Me(){if(f=t.history.listen(({action:j,location:P,delta:D})=>{if(mt){mt(),mt=void 0;return}Ee(Qe.size===0||D!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let B=Sd({currentLocation:y.location,nextLocation:P,historyAction:j});if(B&&D!=null){let V=new Promise(Z=>{mt=Z});t.history.go(D*-1),no(B,{state:"blocked",location:P,proceed(){no(B,{state:"proceeding",proceed:void 0,reset:void 0,location:P}),V.then(()=>t.history.go(D))},reset(){let Z=new Map(y.blockers);Z.set(B,si),Se({blockers:Z})}}),A?.resolve(),A=null;return}return ae(j,P)}),n){r1(e,H);let j=()=>i1(e,H);e.addEventListener("pagehide",j),$=()=>e.removeEventListener("pagehide",j)}return y.initialized||ae("POP",y.location,{initialHydration:!0}),O}function Ce(){f&&f(),$&&$(),p.clear(),N&&N.abort(),y.fetchers.forEach((j,P)=>Xa(P)),y.blockers.forEach((j,P)=>kd(P))}function Ie(j){return p.add(j),()=>p.delete(j)}function Se(j,P={}){j.matches&&(j.matches=j.matches.map(V=>{let Z=o[V.route.id],J=V.route;return J.element!==Z.element||J.errorElement!==Z.errorElement||J.hydrateFallbackElement!==Z.hydrateFallbackElement?{...V,route:Z}:V})),y={...y,...j};let D=[],B=[];y.fetchers.forEach((V,Z)=>{V.state==="idle"&&(ke.has(Z)?D.push(Z):B.push(Z))}),ke.forEach(V=>{!y.fetchers.has(V)&&!X.has(V)&&D.push(V)}),[...p].forEach(V=>V(y,{deletedFetchers:D,newErrors:j.errors??null,viewTransitionOpts:P.viewTransitionOpts,flushSync:P.flushSync===!0})),D.forEach(V=>Xa(V)),B.forEach(V=>y.fetchers.delete(V))}function gt(j,P,{flushSync:D}={}){let B=y.actionData!=null&&y.navigation.formMethod!=null&&Ze(y.navigation.formMethod)&&y.navigation.state==="loading"&&j.state?._isRedirect!==!0,V;P.actionData?Object.keys(P.actionData).length>0?V=P.actionData:V=null:B?V=y.actionData:V=null;let Z=P.loaderData?Gd(y.loaderData,P.loaderData,P.matches||[],P.errors):y.loaderData,J=y.blockers;J.size>0&&(J=new Map(J),J.forEach((se,ne)=>J.set(ne,si)));let Q=F?!1:jd(j,P.matches||y.matches),ee=R===!0||y.navigation.formMethod!=null&&Ze(y.navigation.formMethod)&&j.state?._isRedirect!==!0;l&&(a=l,l=void 0),F||M==="POP"||(M==="PUSH"?t.history.push(j,j.state):M==="REPLACE"&&t.history.replace(j,j.state));let ie;if(M==="POP"){let se=H.get(y.location.pathname);se&&se.has(j.pathname)?ie={currentLocation:y.location,nextLocation:j}:H.has(j.pathname)&&(ie={currentLocation:j,nextLocation:y.location})}else if(L){let se=H.get(y.location.pathname);se?se.add(j.pathname):(se=new Set([j.pathname]),H.set(y.location.pathname,se)),ie={currentLocation:y.location,nextLocation:j}}Se({...P,actionData:V,loaderData:Z,historyAction:M,location:j,initialized:!0,navigation:rl,revalidation:"idle",restoreScrollPosition:Q,preventScrollReset:ee,blockers:J},{viewTransitionOpts:ie,flushSync:D===!0}),M="POP",R=!1,L=!1,F=!1,G=!1,A?.resolve(),A=null,q?.resolve(),q=null}async function I(j,P){if(A?.resolve(),A=null,typeof j=="number"){A||(A=Qd());let ve=A.promise;return t.history.go(j),ve}let D=hc(y.location,y.matches,c,j,P?.fromRouteId,P?.relative),{path:B,submission:V,error:Z}=Bd(!1,D,P),J=y.location,Q=Ei(y.location,B,P&&P.state);Q={...Q,...t.history.encodeLocation(Q)};let ee=P&&P.replace!=null?P.replace:void 0,ie="PUSH";ee===!0?ie="REPLACE":ee===!1||V!=null&&Ze(V.formMethod)&&V.formAction===y.location.pathname+y.location.search&&(ie="REPLACE");let se=P&&"preventScrollReset"in P?P.preventScrollReset===!0:void 0,ne=(P&&P.flushSync)===!0,ye=Sd({currentLocation:J,nextLocation:Q,historyAction:ie});if(ye){no(ye,{state:"blocked",location:Q,proceed(){no(ye,{state:"proceeding",proceed:void 0,reset:void 0,location:Q}),I(j,P)},reset(){let ve=new Map(y.blockers);ve.set(ye,si),Se({blockers:ve})}});return}await ae(ie,Q,{submission:V,pendingError:Z,preventScrollReset:se,replace:P&&P.replace,enableViewTransition:P&&P.viewTransition,flushSync:ne,callSiteDefaultShouldRevalidate:P&&P.unstable_defaultShouldRevalidate})}function K(){q||(q=Qd()),Qa(),Se({revalidation:"loading"});let j=q.promise;return y.navigation.state==="submitting"?j:y.navigation.state==="idle"?(ae(y.historyAction,y.location,{startUninterruptedRevalidation:!0}),j):(ae(M||y.historyAction,y.navigation.location,{overrideNavigation:y.navigation,enableViewTransition:L===!0}),j)}async function ae(j,P,D){N&&N.abort(),N=null,M=j,F=(D&&D.startUninterruptedRevalidation)===!0,Rx(y.location,y.matches),R=(D&&D.preventScrollReset)===!0,L=(D&&D.enableViewTransition)===!0;let B=l||a,V=D&&D.overrideNavigation,Z=D?.initialHydration&&y.matches&&y.matches.length>0&&!S?y.matches:jn(B,P,c),J=(D&&D.flushSync)===!0;if(Z&&y.initialized&&!G&&Gy(y.location,P)&&!(D&&D.submission&&Ze(D.submission.formMethod))){gt(P,{matches:Z},{flushSync:J});return}let Q=ro(Z,B,P.pathname);if(Q.active&&Q.matches&&(Z=Q.matches),!Z){let{error:We,notFoundMatches:it,route:je}=Za(P.pathname);gt(P,{matches:it,loaderData:{},errors:{[je.id]:We}},{flushSync:J});return}N=new AbortController;let ee=xr(t.history,P,N.signal,D&&D.submission),ie=t.getContext?await t.getContext():new Td,se;if(D&&D.pendingError)se=[On(Z).route.id,{type:"error",error:D.pendingError}];else if(D&&D.submission&&Ze(D.submission.formMethod)){let We=await De(ee,P,D.submission,Z,ie,Q.active,D&&D.initialHydration===!0,{replace:D.replace,flushSync:J});if(We.shortCircuited)return;if(We.pendingActionResult){let[it,je]=We.pendingActionResult;if(vt(je)&&Li(je.error)&&je.error.status===404){N=null,gt(P,{matches:We.matches,loaderData:{},errors:{[it]:je.error}});return}}Z=We.matches||Z,se=We.pendingActionResult,V=il(P,D.submission),J=!1,Q.active=!1,ee=xr(t.history,ee.url,ee.signal)}let{shortCircuited:ne,matches:ye,loaderData:ve,errors:Ke}=await Ut(ee,P,Z,ie,Q.active,V,D&&D.submission,D&&D.fetcherSubmission,D&&D.replace,D&&D.initialHydration===!0,J,se,D&&D.callSiteDefaultShouldRevalidate);ne||(N=null,gt(P,{matches:ye||Z,...qd(se),loaderData:ve,errors:Ke}))}async function De(j,P,D,B,V,Z,J,Q={}){Qa();let ee=t1(P,D);if(Se({navigation:ee},{flushSync:Q.flushSync===!0}),Z){let ne=await io(B,P.pathname,j.signal);if(ne.type==="aborted")return{shortCircuited:!0};if(ne.type==="error"){if(ne.partialMatches.length===0){let{matches:ve,route:Ke}=lo(a);return{matches:ve,pendingActionResult:[Ke.id,{type:"error",error:ne.error}]}}let ye=On(ne.partialMatches).route.id;return{matches:ne.partialMatches,pendingActionResult:[ye,{type:"error",error:ne.error}]}}else if(ne.matches)B=ne.matches;else{let{notFoundMatches:ye,error:ve,route:Ke}=Za(P.pathname);return{matches:ye,pendingActionResult:[Ke.id,{type:"error",error:ve}]}}}let ie,se=_o(B,P);if(!se.route.action&&!se.route.lazy)ie={type:"error",error:Pt(405,{method:j.method,pathname:P.pathname,routeId:se.route.id})};else{let ne=Pr(s,o,j,B,se,J?[]:r,V),ye=await ni(j,ne,V,null);if(ie=ye[se.route.id],!ie){for(let ve of B)if(ye[ve.route.id]){ie=ye[ve.route.id];break}}if(j.signal.aborted)return{shortCircuited:!0}}if(er(ie)){let ne;return Q&&Q.replace!=null?ne=Q.replace:ne=Wd(ie.response.headers.get("Location"),new URL(j.url),c)===y.location.pathname+y.location.search,await Wn(j,ie,!0,{submission:D,replace:ne}),{shortCircuited:!0}}if(vt(ie)){let ne=On(B,se.route.id);return(Q&&Q.replace)!==!0&&(M="PUSH"),{matches:B,pendingActionResult:[ne.route.id,ie,se.route.id]}}return{matches:B,pendingActionResult:[se.route.id,ie]}}async function Ut(j,P,D,B,V,Z,J,Q,ee,ie,se,ne,ye){let ve=Z||il(P,J),Ke=J||Q||Yd(ve),We=!F&&!ie;if(V){if(We){let Xe=to(ne);Se({navigation:ve,...Xe!==void 0?{actionData:Xe}:{}},{flushSync:se})}let xe=await io(D,P.pathname,j.signal);if(xe.type==="aborted")return{shortCircuited:!0};if(xe.type==="error"){if(xe.partialMatches.length===0){let{matches:mr,route:Gn}=lo(a);return{matches:mr,loaderData:{},errors:{[Gn.id]:xe.error}}}let Xe=On(xe.partialMatches).route.id;return{matches:xe.partialMatches,loaderData:{},errors:{[Xe]:xe.error}}}else if(xe.matches)D=xe.matches;else{let{error:Xe,notFoundMatches:mr,route:Gn}=Za(P.pathname);return{matches:mr,loaderData:{},errors:{[Gn.id]:Xe}}}}let it=l||a,{dsMatches:je,revalidatingFetchers:jt}=Fd(j,B,s,o,t.history,y,D,Ke,P,ie?[]:r,ie===!0,G,ue,ke,le,Y,it,c,t.patchRoutesOnNavigation!=null,ne,ye);if(oe=++te,!t.dataStrategy&&!je.some(xe=>xe.shouldLoad)&&!je.some(xe=>xe.route.middleware&&xe.route.middleware.length>0)&&jt.length===0){let xe=vd();return gt(P,{matches:D,loaderData:{},errors:ne&&vt(ne[1])?{[ne[0]]:ne[1].error}:null,...qd(ne),...xe?{fetchers:new Map(y.fetchers)}:{}},{flushSync:se}),{shortCircuited:!0}}if(We){let xe={};if(!V){xe.navigation=ve;let Xe=to(ne);Xe!==void 0&&(xe.actionData=Xe)}jt.length>0&&(xe.fetchers=ti(jt)),Se(xe,{flushSync:se})}jt.forEach(xe=>{fn(xe.key),xe.controller&&X.set(xe.key,xe.controller)});let Un=()=>jt.forEach(xe=>fn(xe.key));N&&N.signal.addEventListener("abort",Un);let{loaderResults:ri,fetcherResults:wn}=await bd(je,jt,j,B);if(j.signal.aborted)return{shortCircuited:!0};N&&N.signal.removeEventListener("abort",Un),jt.forEach(xe=>X.delete(xe.key));let Kt=co(ri);if(Kt)return await Wn(j,Kt.result,!0,{replace:ee}),{shortCircuited:!0};if(Kt=co(wn),Kt)return Y.add(Kt.key),await Wn(j,Kt.result,!0,{replace:ee}),{shortCircuited:!0};let{loaderData:el,errors:ii}=Kd(y,D,ri,ne,jt,wn);ie&&y.errors&&(ii={...y.errors,...ii});let Kn=vd(),so=wd(oe),oo=Kn||so||jt.length>0;return{matches:D,loaderData:el,errors:ii,...oo?{fetchers:new Map(y.fetchers)}:{}}}function to(j){if(j&&!vt(j[1]))return{[j[0]]:j[1].data};if(y.actionData)return Object.keys(y.actionData).length===0?null:y.actionData}function ti(j){return j.forEach(P=>{let D=y.fetchers.get(P.key),B=oi(void 0,D?D.data:void 0);y.fetchers.set(P.key,B)}),new Map(y.fetchers)}async function Px(j,P,D,B){fn(j);let V=(B&&B.flushSync)===!0,Z=l||a,J=hc(y.location,y.matches,c,D,P,B?.relative),Q=jn(Z,J,c),ee=ro(Q,Z,J);if(ee.active&&ee.matches&&(Q=ee.matches),!Q){un(j,P,Pt(404,{pathname:J}),{flushSync:V});return}let{path:ie,submission:se,error:ne}=Bd(!0,J,B);if(ne){un(j,P,ne,{flushSync:V});return}let ye=t.getContext?await t.getContext():new Td,ve=(B&&B.preventScrollReset)===!0;if(se&&Ze(se.formMethod)){await Nx(j,P,ie,Q,ye,ee.active,V,ve,se,B&&B.unstable_defaultShouldRevalidate);return}le.set(j,{routeId:P,path:ie}),await Ax(j,P,ie,Q,ye,ee.active,V,ve,se)}async function Nx(j,P,D,B,V,Z,J,Q,ee,ie){Qa(),le.delete(j);let se=y.fetchers.get(j);dn(j,n1(ee,se),{flushSync:J});let ne=new AbortController,ye=xr(t.history,D,ne.signal,ee);if(Z){let Re=await io(B,new URL(ye.url).pathname,ye.signal,j);if(Re.type==="aborted")return;if(Re.type==="error"){un(j,P,Re.error,{flushSync:J});return}else if(Re.matches)B=Re.matches;else{un(j,P,Pt(404,{pathname:D}),{flushSync:J});return}}let ve=_o(B,D);if(!ve.route.action&&!ve.route.lazy){let Re=Pt(405,{method:ee.formMethod,pathname:D,routeId:P});un(j,P,Re,{flushSync:J});return}X.set(j,ne);let Ke=te,We=Pr(s,o,ye,B,ve,r,V),it=await ni(ye,We,V,j),je=it[ve.route.id];if(!je){for(let Re of We)if(it[Re.route.id]){je=it[Re.route.id];break}}if(ye.signal.aborted){X.get(j)===ne&&X.delete(j);return}if(ke.has(j)){if(er(je)||vt(je)){dn(j,pn(void 0));return}}else{if(er(je))if(X.delete(j),oe>Ke){dn(j,pn(void 0));return}else return Y.add(j),dn(j,oi(ee)),Wn(ye,je,!1,{fetcherSubmission:ee,preventScrollReset:Q});if(vt(je)){un(j,P,je.error);return}}let jt=y.navigation.location||y.location,Un=xr(t.history,jt,ne.signal),ri=l||a,wn=y.navigation.state!=="idle"?jn(ri,y.navigation.location,c):y.matches;de(wn,"Didn't find any matches after fetcher action");let Kt=++te;pe.set(j,Kt);let el=oi(ee,je.data);y.fetchers.set(j,el);let{dsMatches:ii,revalidatingFetchers:Kn}=Fd(Un,V,s,o,t.history,y,wn,ee,jt,r,!1,G,ue,ke,le,Y,ri,c,t.patchRoutesOnNavigation!=null,[ve.route.id,je],ie);Kn.filter(Re=>Re.key!==j).forEach(Re=>{let ao=Re.key,Pd=y.fetchers.get(ao),$x=oi(void 0,Pd?Pd.data:void 0);y.fetchers.set(ao,$x),fn(ao),Re.controller&&X.set(ao,Re.controller)}),Se({fetchers:new Map(y.fetchers)});let so=()=>Kn.forEach(Re=>fn(Re.key));ne.signal.addEventListener("abort",so);let{loaderResults:oo,fetcherResults:xe}=await bd(ii,Kn,Un,V);if(ne.signal.aborted)return;if(ne.signal.removeEventListener("abort",so),pe.delete(j),X.delete(j),Kn.forEach(Re=>X.delete(Re.key)),y.fetchers.has(j)){let Re=pn(je.data);y.fetchers.set(j,Re)}let Xe=co(oo);if(Xe)return Wn(Un,Xe.result,!1,{preventScrollReset:Q});if(Xe=co(xe),Xe)return Y.add(Xe.key),Wn(Un,Xe.result,!1,{preventScrollReset:Q});let{loaderData:mr,errors:Gn}=Kd(y,wn,oo,void 0,Kn,xe);wd(Kt),y.navigation.state==="loading"&&Kt>oe?(de(M,"Expected pending action"),N&&N.abort(),gt(y.navigation.location,{matches:wn,loaderData:mr,errors:Gn,fetchers:new Map(y.fetchers)})):(Se({errors:Gn,loaderData:Gd(y.loaderData,mr,wn,Gn),fetchers:new Map(y.fetchers)}),G=!1)}async function Ax(j,P,D,B,V,Z,J,Q,ee){let ie=y.fetchers.get(j);dn(j,oi(ee,ie?ie.data:void 0),{flushSync:J});let se=new AbortController,ne=xr(t.history,D,se.signal);if(Z){let je=await io(B,new URL(ne.url).pathname,ne.signal,j);if(je.type==="aborted")return;if(je.type==="error"){un(j,P,je.error,{flushSync:J});return}else if(je.matches)B=je.matches;else{un(j,P,Pt(404,{pathname:D}),{flushSync:J});return}}let ye=_o(B,D);X.set(j,se);let ve=te,Ke=Pr(s,o,ne,B,ye,r,V),it=(await ni(ne,Ke,V,j))[ye.route.id];if(X.get(j)===se&&X.delete(j),!ne.signal.aborted){if(ke.has(j)){dn(j,pn(void 0));return}if(er(it))if(oe>ve){dn(j,pn(void 0));return}else{Y.add(j),await Wn(ne,it,!1,{preventScrollReset:Q});return}if(vt(it)){un(j,P,it.error);return}dn(j,pn(it.data))}}async function Wn(j,P,D,{submission:B,fetcherSubmission:V,preventScrollReset:Z,replace:J}={}){D||(A?.resolve(),A=null),P.response.headers.has("X-Remix-Revalidate")&&(G=!0);let Q=P.response.headers.get("Location");de(Q,"Expected a Location header on the redirect Response"),Q=Wd(Q,new URL(j.url),c);let ee=Ei(y.location,Q,{_isRedirect:!0});if(n){let Ke=!1;if(P.response.headers.has("X-Remix-Reload-Document"))Ke=!0;else if(Ma(Q)){const We=fm(Q,!0);Ke=We.origin!==e.location.origin||Rt(We.pathname,c)==null}if(Ke){J?e.location.replace(Q):e.location.assign(Q);return}}N=null;let ie=J===!0||P.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:se,formAction:ne,formEncType:ye}=y.navigation;!B&&!V&&se&&ne&&ye&&(B=Yd(y.navigation));let ve=B||V;if(Dy.has(P.response.status)&&ve&&Ze(ve.formMethod))await ae(ie,ee,{submission:{...ve,formAction:Q},preventScrollReset:Z||R,enableViewTransition:D?L:void 0});else{let Ke=il(ee,B);await ae(ie,ee,{overrideNavigation:Ke,fetcherSubmission:V,preventScrollReset:Z||R,enableViewTransition:D?L:void 0})}}async function ni(j,P,D,B){let V,Z={};try{V=await zy(d,j,P,B,D,!1)}catch(J){return P.filter(Q=>Q.shouldLoad).forEach(Q=>{Z[Q.route.id]={type:"error",error:J}}),Z}if(j.signal.aborted)return Z;if(!Ze(j.method))for(let J of P){if(V[J.route.id]?.type==="error")break;!V.hasOwnProperty(J.route.id)&&!y.loaderData.hasOwnProperty(J.route.id)&&(!y.errors||!y.errors.hasOwnProperty(J.route.id))&&J.shouldCallHandler()&&(V[J.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${J.route.id}`)})}for(let[J,Q]of Object.entries(V))if(Qy(Q)){let ee=Q.result;Z[J]={type:"redirect",response:Uy(ee,j,J,P,c)}}else Z[J]=await Wy(Q);return Z}async function bd(j,P,D,B){let V=ni(D,j,B,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,B,ee.key))[ee.match.route.id];return{[ee.key]:se}}else return Promise.resolve({[ee.key]:{type:"error",error:Pt(404,{pathname:ee.path})}})})),J=await V,Q=(await Z).reduce((ee,ie)=>Object.assign(ee,ie),{});return{loaderResults:J,fetcherResults:Q}}function Qa(){G=!0,le.forEach((j,P)=>{X.has(P)&&ue.add(P),fn(P)})}function dn(j,P,D={}){y.fetchers.set(j,P),Se({fetchers:new Map(y.fetchers)},{flushSync:(D&&D.flushSync)===!0})}function un(j,P,D,B={}){let V=On(y.matches,P);Xa(j),Se({errors:{[V.route.id]:D},fetchers:new Map(y.fetchers)},{flushSync:(B&&B.flushSync)===!0})}function xd(j){return me.set(j,(me.get(j)||0)+1),ke.has(j)&&ke.delete(j),y.fetchers.get(j)||Ty}function Mx(j,P){fn(j,P?.reason),dn(j,pn(null))}function Xa(j){let P=y.fetchers.get(j);X.has(j)&&!(P&&P.state==="loading"&&pe.has(j))&&fn(j),le.delete(j),pe.delete(j),Y.delete(j),ke.delete(j),ue.delete(j),y.fetchers.delete(j)}function Dx(j){let P=(me.get(j)||0)-1;P<=0?(me.delete(j),ke.add(j)):me.set(j,P),Se({fetchers:new Map(y.fetchers)})}function fn(j,P){let D=X.get(j);D&&(D.abort(P),X.delete(j))}function yd(j){for(let P of j){let D=xd(P),B=pn(D.data);y.fetchers.set(P,B)}}function vd(){let j=[],P=!1;for(let D of Y){let B=y.fetchers.get(D);de(B,`Expected fetcher: ${D}`),B.state==="loading"&&(Y.delete(D),j.push(D),P=!0)}return yd(j),P}function wd(j){let P=[];for(let[D,B]of pe)if(B<j){let V=y.fetchers.get(D);de(V,`Expected fetcher: ${D}`),V.state==="loading"&&(fn(D),pe.delete(D),P.push(D))}return yd(P),P.length>0}function Tx(j,P){let D=y.blockers.get(j)||si;return Qe.get(j)!==P&&Qe.set(j,P),D}function kd(j){y.blockers.delete(j),Qe.delete(j)}function no(j,P){let D=y.blockers.get(j)||si;de(D.state==="unblocked"&&P.state==="blocked"||D.state==="blocked"&&P.state==="blocked"||D.state==="blocked"&&P.state==="proceeding"||D.state==="blocked"&&P.state==="unblocked"||D.state==="proceeding"&&P.state==="unblocked",`Invalid blocker state transition: ${D.state} -> ${P.state}`);let B=new Map(y.blockers);B.set(j,P),Se({blockers:B})}function Sd({currentLocation:j,nextLocation:P,historyAction:D}){if(Qe.size===0)return;Qe.size>1&&Ee(!1,"A router only supports one blocker at a time");let B=Array.from(Qe.entries()),[V,Z]=B[B.length-1],J=y.blockers.get(V);if(!(J&&J.state==="proceeding")&&Z({currentLocation:j,nextLocation:P,historyAction:D}))return V}function Za(j){let P=Pt(404,{pathname:j}),D=l||a,{matches:B,route:V}=lo(D);return{notFoundMatches:B,route:V,error:P}}function Ex(j,P,D){if(m=j,x=P,b=D||null,!w&&y.navigation===rl){w=!0;let B=jd(y.location,y.matches);B!=null&&Se({restoreScrollPosition:B})}return()=>{m=null,x=null,b=null}}function Cd(j,P){return b&&b(j,P.map(B=>iy(B,y.loaderData)))||j.key}function Rx(j,P){if(m&&x){let D=Cd(j,P);m[D]=x()}}function jd(j,P){if(m){let D=Cd(j,P),B=m[D];if(typeof B=="number")return B}return null}function ro(j,P,D){if(t.patchRoutesOnNavigation)if(j){if(Object.keys(j[0].params).length>0)return{active:!0,matches:yi(P,D,c,!0)}}else return{active:!0,matches:yi(P,D,c,!0)||[]};return{active:!1,matches:null}}async function io(j,P,D,B){if(!t.patchRoutesOnNavigation)return{type:"success",matches:j};let V=j;for(;;){let Z=l==null,J=l||a,Q=o;try{await t.patchRoutesOnNavigation({signal:D,path:P,matches:V,fetcherKey:B,patch:(se,ne)=>{D.aborted||Vd(se,ne,J,Q,s,!1)}})}catch(se){return{type:"error",error:se,partialMatches:V}}finally{Z&&!D.aborted&&(a=[...a])}if(D.aborted)return{type:"aborted"};let ee=jn(J,P,c),ie=null;if(ee){if(Object.keys(ee[0].params).length===0)return{type:"success",matches:ee};if(ie=yi(J,P,c,!0),!(ie&&V.length<ie.length&&Od(V,ie.slice(0,V.length))))return{type:"success",matches:ee}}if(ie||(ie=yi(J,P,c,!0)),!ie||Od(V,ie))return{type:"success",matches:null};V=ie}}function Od(j,P){return j.length===P.length&&j.every((D,B)=>D.route.id===P[B].route.id)}function Lx(j){o={},l=Ri(j,s,void 0,o)}function Ix(j,P,D=!1){let B=l==null;Vd(j,P,l||a,o,s,D),B&&(a=[...a],Se({}))}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:Ex,navigate:I,fetch:Px,revalidate:K,createHref:j=>t.history.createHref(j),encodeLocation:j=>t.history.encodeLocation(j),getFetcher:xd,resetFetcher:Mx,deleteFetcher:Dx,dispose:Ce,getBlocker:Tx,deleteBlocker:kd,patchRoutes:Ix,_internalFetchControllers:X,_internalSetRoutes:Lx,_internalSetStateDoNotUseOrYouWillBreakYourApp(j){Se(j)}},t.unstable_instrumentations&&(O=Sy(O,t.unstable_instrumentations.map(j=>j.router).filter(Boolean))),O}function Ly(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function hc(t,e,n,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=Ta(r||".",Da(o),Rt(t.pathname,n)||t.pathname,s==="path");if(r==null&&(l.search=t.search,l.hash=t.hash),(r==null||r===""||r===".")&&a){let c=mh(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 n!=="/"&&(l.pathname=by({basename:n,pathname:l.pathname})),on(l)}function Bd(t,e,n){if(!n||!Ly(n))return{path:e};if(n.formMethod&&!e1(n.formMethod))return{path:e,error:Pt(405,{method:n.formMethod})};let r=()=>({path:e,error:Pt(400,{type:"invalid-body"})}),s=(n.formMethod||"get").toUpperCase(),o=Mm(e);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Ze(s))return r();let u=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((f,[p,m])=>`${f}${p}=${m}
19
- `,""):String(n.body);return{path:e,submission:{formMethod:s,formAction:o,formEncType:n.formEncType,formData:void 0,json:void 0,text:u}}}else if(n.formEncType==="application/json"){if(!Ze(s))return r();try{let u=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:e,submission:{formMethod:s,formAction:o,formEncType:n.formEncType,formData:void 0,json:u,text:void 0}}}catch{return r()}}}de(typeof FormData=="function","FormData is not available in this environment");let a,l;if(n.formData)a=fc(n.formData),l=n.formData;else if(n.body instanceof FormData)a=fc(n.body),l=n.body;else if(n.body instanceof URLSearchParams)a=n.body,l=Ud(a);else if(n.body==null)a=new URLSearchParams,l=new FormData;else try{a=new URLSearchParams(n.body),l=Ud(a)}catch{return r()}let c={formMethod:s,formAction:o,formEncType:n&&n.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 t&&d.search&&mh(d.search)&&a.append("index",""),d.search=`?${a}`,{path:on(d),submission:c}}function Fd(t,e,n,r,i,s,o,a,l,c,d,u,f,p,m,b,x,w,v,S,C){let k=S?vt(S[1])?S[1].error:S[1].data:void 0,O=i.createURL(s.location),y=i.createURL(l),M;if(d&&s.errors){let F=Object.keys(s.errors)[0];M=o.findIndex(G=>G.route.id===F)}else if(S&&vt(S[1])){let F=S[0];M=o.findIndex(G=>G.route.id===F)-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=Fs(o),H=o.map((F,G)=>{let{route:ue}=F,X=null;if(M!=null&&G>M?X=!1:ue.lazy?X=!0:fh(ue)?d?X=dc(ue,s.loaderData,s.errors):Iy(s.loaderData,s.matches[G],F)&&(X=!0):X=!1,X!==null)return uc(n,r,t,L,F,c,e,X);let te=!1;typeof C=="boolean"?te=C:R?te=!1:(u||O.pathname+O.search===y.pathname+y.search||O.search!==y.search||$y(s.matches[G],F))&&(te=!0);let oe={...N,defaultShouldRevalidate:te},pe=Ci(F,oe);return uc(n,r,t,L,F,c,e,pe,oe,C)}),$=[];return m.forEach((F,G)=>{if(d||!o.some(me=>me.route.id===F.routeId)||p.has(G))return;let ue=s.fetchers.get(G),X=ue&&ue.state!=="idle"&&ue.data===void 0,te=jn(x,F.path,w);if(!te){if(v&&X)return;$.push({key:G,routeId:F.routeId,path:F.path,matches:null,match:null,request:null,controller:null});return}if(b.has(G))return;let oe=_o(te,F.path),pe=new AbortController,Y=xr(i,F.path,pe.signal),le=null;if(f.has(G))f.delete(G),le=Pr(n,r,Y,te,oe,c,e);else if(X)u&&(le=Pr(n,r,Y,te,oe,c,e));else{let me;typeof C=="boolean"?me=C:R?me=!1:me=u;let ke={...N,defaultShouldRevalidate:me};Ci(oe,ke)&&(le=Pr(n,r,Y,te,oe,c,e,ke))}le&&$.push({key:G,routeId:F.routeId,path:F.path,matches:le,match:oe,request:Y,controller:pe})}),{dsMatches:H,revalidatingFetchers:$}}function fh(t){return t.loader!=null||t.middleware!=null&&t.middleware.length>0}function dc(t,e,n){if(t.lazy)return!0;if(!fh(t))return!1;let r=e!=null&&t.id in e,i=n!=null&&n[t.id]!==void 0;return!r&&i?!1:typeof t.loader=="function"&&t.loader.hydrate===!0?!0:!r&&!i}function Iy(t,e,n){let r=!e||n.route.id!==e.route.id,i=!t.hasOwnProperty(n.route.id);return r||i}function $y(t,e){let n=t.route.path;return t.pathname!==e.pathname||n!=null&&n.endsWith("*")&&t.params["*"]!==e.params["*"]}function Ci(t,e){if(t.route.shouldRevalidate){let n=t.route.shouldRevalidate(e);if(typeof n=="boolean")return n}return e.defaultShouldRevalidate}function Vd(t,e,n,r,i,s){let o;if(t){let c=r[t];de(c,`No route found to patch children into: routeId = ${t}`),c.children||(c.children=[]),o=c.children}else o=n;let a=[],l=[];if(e.forEach(c=>{let d=o.find(u=>jm(c,u));d?l.push({existingRoute:d,newRoute:c}):a.push(c)}),a.length>0){let c=Ri(a,i,[t||"_","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]=Ri([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 jm(t,e){return"id"in t&&"id"in e&&t.id===e.id?!0:t.index===e.index&&t.path===e.path&&t.caseSensitive===e.caseSensitive?(!t.children||t.children.length===0)&&(!e.children||e.children.length===0)?!0:t.children.every((n,r)=>e.children?.some(i=>jm(n,i))):!1}var zd=new WeakMap,Om=({key:t,route:e,manifest:n,mapRouteProperties:r})=>{let i=n[e.id];if(de(i,"No route found in manifest"),!i.lazy||typeof i.lazy!="object")return;let s=i.lazy[t];if(!s)return;let o=zd.get(i);o||(o={},zd.set(i,o));let a=o[t];if(a)return a;let l=(async()=>{let c=ey(t),u=i[t]!==void 0&&t!=="hasErrorBoundary";if(c)Ee(!c,"Route property "+t+" is not a supported lazy route property. This property will be ignored."),o[t]=Promise.resolve();else if(u)Ee(!1,`Route "${i.id}" has a static property "${t}" defined. The lazy property will be ignored.`);else{let f=await s();f!=null&&(Object.assign(i,{[t]:f}),Object.assign(i,r(i)))}typeof i.lazy=="object"&&(i.lazy[t]=void 0,Object.values(i.lazy).every(f=>f===void 0)&&(i.lazy=void 0))})();return o[t]=l,l},_d=new WeakMap;function By(t,e,n,r,i){let s=n[t.id];if(de(s,"No route found in manifest"),!t.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof t.lazy=="function"){let d=_d.get(s);if(d)return{lazyRoutePromise:d,lazyHandlerPromise:d};let u=(async()=>{de(typeof t.lazy=="function","No lazy route function found");let f=await t.lazy(),p={};for(let m in f){let b=f[m];if(b===void 0)continue;let x=ny(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 _d.set(s,u),u.catch(()=>{}),{lazyRoutePromise:u,lazyHandlerPromise:u}}let o=Object.keys(t.lazy),a=[],l;for(let d of o){if(i&&i.includes(d))continue;let u=Om({key:d,route:t,manifest:n,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 Hd(t){let e=t.matches.filter(i=>i.shouldLoad),n={};return(await Promise.all(e.map(i=>i.resolve()))).forEach((i,s)=>{n[e[s].route.id]=i}),n}async function Fy(t){return t.matches.some(e=>e.route.middleware)?Pm(t,()=>Hd(t)):Hd(t)}function Pm(t,e){return Vy(t,e,r=>{if(Zy(r))throw r;return r},Jy,n);function n(r,i,s){if(s)return Promise.resolve(Object.assign(s.value,{[i]:{type:"error",result:r}}));{let{matches:o}=t,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 Vy(t,e,n,r,i){let{matches:s,request:o,params:a,context:l,unstable_pattern:c}=t,d=s.flatMap(f=>f.route.middleware?f.route.middleware.map(p=>[f.route.id,p]):[]);return await Nm({request:o,params:a,context:l,unstable_pattern:c},d,e,n,r,i)}async function Nm(t,e,n,r,i,s,o=0){let{request:a}=t;if(a.signal.aborted)throw a.signal.reason??new Error(`Request aborted: ${a.method} ${a.url}`);let l=e[o];if(!l)return await n();let[c,d]=l,u,f=async()=>{if(u)throw new Error("You may only call `next()` once per middleware");try{return u={value:await Nm(t,e,n,r,i,s,o+1)},u.value}catch(p){return u={value:await s(p,c,u)},u.value}};try{let p=await d(t,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 Am(t,e,n,r,i){let s=Om({key:"middleware",route:r.route,manifest:e,mapRouteProperties:t}),o=By(r.route,Ze(n.method)?"action":"loader",e,t,i);return{middleware:s,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function uc(t,e,n,r,i,s,o,a,l=null,c){let d=!1,u=Am(t,e,n,i,s);return{...i,_lazyPromises:u,shouldLoad:a,shouldRevalidateArgs:l,shouldCallHandler(f){return d=!0,l?typeof c=="boolean"?Ci(i,{...l,defaultShouldRevalidate:c}):typeof f=="boolean"?Ci(i,{...l,defaultShouldRevalidate:f}):Ci(i,l):a},resolve(f){let{lazy:p,loader:m,middleware:b}=i.route,x=d||a||f&&!Ze(n.method)&&(p||m),w=b&&b.length>0&&!m&&!p;return x&&(Ze(n.method)||!w)?_y({request:n,unstable_pattern:r,match:i,lazyHandlerPromise:u?.handler,lazyRoutePromise:u?.route,handlerOverride:f,scopedContext:o}):Promise.resolve({type:"data",result:void 0})}}}function Pr(t,e,n,r,i,s,o,a=null){return r.map(l=>l.route.id!==i.route.id?{...l,shouldLoad:!1,shouldRevalidateArgs:a,shouldCallHandler:()=>!1,_lazyPromises:Am(t,e,n,l,s),resolve:()=>Promise.resolve({type:"data",result:void 0})}:uc(t,e,n,Fs(r),l,s,o,!0,a))}async function zy(t,e,n,r,i,s){n.some(c=>c._lazyPromises?.middleware)&&await Promise.all(n.map(c=>c._lazyPromises?.middleware));let o={request:e,unstable_pattern:Fs(n),params:n[0].params,context:i,matches:n},l=await t({...o,fetcherKey:r,runClientMiddleware:c=>{let d=o;return Pm(d,()=>c({...d,fetcherKey:r,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(n.flatMap(c=>[c._lazyPromises?.handler,c._lazyPromises?.route]))}catch{}return l}async function _y({request:t,unstable_pattern:e,match:n,lazyHandlerPromise:r,lazyRoutePromise:i,handlerOverride:s,scopedContext:o}){let a,l,c=Ze(t.method),d=c?"action":"loader",u=f=>{let p,m=new Promise((w,v)=>p=v);l=()=>p(),t.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: ${n.route.id}]`)):f({request:t,unstable_pattern:e,params:n.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?n.route.action:n.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?n.route.action:n.route.loader;if(p)[a]=await Promise.all([u(p),i]);else if(d==="action"){let m=new URL(t.url),b=m.pathname+m.search;throw Pt(405,{method:t.method,pathname:b,routeId:n.route.id})}else return{type:"data",result:void 0}}else if(f)a=await u(f);else{let p=new URL(t.url),m=p.pathname+p.search;throw Pt(404,{pathname:m})}}catch(f){return{type:"error",result:f}}finally{l&&t.signal.removeEventListener("abort",l)}return a}async function Hy(t){let e=t.headers.get("Content-Type");return e&&/\bapplication\/json\b/.test(e)?t.body==null?null:t.json():t.text()}async function Wy(t){let{result:e,type:n}=t;if(ph(e)){let r;try{r=await Hy(e)}catch(i){return{type:"error",error:i}}return n==="error"?{type:"error",error:new Bs(e.status,e.statusText,r),statusCode:e.status,headers:e.headers}:{type:"data",data:r,statusCode:e.status,headers:e.headers}}return n==="error"?Jd(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:qy(e),statusCode:Li(e)?e.status:void 0,headers:e.init?.headers?new Headers(e.init.headers):void 0}:{type:"error",error:e,statusCode:Li(e)?e.status:void 0}:Jd(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 Uy(t,e,n,r,i){let s=t.headers.get("Location");if(de(s,"Redirects returned/thrown from loaders/actions must have a Location header"),!Ma(s)){let o=r.slice(0,r.findIndex(a=>a.route.id===n)+1);s=hc(new URL(e.url),o,i,s),t.headers.set("Location",s)}return t}function Wd(t,e,n){if(Ma(t)){let r=t,i=r.startsWith("//")?new URL(e.protocol+r):new URL(r),s=Rt(i.pathname,n)!=null;if(i.origin===e.origin&&s)return i.pathname+i.search+i.hash}return t}function xr(t,e,n,r){let i=t.createURL(Mm(e)).toString(),s={signal:n};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=fc(r.formData):s.body=r.formData}return new Request(i,s)}function fc(t){let e=new URLSearchParams;for(let[n,r]of t.entries())e.append(n,typeof r=="string"?r:r.name);return e}function Ud(t){let e=new FormData;for(let[n,r]of t.entries())e.append(n,r);return e}function Ky(t,e,n,r=!1,i=!1){let s={},o=null,a,l=!1,c={},d=n&&vt(n[1])?n[1].error:void 0;return t.forEach(u=>{if(!(u.route.id in e))return;let f=u.route.id,p=e[f];if(de(!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(t,f);o[b.route.id]==null&&(o[b.route.id]=m)}r||(s[f]=Cm),l||(l=!0,a=Li(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&&n&&(o={[n[0]]:d},n[2]&&(s[n[2]]=void 0)),{loaderData:s,errors:o,statusCode:a||200,loaderHeaders:c}}function Kd(t,e,n,r,i,s){let{loaderData:o,errors:a}=Ky(e,n,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(de(f,"Did not find corresponding fetcher result"),vt(f)){let p=On(t.matches,d?.route.id);a&&a[p.route.id]||(a={...a,[p.route.id]:f.error}),t.fetchers.delete(c)}else if(er(f))de(!1,"Unhandled fetcher revalidation redirect");else{let p=pn(f.data);t.fetchers.set(c,p)}}),{loaderData:o,errors:a}}function Gd(t,e,n,r){let i=Object.entries(e).filter(([,s])=>s!==Cm).reduce((s,[o,a])=>(s[o]=a,s),{});for(let s of n){let o=s.route.id;if(!e.hasOwnProperty(o)&&t.hasOwnProperty(o)&&s.route.loader&&(i[o]=t[o]),r&&r.hasOwnProperty(o))break}return i}function qd(t){return t?vt(t[1])?{actionData:{}}:{actionData:{[t[0]]:t[1].data}}:{}}function On(t,e){return(e?t.slice(0,t.findIndex(r=>r.route.id===e)+1):[...t]).reverse().find(r=>r.route.hasErrorBoundary===!0)||t[0]}function lo(t){let e=t.length===1?t[0]:t.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:e}],route:e}}function Pt(t,{pathname:e,routeId:n,method:r,type:i,message:s}={}){let o="Unknown Server Error",a="Unknown @remix-run/router error";return t===400?(o="Bad Request",r&&e&&n?a=`You made a ${r} request to "${e}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:i==="invalid-body"&&(a="Unable to encode submission body")):t===403?(o="Forbidden",a=`Route "${n}" does not match URL "${e}"`):t===404?(o="Not Found",a=`No route matches URL "${e}"`):t===405&&(o="Method Not Allowed",r&&e&&n?a=`You made a ${r.toUpperCase()} request to "${e}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(a=`Invalid request method "${r.toUpperCase()}"`)),new Bs(t||500,o,new Error(a),!0)}function co(t){let e=Object.entries(t);for(let n=e.length-1;n>=0;n--){let[r,i]=e[n];if(er(i))return{key:r,result:i}}}function Mm(t){let e=typeof t=="string"?Vn(t):t;return on({...e,hash:""})}function Gy(t,e){return t.pathname!==e.pathname||t.search!==e.search?!1:t.hash===""?e.hash!=="":t.hash===e.hash?!0:e.hash!==""}function qy(t){return new Bs(t.init?.status??500,t.init?.statusText??"Internal Server Error",t.data)}function Jy(t){return t!=null&&typeof t=="object"&&Object.entries(t).every(([e,n])=>typeof e=="string"&&Yy(n))}function Yy(t){return t!=null&&typeof t=="object"&&"type"in t&&"result"in t&&(t.type==="data"||t.type==="error")}function Qy(t){return ph(t.result)&&km.has(t.result.status)}function vt(t){return t.type==="error"}function er(t){return(t&&t.type)==="redirect"}function Jd(t){return typeof t=="object"&&t!=null&&"type"in t&&"data"in t&&"init"in t&&t.type==="DataWithResponseInit"}function ph(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.headers=="object"&&typeof t.body<"u"}function Xy(t){return km.has(t)}function Zy(t){return ph(t)&&Xy(t.status)&&t.headers.has("Location")}function e1(t){return My.has(t.toUpperCase())}function Ze(t){return Ny.has(t.toUpperCase())}function mh(t){return new URLSearchParams(t).getAll("index").some(e=>e==="")}function _o(t,e){let n=typeof e=="string"?Vn(e).search:e.search;if(t[t.length-1].route.index&&mh(n||""))return t[t.length-1];let r=bm(t);return r[r.length-1]}function Yd(t){let{formMethod:e,formAction:n,formEncType:r,text:i,formData:s,json:o}=t;if(!(!e||!n||!r)){if(i!=null)return{formMethod:e,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(s!=null)return{formMethod:e,formAction:n,formEncType:r,formData:s,json:void 0,text:void 0};if(o!==void 0)return{formMethod:e,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function il(t,e){return e?{state:"loading",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}:{state:"loading",location:t,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function t1(t,e){return{state:"submitting",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}}function oi(t,e){return t?{state:"loading",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function n1(t,e){return{state:"submitting",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e?e.data:void 0}}function pn(t){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function r1(t,e){try{let n=t.sessionStorage.getItem(Sm);if(n){let r=JSON.parse(n);for(let[i,s]of Object.entries(r||{}))s&&Array.isArray(s)&&e.set(i,new Set(s||[]))}}catch{}}function i1(t,e){if(e.size>0){let n={};for(let[r,i]of e)n[r]=[...i];try{t.sessionStorage.setItem(Sm,JSON.stringify(n))}catch(r){Ee(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function Qd(){let t,e,n=new Promise((r,i)=>{t=async s=>{r(s);try{await n}catch{}},e=async s=>{i(s);try{await n}catch{}}});return{promise:n,resolve:t,reject:e}}var dr=g.createContext(null);dr.displayName="DataRouter";var Vs=g.createContext(null);Vs.displayName="DataRouterState";var Dm=g.createContext(!1);function s1(){return g.useContext(Dm)}var gh=g.createContext({isTransitioning:!1});gh.displayName="ViewTransition";var Tm=g.createContext(new Map);Tm.displayName="Fetchers";var o1=g.createContext(null);o1.displayName="Await";var kt=g.createContext(null);kt.displayName="Navigation";var Ea=g.createContext(null);Ea.displayName="Location";var It=g.createContext({outlet:null,matches:[],isDataRoute:!1});It.displayName="Route";var bh=g.createContext(null);bh.displayName="RouteError";var Em="REACT_ROUTER_ERROR",a1="REDIRECT",l1="ROUTE_ERROR_RESPONSE";function c1(t){if(t.startsWith(`${Em}:${a1}:{`))try{let e=JSON.parse(t.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function h1(t){if(t.startsWith(`${Em}:${l1}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new Bs(e.status,e.statusText,e.data)}catch{}}function d1(t,{relative:e}={}){de(Wr(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=g.useContext(kt),{hash:i,pathname:s,search:o}=zs(t,{relative:e}),a=s;return n!=="/"&&(a=s==="/"?n:rn([n,s])),r.createHref({pathname:a,search:o,hash:i})}function Wr(){return g.useContext(Ea)!=null}function _t(){return de(Wr(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(Ea).location}var Rm="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Lm(t){g.useContext(kt).static||g.useLayoutEffect(t)}function an(){let{isDataRoute:t}=g.useContext(It);return t?O1():u1()}function u1(){de(Wr(),"useNavigate() may be used only in the context of a <Router> component.");let t=g.useContext(dr),{basename:e,navigator:n}=g.useContext(kt),{matches:r}=g.useContext(It),{pathname:i}=_t(),s=JSON.stringify(Da(r)),o=g.useRef(!1);return Lm(()=>{o.current=!0}),g.useCallback((l,c={})=>{if(Ee(o.current,Rm),!o.current)return;if(typeof l=="number"){n.go(l);return}let d=Ta(l,JSON.parse(s),i,c.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:rn([e,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[e,n,s,i,t])}var Im=g.createContext(null);function f1(){return g.useContext(Im)}function p1(t){let e=g.useContext(It).outlet;return g.useMemo(()=>e&&g.createElement(Im.Provider,{value:t},e),[e,t])}function $m(){let{matches:t}=g.useContext(It),e=t[t.length-1];return e?e.params:{}}function zs(t,{relative:e}={}){let{matches:n}=g.useContext(It),{pathname:r}=_t(),i=JSON.stringify(Da(n));return g.useMemo(()=>Ta(t,JSON.parse(i),r,e==="path"),[t,i,r,e])}function m1(t,e,n,r,i){de(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||"";Fm(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.
18
+ */var um=t=>{throw TypeError(t)},qx=(t,e,n)=>e.has(t)||um("Cannot "+n),tl=(t,e,n)=>(qx(t,e,"read from private field"),n?n.call(t):e.get(t)),Jx=(t,e,n)=>e.has(t)?um("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Md="popstate";function Yx(t={}){function e(r,i){let{pathname:s,search:o,hash:a}=r.location;return Ei("",{pathname:s,search:o,hash:a},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:on(i)}return Xx(e,n,null,t)}function ue(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Ee(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function Qx(){return Math.random().toString(36).substring(2,10)}function Dd(t,e){return{usr:t.state,key:t.key,idx:e}}function Ei(t,e,n=null,r){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?Vn(e):e,state:n,key:e&&e.key||r||Qx()}}function on({pathname:t="/",search:e="",hash:n=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function Vn(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substring(n),t=t.substring(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substring(r),t=t.substring(0,r)),t&&(e.pathname=t)}return e}function Xx(t,e,n,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=Ei(b.location,x,w);c=d()+1;let S=Dd(v,c),C=b.createHref(v);try{o.pushState(S,"",C)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;i.location.assign(C)}s&&l&&l({action:a,location:b.location,delta:1})}function p(x,w){a="REPLACE";let v=Ei(b.location,x,w);c=d();let S=Dd(v,c),C=b.createHref(v);o.replaceState(S,"",C),s&&l&&l({action:a,location:b.location,delta:0})}function m(x){return fm(x)}let b={get action(){return a},get location(){return t(i,o)},listen(x){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(Md,u),l=x,()=>{i.removeEventListener(Md,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 fm(t,e=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),ue(n,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:on(t);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=n+r),new URL(r,n)}var xi,Td=class{constructor(t){if(Jx(this,xi,new Map),t)for(let[e,n]of t)this.set(e,n)}get(t){if(tl(this,xi).has(t))return tl(this,xi).get(t);if(t.defaultValue!==void 0)return t.defaultValue;throw new Error("No value found for context")}set(t,e){tl(this,xi).set(t,e)}};xi=new WeakMap;var Zx=new Set(["lazy","caseSensitive","path","id","index","children"]);function ey(t){return Zx.has(t)}var ty=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function ny(t){return ty.has(t)}function ry(t){return t.index===!0}function Ri(t,e,n=[],r={},i=!1){return t.map((s,o)=>{let a=[...n,String(o)],l=typeof s.id=="string"?s.id:a.join("-");if(ue(s.index!==!0||!s.children,"Cannot specify children on an index route"),ue(i||!r[l],`Found a route id collision on id "${l}". Route id's must be globally unique within Data Router usages`),ry(s)){let c={...s,id:l};return r[l]=Ed(c,e(c)),c}else{let c={...s,id:l,children:void 0};return r[l]=Ed(c,e(c)),s.children&&(c.children=Ri(s.children,e,a,r,i)),c}})}function Ed(t,e){return Object.assign(t,{...e,...typeof e.lazy=="object"&&e.lazy!=null?{lazy:{...t.lazy,...e.lazy}}:{}})}function jn(t,e,n="/"){return yi(t,e,n,!1)}function yi(t,e,n,r){let i=typeof e=="string"?Vn(e):e,s=Rt(i.pathname||"/",n);if(s==null)return null;let o=pm(t);sy(o);let a=null;for(let l=0;a==null&&l<o.length;++l){let c=gy(s);a=py(o[l],c,r)}return a}function iy(t,e){let{route:n,pathname:r,params:i}=t;return{id:n.id,pathname:r,params:i,data:e[n.id],loaderData:e[n.id],handle:n.handle}}function pm(t,e=[],n=[],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;ue(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=n.concat(d);o.children&&o.children.length>0&&(ue(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),pm(o.children,e,f,u,l)),!(o.path==null&&!o.index)&&e.push({path:u,score:uy(u,o.index),routesMeta:f})};return t.forEach((o,a)=>{if(o.path===""||!o.path?.includes("?"))s(o,a);else for(let l of mm(o.path))s(o,a,!0,l)}),e}function mm(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=mm(r.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function sy(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:fy(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var oy=/^:[\w-]+$/,ay=3,ly=2,cy=1,hy=10,dy=-2,Rd=t=>t==="*";function uy(t,e){let n=t.split("/"),r=n.length;return n.some(Rd)&&(r+=dy),e&&(r+=ly),n.filter(i=>!Rd(i)).reduce((i,s)=>i+(oy.test(s)?ay:s===""?cy:hy),r)}function fy(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function py(t,e,n=!1){let{routesMeta:r}=t,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=ta({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},d),f=l.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=ta({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:yy(rn([s,u.pathnameBase])),route:f}),u.pathnameBase!=="/"&&(s=rn([s,u.pathnameBase]))}return o}function ta(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=my(t.path,t.caseSensitive,t.end),i=e.match(n);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:t}}function my(t,e=!1,n=!0){Ee(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function gy(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Ee(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function Rt(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}function by({basename:t,pathname:e}){return e==="/"?t:rn([t,e])}var gm=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ma=t=>gm.test(t);function xy(t,e="/"){let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?Vn(t):t,s;if(n)if(Ma(n))s=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),Ee(!1,`Pathnames cannot have embedded double slashes - normalizing ${o} -> ${n}`)}n.startsWith("/")?s=Ld(n.substring(1),"/"):s=Ld(n,e)}else s=e;return{pathname:s,search:vy(r),hash:wy(i)}}function Ld(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function nl(t,e,n,r){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function bm(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Da(t){let e=bm(t);return e.map((n,r)=>r===e.length-1?n.pathname:n.pathnameBase)}function Ta(t,e,n,r=!1){let i;typeof t=="string"?i=Vn(t):(i={...t},ue(!i.pathname||!i.pathname.includes("?"),nl("?","pathname","search",i)),ue(!i.pathname||!i.pathname.includes("#"),nl("#","pathname","hash",i)),ue(!i.search||!i.search.includes("#"),nl("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=n;else{let u=e.length-1;if(!r&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),u-=1;i.pathname=f.join("/")}a=u>=0?e[u]:"/"}let l=xy(i,a),c=o&&o!=="/"&&o.endsWith("/"),d=(s||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||d)&&(l.pathname+="/"),l}var rn=t=>t.join("/").replace(/\/\/+/g,"/"),yy=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),vy=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,wy=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,Bs=class{constructor(t,e,n,r=!1){this.status=t,this.statusText=e||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Li(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Fs(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var xm=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ym(t,e){let n=t;if(typeof n!="string"||!gm.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(xm)try{let s=new URL(window.location.href),o=n.startsWith("//")?new URL(s.protocol+n):new URL(n),a=Rt(o.pathname,e);o.origin===s.origin&&a!=null?n=a+o.search+o.hash:i=!0}catch{Ee(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var An=Symbol("Uninstrumented");function ky(t,e){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};t.forEach(i=>i({id:e.id,index:e.index,path:e.path,instrument(s){let o=Object.keys(n);for(let a of o)s[a]&&n[a].push(s[a])}}));let r={};if(typeof e.lazy=="function"&&n.lazy.length>0){let i=wr(n.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=n[`lazy.${s}`];if(typeof o=="function"&&a.length>0){let l=wr(a,o,()=>{});l&&(r.lazy=Object.assign(r.lazy||{},{[s]:l}))}})}return["loader","action"].forEach(i=>{let s=e[i];if(typeof s=="function"&&n[i].length>0){let o=s[An]??s,a=wr(n[i],o,(...l)=>Id(l[0]));a&&(a[An]=o,r[i]=a)}}),e.middleware&&e.middleware.length>0&&n.middleware.length>0&&(r.middleware=e.middleware.map(i=>{let s=i[An]??i,o=wr(n.middleware,s,(...a)=>Id(a[0]));return o?(o[An]=s,o):i})),r}function Sy(t,e){let n={navigate:[],fetch:[]};if(e.forEach(r=>r({instrument(i){let s=Object.keys(i);for(let o of s)i[o]&&n[o].push(i[o])}})),n.navigate.length>0){let r=t.navigate[An]??t.navigate,i=wr(n.navigate,r,(...s)=>{let[o,a]=s;return{to:typeof o=="number"||typeof o=="string"?o:o?on(o):".",...$d(t,a??{})}});i&&(i[An]=r,t.navigate=i)}if(n.fetch.length>0){let r=t.fetch[An]??t.fetch,i=wr(n.fetch,r,(...s)=>{let[o,,a,l]=s;return{href:a??".",fetcherKey:o,...$d(t,l??{})}});i&&(i[An]=r,t.fetch=i)}return t}function wr(t,e,n){return t.length===0?null:async(...r)=>{let i=await vm(t,n(...r),()=>e(...r),t.length-1);if(i.type==="error")throw i.value;return i.value}}async function vm(t,e,n,r){let i=t[r],s;if(i){let o,a=async()=>(o?console.error("You cannot call instrumented handlers more than once"):o=vm(t,e,n,r-1),s=await o,ue(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 n()}}catch(o){s={type:"error",value:o}}return s||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function Id(t){let{request:e,context:n,params:r,unstable_pattern:i}=t;return{request:Cy(e),params:{...r},unstable_pattern:i,context:jy(n)}}function $d(t,e){return{currentUrl:on(t.state.location),..."formMethod"in e?{formMethod:e.formMethod}:{},..."formEncType"in e?{formEncType:e.formEncType}:{},..."formData"in e?{formData:e.formData}:{},..."body"in e?{body:e.body}:{}}}function Cy(t){return{method:t.method,url:t.url,headers:{get:(...e)=>t.headers.get(...e)}}}function jy(t){if(Py(t)){let e={...t};return Object.freeze(e),e}else return{get:e=>t.get(e)}}var Oy=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Py(t){if(t===null||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||e===null||Object.getOwnPropertyNames(e).sort().join("\0")===Oy}var wm=["POST","PUT","PATCH","DELETE"],Ny=new Set(wm),Ay=["GET",...wm],My=new Set(Ay),km=new Set([301,302,303,307,308]),Dy=new Set([307,308]),rl={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Ty={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},Ey=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),Sm="remix-router-transitions",Cm=Symbol("ResetLoaderData");function Ry(t){const e=t.window?t.window:typeof window<"u"?window:void 0,n=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u";ue(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=t.hydrationRouteProperties||[],i=t.mapRouteProperties||Ey,s=i;if(t.unstable_instrumentations){let j=t.unstable_instrumentations;s=P=>({...i(P),...ky(j.map(D=>D.route).filter(Boolean),P)})}let o={},a=Ri(t.routes,s,void 0,o),l,c=t.basename||"/";c.startsWith("/")||(c=`/${c}`);let d=t.dataStrategy||Fy,u={...t.future},f=null,p=new Set,m=null,b=null,x=null,w=t.hydrationData!=null,v=jn(a,t.history.location,c),S=!1,C=null,k;if(v==null&&!t.patchRoutesOnNavigation){let j=Pt(404,{pathname:t.history.location.pathname}),{matches:P,route:D}=lo(a);k=!0,v=P,C={[D.id]:j}}else if(v&&!t.hydrationData&&ro(v,a,t.history.location.pathname).active&&(v=null),v)if(v.some(j=>j.route.lazy))k=!1;else if(!v.some(j=>fh(j.route)))k=!0;else{let j=t.hydrationData?t.hydrationData.loaderData:null,P=t.hydrationData?t.hydrationData.errors:null;if(P){let D=v.findIndex(B=>P[B.route.id]!==void 0);k=v.slice(0,D+1).every(B=>!dc(B.route,j,P))}else k=v.every(D=>!dc(D.route,j,P))}else{k=!1,v=[];let j=ro(null,a,t.history.location.pathname);j.active&&j.matches&&(S=!0,v=j.matches)}let O,y={historyAction:t.history.action,location:t.history.location,matches:v,initialized:k,navigation:rl,restoreScrollPosition:t.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:t.hydrationData&&t.hydrationData.loaderData||{},actionData:t.hydrationData&&t.hydrationData.actionData||null,errors:t.hydrationData&&t.hydrationData.errors||C,fetchers:new Map,blockers:new Map},M="POP",A=null,R=!1,N,L=!1,_=new Map,$=null,F=!1,G=!1,fe=new Set,X=new Map,te=0,oe=-1,me=new Map,Y=new Set,ae=new Map,de=new Map,ke=new Set,Qe=new Map,mt,q=null;function Me(){if(f=t.history.listen(({action:j,location:P,delta:D})=>{if(mt){mt(),mt=void 0;return}Ee(Qe.size===0||D!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let B=Sd({currentLocation:y.location,nextLocation:P,historyAction:j});if(B&&D!=null){let V=new Promise(Z=>{mt=Z});t.history.go(D*-1),no(B,{state:"blocked",location:P,proceed(){no(B,{state:"proceeding",proceed:void 0,reset:void 0,location:P}),V.then(()=>t.history.go(D))},reset(){let Z=new Map(y.blockers);Z.set(B,si),Se({blockers:Z})}}),A?.resolve(),A=null;return}return le(j,P)}),n){r1(e,_);let j=()=>i1(e,_);e.addEventListener("pagehide",j),$=()=>e.removeEventListener("pagehide",j)}return y.initialized||le("POP",y.location,{initialHydration:!0}),O}function Ce(){f&&f(),$&&$(),p.clear(),N&&N.abort(),y.fetchers.forEach((j,P)=>Xa(P)),y.blockers.forEach((j,P)=>kd(P))}function Ie(j){return p.add(j),()=>p.delete(j)}function Se(j,P={}){j.matches&&(j.matches=j.matches.map(V=>{let Z=o[V.route.id],J=V.route;return J.element!==Z.element||J.errorElement!==Z.errorElement||J.hydrateFallbackElement!==Z.hydrateFallbackElement?{...V,route:Z}:V})),y={...y,...j};let D=[],B=[];y.fetchers.forEach((V,Z)=>{V.state==="idle"&&(ke.has(Z)?D.push(Z):B.push(Z))}),ke.forEach(V=>{!y.fetchers.has(V)&&!X.has(V)&&D.push(V)}),[...p].forEach(V=>V(y,{deletedFetchers:D,newErrors:j.errors??null,viewTransitionOpts:P.viewTransitionOpts,flushSync:P.flushSync===!0})),D.forEach(V=>Xa(V)),B.forEach(V=>y.fetchers.delete(V))}function gt(j,P,{flushSync:D}={}){let B=y.actionData!=null&&y.navigation.formMethod!=null&&Ze(y.navigation.formMethod)&&y.navigation.state==="loading"&&j.state?._isRedirect!==!0,V;P.actionData?Object.keys(P.actionData).length>0?V=P.actionData:V=null:B?V=y.actionData:V=null;let Z=P.loaderData?Gd(y.loaderData,P.loaderData,P.matches||[],P.errors):y.loaderData,J=y.blockers;J.size>0&&(J=new Map(J),J.forEach((se,ne)=>J.set(ne,si)));let Q=F?!1:jd(j,P.matches||y.matches),ee=R===!0||y.navigation.formMethod!=null&&Ze(y.navigation.formMethod)&&j.state?._isRedirect!==!0;l&&(a=l,l=void 0),F||M==="POP"||(M==="PUSH"?t.history.push(j,j.state):M==="REPLACE"&&t.history.replace(j,j.state));let ie;if(M==="POP"){let se=_.get(y.location.pathname);se&&se.has(j.pathname)?ie={currentLocation:y.location,nextLocation:j}:_.has(j.pathname)&&(ie={currentLocation:j,nextLocation:y.location})}else if(L){let se=_.get(y.location.pathname);se?se.add(j.pathname):(se=new Set([j.pathname]),_.set(y.location.pathname,se)),ie={currentLocation:y.location,nextLocation:j}}Se({...P,actionData:V,loaderData:Z,historyAction:M,location:j,initialized:!0,navigation:rl,revalidation:"idle",restoreScrollPosition:Q,preventScrollReset:ee,blockers:J},{viewTransitionOpts:ie,flushSync:D===!0}),M="POP",R=!1,L=!1,F=!1,G=!1,A?.resolve(),A=null,q?.resolve(),q=null}async function I(j,P){if(A?.resolve(),A=null,typeof j=="number"){A||(A=Qd());let ve=A.promise;return t.history.go(j),ve}let D=hc(y.location,y.matches,c,j,P?.fromRouteId,P?.relative),{path:B,submission:V,error:Z}=Bd(!1,D,P),J=y.location,Q=Ei(y.location,B,P&&P.state);Q={...Q,...t.history.encodeLocation(Q)};let ee=P&&P.replace!=null?P.replace:void 0,ie="PUSH";ee===!0?ie="REPLACE":ee===!1||V!=null&&Ze(V.formMethod)&&V.formAction===y.location.pathname+y.location.search&&(ie="REPLACE");let se=P&&"preventScrollReset"in P?P.preventScrollReset===!0:void 0,ne=(P&&P.flushSync)===!0,ye=Sd({currentLocation:J,nextLocation:Q,historyAction:ie});if(ye){no(ye,{state:"blocked",location:Q,proceed(){no(ye,{state:"proceeding",proceed:void 0,reset:void 0,location:Q}),I(j,P)},reset(){let ve=new Map(y.blockers);ve.set(ye,si),Se({blockers:ve})}});return}await le(ie,Q,{submission:V,pendingError:Z,preventScrollReset:se,replace:P&&P.replace,enableViewTransition:P&&P.viewTransition,flushSync:ne,callSiteDefaultShouldRevalidate:P&&P.unstable_defaultShouldRevalidate})}function K(){q||(q=Qd()),Qa(),Se({revalidation:"loading"});let j=q.promise;return y.navigation.state==="submitting"?j:y.navigation.state==="idle"?(le(y.historyAction,y.location,{startUninterruptedRevalidation:!0}),j):(le(M||y.historyAction,y.navigation.location,{overrideNavigation:y.navigation,enableViewTransition:L===!0}),j)}async function le(j,P,D){N&&N.abort(),N=null,M=j,F=(D&&D.startUninterruptedRevalidation)===!0,Rx(y.location,y.matches),R=(D&&D.preventScrollReset)===!0,L=(D&&D.enableViewTransition)===!0;let B=l||a,V=D&&D.overrideNavigation,Z=D?.initialHydration&&y.matches&&y.matches.length>0&&!S?y.matches:jn(B,P,c),J=(D&&D.flushSync)===!0;if(Z&&y.initialized&&!G&&Gy(y.location,P)&&!(D&&D.submission&&Ze(D.submission.formMethod))){gt(P,{matches:Z},{flushSync:J});return}let Q=ro(Z,B,P.pathname);if(Q.active&&Q.matches&&(Z=Q.matches),!Z){let{error:We,notFoundMatches:it,route:je}=Za(P.pathname);gt(P,{matches:it,loaderData:{},errors:{[je.id]:We}},{flushSync:J});return}N=new AbortController;let ee=xr(t.history,P,N.signal,D&&D.submission),ie=t.getContext?await t.getContext():new Td,se;if(D&&D.pendingError)se=[On(Z).route.id,{type:"error",error:D.pendingError}];else if(D&&D.submission&&Ze(D.submission.formMethod)){let We=await De(ee,P,D.submission,Z,ie,Q.active,D&&D.initialHydration===!0,{replace:D.replace,flushSync:J});if(We.shortCircuited)return;if(We.pendingActionResult){let[it,je]=We.pendingActionResult;if(vt(je)&&Li(je.error)&&je.error.status===404){N=null,gt(P,{matches:We.matches,loaderData:{},errors:{[it]:je.error}});return}}Z=We.matches||Z,se=We.pendingActionResult,V=il(P,D.submission),J=!1,Q.active=!1,ee=xr(t.history,ee.url,ee.signal)}let{shortCircuited:ne,matches:ye,loaderData:ve,errors:Ke}=await Ut(ee,P,Z,ie,Q.active,V,D&&D.submission,D&&D.fetcherSubmission,D&&D.replace,D&&D.initialHydration===!0,J,se,D&&D.callSiteDefaultShouldRevalidate);ne||(N=null,gt(P,{matches:ye||Z,...qd(se),loaderData:ve,errors:Ke}))}async function De(j,P,D,B,V,Z,J,Q={}){Qa();let ee=t1(P,D);if(Se({navigation:ee},{flushSync:Q.flushSync===!0}),Z){let ne=await io(B,P.pathname,j.signal);if(ne.type==="aborted")return{shortCircuited:!0};if(ne.type==="error"){if(ne.partialMatches.length===0){let{matches:ve,route:Ke}=lo(a);return{matches:ve,pendingActionResult:[Ke.id,{type:"error",error:ne.error}]}}let ye=On(ne.partialMatches).route.id;return{matches:ne.partialMatches,pendingActionResult:[ye,{type:"error",error:ne.error}]}}else if(ne.matches)B=ne.matches;else{let{notFoundMatches:ye,error:ve,route:Ke}=Za(P.pathname);return{matches:ye,pendingActionResult:[Ke.id,{type:"error",error:ve}]}}}let ie,se=Ho(B,P);if(!se.route.action&&!se.route.lazy)ie={type:"error",error:Pt(405,{method:j.method,pathname:P.pathname,routeId:se.route.id})};else{let ne=Pr(s,o,j,B,se,J?[]:r,V),ye=await ni(j,ne,V,null);if(ie=ye[se.route.id],!ie){for(let ve of B)if(ye[ve.route.id]){ie=ye[ve.route.id];break}}if(j.signal.aborted)return{shortCircuited:!0}}if(er(ie)){let ne;return Q&&Q.replace!=null?ne=Q.replace:ne=Wd(ie.response.headers.get("Location"),new URL(j.url),c)===y.location.pathname+y.location.search,await Wn(j,ie,!0,{submission:D,replace:ne}),{shortCircuited:!0}}if(vt(ie)){let ne=On(B,se.route.id);return(Q&&Q.replace)!==!0&&(M="PUSH"),{matches:B,pendingActionResult:[ne.route.id,ie,se.route.id]}}return{matches:B,pendingActionResult:[se.route.id,ie]}}async function Ut(j,P,D,B,V,Z,J,Q,ee,ie,se,ne,ye){let ve=Z||il(P,J),Ke=J||Q||Yd(ve),We=!F&&!ie;if(V){if(We){let Xe=to(ne);Se({navigation:ve,...Xe!==void 0?{actionData:Xe}:{}},{flushSync:se})}let xe=await io(D,P.pathname,j.signal);if(xe.type==="aborted")return{shortCircuited:!0};if(xe.type==="error"){if(xe.partialMatches.length===0){let{matches:mr,route:Gn}=lo(a);return{matches:mr,loaderData:{},errors:{[Gn.id]:xe.error}}}let Xe=On(xe.partialMatches).route.id;return{matches:xe.partialMatches,loaderData:{},errors:{[Xe]:xe.error}}}else if(xe.matches)D=xe.matches;else{let{error:Xe,notFoundMatches:mr,route:Gn}=Za(P.pathname);return{matches:mr,loaderData:{},errors:{[Gn.id]:Xe}}}}let it=l||a,{dsMatches:je,revalidatingFetchers:jt}=Fd(j,B,s,o,t.history,y,D,Ke,P,ie?[]:r,ie===!0,G,fe,ke,ae,Y,it,c,t.patchRoutesOnNavigation!=null,ne,ye);if(oe=++te,!t.dataStrategy&&!je.some(xe=>xe.shouldLoad)&&!je.some(xe=>xe.route.middleware&&xe.route.middleware.length>0)&&jt.length===0){let xe=vd();return gt(P,{matches:D,loaderData:{},errors:ne&&vt(ne[1])?{[ne[0]]:ne[1].error}:null,...qd(ne),...xe?{fetchers:new Map(y.fetchers)}:{}},{flushSync:se}),{shortCircuited:!0}}if(We){let xe={};if(!V){xe.navigation=ve;let Xe=to(ne);Xe!==void 0&&(xe.actionData=Xe)}jt.length>0&&(xe.fetchers=ti(jt)),Se(xe,{flushSync:se})}jt.forEach(xe=>{fn(xe.key),xe.controller&&X.set(xe.key,xe.controller)});let Un=()=>jt.forEach(xe=>fn(xe.key));N&&N.signal.addEventListener("abort",Un);let{loaderResults:ri,fetcherResults:wn}=await bd(je,jt,j,B);if(j.signal.aborted)return{shortCircuited:!0};N&&N.signal.removeEventListener("abort",Un),jt.forEach(xe=>X.delete(xe.key));let Kt=co(ri);if(Kt)return await Wn(j,Kt.result,!0,{replace:ee}),{shortCircuited:!0};if(Kt=co(wn),Kt)return Y.add(Kt.key),await Wn(j,Kt.result,!0,{replace:ee}),{shortCircuited:!0};let{loaderData:el,errors:ii}=Kd(y,D,ri,ne,jt,wn);ie&&y.errors&&(ii={...y.errors,...ii});let Kn=vd(),so=wd(oe),oo=Kn||so||jt.length>0;return{matches:D,loaderData:el,errors:ii,...oo?{fetchers:new Map(y.fetchers)}:{}}}function to(j){if(j&&!vt(j[1]))return{[j[0]]:j[1].data};if(y.actionData)return Object.keys(y.actionData).length===0?null:y.actionData}function ti(j){return j.forEach(P=>{let D=y.fetchers.get(P.key),B=oi(void 0,D?D.data:void 0);y.fetchers.set(P.key,B)}),new Map(y.fetchers)}async function Px(j,P,D,B){fn(j);let V=(B&&B.flushSync)===!0,Z=l||a,J=hc(y.location,y.matches,c,D,P,B?.relative),Q=jn(Z,J,c),ee=ro(Q,Z,J);if(ee.active&&ee.matches&&(Q=ee.matches),!Q){un(j,P,Pt(404,{pathname:J}),{flushSync:V});return}let{path:ie,submission:se,error:ne}=Bd(!0,J,B);if(ne){un(j,P,ne,{flushSync:V});return}let ye=t.getContext?await t.getContext():new Td,ve=(B&&B.preventScrollReset)===!0;if(se&&Ze(se.formMethod)){await Nx(j,P,ie,Q,ye,ee.active,V,ve,se,B&&B.unstable_defaultShouldRevalidate);return}ae.set(j,{routeId:P,path:ie}),await Ax(j,P,ie,Q,ye,ee.active,V,ve,se)}async function Nx(j,P,D,B,V,Z,J,Q,ee,ie){Qa(),ae.delete(j);let se=y.fetchers.get(j);dn(j,n1(ee,se),{flushSync:J});let ne=new AbortController,ye=xr(t.history,D,ne.signal,ee);if(Z){let Re=await io(B,new URL(ye.url).pathname,ye.signal,j);if(Re.type==="aborted")return;if(Re.type==="error"){un(j,P,Re.error,{flushSync:J});return}else if(Re.matches)B=Re.matches;else{un(j,P,Pt(404,{pathname:D}),{flushSync:J});return}}let ve=Ho(B,D);if(!ve.route.action&&!ve.route.lazy){let Re=Pt(405,{method:ee.formMethod,pathname:D,routeId:P});un(j,P,Re,{flushSync:J});return}X.set(j,ne);let Ke=te,We=Pr(s,o,ye,B,ve,r,V),it=await ni(ye,We,V,j),je=it[ve.route.id];if(!je){for(let Re of We)if(it[Re.route.id]){je=it[Re.route.id];break}}if(ye.signal.aborted){X.get(j)===ne&&X.delete(j);return}if(ke.has(j)){if(er(je)||vt(je)){dn(j,pn(void 0));return}}else{if(er(je))if(X.delete(j),oe>Ke){dn(j,pn(void 0));return}else return Y.add(j),dn(j,oi(ee)),Wn(ye,je,!1,{fetcherSubmission:ee,preventScrollReset:Q});if(vt(je)){un(j,P,je.error);return}}let jt=y.navigation.location||y.location,Un=xr(t.history,jt,ne.signal),ri=l||a,wn=y.navigation.state!=="idle"?jn(ri,y.navigation.location,c):y.matches;ue(wn,"Didn't find any matches after fetcher action");let Kt=++te;me.set(j,Kt);let el=oi(ee,je.data);y.fetchers.set(j,el);let{dsMatches:ii,revalidatingFetchers:Kn}=Fd(Un,V,s,o,t.history,y,wn,ee,jt,r,!1,G,fe,ke,ae,Y,ri,c,t.patchRoutesOnNavigation!=null,[ve.route.id,je],ie);Kn.filter(Re=>Re.key!==j).forEach(Re=>{let ao=Re.key,Pd=y.fetchers.get(ao),$x=oi(void 0,Pd?Pd.data:void 0);y.fetchers.set(ao,$x),fn(ao),Re.controller&&X.set(ao,Re.controller)}),Se({fetchers:new Map(y.fetchers)});let so=()=>Kn.forEach(Re=>fn(Re.key));ne.signal.addEventListener("abort",so);let{loaderResults:oo,fetcherResults:xe}=await bd(ii,Kn,Un,V);if(ne.signal.aborted)return;if(ne.signal.removeEventListener("abort",so),me.delete(j),X.delete(j),Kn.forEach(Re=>X.delete(Re.key)),y.fetchers.has(j)){let Re=pn(je.data);y.fetchers.set(j,Re)}let Xe=co(oo);if(Xe)return Wn(Un,Xe.result,!1,{preventScrollReset:Q});if(Xe=co(xe),Xe)return Y.add(Xe.key),Wn(Un,Xe.result,!1,{preventScrollReset:Q});let{loaderData:mr,errors:Gn}=Kd(y,wn,oo,void 0,Kn,xe);wd(Kt),y.navigation.state==="loading"&&Kt>oe?(ue(M,"Expected pending action"),N&&N.abort(),gt(y.navigation.location,{matches:wn,loaderData:mr,errors:Gn,fetchers:new Map(y.fetchers)})):(Se({errors:Gn,loaderData:Gd(y.loaderData,mr,wn,Gn),fetchers:new Map(y.fetchers)}),G=!1)}async function Ax(j,P,D,B,V,Z,J,Q,ee){let ie=y.fetchers.get(j);dn(j,oi(ee,ie?ie.data:void 0),{flushSync:J});let se=new AbortController,ne=xr(t.history,D,se.signal);if(Z){let je=await io(B,new URL(ne.url).pathname,ne.signal,j);if(je.type==="aborted")return;if(je.type==="error"){un(j,P,je.error,{flushSync:J});return}else if(je.matches)B=je.matches;else{un(j,P,Pt(404,{pathname:D}),{flushSync:J});return}}let ye=Ho(B,D);X.set(j,se);let ve=te,Ke=Pr(s,o,ne,B,ye,r,V),it=(await ni(ne,Ke,V,j))[ye.route.id];if(X.get(j)===se&&X.delete(j),!ne.signal.aborted){if(ke.has(j)){dn(j,pn(void 0));return}if(er(it))if(oe>ve){dn(j,pn(void 0));return}else{Y.add(j),await Wn(ne,it,!1,{preventScrollReset:Q});return}if(vt(it)){un(j,P,it.error);return}dn(j,pn(it.data))}}async function Wn(j,P,D,{submission:B,fetcherSubmission:V,preventScrollReset:Z,replace:J}={}){D||(A?.resolve(),A=null),P.response.headers.has("X-Remix-Revalidate")&&(G=!0);let Q=P.response.headers.get("Location");ue(Q,"Expected a Location header on the redirect Response"),Q=Wd(Q,new URL(j.url),c);let ee=Ei(y.location,Q,{_isRedirect:!0});if(n){let Ke=!1;if(P.response.headers.has("X-Remix-Reload-Document"))Ke=!0;else if(Ma(Q)){const We=fm(Q,!0);Ke=We.origin!==e.location.origin||Rt(We.pathname,c)==null}if(Ke){J?e.location.replace(Q):e.location.assign(Q);return}}N=null;let ie=J===!0||P.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:se,formAction:ne,formEncType:ye}=y.navigation;!B&&!V&&se&&ne&&ye&&(B=Yd(y.navigation));let ve=B||V;if(Dy.has(P.response.status)&&ve&&Ze(ve.formMethod))await le(ie,ee,{submission:{...ve,formAction:Q},preventScrollReset:Z||R,enableViewTransition:D?L:void 0});else{let Ke=il(ee,B);await le(ie,ee,{overrideNavigation:Ke,fetcherSubmission:V,preventScrollReset:Z||R,enableViewTransition:D?L:void 0})}}async function ni(j,P,D,B){let V,Z={};try{V=await zy(d,j,P,B,D,!1)}catch(J){return P.filter(Q=>Q.shouldLoad).forEach(Q=>{Z[Q.route.id]={type:"error",error:J}}),Z}if(j.signal.aborted)return Z;if(!Ze(j.method))for(let J of P){if(V[J.route.id]?.type==="error")break;!V.hasOwnProperty(J.route.id)&&!y.loaderData.hasOwnProperty(J.route.id)&&(!y.errors||!y.errors.hasOwnProperty(J.route.id))&&J.shouldCallHandler()&&(V[J.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${J.route.id}`)})}for(let[J,Q]of Object.entries(V))if(Qy(Q)){let ee=Q.result;Z[J]={type:"redirect",response:Uy(ee,j,J,P,c)}}else Z[J]=await Wy(Q);return Z}async function bd(j,P,D,B){let V=ni(D,j,B,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,B,ee.key))[ee.match.route.id];return{[ee.key]:se}}else return Promise.resolve({[ee.key]:{type:"error",error:Pt(404,{pathname:ee.path})}})})),J=await V,Q=(await Z).reduce((ee,ie)=>Object.assign(ee,ie),{});return{loaderResults:J,fetcherResults:Q}}function Qa(){G=!0,ae.forEach((j,P)=>{X.has(P)&&fe.add(P),fn(P)})}function dn(j,P,D={}){y.fetchers.set(j,P),Se({fetchers:new Map(y.fetchers)},{flushSync:(D&&D.flushSync)===!0})}function un(j,P,D,B={}){let V=On(y.matches,P);Xa(j),Se({errors:{[V.route.id]:D},fetchers:new Map(y.fetchers)},{flushSync:(B&&B.flushSync)===!0})}function xd(j){return de.set(j,(de.get(j)||0)+1),ke.has(j)&&ke.delete(j),y.fetchers.get(j)||Ty}function Mx(j,P){fn(j,P?.reason),dn(j,pn(null))}function Xa(j){let P=y.fetchers.get(j);X.has(j)&&!(P&&P.state==="loading"&&me.has(j))&&fn(j),ae.delete(j),me.delete(j),Y.delete(j),ke.delete(j),fe.delete(j),y.fetchers.delete(j)}function Dx(j){let P=(de.get(j)||0)-1;P<=0?(de.delete(j),ke.add(j)):de.set(j,P),Se({fetchers:new Map(y.fetchers)})}function fn(j,P){let D=X.get(j);D&&(D.abort(P),X.delete(j))}function yd(j){for(let P of j){let D=xd(P),B=pn(D.data);y.fetchers.set(P,B)}}function vd(){let j=[],P=!1;for(let D of Y){let B=y.fetchers.get(D);ue(B,`Expected fetcher: ${D}`),B.state==="loading"&&(Y.delete(D),j.push(D),P=!0)}return yd(j),P}function wd(j){let P=[];for(let[D,B]of me)if(B<j){let V=y.fetchers.get(D);ue(V,`Expected fetcher: ${D}`),V.state==="loading"&&(fn(D),me.delete(D),P.push(D))}return yd(P),P.length>0}function Tx(j,P){let D=y.blockers.get(j)||si;return Qe.get(j)!==P&&Qe.set(j,P),D}function kd(j){y.blockers.delete(j),Qe.delete(j)}function no(j,P){let D=y.blockers.get(j)||si;ue(D.state==="unblocked"&&P.state==="blocked"||D.state==="blocked"&&P.state==="blocked"||D.state==="blocked"&&P.state==="proceeding"||D.state==="blocked"&&P.state==="unblocked"||D.state==="proceeding"&&P.state==="unblocked",`Invalid blocker state transition: ${D.state} -> ${P.state}`);let B=new Map(y.blockers);B.set(j,P),Se({blockers:B})}function Sd({currentLocation:j,nextLocation:P,historyAction:D}){if(Qe.size===0)return;Qe.size>1&&Ee(!1,"A router only supports one blocker at a time");let B=Array.from(Qe.entries()),[V,Z]=B[B.length-1],J=y.blockers.get(V);if(!(J&&J.state==="proceeding")&&Z({currentLocation:j,nextLocation:P,historyAction:D}))return V}function Za(j){let P=Pt(404,{pathname:j}),D=l||a,{matches:B,route:V}=lo(D);return{notFoundMatches:B,route:V,error:P}}function Ex(j,P,D){if(m=j,x=P,b=D||null,!w&&y.navigation===rl){w=!0;let B=jd(y.location,y.matches);B!=null&&Se({restoreScrollPosition:B})}return()=>{m=null,x=null,b=null}}function Cd(j,P){return b&&b(j,P.map(B=>iy(B,y.loaderData)))||j.key}function Rx(j,P){if(m&&x){let D=Cd(j,P);m[D]=x()}}function jd(j,P){if(m){let D=Cd(j,P),B=m[D];if(typeof B=="number")return B}return null}function ro(j,P,D){if(t.patchRoutesOnNavigation)if(j){if(Object.keys(j[0].params).length>0)return{active:!0,matches:yi(P,D,c,!0)}}else return{active:!0,matches:yi(P,D,c,!0)||[]};return{active:!1,matches:null}}async function io(j,P,D,B){if(!t.patchRoutesOnNavigation)return{type:"success",matches:j};let V=j;for(;;){let Z=l==null,J=l||a,Q=o;try{await t.patchRoutesOnNavigation({signal:D,path:P,matches:V,fetcherKey:B,patch:(se,ne)=>{D.aborted||Vd(se,ne,J,Q,s,!1)}})}catch(se){return{type:"error",error:se,partialMatches:V}}finally{Z&&!D.aborted&&(a=[...a])}if(D.aborted)return{type:"aborted"};let ee=jn(J,P,c),ie=null;if(ee){if(Object.keys(ee[0].params).length===0)return{type:"success",matches:ee};if(ie=yi(J,P,c,!0),!(ie&&V.length<ie.length&&Od(V,ie.slice(0,V.length))))return{type:"success",matches:ee}}if(ie||(ie=yi(J,P,c,!0)),!ie||Od(V,ie))return{type:"success",matches:null};V=ie}}function Od(j,P){return j.length===P.length&&j.every((D,B)=>D.route.id===P[B].route.id)}function Lx(j){o={},l=Ri(j,s,void 0,o)}function Ix(j,P,D=!1){let B=l==null;Vd(j,P,l||a,o,s,D),B&&(a=[...a],Se({}))}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:Ex,navigate:I,fetch:Px,revalidate:K,createHref:j=>t.history.createHref(j),encodeLocation:j=>t.history.encodeLocation(j),getFetcher:xd,resetFetcher:Mx,deleteFetcher:Dx,dispose:Ce,getBlocker:Tx,deleteBlocker:kd,patchRoutes:Ix,_internalFetchControllers:X,_internalSetRoutes:Lx,_internalSetStateDoNotUseOrYouWillBreakYourApp(j){Se(j)}},t.unstable_instrumentations&&(O=Sy(O,t.unstable_instrumentations.map(j=>j.router).filter(Boolean))),O}function Ly(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function hc(t,e,n,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=Ta(r||".",Da(o),Rt(t.pathname,n)||t.pathname,s==="path");if(r==null&&(l.search=t.search,l.hash=t.hash),(r==null||r===""||r===".")&&a){let c=mh(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 n!=="/"&&(l.pathname=by({basename:n,pathname:l.pathname})),on(l)}function Bd(t,e,n){if(!n||!Ly(n))return{path:e};if(n.formMethod&&!e1(n.formMethod))return{path:e,error:Pt(405,{method:n.formMethod})};let r=()=>({path:e,error:Pt(400,{type:"invalid-body"})}),s=(n.formMethod||"get").toUpperCase(),o=Mm(e);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Ze(s))return r();let u=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((f,[p,m])=>`${f}${p}=${m}
19
+ `,""):String(n.body);return{path:e,submission:{formMethod:s,formAction:o,formEncType:n.formEncType,formData:void 0,json:void 0,text:u}}}else if(n.formEncType==="application/json"){if(!Ze(s))return r();try{let u=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:e,submission:{formMethod:s,formAction:o,formEncType:n.formEncType,formData:void 0,json:u,text:void 0}}}catch{return r()}}}ue(typeof FormData=="function","FormData is not available in this environment");let a,l;if(n.formData)a=fc(n.formData),l=n.formData;else if(n.body instanceof FormData)a=fc(n.body),l=n.body;else if(n.body instanceof URLSearchParams)a=n.body,l=Ud(a);else if(n.body==null)a=new URLSearchParams,l=new FormData;else try{a=new URLSearchParams(n.body),l=Ud(a)}catch{return r()}let c={formMethod:s,formAction:o,formEncType:n&&n.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 t&&d.search&&mh(d.search)&&a.append("index",""),d.search=`?${a}`,{path:on(d),submission:c}}function Fd(t,e,n,r,i,s,o,a,l,c,d,u,f,p,m,b,x,w,v,S,C){let k=S?vt(S[1])?S[1].error:S[1].data:void 0,O=i.createURL(s.location),y=i.createURL(l),M;if(d&&s.errors){let F=Object.keys(s.errors)[0];M=o.findIndex(G=>G.route.id===F)}else if(S&&vt(S[1])){let F=S[0];M=o.findIndex(G=>G.route.id===F)-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=Fs(o),_=o.map((F,G)=>{let{route:fe}=F,X=null;if(M!=null&&G>M?X=!1:fe.lazy?X=!0:fh(fe)?d?X=dc(fe,s.loaderData,s.errors):Iy(s.loaderData,s.matches[G],F)&&(X=!0):X=!1,X!==null)return uc(n,r,t,L,F,c,e,X);let te=!1;typeof C=="boolean"?te=C:R?te=!1:(u||O.pathname+O.search===y.pathname+y.search||O.search!==y.search||$y(s.matches[G],F))&&(te=!0);let oe={...N,defaultShouldRevalidate:te},me=Ci(F,oe);return uc(n,r,t,L,F,c,e,me,oe,C)}),$=[];return m.forEach((F,G)=>{if(d||!o.some(de=>de.route.id===F.routeId)||p.has(G))return;let fe=s.fetchers.get(G),X=fe&&fe.state!=="idle"&&fe.data===void 0,te=jn(x,F.path,w);if(!te){if(v&&X)return;$.push({key:G,routeId:F.routeId,path:F.path,matches:null,match:null,request:null,controller:null});return}if(b.has(G))return;let oe=Ho(te,F.path),me=new AbortController,Y=xr(i,F.path,me.signal),ae=null;if(f.has(G))f.delete(G),ae=Pr(n,r,Y,te,oe,c,e);else if(X)u&&(ae=Pr(n,r,Y,te,oe,c,e));else{let de;typeof C=="boolean"?de=C:R?de=!1:de=u;let ke={...N,defaultShouldRevalidate:de};Ci(oe,ke)&&(ae=Pr(n,r,Y,te,oe,c,e,ke))}ae&&$.push({key:G,routeId:F.routeId,path:F.path,matches:ae,match:oe,request:Y,controller:me})}),{dsMatches:_,revalidatingFetchers:$}}function fh(t){return t.loader!=null||t.middleware!=null&&t.middleware.length>0}function dc(t,e,n){if(t.lazy)return!0;if(!fh(t))return!1;let r=e!=null&&t.id in e,i=n!=null&&n[t.id]!==void 0;return!r&&i?!1:typeof t.loader=="function"&&t.loader.hydrate===!0?!0:!r&&!i}function Iy(t,e,n){let r=!e||n.route.id!==e.route.id,i=!t.hasOwnProperty(n.route.id);return r||i}function $y(t,e){let n=t.route.path;return t.pathname!==e.pathname||n!=null&&n.endsWith("*")&&t.params["*"]!==e.params["*"]}function Ci(t,e){if(t.route.shouldRevalidate){let n=t.route.shouldRevalidate(e);if(typeof n=="boolean")return n}return e.defaultShouldRevalidate}function Vd(t,e,n,r,i,s){let o;if(t){let c=r[t];ue(c,`No route found to patch children into: routeId = ${t}`),c.children||(c.children=[]),o=c.children}else o=n;let a=[],l=[];if(e.forEach(c=>{let d=o.find(u=>jm(c,u));d?l.push({existingRoute:d,newRoute:c}):a.push(c)}),a.length>0){let c=Ri(a,i,[t||"_","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]=Ri([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 jm(t,e){return"id"in t&&"id"in e&&t.id===e.id?!0:t.index===e.index&&t.path===e.path&&t.caseSensitive===e.caseSensitive?(!t.children||t.children.length===0)&&(!e.children||e.children.length===0)?!0:t.children.every((n,r)=>e.children?.some(i=>jm(n,i))):!1}var zd=new WeakMap,Om=({key:t,route:e,manifest:n,mapRouteProperties:r})=>{let i=n[e.id];if(ue(i,"No route found in manifest"),!i.lazy||typeof i.lazy!="object")return;let s=i.lazy[t];if(!s)return;let o=zd.get(i);o||(o={},zd.set(i,o));let a=o[t];if(a)return a;let l=(async()=>{let c=ey(t),u=i[t]!==void 0&&t!=="hasErrorBoundary";if(c)Ee(!c,"Route property "+t+" is not a supported lazy route property. This property will be ignored."),o[t]=Promise.resolve();else if(u)Ee(!1,`Route "${i.id}" has a static property "${t}" defined. The lazy property will be ignored.`);else{let f=await s();f!=null&&(Object.assign(i,{[t]:f}),Object.assign(i,r(i)))}typeof i.lazy=="object"&&(i.lazy[t]=void 0,Object.values(i.lazy).every(f=>f===void 0)&&(i.lazy=void 0))})();return o[t]=l,l},Hd=new WeakMap;function By(t,e,n,r,i){let s=n[t.id];if(ue(s,"No route found in manifest"),!t.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof t.lazy=="function"){let d=Hd.get(s);if(d)return{lazyRoutePromise:d,lazyHandlerPromise:d};let u=(async()=>{ue(typeof t.lazy=="function","No lazy route function found");let f=await t.lazy(),p={};for(let m in f){let b=f[m];if(b===void 0)continue;let x=ny(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 Hd.set(s,u),u.catch(()=>{}),{lazyRoutePromise:u,lazyHandlerPromise:u}}let o=Object.keys(t.lazy),a=[],l;for(let d of o){if(i&&i.includes(d))continue;let u=Om({key:d,route:t,manifest:n,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 _d(t){let e=t.matches.filter(i=>i.shouldLoad),n={};return(await Promise.all(e.map(i=>i.resolve()))).forEach((i,s)=>{n[e[s].route.id]=i}),n}async function Fy(t){return t.matches.some(e=>e.route.middleware)?Pm(t,()=>_d(t)):_d(t)}function Pm(t,e){return Vy(t,e,r=>{if(Zy(r))throw r;return r},Jy,n);function n(r,i,s){if(s)return Promise.resolve(Object.assign(s.value,{[i]:{type:"error",result:r}}));{let{matches:o}=t,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 Vy(t,e,n,r,i){let{matches:s,request:o,params:a,context:l,unstable_pattern:c}=t,d=s.flatMap(f=>f.route.middleware?f.route.middleware.map(p=>[f.route.id,p]):[]);return await Nm({request:o,params:a,context:l,unstable_pattern:c},d,e,n,r,i)}async function Nm(t,e,n,r,i,s,o=0){let{request:a}=t;if(a.signal.aborted)throw a.signal.reason??new Error(`Request aborted: ${a.method} ${a.url}`);let l=e[o];if(!l)return await n();let[c,d]=l,u,f=async()=>{if(u)throw new Error("You may only call `next()` once per middleware");try{return u={value:await Nm(t,e,n,r,i,s,o+1)},u.value}catch(p){return u={value:await s(p,c,u)},u.value}};try{let p=await d(t,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 Am(t,e,n,r,i){let s=Om({key:"middleware",route:r.route,manifest:e,mapRouteProperties:t}),o=By(r.route,Ze(n.method)?"action":"loader",e,t,i);return{middleware:s,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function uc(t,e,n,r,i,s,o,a,l=null,c){let d=!1,u=Am(t,e,n,i,s);return{...i,_lazyPromises:u,shouldLoad:a,shouldRevalidateArgs:l,shouldCallHandler(f){return d=!0,l?typeof c=="boolean"?Ci(i,{...l,defaultShouldRevalidate:c}):typeof f=="boolean"?Ci(i,{...l,defaultShouldRevalidate:f}):Ci(i,l):a},resolve(f){let{lazy:p,loader:m,middleware:b}=i.route,x=d||a||f&&!Ze(n.method)&&(p||m),w=b&&b.length>0&&!m&&!p;return x&&(Ze(n.method)||!w)?Hy({request:n,unstable_pattern:r,match:i,lazyHandlerPromise:u?.handler,lazyRoutePromise:u?.route,handlerOverride:f,scopedContext:o}):Promise.resolve({type:"data",result:void 0})}}}function Pr(t,e,n,r,i,s,o,a=null){return r.map(l=>l.route.id!==i.route.id?{...l,shouldLoad:!1,shouldRevalidateArgs:a,shouldCallHandler:()=>!1,_lazyPromises:Am(t,e,n,l,s),resolve:()=>Promise.resolve({type:"data",result:void 0})}:uc(t,e,n,Fs(r),l,s,o,!0,a))}async function zy(t,e,n,r,i,s){n.some(c=>c._lazyPromises?.middleware)&&await Promise.all(n.map(c=>c._lazyPromises?.middleware));let o={request:e,unstable_pattern:Fs(n),params:n[0].params,context:i,matches:n},l=await t({...o,fetcherKey:r,runClientMiddleware:c=>{let d=o;return Pm(d,()=>c({...d,fetcherKey:r,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(n.flatMap(c=>[c._lazyPromises?.handler,c._lazyPromises?.route]))}catch{}return l}async function Hy({request:t,unstable_pattern:e,match:n,lazyHandlerPromise:r,lazyRoutePromise:i,handlerOverride:s,scopedContext:o}){let a,l,c=Ze(t.method),d=c?"action":"loader",u=f=>{let p,m=new Promise((w,v)=>p=v);l=()=>p(),t.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: ${n.route.id}]`)):f({request:t,unstable_pattern:e,params:n.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?n.route.action:n.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?n.route.action:n.route.loader;if(p)[a]=await Promise.all([u(p),i]);else if(d==="action"){let m=new URL(t.url),b=m.pathname+m.search;throw Pt(405,{method:t.method,pathname:b,routeId:n.route.id})}else return{type:"data",result:void 0}}else if(f)a=await u(f);else{let p=new URL(t.url),m=p.pathname+p.search;throw Pt(404,{pathname:m})}}catch(f){return{type:"error",result:f}}finally{l&&t.signal.removeEventListener("abort",l)}return a}async function _y(t){let e=t.headers.get("Content-Type");return e&&/\bapplication\/json\b/.test(e)?t.body==null?null:t.json():t.text()}async function Wy(t){let{result:e,type:n}=t;if(ph(e)){let r;try{r=await _y(e)}catch(i){return{type:"error",error:i}}return n==="error"?{type:"error",error:new Bs(e.status,e.statusText,r),statusCode:e.status,headers:e.headers}:{type:"data",data:r,statusCode:e.status,headers:e.headers}}return n==="error"?Jd(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:qy(e),statusCode:Li(e)?e.status:void 0,headers:e.init?.headers?new Headers(e.init.headers):void 0}:{type:"error",error:e,statusCode:Li(e)?e.status:void 0}:Jd(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 Uy(t,e,n,r,i){let s=t.headers.get("Location");if(ue(s,"Redirects returned/thrown from loaders/actions must have a Location header"),!Ma(s)){let o=r.slice(0,r.findIndex(a=>a.route.id===n)+1);s=hc(new URL(e.url),o,i,s),t.headers.set("Location",s)}return t}function Wd(t,e,n){if(Ma(t)){let r=t,i=r.startsWith("//")?new URL(e.protocol+r):new URL(r),s=Rt(i.pathname,n)!=null;if(i.origin===e.origin&&s)return i.pathname+i.search+i.hash}return t}function xr(t,e,n,r){let i=t.createURL(Mm(e)).toString(),s={signal:n};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=fc(r.formData):s.body=r.formData}return new Request(i,s)}function fc(t){let e=new URLSearchParams;for(let[n,r]of t.entries())e.append(n,typeof r=="string"?r:r.name);return e}function Ud(t){let e=new FormData;for(let[n,r]of t.entries())e.append(n,r);return e}function Ky(t,e,n,r=!1,i=!1){let s={},o=null,a,l=!1,c={},d=n&&vt(n[1])?n[1].error:void 0;return t.forEach(u=>{if(!(u.route.id in e))return;let f=u.route.id,p=e[f];if(ue(!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(t,f);o[b.route.id]==null&&(o[b.route.id]=m)}r||(s[f]=Cm),l||(l=!0,a=Li(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&&n&&(o={[n[0]]:d},n[2]&&(s[n[2]]=void 0)),{loaderData:s,errors:o,statusCode:a||200,loaderHeaders:c}}function Kd(t,e,n,r,i,s){let{loaderData:o,errors:a}=Ky(e,n,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(ue(f,"Did not find corresponding fetcher result"),vt(f)){let p=On(t.matches,d?.route.id);a&&a[p.route.id]||(a={...a,[p.route.id]:f.error}),t.fetchers.delete(c)}else if(er(f))ue(!1,"Unhandled fetcher revalidation redirect");else{let p=pn(f.data);t.fetchers.set(c,p)}}),{loaderData:o,errors:a}}function Gd(t,e,n,r){let i=Object.entries(e).filter(([,s])=>s!==Cm).reduce((s,[o,a])=>(s[o]=a,s),{});for(let s of n){let o=s.route.id;if(!e.hasOwnProperty(o)&&t.hasOwnProperty(o)&&s.route.loader&&(i[o]=t[o]),r&&r.hasOwnProperty(o))break}return i}function qd(t){return t?vt(t[1])?{actionData:{}}:{actionData:{[t[0]]:t[1].data}}:{}}function On(t,e){return(e?t.slice(0,t.findIndex(r=>r.route.id===e)+1):[...t]).reverse().find(r=>r.route.hasErrorBoundary===!0)||t[0]}function lo(t){let e=t.length===1?t[0]:t.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:e}],route:e}}function Pt(t,{pathname:e,routeId:n,method:r,type:i,message:s}={}){let o="Unknown Server Error",a="Unknown @remix-run/router error";return t===400?(o="Bad Request",r&&e&&n?a=`You made a ${r} request to "${e}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:i==="invalid-body"&&(a="Unable to encode submission body")):t===403?(o="Forbidden",a=`Route "${n}" does not match URL "${e}"`):t===404?(o="Not Found",a=`No route matches URL "${e}"`):t===405&&(o="Method Not Allowed",r&&e&&n?a=`You made a ${r.toUpperCase()} request to "${e}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(a=`Invalid request method "${r.toUpperCase()}"`)),new Bs(t||500,o,new Error(a),!0)}function co(t){let e=Object.entries(t);for(let n=e.length-1;n>=0;n--){let[r,i]=e[n];if(er(i))return{key:r,result:i}}}function Mm(t){let e=typeof t=="string"?Vn(t):t;return on({...e,hash:""})}function Gy(t,e){return t.pathname!==e.pathname||t.search!==e.search?!1:t.hash===""?e.hash!=="":t.hash===e.hash?!0:e.hash!==""}function qy(t){return new Bs(t.init?.status??500,t.init?.statusText??"Internal Server Error",t.data)}function Jy(t){return t!=null&&typeof t=="object"&&Object.entries(t).every(([e,n])=>typeof e=="string"&&Yy(n))}function Yy(t){return t!=null&&typeof t=="object"&&"type"in t&&"result"in t&&(t.type==="data"||t.type==="error")}function Qy(t){return ph(t.result)&&km.has(t.result.status)}function vt(t){return t.type==="error"}function er(t){return(t&&t.type)==="redirect"}function Jd(t){return typeof t=="object"&&t!=null&&"type"in t&&"data"in t&&"init"in t&&t.type==="DataWithResponseInit"}function ph(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.headers=="object"&&typeof t.body<"u"}function Xy(t){return km.has(t)}function Zy(t){return ph(t)&&Xy(t.status)&&t.headers.has("Location")}function e1(t){return My.has(t.toUpperCase())}function Ze(t){return Ny.has(t.toUpperCase())}function mh(t){return new URLSearchParams(t).getAll("index").some(e=>e==="")}function Ho(t,e){let n=typeof e=="string"?Vn(e).search:e.search;if(t[t.length-1].route.index&&mh(n||""))return t[t.length-1];let r=bm(t);return r[r.length-1]}function Yd(t){let{formMethod:e,formAction:n,formEncType:r,text:i,formData:s,json:o}=t;if(!(!e||!n||!r)){if(i!=null)return{formMethod:e,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(s!=null)return{formMethod:e,formAction:n,formEncType:r,formData:s,json:void 0,text:void 0};if(o!==void 0)return{formMethod:e,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function il(t,e){return e?{state:"loading",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}:{state:"loading",location:t,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function t1(t,e){return{state:"submitting",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}}function oi(t,e){return t?{state:"loading",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function n1(t,e){return{state:"submitting",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e?e.data:void 0}}function pn(t){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function r1(t,e){try{let n=t.sessionStorage.getItem(Sm);if(n){let r=JSON.parse(n);for(let[i,s]of Object.entries(r||{}))s&&Array.isArray(s)&&e.set(i,new Set(s||[]))}}catch{}}function i1(t,e){if(e.size>0){let n={};for(let[r,i]of e)n[r]=[...i];try{t.sessionStorage.setItem(Sm,JSON.stringify(n))}catch(r){Ee(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function Qd(){let t,e,n=new Promise((r,i)=>{t=async s=>{r(s);try{await n}catch{}},e=async s=>{i(s);try{await n}catch{}}});return{promise:n,resolve:t,reject:e}}var dr=g.createContext(null);dr.displayName="DataRouter";var Vs=g.createContext(null);Vs.displayName="DataRouterState";var Dm=g.createContext(!1);function s1(){return g.useContext(Dm)}var gh=g.createContext({isTransitioning:!1});gh.displayName="ViewTransition";var Tm=g.createContext(new Map);Tm.displayName="Fetchers";var o1=g.createContext(null);o1.displayName="Await";var kt=g.createContext(null);kt.displayName="Navigation";var Ea=g.createContext(null);Ea.displayName="Location";var It=g.createContext({outlet:null,matches:[],isDataRoute:!1});It.displayName="Route";var bh=g.createContext(null);bh.displayName="RouteError";var Em="REACT_ROUTER_ERROR",a1="REDIRECT",l1="ROUTE_ERROR_RESPONSE";function c1(t){if(t.startsWith(`${Em}:${a1}:{`))try{let e=JSON.parse(t.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function h1(t){if(t.startsWith(`${Em}:${l1}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new Bs(e.status,e.statusText,e.data)}catch{}}function d1(t,{relative:e}={}){ue(Wr(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=g.useContext(kt),{hash:i,pathname:s,search:o}=zs(t,{relative:e}),a=s;return n!=="/"&&(a=s==="/"?n:rn([n,s])),r.createHref({pathname:a,search:o,hash:i})}function Wr(){return g.useContext(Ea)!=null}function Ht(){return ue(Wr(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(Ea).location}var Rm="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Lm(t){g.useContext(kt).static||g.useLayoutEffect(t)}function an(){let{isDataRoute:t}=g.useContext(It);return t?O1():u1()}function u1(){ue(Wr(),"useNavigate() may be used only in the context of a <Router> component.");let t=g.useContext(dr),{basename:e,navigator:n}=g.useContext(kt),{matches:r}=g.useContext(It),{pathname:i}=Ht(),s=JSON.stringify(Da(r)),o=g.useRef(!1);return Lm(()=>{o.current=!0}),g.useCallback((l,c={})=>{if(Ee(o.current,Rm),!o.current)return;if(typeof l=="number"){n.go(l);return}let d=Ta(l,JSON.parse(s),i,c.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:rn([e,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[e,n,s,i,t])}var Im=g.createContext(null);function f1(){return g.useContext(Im)}function p1(t){let e=g.useContext(It).outlet;return g.useMemo(()=>e&&g.createElement(Im.Provider,{value:t},e),[e,t])}function $m(){let{matches:t}=g.useContext(It),e=t[t.length-1];return e?e.params:{}}function zs(t,{relative:e}={}){let{matches:n}=g.useContext(It),{pathname:r}=Ht(),i=JSON.stringify(Da(n));return g.useMemo(()=>Ta(t,JSON.parse(i),r,e==="path"),[t,i,r,e])}function m1(t,e,n,r,i){ue(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||"";Fm(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="${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(t,{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.`),v1(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,n,r,i)}function g1(){let t=j1(),e=Li(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},s={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",t),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),n?g.createElement("pre",{style:i},n):null,o)}var b1=g.createElement(g1,null),Bm=class extends g.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.onError?this.props.onError(t,e):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const n=h1(t.digest);n&&(t=n)}let e=t!==void 0?g.createElement(It.Provider,{value:this.props.routeContext},g.createElement(bh.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?g.createElement(x1,{error:t},e):e}};Bm.contextType=Dm;var sl=new WeakMap;function x1({children:t,error:e}){let{basename:n}=g.useContext(kt);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=c1(e.digest);if(r){let i=sl.get(e);if(i)throw i;let s=ym(r.location,n);if(xm&&!sl.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 sl.set(e,o),o}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return t}function y1({routeContext:t,match:e,children:n}){let r=g.useContext(dr);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),g.createElement(It.Provider,{value:t},n)}function v1(t,e=[],n=null,r=null,i=null){if(t==null){if(!n)return null;if(n.errors)t=n.matches;else if(e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let s=t,o=n?.errors;if(o!=null){let d=s.findIndex(u=>u.route.id&&o?.[u.route.id]!==void 0);de(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(n)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}=n,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=n&&r?(d,u)=>{r(d,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:Fs(n.matches),errorInfo:u})}:void 0;return s.reduceRight((d,u,f)=>{let p,m=!1,b=null,x=null;n&&(p=o&&u.route.id?o[u.route.id]:void 0,b=u.route.errorElement||b1,a&&(l<0&&f===0?(Fm("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(y1,{match:u,routeContext:{outlet:d,matches:w,isDataRoute:n!=null},children:S})};return n&&(u.route.ErrorBoundary||u.route.errorElement||f===0)?g.createElement(Bm,{location:n.location,revalidation:n.revalidation,component:b,error:p,children:v(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:c}):v()},null)}function xh(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function w1(t){let e=g.useContext(dr);return de(e,xh(t)),e}function k1(t){let e=g.useContext(Vs);return de(e,xh(t)),e}function S1(t){let e=g.useContext(It);return de(e,xh(t)),e}function yh(t){let e=S1(t),n=e.matches[e.matches.length-1];return de(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function C1(){return yh("useRouteId")}function j1(){let t=g.useContext(bh),e=k1("useRouteError"),n=yh("useRouteError");return t!==void 0?t:e.errors?.[n]}function O1(){let{router:t}=w1("useNavigate"),e=yh("useNavigate"),n=g.useRef(!1);return Lm(()=>{n.current=!0}),g.useCallback(async(i,s={})=>{Ee(n.current,Rm),n.current&&(typeof i=="number"?await t.navigate(i):await t.navigate(i,{fromRouteId:e,...s}))},[t,e])}var Xd={};function Fm(t,e,n){!e&&!Xd[t]&&(Xd[t]=!0,Ee(!1,n))}var Zd={};function eu(t,e){!t&&!Zd[e]&&(Zd[e]=!0,console.warn(e))}var P1="useOptimistic",tu=Vx[P1],N1=()=>{};function A1(t){return tu?tu(t):[t,N1]}function M1(t){let e={hasErrorBoundary:t.hasErrorBoundary||t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&(t.element&&Ee(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(e,{element:g.createElement(t.Component),Component:void 0})),t.HydrateFallback&&(t.hydrateFallbackElement&&Ee(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(e,{hydrateFallbackElement:g.createElement(t.HydrateFallback),HydrateFallback:void 0})),t.ErrorBoundary&&(t.errorElement&&Ee(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(e,{errorElement:g.createElement(t.ErrorBoundary),ErrorBoundary:void 0})),e}var D1=["HydrateFallback","hydrateFallbackElement"],T1=class{constructor(){this.status="pending",this.promise=new Promise((t,e)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",t(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",e(n))}})}};function E1({router:t,flushSync:e,onError:n,unstable_useTransitions:r}){r=s1()||r;let[s,o]=g.useState(t.state),[a,l]=A1(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),C=g.useCallback((M,{deletedFetchers:A,newErrors:R,flushSync:N,viewTransitionOpts:L})=>{R&&n&&Object.values(R).forEach($=>n($,{location:M.location,params:M.matches[0]?.params??{},unstable_pattern:Fs(M.matches)})),M.fetchers.forEach(($,F)=>{$.data!==void 0&&S.current.set(F,$.data)}),A.forEach($=>S.current.delete($)),eu(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 H=t.window!=null&&t.window.document!=null&&typeof t.window.document.startViewTransition=="function";if(eu(L==null||H,"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||!H){e&&N?e(()=>o(M)):r===!1?o(M):g.startTransition(()=>{r===!0&&l($=>nu($,M)),o(M)});return}if(e&&N){e(()=>{b&&(p?.resolve(),b.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:L.currentLocation,nextLocation:L.nextLocation})});let $=t.window.document.startViewTransition(()=>{e(()=>o(M))});$.finished.finally(()=>{e(()=>{m(void 0),x(void 0),d(void 0),f({isTransitioning:!1})})}),e(()=>x($));return}b?(p?.resolve(),b.skipTransition(),v({state:M,currentLocation:L.currentLocation,nextLocation:L.nextLocation})):(d(M),f({isTransitioning:!0,flushSync:!1,currentLocation:L.currentLocation,nextLocation:L.nextLocation}))},[t.window,e,b,p,r,l,n]);g.useLayoutEffect(()=>t.subscribe(C),[t,C]),g.useEffect(()=>{u.isTransitioning&&!u.flushSync&&m(new T1)},[u]),g.useEffect(()=>{if(p&&c&&t.window){let M=c,A=p.promise,R=t.window.document.startViewTransition(async()=>{r===!1?o(M):g.startTransition(()=>{r===!0&&l(N=>nu(N,M)),o(M)}),await A});R.finished.finally(()=>{m(void 0),x(void 0),d(void 0),f({isTransitioning:!1})}),x(R)}},[c,p,t.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:t.createHref,encodeLocation:t.encodeLocation,go:M=>t.navigate(M),push:(M,A,R)=>t.navigate(M,{state:A,preventScrollReset:R?.preventScrollReset}),replace:(M,A,R)=>t.navigate(M,{replace:!0,state:A,preventScrollReset:R?.preventScrollReset})}),[t]),O=t.basename||"/",y=g.useMemo(()=>({router:t,navigator:k,static:!1,basename:O,onError:n}),[t,k,O,n]);return g.createElement(g.Fragment,null,g.createElement(dr.Provider,{value:y},g.createElement(Vs.Provider,{value:a},g.createElement(Tm.Provider,{value:S.current},g.createElement(gh.Provider,{value:u},g.createElement($1,{basename:O,location:a.location,navigationType:a.historyAction,navigator:k,unstable_useTransitions:r},g.createElement(R1,{routes:t.routes,future:t.future,state:a,onError:n})))))),null)}function nu(t,e){return{...t,navigation:e.navigation.state!=="idle"?e.navigation:t.navigation,revalidation:e.revalidation!=="idle"?e.revalidation:t.revalidation,actionData:e.navigation.state!=="submitting"?e.actionData:t.actionData,fetchers:e.fetchers}}var R1=g.memo(L1);function L1({routes:t,future:e,state:n,onError:r}){return m1(t,void 0,n,r,e)}function ol({to:t,replace:e,state:n,relative:r}){de(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=Ta(t,Da(s),o,r==="path"),c=JSON.stringify(l);return g.useEffect(()=>{a(JSON.parse(c),{replace:e,state:n,relative:r})},[a,c,r,e,n]),null}function I1(t){return p1(t.context)}function $1({basename:t="/",children:e=null,location:n,navigationType:r="POP",navigator:i,static:s=!1,unstable_useTransitions:o}){de(!Wr(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let a=t.replace(/^\/*/,"/"),l=g.useMemo(()=>({basename:a,navigator:i,static:s,unstable_useTransitions:o,future:{}}),[a,i,s,o]);typeof n=="string"&&(n=Vn(n));let{pathname:c="/",search:d="",hash:u="",state:f=null,key:p="default"}=n,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(Ea.Provider,{children:e,value:m}))}var Ho="get",Wo="application/x-www-form-urlencoded";function Ra(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function B1(t){return Ra(t)&&t.tagName.toLowerCase()==="button"}function F1(t){return Ra(t)&&t.tagName.toLowerCase()==="form"}function V1(t){return Ra(t)&&t.tagName.toLowerCase()==="input"}function z1(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function _1(t,e){return t.button===0&&(!e||e==="_self")&&!z1(t)}function pc(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function H1(t,e){let n=pc(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(s=>{n.append(i,s)})}),n}var ho=null;function W1(){if(ho===null)try{new FormData(document.createElement("form"),0),ho=!1}catch{ho=!0}return ho}var U1=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function al(t){return t!=null&&!U1.has(t)?(Ee(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Wo}"`),null):t}function K1(t,e){let n,r,i,s,o;if(F1(t)){let a=t.getAttribute("action");r=a?Rt(a,e):null,n=t.getAttribute("method")||Ho,i=al(t.getAttribute("enctype"))||Wo,s=new FormData(t)}else if(B1(t)||V1(t)&&(t.type==="submit"||t.type==="image")){let a=t.form;if(a==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=t.getAttribute("formaction")||a.getAttribute("action");if(r=l?Rt(l,e):null,n=t.getAttribute("formmethod")||a.getAttribute("method")||Ho,i=al(t.getAttribute("formenctype"))||al(a.getAttribute("enctype"))||Wo,s=new FormData(a,t),!W1()){let{name:c,type:d,value:u}=t;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(Ra(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Ho,r=null,i=Wo,o=t}return s&&i==="text/plain"&&(o=s,s=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:s,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function vh(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function G1(t,e,n){let r=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return r.pathname==="/"?r.pathname=`_root.${n}`:e&&Rt(r.pathname,e)==="/"?r.pathname=`${e.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function q1(t,e){if(t.id in e)return e[t.id];try{let n=await import(t.module);return e[t.id]=n,n}catch(n){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function J1(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function Y1(t,e,n){let r=await Promise.all(t.map(async i=>{let s=e.routes[i.route.id];if(s){let o=await q1(s,n);return o.links?o.links():[]}return[]}));return ev(r.flat(1).filter(J1).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function ru(t,e,n,r,i,s){let o=(l,c)=>n[c]?l.route.id!==n[c].route.id:!0,a=(l,c)=>n[c].pathname!==l.pathname||n[c].route.path?.endsWith("*")&&n[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:n[0]?.params||{},nextUrl:new URL(t,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof u=="boolean")return u}return!0}):[]}function Q1(t,e,{includeHydrateFallback:n}={}){return X1(t.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)),n&&i.hydrateFallbackModule&&(s=s.concat(i.hydrateFallbackModule)),i.imports&&(s=s.concat(i.imports)),s}).flat(1))}function X1(t){return[...new Set(t)]}function Z1(t){let e={},n=Object.keys(t).sort();for(let r of n)e[r]=t[r];return e}function ev(t,e){let n=new Set;return new Set(e),t.reduce((r,i)=>{let s=JSON.stringify(Z1(i));return n.has(s)||(n.add(s),r.push({key:s,link:i})),r},[])}function Vm(){let t=g.useContext(dr);return vh(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function tv(){let t=g.useContext(Vs);return vh(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var wh=g.createContext(void 0);wh.displayName="FrameworkContext";function zm(){let t=g.useContext(wh);return vh(t,"You must render this element inside a <HydratedRouter> element"),t}function nv(t,e){let n=g.useContext(wh),[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(t==="render"&&o(!0),t==="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()}}},[t]),g.useEffect(()=>{if(r){let b=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(b)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?t!=="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(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function rv({page:t,...e}){let{router:n}=Vm(),r=g.useMemo(()=>jn(n.routes,t,n.basename),[n.routes,t,n.basename]);return r?g.createElement(sv,{page:t,matches:r,...e}):null}function iv(t){let{manifest:e,routeModules:n}=zm(),[r,i]=g.useState([]);return g.useEffect(()=>{let s=!1;return Y1(t,e,n).then(o=>{s||i(o)}),()=>{s=!0}},[t,e,n]),r}function sv({page:t,matches:e,...n}){let r=_t(),{manifest:i,routeModules:s}=zm(),{basename:o}=Vm(),{loaderData:a,matches:l}=tv(),c=g.useMemo(()=>ru(t,e,l,i,r,"data"),[t,e,l,i,r]),d=g.useMemo(()=>ru(t,e,l,i,r,"assets"),[t,e,l,i,r]),u=g.useMemo(()=>{if(t===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=G1(t,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,t,s]),f=g.useMemo(()=>Q1(d,i),[d,i]),p=iv(d);return g.createElement(g.Fragment,null,u.map(m=>g.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...n})),f.map(m=>g.createElement("link",{key:m,rel:"modulepreload",href:m,...n})),p.map(({key:m,link:b})=>g.createElement("link",{key:m,nonce:n.nonce,...b})))}function ov(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var av=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{av&&(window.__reactRouterVersion="7.11.0")}catch{}function lv(t,e){return Ry({basename:e?.basename,getContext:e?.getContext,future:e?.future,history:Yx({window:e?.window}),hydrationData:cv(),routes:t,mapRouteProperties:M1,hydrationRouteProperties:D1,dataStrategy:e?.dataStrategy,patchRoutesOnNavigation:e?.patchRoutesOnNavigation,window:e?.window,unstable_instrumentations:e?.unstable_instrumentations}).initialize()}function cv(){let t=window?.__staticRouterHydrationData;return t&&t.errors&&(t={...t,errors:hv(t.errors)}),t}function hv(t){if(!t)return null;let e=Object.entries(t),n={};for(let[r,i]of e)if(i&&i.__type==="RouteErrorResponse")n[r]=new Bs(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="",n[r]=o}catch{}}if(n[r]==null){let s=new Error(i.message);s.stack="",n[r]=s}}else n[r]=i;return n}var _m=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Hm=g.forwardRef(function({onClick:e,discover:n="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"&&_m.test(c),v=ym(c,b);c=v.to;let S=d1(c,{relative:i}),[C,k,O]=nv(r,p),y=pv(c,{replace:o,state:a,target:l,preventScrollReset:d,relative:i,viewTransition:u,unstable_defaultShouldRevalidate:f,unstable_useTransitions:x});function M(R){e&&e(R),R.defaultPrevented||y(R)}let A=g.createElement("a",{...p,...O,href:v.absoluteURL||S,onClick:v.isExternal||s?e:M,ref:ov(m,k),target:l,"data-discover":!w&&n==="render"?"true":void 0});return C&&!w?g.createElement(g.Fragment,null,A,g.createElement(rv,{page:S})):A});Hm.displayName="Link";var dv=g.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:r="",end:i=!1,style:s,to:o,viewTransition:a,children:l,...c},d){let u=zs(o,{relative:c.relative}),f=_t(),p=g.useContext(Vs),{navigator:m,basename:b}=g.useContext(kt),x=p!=null&&vv(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;n||(v=v.toLowerCase(),S=S?S.toLowerCase():null,w=w.toLowerCase()),S&&b&&(S=Rt(S,b)||S);const C=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let k=v===w||!i&&v.startsWith(w)&&v.charAt(C)==="/",O=S!=null&&(S===w||!i&&S.startsWith(w)&&S.charAt(w.length)==="/"),y={isActive:k,isPending:O,isTransitioning:x},M=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(Hm,{...c,"aria-current":M,className:A,ref:d,style:R,to:o,viewTransition:a},typeof l=="function"?l(y):l)});dv.displayName="NavLink";var uv=g.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:r,replace:i,state:s,method:o=Ho,action:a,onSubmit:l,relative:c,preventScrollReset:d,viewTransition:u,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:b}=g.useContext(kt),x=xv(),w=yv(a,{relative:c}),v=o.toLowerCase()==="get"?"get":"post",S=typeof a=="string"&&_m.test(a),C=k=>{if(l&&l(k),k.defaultPrevented)return;k.preventDefault();let O=k.nativeEvent.submitter,y=O?.getAttribute("formmethod")||o,M=()=>x(O||k.currentTarget,{fetcherKey:e,method:y,navigate:n,replace:i,state:s,relative:c,preventScrollReset:d,viewTransition:u,unstable_defaultShouldRevalidate:f});b&&n!==!1?g.startTransition(()=>M()):M()};return g.createElement("form",{ref:m,method:v,action:w,onSubmit:r?l:C,...p,"data-discover":!S&&t==="render"?"true":void 0})});uv.displayName="Form";function fv(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Wm(t){let e=g.useContext(dr);return de(e,fv(t)),e}function pv(t,{target:e,replace:n,state:r,preventScrollReset:i,relative:s,viewTransition:o,unstable_defaultShouldRevalidate:a,unstable_useTransitions:l}={}){let c=an(),d=_t(),u=zs(t,{relative:s});return g.useCallback(f=>{if(_1(f,e)){f.preventDefault();let p=n!==void 0?n:on(d)===on(u),m=()=>c(t,{replace:p,state:r,preventScrollReset:i,relative:s,viewTransition:o,unstable_defaultShouldRevalidate:a});l?g.startTransition(()=>m()):m()}},[d,c,u,n,r,e,t,i,s,o,a,l])}function mv(t){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(pc(t)),n=g.useRef(!1),r=_t(),i=g.useMemo(()=>H1(r.search,n.current?null:e.current),[r.search]),s=an(),o=g.useCallback((a,l)=>{const c=pc(typeof a=="function"?a(new URLSearchParams(i)):a);n.current=!0,s("?"+c,l)},[s,i]);return[i,o]}var gv=0,bv=()=>`__${String(++gv)}__`;function xv(){let{router:t}=Wm("useSubmit"),{basename:e}=g.useContext(kt),n=C1(),r=t.fetch,i=t.navigate;return g.useCallback(async(s,o={})=>{let{action:a,method:l,encType:c,formData:d,body:u}=K1(s,e);if(o.navigate===!1){let f=o.fetcherKey||bv();await r(f,n,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:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[r,i,e,n])}function yv(t,{relative:e}={}){let{basename:n}=g.useContext(kt),r=g.useContext(It);de(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),s={...zs(t||".",{relative:e})},o=_t();if(t==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(!t||t===".")&&i.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:rn([n,s.pathname])),on(s)}function vv(t,{relative:e}={}){let n=g.useContext(gh);de(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Wm("useViewTransitionState"),i=zs(t,{relative:e});if(!n.isTransitioning)return!1;let s=Rt(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Rt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ta(i.pathname,o)!=null||ta(i.pathname,s)!=null}function wv(t){return g.createElement(E1,{flushSync:cm.flushSync,...t})}const kv={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",sectionUpdatePipeline:"Update Pipeline",fieldAutoInitAfterUpdate:"Auto Init After Update",fieldAutoInitAfterUpdateDesc:"Automatically run ck init after ck update when kit has new version",fieldAutoMigrateAfterUpdate:"Auto Migrate After Update",fieldAutoMigrateAfterUpdateDesc:"Automatically run ck migrate after ck update (independent of init)",fieldMigrateProviders:"Migrate Providers",fieldMigrateProvidersDesc:"Which providers to auto-migrate. Use 'auto' to scan filesystem or a comma-separated list.",skillsPageTitle:"Skills Management",skillsPageDesc:"Install ClaudeKit skills to your coding agents",availableSkills:"Available Skills",installedSkills:"Installed Skills",noSkillsFound:"No skills found",installSkill:"Install",uninstallSkill:"Uninstall",manageSkill:"Manage",syncRegistry:"Sync",installSkillTitle:"Install Skill",selectAgents:"Select target agents",installLocation:"Installation location",globalInstall:"Global",projectInstall:"Project",confirmInstall:"Install to selected agents",installingSkill:"Installing...",skillInstallSuccess:"Skill installed successfully",skillInstallFailed:"Installation failed",agentClaudeCode:"Claude Code",agentCursor:"Cursor",agentCodex:"Codex",agentOpencode:"OpenCode",agentGoose:"Goose",agentGeminiCli:"Gemini CLI",agentAntigravity:"Antigravity",agentGithubCopilot:"GitHub Copilot",agentAmp:"Amp",agentKilo:"Kilo",agentRoo:"Roo",agentWindsurf:"Windsurf",agentCline:"Cline",agentOpenhands:"OpenHands",installed:"Installed",notInstalled:"Not installed",allAgents:"All Agents",filterByAgent:"Filter by agent",skillsTitle:"Skills",skillsSubtitle:"Browse, install, and manage skills for your coding agents",availableCount:"Available",installedCount:"Installed",agentsCount:"Agents",searchSkills:"Search skills...",searchShortcut:"/",sortAZ:"A-Z",sortCategory:"Category",sortInstalledFirst:"Installed first",listView:"List view",gridView:"Grid view",categoryAll:"All",categoryAI:"AI",categoryUIUX:"UI/UX",categoryBackend:"Backend",categorySecurity:"Security",categoryDevOps:"DevOps",categoryDatabase:"Database",categoryDevelopment:"Development",categoryResearch:"Research",categoryGeneral:"General",categoryCore:"Core",categoryDocumentation:"Documentation",categoryTooling:"Tooling",categoryMedia:"Media",categoryFrameworks:"Frameworks",skillsCountLabel:"{count} skills",installToAll:"Install to All Detected",scopeLabel:"Installation Scope",agentInstalled:"Installed",agentNotInstalled:"Not installed",skillSource:"Source location",skillSourceBadge:"Source",detailPanelClose:"Close",versionLabel:"v{version}",installAllToAllAgents:"Install All to All Agents",bulkInstallFailed:"Bulk install failed",noAgentsDetected:"No agents detected",kitBadgeEngineer:"Engineer",kitBadgeMarketing:"Marketing",customizedBadge:"Customized",installedVersionLabel:"Installed Version",installedAtLabel:"Installed At",sourceTimestampLabel:"Source Date",kitLabel:"Kit",skillMetadata:"Skill Info",migrate:"Migrate",migrateTitle:"Migrate",migrateSubtitle:"Migrate your Claude Code stack to other providers",migrateDetectedProviders:"Detected",migrateSelectedProviders:"Selected",migrateDiscovering:"Discovering migration sources...",migrateRefresh:"Refresh Discovery",migrateRun:"Run Migration",migrateRunning:"Migrating...",migrateSourceSummary:"Source Summary",migratePresetCodex:"Codex",migratePresetAntigravity:"Antigravity",migratePresetCore:"Codex + Antigravity + Droid",migratePresetDetected:"All Detected",migrateScope:"Scope",migrateScopeProject:"Project",migrateScopeGlobal:"Global",migrateTypes:"Portable Types",migrateTypeAgents:"Subagents",migrateTypeCommands:"Commands",migrateTypeSkills:"Skills",migrateTypeConfig:"Config",migrateTypeRules:"Rules",migrateTypeHooks:"Hooks",migrateSearchProviders:"Search providers...",migrateSelectVisible:"Select Visible",migrateClearSelection:"Clear Selection",migrateProvidersHeading:"Target Providers",migrateProvidersCountSuffix:"providers",migrateNoProvidersMatch:"No providers match current filters.",migrateSelectButton:"Select",migrateSelectedButton:"Selected",migrateSelectProviderAction:"Select Provider",migrateUnselectProvider:"Unselect Provider",migrateCapabilitiesLabel:"types",migrateCapabilitiesSection:"Capability Matrix",migrateSupported:"Supported",migrateUnsupportedShort:"Unsupported",migrateIncludedEnabled:"Enabled",migrateIncludedDisabled:"Disabled",migrateLatestTarget:"Latest Target",migrateNoResultForProvider:"No migration result for this provider yet.",migrateActionSummaryTitle:"Ready to Migrate",migrateGlobalOnlyCommandsShort:"Commands global-only",migrateNoProviders:"No providers available.",migrateUnsupported:"Will be skipped (unsupported)",migrateGlobalForced:"Codex commands are global-only. Scope will be forced to global.",migrateResults:"Migration Results",migrateInstalled:"Installed",migrateSkipped:"Skipped",migrateFailed:"Failed",migrateProvider:"Provider",migrateStatus:"Status",migratePath:"Path",migrateError:"Error",migrateStatusInstalled:"Installed",migrateStatusSkipped:"Skipped",migrateStatusFailed:"Failed",migrateNoResults:"No migration results yet.",migrateDetectFailed:"Failed to discover migration data",migrateExecuteFailed:"Migration execution failed",migrateSelectProvider:"Select at least one provider",migrateNoTypesEnabled:"Enable at least one portable type",migrateDetectedTag:"Detected",migrateNotDetectedTag:"Not detected",migrateFilterRecommended:"Recommended",migrateActionInstall:"Install",migrateActionUpdate:"Update",migrateActionSkip:"Skip",migrateActionConflict:"Conflict",migrateActionDelete:"Delete",migrateUnchanged:"unchanged",migrateConflictSectionTitle:"Conflicts",migrateConflictUseCK:"Use CK",migrateConflictKeepMine:"Keep Mine",migrateConflictSmartMerge:"Smart Merge",migrateConflictShowDiff:"Show Diff",migrateConflictHideDiff:"Hide Diff",migrateConflictResolved:"Resolved",migrateConflictManual:"Manual",migrateConflictOverwriteAll:"Overwrite All",migrateConflictKeepAll:"Keep All",migrateSummaryTitle:"Migration Complete",migrateSummaryNewMigration:"New Migration",migrateType:"Type",migrateItem:"Item",migrateReconciling:"Analyzing changes...",migrateReviewPlan:"Review Plan",migrateExecutePlan:"Execute Migration",migrateExecuting:"Executing migration...",migrateResolveConflicts:"Resolve all conflicts before executing",migrateSummarySubtitle:"items migrated",migrateSummarySearchPlaceholder:"Search items...",migrateSummaryFilterAll:"All",migrateSummaryCollapseAll:"Collapse all",migrateSummaryExpandAll:"Expand all",migrateSummaryNoResults:"No items match your search",migrateSummaryProviders:"Providers",migrateTypeUnknown:"Other",kanbanTitle:"Plan Kanban",kanbanNoFile:"No plan file specified. Use ?file= parameter.",kanbanNoPhases:"No phases detected in this plan",kanbanError400:"Invalid request — missing file parameter",kanbanError403:"Access denied — file is outside the project directory",kanbanError404:"Plan file not found",kanbanComplete:"complete",kanbanStatus_pending:"Pending","kanbanStatus_in-progress":"In Progress",kanbanStatus_completed:"Completed",kanbanPhases:"phases",kanbanProgress:"Progress",kanbanLoadError:"Failed to load plan data",developmentFeature:"Development",betaFeature:"Beta",experimentalFeature:"Experimental",sectionModelTaxonomy:"Model Taxonomy",taxonomyDescription:"Customize model mappings for portable migration to other coding agents.",taxonomyTierHeavy:"Heavy (opus)",taxonomyTierBalanced:"Balanced (sonnet)",taxonomyTierLight:"Light (haiku)",taxonomyModel:"Model",taxonomyEffort:"Effort",taxonomyResetProvider:"Reset",taxonomyTier:"Tier"},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",sectionUpdatePipeline:"Pipeline Cập nhật",fieldAutoInitAfterUpdate:"Tự động Init sau Update",fieldAutoInitAfterUpdateDesc:"Tự động chạy ck init sau ck update khi kit có phiên bản mới",fieldAutoMigrateAfterUpdate:"Tự động Migrate sau Update",fieldAutoMigrateAfterUpdateDesc:"Tự động chạy ck migrate sau ck update (độc lập với init)",fieldMigrateProviders:"Provider Migrate",fieldMigrateProvidersDesc:"Provider nào tự động migrate. Dùng 'auto' để quét hệ thống hoặc danh sách phân cách bằng dấu phẩy.",skillsPageTitle:"Quản lý Kỹ năng",skillsPageDesc:"Cài đặt kỹ năng ClaudeKit cho các agent lập trình",availableSkills:"Kỹ năng có sẵn",installedSkills:"Kỹ năng đã cài",noSkillsFound:"Không tìm thấy kỹ năng",installSkill:"Cài đặt",uninstallSkill:"Gỡ cài đặt",manageSkill:"Quản lý",syncRegistry:"Đồng bộ",installSkillTitle:"Cài đặt Kỹ năng",selectAgents:"Chọn agent đích",installLocation:"Vị trí cài đặt",globalInstall:"Toàn cục",projectInstall:"Dự án",confirmInstall:"Cài đặt cho các agent đã chọn",installingSkill:"Đang cài đặt...",skillInstallSuccess:"Cài đặt kỹ năng thành công",skillInstallFailed:"Cài đặt thất bại",agentClaudeCode:"Claude Code",agentCursor:"Cursor",agentCodex:"Codex",agentOpencode:"OpenCode",agentGoose:"Goose",agentGeminiCli:"Gemini CLI",agentAntigravity:"Antigravity",agentGithubCopilot:"GitHub Copilot",agentAmp:"Amp",agentKilo:"Kilo",agentRoo:"Roo",agentWindsurf:"Windsurf",agentCline:"Cline",agentOpenhands:"OpenHands",installed:"Đã cài",notInstalled:"Chưa cài",allAgents:"Tất cả Agent",filterByAgent:"Lọc theo agent",skillsTitle:"Kỹ năng",skillsSubtitle:"Duyệt, cài đặt và quản lý kỹ năng cho coding agents",availableCount:"Có sẵn",installedCount:"Đã cài",agentsCount:"Agents",searchSkills:"Tìm kiếm kỹ năng...",searchShortcut:"/",sortAZ:"A-Z",sortCategory:"Danh mục",sortInstalledFirst:"Đã cài trước",listView:"Dạng danh sách",gridView:"Dạng lưới",categoryAll:"Tất cả",categoryAI:"AI",categoryUIUX:"UI/UX",categoryBackend:"Backend",categorySecurity:"Bảo mật",categoryDevOps:"DevOps",categoryDatabase:"Cơ sở dữ liệu",categoryDevelopment:"Phát triển",categoryResearch:"Nghiên cứu",categoryGeneral:"Tổng quát",categoryCore:"Cốt lõi",categoryDocumentation:"Tài liệu",categoryTooling:"Công cụ",categoryMedia:"Phương tiện",categoryFrameworks:"Framework",skillsCountLabel:"{count} kỹ năng",installToAll:"Cài cho tất cả đã phát hiện",scopeLabel:"Phạm vi cài đặt",agentInstalled:"Đã cài",agentNotInstalled:"Chưa cài",skillSource:"Vị trí nguồn",skillSourceBadge:"Nguồn",detailPanelClose:"Đóng",versionLabel:"v{version}",installAllToAllAgents:"Cài tất cả cho tất cả Agent",bulkInstallFailed:"Cài hàng loạt thất bại",noAgentsDetected:"Không phát hiện agent nào",kitBadgeEngineer:"Engineer",kitBadgeMarketing:"Marketing",customizedBadge:"Đã tùy chỉnh",installedVersionLabel:"Phiên bản cài đặt",installedAtLabel:"Cài đặt lúc",sourceTimestampLabel:"Ngày nguồn",kitLabel:"Kit",skillMetadata:"Thông tin Skill",migrate:"Di trú",migrateTitle:"Di trú",migrateSubtitle:"Chuyển toàn bộ stack Claude Code sang provider khác",migrateDetectedProviders:"Đã phát hiện",migrateSelectedProviders:"Đã chọn",migrateDiscovering:"Đang quét nguồn di trú...",migrateRefresh:"Làm mới quét",migrateRun:"Chạy di trú",migrateRunning:"Đang di trú...",migrateSourceSummary:"Tổng quan nguồn",migratePresetCodex:"Codex",migratePresetAntigravity:"Antigravity",migratePresetCore:"Codex + Antigravity + Droid",migratePresetDetected:"Tất cả đã phát hiện",migrateScope:"Phạm vi",migrateScopeProject:"Dự án",migrateScopeGlobal:"Toàn cục",migrateTypes:"Loại di trú",migrateTypeAgents:"Subagents",migrateTypeCommands:"Commands",migrateTypeSkills:"Skills",migrateTypeConfig:"Config",migrateTypeRules:"Rules",migrateTypeHooks:"Hooks",migrateSearchProviders:"Tìm provider...",migrateSelectVisible:"Chọn phần đang hiện",migrateClearSelection:"Bỏ chọn tất cả",migrateProvidersHeading:"Provider đích",migrateProvidersCountSuffix:"provider",migrateNoProvidersMatch:"Không có provider khớp bộ lọc hiện tại.",migrateSelectButton:"Chọn",migrateSelectedButton:"Đã chọn",migrateSelectProviderAction:"Chọn provider",migrateUnselectProvider:"Bỏ chọn provider",migrateCapabilitiesLabel:"loại",migrateCapabilitiesSection:"Ma trận khả năng",migrateSupported:"Hỗ trợ",migrateUnsupportedShort:"Không hỗ trợ",migrateIncludedEnabled:"Đang bật",migrateIncludedDisabled:"Đang tắt",migrateLatestTarget:"Đích gần nhất",migrateNoResultForProvider:"Chưa có kết quả di trú cho provider này.",migrateActionSummaryTitle:"Sẵn sàng di trú",migrateGlobalOnlyCommandsShort:"Commands chỉ global",migrateNoProviders:"Không có provider khả dụng.",migrateUnsupported:"Sẽ bỏ qua (không hỗ trợ)",migrateGlobalForced:"Lệnh Codex chỉ hỗ trợ global. Phạm vi sẽ tự chuyển global.",migrateResults:"Kết quả di trú",migrateInstalled:"Đã cài",migrateSkipped:"Đã bỏ qua",migrateFailed:"Lỗi",migrateProvider:"Provider",migrateStatus:"Trạng thái",migratePath:"Đường dẫn",migrateError:"Lỗi",migrateStatusInstalled:"Đã cài",migrateStatusSkipped:"Đã bỏ qua",migrateStatusFailed:"Lỗi",migrateNoResults:"Chưa có kết quả di trú.",migrateDetectFailed:"Không thể quét dữ liệu di trú",migrateExecuteFailed:"Chạy di trú thất bại",migrateSelectProvider:"Vui lòng chọn ít nhất một provider",migrateNoTypesEnabled:"Bật ít nhất một loại di trú",migrateDetectedTag:"Đã phát hiện",migrateNotDetectedTag:"Chưa phát hiện",migrateFilterRecommended:"Đề xuất",migrateActionInstall:"Cài",migrateActionUpdate:"Cập nhật",migrateActionSkip:"Bỏ qua",migrateActionConflict:"Xung đột",migrateActionDelete:"Xóa",migrateUnchanged:"chưa thay đổi",migrateConflictSectionTitle:"Xung đột",migrateConflictUseCK:"Dùng CK",migrateConflictKeepMine:"Giữ của tôi",migrateConflictSmartMerge:"Merge thông minh",migrateConflictShowDiff:"Hiện diff",migrateConflictHideDiff:"Ẩn diff",migrateConflictResolved:"Đã giải quyết",migrateConflictManual:"Thủ công",migrateConflictOverwriteAll:"Ghi đè tất cả",migrateConflictKeepAll:"Giữ tất cả",migrateSummaryTitle:"Di trú hoàn tất",migrateSummaryNewMigration:"Di trú mới",migrateType:"Loại",migrateItem:"Mục",migrateReconciling:"Đang phân tích thay đổi...",migrateReviewPlan:"Xem kế hoạch",migrateExecutePlan:"Thực hiện di trú",migrateExecuting:"Đang thực hiện di trú...",migrateResolveConflicts:"Giải quyết xung đột trước khi thực hiện",migrateSummarySubtitle:"mục đã di trú",migrateSummarySearchPlaceholder:"Tìm kiếm...",migrateSummaryFilterAll:"Tất cả",migrateSummaryCollapseAll:"Thu gọn",migrateSummaryExpandAll:"Mở rộng",migrateSummaryNoResults:"Không tìm thấy mục nào",migrateSummaryProviders:"Provider",migrateTypeUnknown:"Khác",kanbanTitle:"Bảng Kanban Kế hoạch",kanbanNoFile:"Chưa chọn file kế hoạch. Dùng tham số ?file=.",kanbanNoPhases:"Không phát hiện giai đoạn nào trong kế hoạch này",kanbanError400:"Yêu cầu không hợp lệ — thiếu tham số file",kanbanError403:"Truy cập bị từ chối — file nằm ngoài thư mục dự án",kanbanError404:"Không tìm thấy file kế hoạch",kanbanComplete:"hoàn thành",kanbanStatus_pending:"Chờ xử lý","kanbanStatus_in-progress":"Đang thực hiện",kanbanStatus_completed:"Hoàn thành",kanbanPhases:"giai đoạn",kanbanProgress:"Tiến độ",kanbanLoadError:"Không thể tải dữ liệu kế hoạch",developmentFeature:"Đang phát triển",betaFeature:"Beta",experimentalFeature:"Thử nghiệm",sectionModelTaxonomy:"Phân loại mô hình",taxonomyDescription:"Tuỳ chỉnh ánh xạ mô hình cho migration portable sang coding agent khác.",taxonomyTierHeavy:"Nặng (opus)",taxonomyTierBalanced:"Cân bằng (sonnet)",taxonomyTierLight:"Nhẹ (haiku)",taxonomyModel:"Mô hình",taxonomyEffort:"Mức nỗ lực",taxonomyResetProvider:"Đặt lại",taxonomyTier:"Cấp độ"}},kh=g.createContext(null),Um="ck-dashboard-lang";function Sv(){const t=localStorage.getItem(Um);return t==="en"||t==="vi"?t:navigator.language.startsWith("vi")?"vi":"en"}function Cv({children:t}){const[e,n]=g.useState(Sv),r=g.useCallback(o=>{localStorage.setItem(Um,o),n(o)},[]),i=g.useCallback(o=>kv[e][o],[e]),s=g.useMemo(()=>({lang:e,setLang:r,t:i}),[e,r,i]);return h.jsx(kh.Provider,{value:s,children:t})}function he(){const t=g.useContext(kh);if(!t)throw new Error("useI18n must be used within I18nProvider");return t}class jv extends g.Component{constructor(){super(...arguments);Nd(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){console.error("App error:",n,r.componentStack)}render(){if(this.state.hasError){const n=this.state.error?.name==="ServerUnavailableError";return h.jsx(kh.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:n?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 tr=({direction:t="horizontal",isDragging:e=!1,onMouseDown:n})=>{const r=t==="horizontal";return h.jsx("div",{onMouseDown:n,className:`
21
+ Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}/*`}">.`)}let f=Ht(),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(t,{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.`),v1(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,n,r,i)}function g1(){let t=j1(),e=Li(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},s={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",t),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),n?g.createElement("pre",{style:i},n):null,o)}var b1=g.createElement(g1,null),Bm=class extends g.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.onError?this.props.onError(t,e):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const n=h1(t.digest);n&&(t=n)}let e=t!==void 0?g.createElement(It.Provider,{value:this.props.routeContext},g.createElement(bh.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?g.createElement(x1,{error:t},e):e}};Bm.contextType=Dm;var sl=new WeakMap;function x1({children:t,error:e}){let{basename:n}=g.useContext(kt);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=c1(e.digest);if(r){let i=sl.get(e);if(i)throw i;let s=ym(r.location,n);if(xm&&!sl.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 sl.set(e,o),o}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return t}function y1({routeContext:t,match:e,children:n}){let r=g.useContext(dr);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),g.createElement(It.Provider,{value:t},n)}function v1(t,e=[],n=null,r=null,i=null){if(t==null){if(!n)return null;if(n.errors)t=n.matches;else if(e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let s=t,o=n?.errors;if(o!=null){let d=s.findIndex(u=>u.route.id&&o?.[u.route.id]!==void 0);ue(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(n)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}=n,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=n&&r?(d,u)=>{r(d,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:Fs(n.matches),errorInfo:u})}:void 0;return s.reduceRight((d,u,f)=>{let p,m=!1,b=null,x=null;n&&(p=o&&u.route.id?o[u.route.id]:void 0,b=u.route.errorElement||b1,a&&(l<0&&f===0?(Fm("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(y1,{match:u,routeContext:{outlet:d,matches:w,isDataRoute:n!=null},children:S})};return n&&(u.route.ErrorBoundary||u.route.errorElement||f===0)?g.createElement(Bm,{location:n.location,revalidation:n.revalidation,component:b,error:p,children:v(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:c}):v()},null)}function xh(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function w1(t){let e=g.useContext(dr);return ue(e,xh(t)),e}function k1(t){let e=g.useContext(Vs);return ue(e,xh(t)),e}function S1(t){let e=g.useContext(It);return ue(e,xh(t)),e}function yh(t){let e=S1(t),n=e.matches[e.matches.length-1];return ue(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function C1(){return yh("useRouteId")}function j1(){let t=g.useContext(bh),e=k1("useRouteError"),n=yh("useRouteError");return t!==void 0?t:e.errors?.[n]}function O1(){let{router:t}=w1("useNavigate"),e=yh("useNavigate"),n=g.useRef(!1);return Lm(()=>{n.current=!0}),g.useCallback(async(i,s={})=>{Ee(n.current,Rm),n.current&&(typeof i=="number"?await t.navigate(i):await t.navigate(i,{fromRouteId:e,...s}))},[t,e])}var Xd={};function Fm(t,e,n){!e&&!Xd[t]&&(Xd[t]=!0,Ee(!1,n))}var Zd={};function eu(t,e){!t&&!Zd[e]&&(Zd[e]=!0,console.warn(e))}var P1="useOptimistic",tu=Vx[P1],N1=()=>{};function A1(t){return tu?tu(t):[t,N1]}function M1(t){let e={hasErrorBoundary:t.hasErrorBoundary||t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&(t.element&&Ee(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(e,{element:g.createElement(t.Component),Component:void 0})),t.HydrateFallback&&(t.hydrateFallbackElement&&Ee(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(e,{hydrateFallbackElement:g.createElement(t.HydrateFallback),HydrateFallback:void 0})),t.ErrorBoundary&&(t.errorElement&&Ee(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(e,{errorElement:g.createElement(t.ErrorBoundary),ErrorBoundary:void 0})),e}var D1=["HydrateFallback","hydrateFallbackElement"],T1=class{constructor(){this.status="pending",this.promise=new Promise((t,e)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",t(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",e(n))}})}};function E1({router:t,flushSync:e,onError:n,unstable_useTransitions:r}){r=s1()||r;let[s,o]=g.useState(t.state),[a,l]=A1(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),C=g.useCallback((M,{deletedFetchers:A,newErrors:R,flushSync:N,viewTransitionOpts:L})=>{R&&n&&Object.values(R).forEach($=>n($,{location:M.location,params:M.matches[0]?.params??{},unstable_pattern:Fs(M.matches)})),M.fetchers.forEach(($,F)=>{$.data!==void 0&&S.current.set(F,$.data)}),A.forEach($=>S.current.delete($)),eu(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 _=t.window!=null&&t.window.document!=null&&typeof t.window.document.startViewTransition=="function";if(eu(L==null||_,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!L||!_){e&&N?e(()=>o(M)):r===!1?o(M):g.startTransition(()=>{r===!0&&l($=>nu($,M)),o(M)});return}if(e&&N){e(()=>{b&&(p?.resolve(),b.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:L.currentLocation,nextLocation:L.nextLocation})});let $=t.window.document.startViewTransition(()=>{e(()=>o(M))});$.finished.finally(()=>{e(()=>{m(void 0),x(void 0),d(void 0),f({isTransitioning:!1})})}),e(()=>x($));return}b?(p?.resolve(),b.skipTransition(),v({state:M,currentLocation:L.currentLocation,nextLocation:L.nextLocation})):(d(M),f({isTransitioning:!0,flushSync:!1,currentLocation:L.currentLocation,nextLocation:L.nextLocation}))},[t.window,e,b,p,r,l,n]);g.useLayoutEffect(()=>t.subscribe(C),[t,C]),g.useEffect(()=>{u.isTransitioning&&!u.flushSync&&m(new T1)},[u]),g.useEffect(()=>{if(p&&c&&t.window){let M=c,A=p.promise,R=t.window.document.startViewTransition(async()=>{r===!1?o(M):g.startTransition(()=>{r===!0&&l(N=>nu(N,M)),o(M)}),await A});R.finished.finally(()=>{m(void 0),x(void 0),d(void 0),f({isTransitioning:!1})}),x(R)}},[c,p,t.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:t.createHref,encodeLocation:t.encodeLocation,go:M=>t.navigate(M),push:(M,A,R)=>t.navigate(M,{state:A,preventScrollReset:R?.preventScrollReset}),replace:(M,A,R)=>t.navigate(M,{replace:!0,state:A,preventScrollReset:R?.preventScrollReset})}),[t]),O=t.basename||"/",y=g.useMemo(()=>({router:t,navigator:k,static:!1,basename:O,onError:n}),[t,k,O,n]);return g.createElement(g.Fragment,null,g.createElement(dr.Provider,{value:y},g.createElement(Vs.Provider,{value:a},g.createElement(Tm.Provider,{value:S.current},g.createElement(gh.Provider,{value:u},g.createElement($1,{basename:O,location:a.location,navigationType:a.historyAction,navigator:k,unstable_useTransitions:r},g.createElement(R1,{routes:t.routes,future:t.future,state:a,onError:n})))))),null)}function nu(t,e){return{...t,navigation:e.navigation.state!=="idle"?e.navigation:t.navigation,revalidation:e.revalidation!=="idle"?e.revalidation:t.revalidation,actionData:e.navigation.state!=="submitting"?e.actionData:t.actionData,fetchers:e.fetchers}}var R1=g.memo(L1);function L1({routes:t,future:e,state:n,onError:r}){return m1(t,void 0,n,r,e)}function ol({to:t,replace:e,state:n,relative:r}){ue(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}=Ht(),a=an(),l=Ta(t,Da(s),o,r==="path"),c=JSON.stringify(l);return g.useEffect(()=>{a(JSON.parse(c),{replace:e,state:n,relative:r})},[a,c,r,e,n]),null}function I1(t){return p1(t.context)}function $1({basename:t="/",children:e=null,location:n,navigationType:r="POP",navigator:i,static:s=!1,unstable_useTransitions:o}){ue(!Wr(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let a=t.replace(/^\/*/,"/"),l=g.useMemo(()=>({basename:a,navigator:i,static:s,unstable_useTransitions:o,future:{}}),[a,i,s,o]);typeof n=="string"&&(n=Vn(n));let{pathname:c="/",search:d="",hash:u="",state:f=null,key:p="default"}=n,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(Ea.Provider,{children:e,value:m}))}var _o="get",Wo="application/x-www-form-urlencoded";function Ra(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function B1(t){return Ra(t)&&t.tagName.toLowerCase()==="button"}function F1(t){return Ra(t)&&t.tagName.toLowerCase()==="form"}function V1(t){return Ra(t)&&t.tagName.toLowerCase()==="input"}function z1(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function H1(t,e){return t.button===0&&(!e||e==="_self")&&!z1(t)}function pc(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function _1(t,e){let n=pc(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(s=>{n.append(i,s)})}),n}var ho=null;function W1(){if(ho===null)try{new FormData(document.createElement("form"),0),ho=!1}catch{ho=!0}return ho}var U1=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function al(t){return t!=null&&!U1.has(t)?(Ee(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Wo}"`),null):t}function K1(t,e){let n,r,i,s,o;if(F1(t)){let a=t.getAttribute("action");r=a?Rt(a,e):null,n=t.getAttribute("method")||_o,i=al(t.getAttribute("enctype"))||Wo,s=new FormData(t)}else if(B1(t)||V1(t)&&(t.type==="submit"||t.type==="image")){let a=t.form;if(a==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=t.getAttribute("formaction")||a.getAttribute("action");if(r=l?Rt(l,e):null,n=t.getAttribute("formmethod")||a.getAttribute("method")||_o,i=al(t.getAttribute("formenctype"))||al(a.getAttribute("enctype"))||Wo,s=new FormData(a,t),!W1()){let{name:c,type:d,value:u}=t;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(Ra(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=_o,r=null,i=Wo,o=t}return s&&i==="text/plain"&&(o=s,s=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:s,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function vh(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function G1(t,e,n){let r=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return r.pathname==="/"?r.pathname=`_root.${n}`:e&&Rt(r.pathname,e)==="/"?r.pathname=`${e.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function q1(t,e){if(t.id in e)return e[t.id];try{let n=await import(t.module);return e[t.id]=n,n}catch(n){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function J1(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function Y1(t,e,n){let r=await Promise.all(t.map(async i=>{let s=e.routes[i.route.id];if(s){let o=await q1(s,n);return o.links?o.links():[]}return[]}));return ev(r.flat(1).filter(J1).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function ru(t,e,n,r,i,s){let o=(l,c)=>n[c]?l.route.id!==n[c].route.id:!0,a=(l,c)=>n[c].pathname!==l.pathname||n[c].route.path?.endsWith("*")&&n[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:n[0]?.params||{},nextUrl:new URL(t,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof u=="boolean")return u}return!0}):[]}function Q1(t,e,{includeHydrateFallback:n}={}){return X1(t.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)),n&&i.hydrateFallbackModule&&(s=s.concat(i.hydrateFallbackModule)),i.imports&&(s=s.concat(i.imports)),s}).flat(1))}function X1(t){return[...new Set(t)]}function Z1(t){let e={},n=Object.keys(t).sort();for(let r of n)e[r]=t[r];return e}function ev(t,e){let n=new Set;return new Set(e),t.reduce((r,i)=>{let s=JSON.stringify(Z1(i));return n.has(s)||(n.add(s),r.push({key:s,link:i})),r},[])}function Vm(){let t=g.useContext(dr);return vh(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function tv(){let t=g.useContext(Vs);return vh(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var wh=g.createContext(void 0);wh.displayName="FrameworkContext";function zm(){let t=g.useContext(wh);return vh(t,"You must render this element inside a <HydratedRouter> element"),t}function nv(t,e){let n=g.useContext(wh),[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(t==="render"&&o(!0),t==="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()}}},[t]),g.useEffect(()=>{if(r){let b=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(b)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?t!=="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(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function rv({page:t,...e}){let{router:n}=Vm(),r=g.useMemo(()=>jn(n.routes,t,n.basename),[n.routes,t,n.basename]);return r?g.createElement(sv,{page:t,matches:r,...e}):null}function iv(t){let{manifest:e,routeModules:n}=zm(),[r,i]=g.useState([]);return g.useEffect(()=>{let s=!1;return Y1(t,e,n).then(o=>{s||i(o)}),()=>{s=!0}},[t,e,n]),r}function sv({page:t,matches:e,...n}){let r=Ht(),{manifest:i,routeModules:s}=zm(),{basename:o}=Vm(),{loaderData:a,matches:l}=tv(),c=g.useMemo(()=>ru(t,e,l,i,r,"data"),[t,e,l,i,r]),d=g.useMemo(()=>ru(t,e,l,i,r,"assets"),[t,e,l,i,r]),u=g.useMemo(()=>{if(t===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=G1(t,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,t,s]),f=g.useMemo(()=>Q1(d,i),[d,i]),p=iv(d);return g.createElement(g.Fragment,null,u.map(m=>g.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...n})),f.map(m=>g.createElement("link",{key:m,rel:"modulepreload",href:m,...n})),p.map(({key:m,link:b})=>g.createElement("link",{key:m,nonce:n.nonce,...b})))}function ov(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var av=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{av&&(window.__reactRouterVersion="7.11.0")}catch{}function lv(t,e){return Ry({basename:e?.basename,getContext:e?.getContext,future:e?.future,history:Yx({window:e?.window}),hydrationData:cv(),routes:t,mapRouteProperties:M1,hydrationRouteProperties:D1,dataStrategy:e?.dataStrategy,patchRoutesOnNavigation:e?.patchRoutesOnNavigation,window:e?.window,unstable_instrumentations:e?.unstable_instrumentations}).initialize()}function cv(){let t=window?.__staticRouterHydrationData;return t&&t.errors&&(t={...t,errors:hv(t.errors)}),t}function hv(t){if(!t)return null;let e=Object.entries(t),n={};for(let[r,i]of e)if(i&&i.__type==="RouteErrorResponse")n[r]=new Bs(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="",n[r]=o}catch{}}if(n[r]==null){let s=new Error(i.message);s.stack="",n[r]=s}}else n[r]=i;return n}var Hm=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_m=g.forwardRef(function({onClick:e,discover:n="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"&&Hm.test(c),v=ym(c,b);c=v.to;let S=d1(c,{relative:i}),[C,k,O]=nv(r,p),y=pv(c,{replace:o,state:a,target:l,preventScrollReset:d,relative:i,viewTransition:u,unstable_defaultShouldRevalidate:f,unstable_useTransitions:x});function M(R){e&&e(R),R.defaultPrevented||y(R)}let A=g.createElement("a",{...p,...O,href:v.absoluteURL||S,onClick:v.isExternal||s?e:M,ref:ov(m,k),target:l,"data-discover":!w&&n==="render"?"true":void 0});return C&&!w?g.createElement(g.Fragment,null,A,g.createElement(rv,{page:S})):A});_m.displayName="Link";var dv=g.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:r="",end:i=!1,style:s,to:o,viewTransition:a,children:l,...c},d){let u=zs(o,{relative:c.relative}),f=Ht(),p=g.useContext(Vs),{navigator:m,basename:b}=g.useContext(kt),x=p!=null&&vv(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;n||(v=v.toLowerCase(),S=S?S.toLowerCase():null,w=w.toLowerCase()),S&&b&&(S=Rt(S,b)||S);const C=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let k=v===w||!i&&v.startsWith(w)&&v.charAt(C)==="/",O=S!=null&&(S===w||!i&&S.startsWith(w)&&S.charAt(w.length)==="/"),y={isActive:k,isPending:O,isTransitioning:x},M=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(_m,{...c,"aria-current":M,className:A,ref:d,style:R,to:o,viewTransition:a},typeof l=="function"?l(y):l)});dv.displayName="NavLink";var uv=g.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:r,replace:i,state:s,method:o=_o,action:a,onSubmit:l,relative:c,preventScrollReset:d,viewTransition:u,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:b}=g.useContext(kt),x=xv(),w=yv(a,{relative:c}),v=o.toLowerCase()==="get"?"get":"post",S=typeof a=="string"&&Hm.test(a),C=k=>{if(l&&l(k),k.defaultPrevented)return;k.preventDefault();let O=k.nativeEvent.submitter,y=O?.getAttribute("formmethod")||o,M=()=>x(O||k.currentTarget,{fetcherKey:e,method:y,navigate:n,replace:i,state:s,relative:c,preventScrollReset:d,viewTransition:u,unstable_defaultShouldRevalidate:f});b&&n!==!1?g.startTransition(()=>M()):M()};return g.createElement("form",{ref:m,method:v,action:w,onSubmit:r?l:C,...p,"data-discover":!S&&t==="render"?"true":void 0})});uv.displayName="Form";function fv(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Wm(t){let e=g.useContext(dr);return ue(e,fv(t)),e}function pv(t,{target:e,replace:n,state:r,preventScrollReset:i,relative:s,viewTransition:o,unstable_defaultShouldRevalidate:a,unstable_useTransitions:l}={}){let c=an(),d=Ht(),u=zs(t,{relative:s});return g.useCallback(f=>{if(H1(f,e)){f.preventDefault();let p=n!==void 0?n:on(d)===on(u),m=()=>c(t,{replace:p,state:r,preventScrollReset:i,relative:s,viewTransition:o,unstable_defaultShouldRevalidate:a});l?g.startTransition(()=>m()):m()}},[d,c,u,n,r,e,t,i,s,o,a,l])}function mv(t){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(pc(t)),n=g.useRef(!1),r=Ht(),i=g.useMemo(()=>_1(r.search,n.current?null:e.current),[r.search]),s=an(),o=g.useCallback((a,l)=>{const c=pc(typeof a=="function"?a(new URLSearchParams(i)):a);n.current=!0,s("?"+c,l)},[s,i]);return[i,o]}var gv=0,bv=()=>`__${String(++gv)}__`;function xv(){let{router:t}=Wm("useSubmit"),{basename:e}=g.useContext(kt),n=C1(),r=t.fetch,i=t.navigate;return g.useCallback(async(s,o={})=>{let{action:a,method:l,encType:c,formData:d,body:u}=K1(s,e);if(o.navigate===!1){let f=o.fetcherKey||bv();await r(f,n,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:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[r,i,e,n])}function yv(t,{relative:e}={}){let{basename:n}=g.useContext(kt),r=g.useContext(It);ue(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),s={...zs(t||".",{relative:e})},o=Ht();if(t==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(!t||t===".")&&i.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:rn([n,s.pathname])),on(s)}function vv(t,{relative:e}={}){let n=g.useContext(gh);ue(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Wm("useViewTransitionState"),i=zs(t,{relative:e});if(!n.isTransitioning)return!1;let s=Rt(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Rt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ta(i.pathname,o)!=null||ta(i.pathname,s)!=null}function wv(t){return g.createElement(E1,{flushSync:cm.flushSync,...t})}const kv={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",fieldStatuslineQuota:"Statusline Quota Display",fieldStatuslineQuotaDesc:"Show the 5h / wk quota chips in the statusline",fieldThinkingLanguage:"Thinking Language",fieldThinkingLanguageDesc:"Language for Claude's internal reasoning (null=English)",fieldResponseLanguage:"Response Language",fieldResponseLanguageDesc:"Language for Claude's responses (null=match user)",fieldDocsPath:"Docs Directory",fieldDocsPathDesc:"Path to documentation directory",fieldPlansPath:"Plans Directory",fieldPlansPathDesc:"Path to plans directory",fieldPrivacyBlock:"Privacy Block",fieldPrivacyBlockDesc:"Block access to sensitive files (.env, credentials)",fieldTrustEnabled:"Trust Mode",fieldTrustEnabledDesc:"Enable auto-approval for tool calls",fieldTrustPassphrase:"Trust Passphrase",fieldTrustPassphraseDesc:"Passphrase to enable trust mode",fieldProjectType:"Project Type",fieldProjectTypeDesc:"Override auto-detected project type",fieldPackageManager:"Package Manager",fieldPackageManagerDesc:"Override auto-detected package manager",fieldFramework:"Framework",fieldFrameworkDesc:"Override auto-detected framework",fieldGeminiModel:"Gemini Model",fieldGeminiModelDesc:"Gemini model for CLI commands; legacy gemini-3.0-* ids auto-map",fieldResearchUseGemini:"Use Gemini for Research",fieldResearchUseGeminiDesc:"Use Gemini CLI instead of WebSearch",fieldDocsMaxLoc:"Max Lines per Doc",fieldDocsMaxLocDesc:"Maximum lines of code per documentation file",fieldPlanNamingFormat:"Plan Naming Format",fieldPlanNamingFormatDesc:"Format for plan directory names",fieldPlanDateFormat:"Plan Date Format",fieldPlanDateFormatDesc:"Date format for plan names (moment.js)",fieldPlanValidationMode:"Validation Mode",fieldPlanValidationModeDesc:"How to validate plans before implementation",fieldPlanMinQuestions:"Min Questions",fieldPlanMinQuestionsDesc:"Minimum validation questions",fieldPlanMaxQuestions:"Max Questions",fieldPlanMaxQuestionsDesc:"Maximum validation questions",fieldAssertions:"Assertions",fieldAssertionsDesc:"Code assertions and rules to enforce",fieldHookSessionInit:"Session Init",fieldHookSessionInitDesc:"Project detection and environment setup",fieldHookSubagentInit:"Subagent Init",fieldHookSubagentInitDesc:"Inject context to subagents",fieldHookDescriptiveName:"Descriptive Name",fieldHookDescriptiveNameDesc:"Enforce kebab-case descriptive file naming for scripts",fieldHookDevRulesReminder:"Dev Rules Reminder",fieldHookDevRulesReminderDesc:"Inject development rules context",fieldHookUsageContextAwareness:"Usage Prompt Awareness",fieldHookUsageContextAwarenessDesc:"Inject usage-limit awareness into prompts",fieldHookContextTracking:"Context Tracking",fieldHookContextTrackingDesc:"Context window tracking (% used, token counts)",fieldHookScoutBlock:"Scout Block",fieldHookScoutBlockDesc:"Block heavy directories from exploration",fieldHookPrivacyBlock:"Privacy Block Hook",fieldHookPrivacyBlockDesc:"Block sensitive files from reading",fieldHookPostEditSimplify:"Post-Edit Simplify",fieldHookPostEditSimplifyDesc:"Simplify reminder after edits",sectionUpdatePipeline:"Update Pipeline",fieldAutoInitAfterUpdate:"Auto Init After Update",fieldAutoInitAfterUpdateDesc:"Automatically run ck init after ck update when kit has new version",fieldAutoMigrateAfterUpdate:"Auto Migrate After Update",fieldAutoMigrateAfterUpdateDesc:"Automatically run ck migrate after ck update (independent of init)",fieldMigrateProviders:"Migrate Providers",fieldMigrateProvidersDesc:"Which providers to auto-migrate. Use 'auto' to scan filesystem or a comma-separated list.",skillsPageTitle:"Skills Management",skillsPageDesc:"Install ClaudeKit skills to your coding agents",availableSkills:"Available Skills",installedSkills:"Installed Skills",noSkillsFound:"No skills found",installSkill:"Install",uninstallSkill:"Uninstall",manageSkill:"Manage",syncRegistry:"Sync",installSkillTitle:"Install Skill",selectAgents:"Select target agents",installLocation:"Installation location",globalInstall:"Global",projectInstall:"Project",confirmInstall:"Install to selected agents",installingSkill:"Installing...",skillInstallSuccess:"Skill installed successfully",skillInstallFailed:"Installation failed",agentClaudeCode:"Claude Code",agentCursor:"Cursor",agentCodex:"Codex",agentOpencode:"OpenCode",agentGoose:"Goose",agentGeminiCli:"Gemini CLI",agentAntigravity:"Antigravity",agentGithubCopilot:"GitHub Copilot",agentAmp:"Amp",agentKilo:"Kilo",agentRoo:"Roo",agentWindsurf:"Windsurf",agentCline:"Cline",agentOpenhands:"OpenHands",installed:"Installed",notInstalled:"Not installed",allAgents:"All Agents",filterByAgent:"Filter by agent",skillsTitle:"Skills",skillsSubtitle:"Browse, install, and manage skills for your coding agents",availableCount:"Available",installedCount:"Installed",agentsCount:"Agents",searchSkills:"Search skills...",searchShortcut:"/",sortAZ:"A-Z",sortCategory:"Category",sortInstalledFirst:"Installed first",listView:"List view",gridView:"Grid view",categoryAll:"All",categoryAI:"AI",categoryUIUX:"UI/UX",categoryBackend:"Backend",categorySecurity:"Security",categoryDevOps:"DevOps",categoryDatabase:"Database",categoryDevelopment:"Development",categoryResearch:"Research",categoryGeneral:"General",categoryCore:"Core",categoryDocumentation:"Documentation",categoryTooling:"Tooling",categoryMedia:"Media",categoryFrameworks:"Frameworks",skillsCountLabel:"{count} skills",installToAll:"Install to All Detected",scopeLabel:"Installation Scope",agentInstalled:"Installed",agentNotInstalled:"Not installed",skillSource:"Source location",skillSourceBadge:"Source",detailPanelClose:"Close",versionLabel:"v{version}",installAllToAllAgents:"Install All to All Agents",bulkInstallFailed:"Bulk install failed",noAgentsDetected:"No agents detected",kitBadgeEngineer:"Engineer",kitBadgeMarketing:"Marketing",customizedBadge:"Customized",installedVersionLabel:"Installed Version",installedAtLabel:"Installed At",sourceTimestampLabel:"Source Date",kitLabel:"Kit",skillMetadata:"Skill Info",migrate:"Migrate",migrateTitle:"Migrate",migrateSubtitle:"Migrate your Claude Code stack to other providers",migrateDetectedProviders:"Detected",migrateSelectedProviders:"Selected",migrateDiscovering:"Discovering migration sources...",migrateRefresh:"Refresh Discovery",migrateRun:"Run Migration",migrateRunning:"Migrating...",migrateSourceSummary:"Source Summary",migratePresetCodex:"Codex",migratePresetAntigravity:"Antigravity",migratePresetCore:"Codex + Antigravity + Droid",migratePresetDetected:"All Detected",migrateScope:"Scope",migrateScopeProject:"Project",migrateScopeGlobal:"Global",migrateTypes:"Portable Types",migrateTypeAgents:"Subagents",migrateTypeCommands:"Commands",migrateTypeSkills:"Skills",migrateTypeConfig:"Config",migrateTypeRules:"Rules",migrateTypeHooks:"Hooks",migrateSearchProviders:"Search providers...",migrateSelectVisible:"Select Visible",migrateClearSelection:"Clear Selection",migrateProvidersHeading:"Target Providers",migrateProvidersCountSuffix:"providers",migrateNoProvidersMatch:"No providers match current filters.",migrateSelectButton:"Select",migrateSelectedButton:"Selected",migrateSelectProviderAction:"Select Provider",migrateUnselectProvider:"Unselect Provider",migrateCapabilitiesLabel:"types",migrateCapabilitiesSection:"Capability Matrix",migrateSupported:"Supported",migrateUnsupportedShort:"Unsupported",migrateIncludedEnabled:"Enabled",migrateIncludedDisabled:"Disabled",migrateLatestTarget:"Latest Target",migrateNoResultForProvider:"No migration result for this provider yet.",migrateActionSummaryTitle:"Ready to Migrate",migrateGlobalOnlyCommandsShort:"Commands global-only",migrateNoProviders:"No providers available.",migrateUnsupported:"Will be skipped (unsupported)",migrateGlobalForced:"Codex commands are global-only. Scope will be forced to global.",migrateResults:"Migration Results",migrateInstalled:"Installed",migrateSkipped:"Skipped",migrateFailed:"Failed",migrateProvider:"Provider",migrateStatus:"Status",migratePath:"Path",migrateError:"Error",migrateStatusInstalled:"Installed",migrateStatusSkipped:"Skipped",migrateStatusFailed:"Failed",migrateNoResults:"No migration results yet.",migrateDetectFailed:"Failed to discover migration data",migrateExecuteFailed:"Migration execution failed",migrateSelectProvider:"Select at least one provider",migrateNoTypesEnabled:"Enable at least one portable type",migrateDetectedTag:"Detected",migrateNotDetectedTag:"Not detected",migrateFilterRecommended:"Recommended",migrateActionInstall:"Install",migrateActionUpdate:"Update",migrateActionSkip:"Skip",migrateActionConflict:"Conflict",migrateActionDelete:"Delete",migrateUnchanged:"unchanged",migrateConflictSectionTitle:"Conflicts",migrateConflictUseCK:"Use CK",migrateConflictKeepMine:"Keep Mine",migrateConflictSmartMerge:"Smart Merge",migrateConflictShowDiff:"Show Diff",migrateConflictHideDiff:"Hide Diff",migrateConflictResolved:"Resolved",migrateConflictManual:"Manual",migrateConflictOverwriteAll:"Overwrite All",migrateConflictKeepAll:"Keep All",migrateSummaryTitle:"Migration Complete",migrateSummaryNewMigration:"New Migration",migrateType:"Type",migrateItem:"Item",migrateReconciling:"Analyzing changes...",migrateReviewPlan:"Review Plan",migrateExecutePlan:"Execute Migration",migrateExecuting:"Executing migration...",migrateResolveConflicts:"Resolve all conflicts before executing",migrateSummarySubtitle:"items migrated",migrateSummarySearchPlaceholder:"Search items...",migrateSummaryFilterAll:"All",migrateSummaryCollapseAll:"Collapse all",migrateSummaryExpandAll:"Expand all",migrateSummaryNoResults:"No items match your search",migrateSummaryProviders:"Providers",migrateTypeUnknown:"Other",kanbanTitle:"Plan Kanban",kanbanNoFile:"No plan file specified. Use ?file= parameter.",kanbanNoPhases:"No phases detected in this plan",kanbanError400:"Invalid request — missing file parameter",kanbanError403:"Access denied — file is outside the project directory",kanbanError404:"Plan file not found",kanbanComplete:"complete",kanbanStatus_pending:"Pending","kanbanStatus_in-progress":"In Progress",kanbanStatus_completed:"Completed",kanbanPhases:"phases",kanbanProgress:"Progress",kanbanLoadError:"Failed to load plan data",developmentFeature:"Development",betaFeature:"Beta",experimentalFeature:"Experimental",sectionModelTaxonomy:"Model Taxonomy",taxonomyDescription:"Customize model mappings for portable migration to other coding agents.",taxonomyTierHeavy:"Heavy (opus)",taxonomyTierBalanced:"Balanced (sonnet)",taxonomyTierLight:"Light (haiku)",taxonomyModel:"Model",taxonomyEffort:"Effort",taxonomyResetProvider:"Reset",taxonomyTier:"Tier"},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",fieldStatuslineQuota:"Hiển thị Quota Statusline",fieldStatuslineQuotaDesc:"Hiển thị các nhãn quota 5h / wk trong statusline",fieldThinkingLanguage:"Ngôn ngữ suy nghĩ",fieldThinkingLanguageDesc:"Ngôn ngữ cho suy luận nội bộ của Claude (null=Tiếng Anh)",fieldResponseLanguage:"Ngôn ngữ phản hồi",fieldResponseLanguageDesc:"Ngôn ngữ cho phản hồi của Claude (null=theo người dùng)",fieldDocsPath:"Thư mục tài liệu",fieldDocsPathDesc:"Đường dẫn đến thư mục tài liệu",fieldPlansPath:"Thư mục kế hoạch",fieldPlansPathDesc:"Đường dẫn đến thư mục kế hoạch",fieldPrivacyBlock:"Chặn quyền riêng tư",fieldPrivacyBlockDesc:"Chặn truy cập file nhạy cảm (.env, credentials)",fieldTrustEnabled:"Chế độ tin cậy",fieldTrustEnabledDesc:"Tự động phê duyệt các tool calls",fieldTrustPassphrase:"Mật khẩu tin cậy",fieldTrustPassphraseDesc:"Mật khẩu để bật chế độ tin cậy",fieldProjectType:"Loại dự án",fieldProjectTypeDesc:"Ghi đè loại dự án tự động phát hiện",fieldPackageManager:"Trình quản lý gói",fieldPackageManagerDesc:"Ghi đè trình quản lý gói tự động phát hiện",fieldFramework:"Framework",fieldFrameworkDesc:"Ghi đè framework tự động phát hiện",fieldGeminiModel:"Mô hình Gemini",fieldGeminiModelDesc:"Mô hình Gemini cho các lệnh CLI; id gemini-3.0-* cũ sẽ tự động ánh xạ",fieldResearchUseGemini:"Dùng Gemini cho nghiên cứu",fieldResearchUseGeminiDesc:"Dùng Gemini CLI thay vì WebSearch",fieldDocsMaxLoc:"Số dòng tối đa/tài liệu",fieldDocsMaxLocDesc:"Số dòng code tối đa cho mỗi file tài liệu",fieldPlanNamingFormat:"Định dạng tên kế hoạch",fieldPlanNamingFormatDesc:"Định dạng cho tên thư mục kế hoạch",fieldPlanDateFormat:"Định dạng ngày kế hoạch",fieldPlanDateFormatDesc:"Định dạng ngày cho tên kế hoạch (moment.js)",fieldPlanValidationMode:"Chế độ xác thực",fieldPlanValidationModeDesc:"Cách xác thực kế hoạch trước khi triển khai",fieldPlanMinQuestions:"Số câu hỏi tối thiểu",fieldPlanMinQuestionsDesc:"Số câu hỏi xác thực tối thiểu",fieldPlanMaxQuestions:"Số câu hỏi tối đa",fieldPlanMaxQuestionsDesc:"Số câu hỏi xác thực tối đa",fieldAssertions:"Assertions",fieldAssertionsDesc:"Các assertions và quy tắc cần thực thi",fieldHookSessionInit:"Khởi tạo phiên",fieldHookSessionInitDesc:"Phát hiện dự án và thiết lập môi trường",fieldHookSubagentInit:"Khởi tạo subagent",fieldHookSubagentInitDesc:"Inject context vào subagents",fieldHookDescriptiveName:"Tên mô tả",fieldHookDescriptiveNameDesc:"Bắt buộc đặt tên file dạng kebab-case mô tả cho scripts",fieldHookDevRulesReminder:"Nhắc nhở quy tắc dev",fieldHookDevRulesReminderDesc:"Inject context quy tắc phát triển",fieldHookUsageContextAwareness:"Nhận thức sử dụng cho prompt",fieldHookUsageContextAwarenessDesc:"Inject nhận thức giới hạn sử dụng vào prompt",fieldHookContextTracking:"Theo dõi ngữ cảnh",fieldHookContextTrackingDesc:"Theo dõi cửa sổ ngữ cảnh (% đã dùng, số token)",fieldHookScoutBlock:"Chặn Scout",fieldHookScoutBlockDesc:"Chặn thư mục nặng khỏi việc khám phá",fieldHookPrivacyBlock:"Hook chặn quyền riêng tư",fieldHookPrivacyBlockDesc:"Chặn đọc file nhạy cảm",fieldHookPostEditSimplify:"Đơn giản sau chỉnh sửa",fieldHookPostEditSimplifyDesc:"Nhắc đơn giản sau khi chỉnh sửa",sectionUpdatePipeline:"Pipeline Cập nhật",fieldAutoInitAfterUpdate:"Tự động Init sau Update",fieldAutoInitAfterUpdateDesc:"Tự động chạy ck init sau ck update khi kit có phiên bản mới",fieldAutoMigrateAfterUpdate:"Tự động Migrate sau Update",fieldAutoMigrateAfterUpdateDesc:"Tự động chạy ck migrate sau ck update (độc lập với init)",fieldMigrateProviders:"Provider Migrate",fieldMigrateProvidersDesc:"Provider nào tự động migrate. Dùng 'auto' để quét hệ thống hoặc danh sách phân cách bằng dấu phẩy.",skillsPageTitle:"Quản lý Kỹ năng",skillsPageDesc:"Cài đặt kỹ năng ClaudeKit cho các agent lập trình",availableSkills:"Kỹ năng có sẵn",installedSkills:"Kỹ năng đã cài",noSkillsFound:"Không tìm thấy kỹ năng",installSkill:"Cài đặt",uninstallSkill:"Gỡ cài đặt",manageSkill:"Quản lý",syncRegistry:"Đồng bộ",installSkillTitle:"Cài đặt Kỹ năng",selectAgents:"Chọn agent đích",installLocation:"Vị trí cài đặt",globalInstall:"Toàn cục",projectInstall:"Dự án",confirmInstall:"Cài đặt cho các agent đã chọn",installingSkill:"Đang cài đặt...",skillInstallSuccess:"Cài đặt kỹ năng thành công",skillInstallFailed:"Cài đặt thất bại",agentClaudeCode:"Claude Code",agentCursor:"Cursor",agentCodex:"Codex",agentOpencode:"OpenCode",agentGoose:"Goose",agentGeminiCli:"Gemini CLI",agentAntigravity:"Antigravity",agentGithubCopilot:"GitHub Copilot",agentAmp:"Amp",agentKilo:"Kilo",agentRoo:"Roo",agentWindsurf:"Windsurf",agentCline:"Cline",agentOpenhands:"OpenHands",installed:"Đã cài",notInstalled:"Chưa cài",allAgents:"Tất cả Agent",filterByAgent:"Lọc theo agent",skillsTitle:"Kỹ năng",skillsSubtitle:"Duyệt, cài đặt và quản lý kỹ năng cho coding agents",availableCount:"Có sẵn",installedCount:"Đã cài",agentsCount:"Agents",searchSkills:"Tìm kiếm kỹ năng...",searchShortcut:"/",sortAZ:"A-Z",sortCategory:"Danh mục",sortInstalledFirst:"Đã cài trước",listView:"Dạng danh sách",gridView:"Dạng lưới",categoryAll:"Tất cả",categoryAI:"AI",categoryUIUX:"UI/UX",categoryBackend:"Backend",categorySecurity:"Bảo mật",categoryDevOps:"DevOps",categoryDatabase:"Cơ sở dữ liệu",categoryDevelopment:"Phát triển",categoryResearch:"Nghiên cứu",categoryGeneral:"Tổng quát",categoryCore:"Cốt lõi",categoryDocumentation:"Tài liệu",categoryTooling:"Công cụ",categoryMedia:"Phương tiện",categoryFrameworks:"Framework",skillsCountLabel:"{count} kỹ năng",installToAll:"Cài cho tất cả đã phát hiện",scopeLabel:"Phạm vi cài đặt",agentInstalled:"Đã cài",agentNotInstalled:"Chưa cài",skillSource:"Vị trí nguồn",skillSourceBadge:"Nguồn",detailPanelClose:"Đóng",versionLabel:"v{version}",installAllToAllAgents:"Cài tất cả cho tất cả Agent",bulkInstallFailed:"Cài hàng loạt thất bại",noAgentsDetected:"Không phát hiện agent nào",kitBadgeEngineer:"Engineer",kitBadgeMarketing:"Marketing",customizedBadge:"Đã tùy chỉnh",installedVersionLabel:"Phiên bản cài đặt",installedAtLabel:"Cài đặt lúc",sourceTimestampLabel:"Ngày nguồn",kitLabel:"Kit",skillMetadata:"Thông tin Skill",migrate:"Di trú",migrateTitle:"Di trú",migrateSubtitle:"Chuyển toàn bộ stack Claude Code sang provider khác",migrateDetectedProviders:"Đã phát hiện",migrateSelectedProviders:"Đã chọn",migrateDiscovering:"Đang quét nguồn di trú...",migrateRefresh:"Làm mới quét",migrateRun:"Chạy di trú",migrateRunning:"Đang di trú...",migrateSourceSummary:"Tổng quan nguồn",migratePresetCodex:"Codex",migratePresetAntigravity:"Antigravity",migratePresetCore:"Codex + Antigravity + Droid",migratePresetDetected:"Tất cả đã phát hiện",migrateScope:"Phạm vi",migrateScopeProject:"Dự án",migrateScopeGlobal:"Toàn cục",migrateTypes:"Loại di trú",migrateTypeAgents:"Subagents",migrateTypeCommands:"Commands",migrateTypeSkills:"Skills",migrateTypeConfig:"Config",migrateTypeRules:"Rules",migrateTypeHooks:"Hooks",migrateSearchProviders:"Tìm provider...",migrateSelectVisible:"Chọn phần đang hiện",migrateClearSelection:"Bỏ chọn tất cả",migrateProvidersHeading:"Provider đích",migrateProvidersCountSuffix:"provider",migrateNoProvidersMatch:"Không có provider khớp bộ lọc hiện tại.",migrateSelectButton:"Chọn",migrateSelectedButton:"Đã chọn",migrateSelectProviderAction:"Chọn provider",migrateUnselectProvider:"Bỏ chọn provider",migrateCapabilitiesLabel:"loại",migrateCapabilitiesSection:"Ma trận khả năng",migrateSupported:"Hỗ trợ",migrateUnsupportedShort:"Không hỗ trợ",migrateIncludedEnabled:"Đang bật",migrateIncludedDisabled:"Đang tắt",migrateLatestTarget:"Đích gần nhất",migrateNoResultForProvider:"Chưa có kết quả di trú cho provider này.",migrateActionSummaryTitle:"Sẵn sàng di trú",migrateGlobalOnlyCommandsShort:"Commands chỉ global",migrateNoProviders:"Không có provider khả dụng.",migrateUnsupported:"Sẽ bỏ qua (không hỗ trợ)",migrateGlobalForced:"Lệnh Codex chỉ hỗ trợ global. Phạm vi sẽ tự chuyển global.",migrateResults:"Kết quả di trú",migrateInstalled:"Đã cài",migrateSkipped:"Đã bỏ qua",migrateFailed:"Lỗi",migrateProvider:"Provider",migrateStatus:"Trạng thái",migratePath:"Đường dẫn",migrateError:"Lỗi",migrateStatusInstalled:"Đã cài",migrateStatusSkipped:"Đã bỏ qua",migrateStatusFailed:"Lỗi",migrateNoResults:"Chưa có kết quả di trú.",migrateDetectFailed:"Không thể quét dữ liệu di trú",migrateExecuteFailed:"Chạy di trú thất bại",migrateSelectProvider:"Vui lòng chọn ít nhất một provider",migrateNoTypesEnabled:"Bật ít nhất một loại di trú",migrateDetectedTag:"Đã phát hiện",migrateNotDetectedTag:"Chưa phát hiện",migrateFilterRecommended:"Đề xuất",migrateActionInstall:"Cài",migrateActionUpdate:"Cập nhật",migrateActionSkip:"Bỏ qua",migrateActionConflict:"Xung đột",migrateActionDelete:"Xóa",migrateUnchanged:"chưa thay đổi",migrateConflictSectionTitle:"Xung đột",migrateConflictUseCK:"Dùng CK",migrateConflictKeepMine:"Giữ của tôi",migrateConflictSmartMerge:"Merge thông minh",migrateConflictShowDiff:"Hiện diff",migrateConflictHideDiff:"Ẩn diff",migrateConflictResolved:"Đã giải quyết",migrateConflictManual:"Thủ công",migrateConflictOverwriteAll:"Ghi đè tất cả",migrateConflictKeepAll:"Giữ tất cả",migrateSummaryTitle:"Di trú hoàn tất",migrateSummaryNewMigration:"Di trú mới",migrateType:"Loại",migrateItem:"Mục",migrateReconciling:"Đang phân tích thay đổi...",migrateReviewPlan:"Xem kế hoạch",migrateExecutePlan:"Thực hiện di trú",migrateExecuting:"Đang thực hiện di trú...",migrateResolveConflicts:"Giải quyết xung đột trước khi thực hiện",migrateSummarySubtitle:"mục đã di trú",migrateSummarySearchPlaceholder:"Tìm kiếm...",migrateSummaryFilterAll:"Tất cả",migrateSummaryCollapseAll:"Thu gọn",migrateSummaryExpandAll:"Mở rộng",migrateSummaryNoResults:"Không tìm thấy mục nào",migrateSummaryProviders:"Provider",migrateTypeUnknown:"Khác",kanbanTitle:"Bảng Kanban Kế hoạch",kanbanNoFile:"Chưa chọn file kế hoạch. Dùng tham số ?file=.",kanbanNoPhases:"Không phát hiện giai đoạn nào trong kế hoạch này",kanbanError400:"Yêu cầu không hợp lệ — thiếu tham số file",kanbanError403:"Truy cập bị từ chối — file nằm ngoài thư mục dự án",kanbanError404:"Không tìm thấy file kế hoạch",kanbanComplete:"hoàn thành",kanbanStatus_pending:"Chờ xử lý","kanbanStatus_in-progress":"Đang thực hiện",kanbanStatus_completed:"Hoàn thành",kanbanPhases:"giai đoạn",kanbanProgress:"Tiến độ",kanbanLoadError:"Không thể tải dữ liệu kế hoạch",developmentFeature:"Đang phát triển",betaFeature:"Beta",experimentalFeature:"Thử nghiệm",sectionModelTaxonomy:"Phân loại mô hình",taxonomyDescription:"Tuỳ chỉnh ánh xạ mô hình cho migration portable sang coding agent khác.",taxonomyTierHeavy:"Nặng (opus)",taxonomyTierBalanced:"Cân bằng (sonnet)",taxonomyTierLight:"Nhẹ (haiku)",taxonomyModel:"Mô hình",taxonomyEffort:"Mức nỗ lực",taxonomyResetProvider:"Đặt lại",taxonomyTier:"Cấp độ"}},kh=g.createContext(null),Um="ck-dashboard-lang";function Sv(){const t=localStorage.getItem(Um);return t==="en"||t==="vi"?t:navigator.language.startsWith("vi")?"vi":"en"}function Cv({children:t}){const[e,n]=g.useState(Sv),r=g.useCallback(o=>{localStorage.setItem(Um,o),n(o)},[]),i=g.useCallback(o=>kv[e][o],[e]),s=g.useMemo(()=>({lang:e,setLang:r,t:i}),[e,r,i]);return h.jsx(kh.Provider,{value:s,children:t})}function he(){const t=g.useContext(kh);if(!t)throw new Error("useI18n must be used within I18nProvider");return t}class jv extends g.Component{constructor(){super(...arguments);Nd(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){console.error("App error:",n,r.componentStack)}render(){if(this.state.hasError){const n=this.state.error?.name==="ServerUnavailableError";return h.jsx(kh.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:n?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 tr=({direction:t="horizontal",isDragging:e=!1,onMouseDown:n})=>{const r=t==="horizontal";return h.jsx("div",{onMouseDown:n,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"}
@@ -27,7 +27,7 @@ Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}
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=(t=>(t.HEALTHY="healthy",t.WARNING="warning",t.ERROR="error",t.LOADING="loading",t.UNKNOWN="unknown",t))(Pn||{}),Qt=(t=>(t.ENGINEER="engineer",t.MARKETING="marketing",t.ARCHITECT="architect",t.RESEARCHER="researcher",t.DEVOP="devops",t))(Qt||{});const Ov=({isOpen:t,onClose:e,onAdd:n})=>{const{t:r}=he(),[i,s]=g.useState(""),[o,a]=g.useState(""),[l,c]=g.useState(!1),[d,u]=g.useState(null);g.useEffect(()=>{t||(s(""),a(""),u(null),c(!1))},[t]),g.useEffect(()=>{if(!t)return;const p=m=>{m.key==="Escape"&&e()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t]),g.useEffect(()=>{if(!t)return;const p=document.activeElement;return document.querySelector("#project-path")?.focus(),()=>{p?.focus()}},[t]);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 n(m),e()}catch(m){u(m instanceof Error?m.message:r("failedToAdd"))}finally{c(!1)}};return t?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},Pv=({vertical:t=!1})=>{const{lang:e,setLang:n}=he();return h.jsxs("div",{className:`flex ${t?"flex-col":""} items-center rounded-lg border border-dash-border overflow-hidden`,children:[h.jsx("button",{onClick:()=>n("en"),className:`px-2 py-1 text-xs font-medium transition-colors ${e==="en"?"bg-dash-accent text-dash-bg":"text-dash-text-muted hover:bg-dash-surface-hover"}`,title:"English",children:"EN"}),h.jsx("button",{onClick:()=>n("vi"),className:`px-2 py-1 text-xs font-medium transition-colors ${e==="vi"?"bg-dash-accent text-dash-bg":"text-dash-text-muted hover:bg-dash-surface-hover"}`,title:"Tiếng Việt",children:"VI"})]})},Nv=({projects:t,currentProjectId:e,isCollapsed:n,width:r,isConnected:i,theme:s,onSwitchProject:o,onToggle:a,onAddProject:l,onToggleTheme:c})=>{const{t:d}=he(),u=an(),f=_t(),[p,m]=g.useState(!1),b=f.pathname==="/config/global",x=f.pathname==="/migrate"||f.pathname==="/skills",w=[...t].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?"":n?"w-14":"w-72",C=r?r>=160:!n;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 ${C?"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"}),C&&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:`${C?"px-4":"px-2"} py-2 space-y-1`,children:[C&&h.jsx("p",{className:"px-2 pb-2 text-[10px] font-bold text-dash-text-muted uppercase tracking-widest",children:d("settingsSection")}),h.jsx(iu,{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:!C,active:b,onClick:()=>u("/config/global")}),h.jsx(iu,{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:!C,active:x,onClick:()=>u("/migrate")})]}),h.jsxs("div",{className:`flex-1 overflow-y-auto overflow-x-hidden ${C?"px-4":"px-2"} py-2 space-y-1 border-t border-dash-border`,children:[C&&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 ${C?"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":""}`}),C&&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})]}),!C&&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 ${C?"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:`${C?"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"})})}),C&&h.jsx("span",{className:"text-sm font-medium",children:d("addProject")})]})]}),h.jsx(Ov,{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 ${C?"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"}`}),C&&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 ${C?"":"flex-col"}`,children:[h.jsx(Pv,{vertical:!C}),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(n?"expand":"collapse"),children:n?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"})})})]})]})})]})},iu=({icon:t,label:e,badge:n,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:t}),!i&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-sm font-medium flex-1 text-left",children:e}),n&&h.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded ${r}`,children:n})]}),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 ll 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 ll}catch(t){throw t instanceof ll?t:new ll}}function Sh(t){return{id:t.id,name:t.name,path:t.path,health:t.health,kitType:t.kitType||"engineer",model:t.model,activeHooks:t.activeHooks,mcpServers:t.mcpServers,skills:t.skills,pinned:t.pinned,tags:t.tags,addedAt:t.addedAt,lastOpened:t.lastOpened,preferences:t.preferences}}async function Ch(){await St();const t=await fetch(`${tt}/projects`);if(!t.ok)throw new Error("Failed to fetch projects");return(await t.json()).map(Sh)}async function Av(){await St();const t=await fetch(`${tt}/skills`);if(!t.ok)throw new Error("Failed to fetch skills");return t.json()}async function Mv(t,e){try{await St();const n=e!==void 0?`?limit=${e}`:"",r=await fetch(`${tt}/sessions/${encodeURIComponent(t)}${n}`);return r.ok?r.json():[]}catch{return[]}}async function Dv(t,e){await St();const n=new URLSearchParams;t&&n.set("projectId",t);const r=await fetch(`${tt}/actions/options?${n.toString()}`,{signal:e});if(!r.ok)throw new Error("Failed to fetch action options");return r.json()}async function Tv(t,e,n,r){await St();const i=await fetch(`${tt}/actions/open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:t,path:e,appId:n,projectId:r})});if(!i.ok){const s=await i.json().catch(()=>({error:"Action failed"}));throw new Error(s.error||"Action failed")}}async function Ev(){await St();try{const r=await fetch(`${tt}/settings/raw`);if(r.ok)return r.json()}catch{}const t=await fetch(`${tt}/settings`);if(!t.ok)throw new Error("Failed to fetch settings file");const e=await t.json(),n=e.settings&&typeof e.settings=="object"?e.settings:{model:e.model,permissions:e.permissions,hookCount:e.hookCount,mcpServerCount:e.mcpServerCount};return{path:e.settingsPath??"~/.claude/settings.json",exists:e.settingsExists??!0,settings:n}}async function Rv(t){await St();const e=await fetch(`${tt}/settings/raw`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:t})});if(!e.ok){const n=await e.json().catch(()=>({error:"Failed to save settings file"}));throw new Error(n.error||"Failed to save settings file")}return e.json()}async function Lv(t){await St();const e=new URLSearchParams;t?.scope&&e.set("scope",t.scope),t?.projectId&&e.set("projectId",t.projectId),e.set("limit",String(t.limit));const n=e.toString(),r=await fetch(`${tt}/system/hook-diagnostics${n?`?${n}`:""}`,{signal:t?.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 Iv(t){await St();const e=await fetch(`${tt}/projects`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!e.ok){const r=await e.text();throw new Error(r||"Failed to add project")}const n=await e.json();return Sh(n)}async function $v(t){await St();const e=await fetch(`${tt}/projects/${encodeURIComponent(t)}`,{method:"DELETE"});if(!e.ok){const n=await e.text();throw new Error(n||"Failed to remove project")}}async function Km(t,e){await St();const n=await fetch(`${tt}/projects/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok){const i=await n.text();throw new Error(i||"Failed to update project")}const r=await n.json();return Sh(r)}async function Bv(){const t=await fetch(`${tt}/metadata/global`);return t.ok?t.json():(console.error("Failed to fetch global metadata"),{})}async function Fv(){await St();const t=await fetch(`${tt}/migrate/providers`);if(!t.ok)throw new Error("Failed to fetch migration providers");return t.json()}async function su(){await St();const t=await fetch(`${tt}/migrate/discovery`);if(!t.ok)throw new Error("Failed to discover migration items");return t.json()}function Vv(){const[t,e]=g.useState([]),[n,r]=g.useState(!0),[i,s]=g.useState(null),o=g.useCallback(async()=>{try{r(!0),s(null);const a=await Av();e(a)}catch(a){s(a instanceof Error?a.message:"Failed to load skills")}finally{r(!1)}},[]);return g.useEffect(()=>{o()},[o]),{skills:t,loading:n,error:i,reload:o}}function zv(t){const[e,n]=g.useState([]),[r,i]=g.useState(!1),[s,o]=g.useState(null),a=g.useCallback(async()=>{if(!t){n([]);return}try{i(!0),o(null);const l=await Mv(t,999);n(l)}catch(l){o(l instanceof Error?l.message:"Failed to load sessions")}finally{i(!1)}},[t]);return g.useEffect(()=>{a()},[a]),{sessions:e,loading:r,error:s,reload:a}}function _v(){const[t,e]=g.useState([]),[n,r]=g.useState(!0),[i,s]=g.useState(null),o=g.useCallback(async()=>{try{r(!0),s(null);const d=await Ch();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 Iv(d);return await o(),u},[o]),l=g.useCallback(async d=>{await $v(d),await o()},[o]),c=g.useCallback(async(d,u)=>{const f=await Km(d,u);return await o(),f},[o]);return g.useEffect(()=>{o()},[o]),{projects:t,loading:n,error:i,reload:o,addProject:a,removeProject:l,updateProject:c}}function Hv({storageKey:t,defaultSize:e,minSize:n,maxSize:r,direction:i="horizontal"}){const[s,o]=g.useState(()=>{if(typeof window>"u")return e;const f=localStorage.getItem(t);if(f){const p=Number.parseInt(f,10);if(!Number.isNaN(p)&&p>=n&&p<=r)return p}return e}),[a,l]=g.useState(!1);g.useEffect(()=>{localStorage.setItem(t,String(s))},[s,t]);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,C=Math.max(n,Math.min(r,m+S));o(C)},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,n,r,i]),d=g.useCallback(()=>{o(e)},[e]),u=g.useCallback(f=>{o(Math.max(n,Math.min(r,f)))},[n,r]);return{size:s,isDragging:a,startDrag:c,setSize:u,reset:d}}const Wv=()=>{const{t}=he(),e=an(),n=_t(),{projectId:r}=$m(),[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}=Hv({storageKey:"claudekit-sidebar-width",defaultSize:288,minSize:56,maxSize:400}),p=c<=56,{projects:m,loading:b,error:x,addProject:w}=_v(),v=async y=>{await w(y)};g.useEffect(()=>{const y=n.pathname.startsWith("/project/");m.length===0||r||!y||e(`/project/${m[0].id}`,{replace:!0})},[m,r,e,n.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"),C=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:t("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:[t("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(Nv,{projects:m,currentProjectId:i,isCollapsed:p,width:c,isConnected:l,theme:o,onSwitchProject:k,onToggle:O,onAddProject:v,onToggleTheme:S}),h.jsx(tr,{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(I1,{context:{project:C,isConnected:l,theme:o,onToggleTheme:S}})})})]})},Gm=({title:t,filePath:e,onBack:n,onSave:r,onReset:i,saveStatus:s,syntaxError:o,showResetConfirm:a,setShowResetConfirm:l,badge:c,showActions:d=!0,showFilePath:u=!0})=>{const{t:f}=he();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:n,className:"px-2 py-1 rounded-lg bg-dash-surface hover:bg-dash-surface-hover border border-dash-border text-sm text-dash-text-secondary hover:text-dash-text flex items-center group transition-all font-medium shadow-sm",title:f("backToDashboard"),children: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:t}),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")})]})]})},qm={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:`{
30
+ `})})};var Pn=(t=>(t.HEALTHY="healthy",t.WARNING="warning",t.ERROR="error",t.LOADING="loading",t.UNKNOWN="unknown",t))(Pn||{}),Qt=(t=>(t.ENGINEER="engineer",t.MARKETING="marketing",t.ARCHITECT="architect",t.RESEARCHER="researcher",t.DEVOP="devops",t))(Qt||{});const Ov=({isOpen:t,onClose:e,onAdd:n})=>{const{t:r}=he(),[i,s]=g.useState(""),[o,a]=g.useState(""),[l,c]=g.useState(!1),[d,u]=g.useState(null);g.useEffect(()=>{t||(s(""),a(""),u(null),c(!1))},[t]),g.useEffect(()=>{if(!t)return;const p=m=>{m.key==="Escape"&&e()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t]),g.useEffect(()=>{if(!t)return;const p=document.activeElement;return document.querySelector("#project-path")?.focus(),()=>{p?.focus()}},[t]);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 n(m),e()}catch(m){u(m instanceof Error?m.message:r("failedToAdd"))}finally{c(!1)}};return t?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},Pv=({vertical:t=!1})=>{const{lang:e,setLang:n}=he();return h.jsxs("div",{className:`flex ${t?"flex-col":""} items-center rounded-lg border border-dash-border overflow-hidden`,children:[h.jsx("button",{onClick:()=>n("en"),className:`px-2 py-1 text-xs font-medium transition-colors ${e==="en"?"bg-dash-accent text-dash-bg":"text-dash-text-muted hover:bg-dash-surface-hover"}`,title:"English",children:"EN"}),h.jsx("button",{onClick:()=>n("vi"),className:`px-2 py-1 text-xs font-medium transition-colors ${e==="vi"?"bg-dash-accent text-dash-bg":"text-dash-text-muted hover:bg-dash-surface-hover"}`,title:"Tiếng Việt",children:"VI"})]})},Nv=({projects:t,currentProjectId:e,isCollapsed:n,width:r,isConnected:i,theme:s,onSwitchProject:o,onToggle:a,onAddProject:l,onToggleTheme:c})=>{const{t:d}=he(),u=an(),f=Ht(),[p,m]=g.useState(!1),b=f.pathname==="/config/global",x=f.pathname==="/migrate"||f.pathname==="/skills",w=[...t].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?"":n?"w-14":"w-72",C=r?r>=160:!n;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 ${C?"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"}),C&&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:`${C?"px-4":"px-2"} py-2 space-y-1`,children:[C&&h.jsx("p",{className:"px-2 pb-2 text-[10px] font-bold text-dash-text-muted uppercase tracking-widest",children:d("settingsSection")}),h.jsx(iu,{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:!C,active:b,onClick:()=>u("/config/global")}),h.jsx(iu,{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:!C,active:x,onClick:()=>u("/migrate")})]}),h.jsxs("div",{className:`flex-1 overflow-y-auto overflow-x-hidden ${C?"px-4":"px-2"} py-2 space-y-1 border-t border-dash-border`,children:[C&&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 ${C?"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":""}`}),C&&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})]}),!C&&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 ${C?"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:`${C?"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"})})}),C&&h.jsx("span",{className:"text-sm font-medium",children:d("addProject")})]})]}),h.jsx(Ov,{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 ${C?"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"}`}),C&&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 ${C?"":"flex-col"}`,children:[h.jsx(Pv,{vertical:!C}),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(n?"expand":"collapse"),children:n?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"})})})]})]})})]})},iu=({icon:t,label:e,badge:n,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:t}),!i&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-sm font-medium flex-1 text-left",children:e}),n&&h.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded ${r}`,children:n})]}),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 ll 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 ll}catch(t){throw t instanceof ll?t:new ll}}function Sh(t){return{id:t.id,name:t.name,path:t.path,health:t.health,kitType:t.kitType||"engineer",model:t.model,activeHooks:t.activeHooks,mcpServers:t.mcpServers,skills:t.skills,pinned:t.pinned,tags:t.tags,addedAt:t.addedAt,lastOpened:t.lastOpened,preferences:t.preferences}}async function Ch(){await St();const t=await fetch(`${tt}/projects`);if(!t.ok)throw new Error("Failed to fetch projects");return(await t.json()).map(Sh)}async function Av(){await St();const t=await fetch(`${tt}/skills`);if(!t.ok)throw new Error("Failed to fetch skills");return t.json()}async function Mv(t,e){try{await St();const n=e!==void 0?`?limit=${e}`:"",r=await fetch(`${tt}/sessions/${encodeURIComponent(t)}${n}`);return r.ok?r.json():[]}catch{return[]}}async function Dv(t,e){await St();const n=new URLSearchParams;t&&n.set("projectId",t);const r=await fetch(`${tt}/actions/options?${n.toString()}`,{signal:e});if(!r.ok)throw new Error("Failed to fetch action options");return r.json()}async function Tv(t,e,n,r){await St();const i=await fetch(`${tt}/actions/open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:t,path:e,appId:n,projectId:r})});if(!i.ok){const s=await i.json().catch(()=>({error:"Action failed"}));throw new Error(s.error||"Action failed")}}async function Ev(){await St();try{const r=await fetch(`${tt}/settings/raw`);if(r.ok)return r.json()}catch{}const t=await fetch(`${tt}/settings`);if(!t.ok)throw new Error("Failed to fetch settings file");const e=await t.json(),n=e.settings&&typeof e.settings=="object"?e.settings:{model:e.model,permissions:e.permissions,hookCount:e.hookCount,mcpServerCount:e.mcpServerCount};return{path:e.settingsPath??"~/.claude/settings.json",exists:e.settingsExists??!0,settings:n}}async function Rv(t){await St();const e=await fetch(`${tt}/settings/raw`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:t})});if(!e.ok){const n=await e.json().catch(()=>({error:"Failed to save settings file"}));throw new Error(n.error||"Failed to save settings file")}return e.json()}async function Lv(t){await St();const e=new URLSearchParams;t?.scope&&e.set("scope",t.scope),t?.projectId&&e.set("projectId",t.projectId),e.set("limit",String(t.limit));const n=e.toString(),r=await fetch(`${tt}/system/hook-diagnostics${n?`?${n}`:""}`,{signal:t?.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 Iv(t){await St();const e=await fetch(`${tt}/projects`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!e.ok){const r=await e.text();throw new Error(r||"Failed to add project")}const n=await e.json();return Sh(n)}async function $v(t){await St();const e=await fetch(`${tt}/projects/${encodeURIComponent(t)}`,{method:"DELETE"});if(!e.ok){const n=await e.text();throw new Error(n||"Failed to remove project")}}async function Km(t,e){await St();const n=await fetch(`${tt}/projects/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok){const i=await n.text();throw new Error(i||"Failed to update project")}const r=await n.json();return Sh(r)}async function Bv(){const t=await fetch(`${tt}/metadata/global`);return t.ok?t.json():(console.error("Failed to fetch global metadata"),{})}async function Fv(){await St();const t=await fetch(`${tt}/migrate/providers`);if(!t.ok)throw new Error("Failed to fetch migration providers");return t.json()}async function su(){await St();const t=await fetch(`${tt}/migrate/discovery`);if(!t.ok)throw new Error("Failed to discover migration items");return t.json()}function Vv(){const[t,e]=g.useState([]),[n,r]=g.useState(!0),[i,s]=g.useState(null),o=g.useCallback(async()=>{try{r(!0),s(null);const a=await Av();e(a)}catch(a){s(a instanceof Error?a.message:"Failed to load skills")}finally{r(!1)}},[]);return g.useEffect(()=>{o()},[o]),{skills:t,loading:n,error:i,reload:o}}function zv(t){const[e,n]=g.useState([]),[r,i]=g.useState(!1),[s,o]=g.useState(null),a=g.useCallback(async()=>{if(!t){n([]);return}try{i(!0),o(null);const l=await Mv(t,999);n(l)}catch(l){o(l instanceof Error?l.message:"Failed to load sessions")}finally{i(!1)}},[t]);return g.useEffect(()=>{a()},[a]),{sessions:e,loading:r,error:s,reload:a}}function Hv(){const[t,e]=g.useState([]),[n,r]=g.useState(!0),[i,s]=g.useState(null),o=g.useCallback(async()=>{try{r(!0),s(null);const d=await Ch();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 Iv(d);return await o(),u},[o]),l=g.useCallback(async d=>{await $v(d),await o()},[o]),c=g.useCallback(async(d,u)=>{const f=await Km(d,u);return await o(),f},[o]);return g.useEffect(()=>{o()},[o]),{projects:t,loading:n,error:i,reload:o,addProject:a,removeProject:l,updateProject:c}}function _v({storageKey:t,defaultSize:e,minSize:n,maxSize:r,direction:i="horizontal"}){const[s,o]=g.useState(()=>{if(typeof window>"u")return e;const f=localStorage.getItem(t);if(f){const p=Number.parseInt(f,10);if(!Number.isNaN(p)&&p>=n&&p<=r)return p}return e}),[a,l]=g.useState(!1);g.useEffect(()=>{localStorage.setItem(t,String(s))},[s,t]);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,C=Math.max(n,Math.min(r,m+S));o(C)},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,n,r,i]),d=g.useCallback(()=>{o(e)},[e]),u=g.useCallback(f=>{o(Math.max(n,Math.min(r,f)))},[n,r]);return{size:s,isDragging:a,startDrag:c,setSize:u,reset:d}}const Wv=()=>{const{t}=he(),e=an(),n=Ht(),{projectId:r}=$m(),[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}=_v({storageKey:"claudekit-sidebar-width",defaultSize:288,minSize:56,maxSize:400}),p=c<=56,{projects:m,loading:b,error:x,addProject:w}=Hv(),v=async y=>{await w(y)};g.useEffect(()=>{const y=n.pathname.startsWith("/project/");m.length===0||r||!y||e(`/project/${m[0].id}`,{replace:!0})},[m,r,e,n.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"),C=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:t("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:[t("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(Nv,{projects:m,currentProjectId:i,isCollapsed:p,width:c,isConnected:l,theme:o,onSwitchProject:k,onToggle:O,onAddProject:v,onToggleTheme:S}),h.jsx(tr,{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(I1,{context:{project:C,isConnected:l,theme:o,onToggleTheme:S}})})})]})},Gm=({title:t,filePath:e,onBack:n,onSave:r,onReset:i,saveStatus:s,syntaxError:o,showResetConfirm:a,setShowResetConfirm:l,badge:c,showActions:d=!0,showFilePath:u=!0})=>{const{t:f}=he();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:n,className:"px-2 py-1 rounded-lg bg-dash-surface hover:bg-dash-surface-hover border border-dash-border text-sm text-dash-text-secondary hover:text-dash-text flex items-center group transition-all font-medium shadow-sm",title:f("backToDashboard"),children: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:t}),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")})]})]})},qm={plan:{path:"plan",type:"object",default:"{}",description:"Configuration for plan management including naming conventions, resolution strategies, and validation workflows.",descriptionVi:"Cấu hình quản lý kế hoạch bao gồm quy ước đặt tên, chiến lược giải quyết và quy trình xác thực.",effect:"Controls how plans are created (namingFormat), located (resolution), and reviewed (validation) during development.",effectVi:"Điều khiển cách tạo kế hoạch (namingFormat), định vị (resolution) và xem xét (validation) trong quá trình phát triển."},"plan.resolution":{path:"plan.resolution",type:"object",default:"{}",description:"Settings for resolving which plan is currently active. Uses cascading resolution: session state (explicit) → branch name matching (suggested).",descriptionVi:"Cài đặt để xác định kế hoạch đang hoạt động. Sử dụng giải quyết theo tầng: trạng thái phiên (rõ ràng) → khớp tên nhánh (gợi ý).",effect:"'session' = ACTIVE (explicitly set via set-active-plan). 'branch' = SUGGESTED (hint from git branch name). 'mostRecent' was removed to avoid stale plan pollution.",effectVi:"'session' = ĐANG HOẠT ĐỘNG (đặt rõ ràng qua set-active-plan). 'branch' = GỢI Ý (từ tên nhánh git). 'mostRecent' đã bị xóa để tránh ô nhiễm kế hoạch cũ."},"plan.validation":{path:"plan.validation",type:"object",default:"{}",description:"Settings for the plan validation interview that reviews assumptions, risks, and architecture decisions.",descriptionVi:"Cài đặt cho phỏng vấn xác thực kế hoạch để xem xét giả định, rủi ro và quyết định kiến trúc.",effect:"Runs validation interview based on mode: 'prompt' (ask first), 'auto' (run automatically), 'strict' (enforce validation), 'none' (skip). Questions focus on configured areas.",effectVi:"Chạy phỏng vấn xác thực dựa trên chế độ: 'prompt' (hỏi trước), 'auto' (tự chạy), 'strict' (bắt buộc xác thực), 'none' (bỏ qua). Câu hỏi tập trung vào các lĩnh vực đã cấu hình."},paths:{path:"paths",type:"object",default:"{}",description:"Custom paths for project directories. Supports relative paths (from project root) or absolute paths for consolidated setups.",descriptionVi:"Đường dẫn tùy chỉnh cho các thư mục dự án. Hỗ trợ đường dẫn tương đối (từ thư mục gốc) hoặc tuyệt đối cho thiết lập tập trung.",effect:"Relative paths are resolved from project root. Absolute paths allow consolidated plans across repos.",effectVi:"Đường dẫn tương đối được giải quyết từ thư mục gốc dự án. Đường dẫn tuyệt đối cho phép kế hoạch tập trung giữa các repo."},locale:{path:"locale",type:"object",default:"{}",description:"Language settings separating internal AI reasoning from user-facing output for optimal precision.",descriptionVi:"Cài đặt ngôn ngữ tách suy luận AI nội bộ khỏi đầu ra cho người dùng để có độ chính xác tối ưu.",effect:"thinkingLanguage: for reasoning/logic (recommended: 'en'). responseLanguage: for user output (e.g., 'vi' for Vietnamese responses).",effectVi:"thinkingLanguage: cho suy luận/logic (khuyến nghị: 'en'). responseLanguage: cho đầu ra người dùng (vd: 'vi' cho phản hồi tiếng Việt)."},trust:{path:"trust",type:"object",default:"{}",description:"Trusted execution mode for bypassing certain security confirmations in controlled environments.",descriptionVi:"Chế độ thực thi tin cậy để bỏ qua một số xác nhận bảo mật trong môi trường được kiểm soát.",effect:"When trust.enabled=true, security prompts may be skipped. passphrase is used for context injection testing.",effectVi:"Khi trust.enabled=true, các lời nhắc bảo mật có thể bị bỏ qua. passphrase dùng để kiểm tra tiêm ngữ cảnh."},project:{path:"project",type:"object",default:"{}",description:"Override automatic project detection. Set to 'auto' for automatic detection or specify exact values.",descriptionVi:"Ghi đè phát hiện dự án tự động. Đặt 'auto' để tự động phát hiện hoặc chỉ định giá trị cụ thể.",effect:"type: single-repo/monorepo/library. packageManager: npm/yarn/pnpm/bun. framework: next/nuxt/astro/etc.",effectVi:"type: single-repo/monorepo/library. packageManager: npm/yarn/pnpm/bun. framework: next/nuxt/astro/v.v."},codingLevel:{path:"codingLevel",type:"number",default:"-1",validValues:["-1","0","1","2","3","4","5"],description:"Controls the communication style and depth of explanations based on user's coding experience level.",descriptionVi:"Điều khiển phong cách giao tiếp và độ sâu giải thích dựa trên trình độ lập trình của người dùng.",effect:"Loads corresponding output style and injects it into the session context. Changes how Claude explains code and structures responses.",effectVi:"Tải phong cách đầu ra tương ứng và đưa vào ngữ cảnh phiên. Thay đổi cách Claude giải thích code và cấu trúc phản hồi.",example:`{
31
31
  "codingLevel": 1
32
32
  }`},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:`{
33
33
  "privacyBlock": false
@@ -47,7 +47,7 @@ Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}
47
47
  "plan": {
48
48
  "reportsDir": "reports"
49
49
  }
50
- }`},"plan.resolution.order":{path:"plan.resolution.order",type:"string[]",default:'["session", "branch"]',validValues:["session","branch"],description:"Order of resolution methods to try when finding the active plan.",descriptionVi:"Thứ tự các phương thức giải quyết để tìm kế hoạch đang hoạt động.",example:`{
50
+ }`},"plan.resolution.order":{path:"plan.resolution.order",type:"string[]",default:'["session", "branch"]',validValues:["session","branch","directory"],description:"Order of resolution methods to try when finding the active plan.",descriptionVi:"Thứ tự các phương thức giải quyết để tìm kế hoạch đang hoạt động.",example:`{
51
51
  "plan": {
52
52
  "resolution": {
53
53
  "order": ["session", "branch"]
@@ -59,7 +59,7 @@ Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}
59
59
  "branchPattern": "(?:feat|fix)/(.+)"
60
60
  }
61
61
  }
62
- }`},"plan.validation.mode":{path:"plan.validation.mode",type:"string",default:'"prompt"',validValues:["auto","prompt","off"],description:"Controls when plan validation interview runs.",descriptionVi:"Điều khiển thời điểm chạy phỏng vấn xác thực kế hoạch.",example:`{
62
+ }`},"plan.validation.mode":{path:"plan.validation.mode",type:"string",default:'"prompt"',validValues:["prompt","auto","strict","none"],description:"Controls when plan validation interview runs.",descriptionVi:"Điều khiển thời điểm chạy phỏng vấn xác thực kế hoạch.",example:`{
63
63
  "plan": {
64
64
  "validation": {
65
65
  "mode": "auto"
@@ -123,7 +123,7 @@ Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}
123
123
  "docs": {
124
124
  "maxLoc": 1000
125
125
  }
126
- }`},gemini:{path:"gemini",type:"object",default:"{}",description:"Configuration for Google Gemini API integration used for CLI commands and research tasks.",descriptionVi:"Cấu hình tích hợp Google Gemini API dùng cho lệnh CLI và tác vụ nghiên cứu.",effect:"Controls which Gemini model is used for research, web search, and other AI-powered CLI operations.",effectVi:"Điều khiển model Gemini nào được dùng cho nghiên cứu, tìm kiếm web và các thao tác CLI hỗ trợ AI khác."},"gemini.model":{path:"gemini.model",type:"string",default:'"gemini-3-flash-preview"',validValues:["gemini-2.5-flash","gemini-2.5-pro","gemini-3-pro-preview","gemini-3-flash-preview"],description:"Gemini model used for CLI commands and research operations.",descriptionVi:"Model Gemini dùng cho lệnh CLI và thao tác nghiên cứu.",effect:"Determines which Gemini model handles research, web search, and other auxiliary tasks. Flash models are faster but less capable than Pro models.",effectVi:"Xác định model Gemini nào xử lý nghiên cứu, tìm kiếm web và các tác vụ phụ trợ khác. Model Flash nhanh hơn nhưng kém khả năng hơn model Pro.",example:`{
126
+ }`},gemini:{path:"gemini",type:"object",default:"{}",description:"Configuration for Google Gemini API integration used for CLI commands and research tasks.",descriptionVi:"Cấu hình tích hợp Google Gemini API dùng cho lệnh CLI và tác vụ nghiên cứu.",effect:"Controls which Gemini model is used for research, web search, and other AI-powered CLI operations.",effectVi:"Điều khiển model Gemini nào được dùng cho nghiên cứu, tìm kiếm web và các thao tác CLI hỗ trợ AI khác."},"gemini.model":{path:"gemini.model",type:"string",default:'"gemini-3-flash-preview"',validValues:["gemini-2.5-flash","gemini-2.5-pro","gemini-3-pro-preview","gemini-3-flash-preview"],description:"Gemini model used for CLI commands and research operations. Legacy gemini-3.0-* ids are auto-mapped on load.",descriptionVi:"Model Gemini dùng cho lệnh CLI và thao tác nghiên cứu. Các id gemini-3.0-* cũ sẽ được tự động ánh xạ khi tải.",effect:"Determines which Gemini model handles research, web search, and other auxiliary tasks. Flash models are faster but less capable than Pro models.",effectVi:"Xác định model Gemini nào xử lý nghiên cứu, tìm kiếm web và các tác vụ phụ trợ khác. Model Flash nhanh hơn nhưng kém khả năng hơn model Pro.",example:`{
127
127
  "gemini": {
128
128
  "model": "gemini-2.5-pro"
129
129
  }
@@ -149,7 +149,7 @@ Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}
149
149
  "hooks": {
150
150
  "dev-rules-reminder": false
151
151
  }
152
- }`},"hooks.usage-context-awareness":{path:"hooks.usage-context-awareness",type:"boolean",default:"true",description:"Monitors token usage and rate limits, injects awareness context to prevent overruns.",descriptionVi:"Giám sát sử dụng token và giới hạn tốc độ, tiêm ngữ cảnh nhận biết để ngăn vượt quá.",effect:"When approaching token limits or rate limits, warns the agent to be more concise or split operations.",effectVi:"Khi tiến gần giới hạn token hoặc giới hạn tốc độ, cảnh báo agent để ngắn gọn hơn hoặc chia nhỏ thao tác.",example:`{
152
+ }`},"hooks.usage-context-awareness":{path:"hooks.usage-context-awareness",type:"boolean",default:"true",description:"Injects usage-limit awareness into prompt context so the agent can react before overruns.",descriptionVi:"Tiêm nhận biết giới hạn sử dụng vào ngữ cảnh prompt để agent phản ứng trước khi vượt quá.",effect:"When enabled, reminder context can warn the agent to stay concise or split work when usage windows are tight.",effectVi:"Khi bật, ngữ cảnh nhắc nhở thể cảnh báo agent nên ngắn gọn hơn hoặc chia nhỏ công việc khi cửa sổ sử dụng trở nên chặt.",example:`{
153
153
  "hooks": {
154
154
  "usage-context-awareness": false
155
155
  }
@@ -191,6 +191,8 @@ Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}
191
191
  "statusline": "compact"
192
192
  }`},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:`{
193
193
  "statuslineColors": false
194
+ }`},statuslineQuota:{path:"statuslineQuota",type:"boolean",default:"true",description:"Controls whether the cosmetic 5h / wk quota chips are shown in the statusline.",descriptionVi:"Kiểm soát việc các nhãn quota 5h / wk mang tính thẩm mỹ có được hiển thị trong thanh trạng thái hay không.",effect:"When enabled, the statusline shows cached 5h and weekly quota percentages. When disabled, the rest of the statusline stays intact and only the quota chips are hidden.",effectVi:"Khi bật, thanh trạng thái hiển thị phần trăm quota 5h và hàng tuần từ cache. Khi tắt, phần còn lại của thanh trạng thái vẫn giữ nguyên và chỉ ẩn các nhãn quota.",example:`{
195
+ "statuslineQuota": false
194
196
  }`},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:`{
195
197
  "assertions": ["Use strict mode", "No console.logs"]
196
198
  }`}};function Uv(t,e,n){const r={...t},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]]=n,r}function mc(t,e){const n=e.split(".");let r=t;for(const i of n){if(r==null||typeof r!="object")return;r=r[i]}return r}function Jm(t,e){const n=e.split(".");let r=t;for(const i of n){if(!r.properties)return{};const s=r.properties;if(!s[i])return{};r=s[i]}return r}function Kv(t){if(Array.isArray(t.oneOf)){const e=t.oneOf.map(n=>{if(!n||typeof n!="object")return null;const r=n;return r.const!==void 0?JSON.stringify(r.const):r.type==="array"&&r.items?"string[]":Array.isArray(r.type)?r.type.join(" | "):typeof r.type=="string"?r.type:null}).filter(n=>!!n);return e.length>0?e.join(" | "):"unknown"}return Array.isArray(t.type)?t.type.join(" | "):typeof t.type=="string"?t.type:"unknown"}function Gv(t,e){if(!t)return null;const n=qm[t];if(n)return n;if(!e)return null;const r=Jm(e,t);if(Object.keys(r).length===0)return null;const i=Array.isArray(r.enum)?r.enum.map(s=>String(s)):Array.isArray(r.oneOf)?r.oneOf.map(s=>{if(!s||typeof s!="object")return null;const o=s;return o.const!==void 0?String(o.const):null}).filter(s=>!!s):void 0;return{path:t,type:Kv(r),default:r.default!==void 0?JSON.stringify(r.default):"n/a",validValues:i&&i.length>0?i:void 0,description:typeof r.description=="string"?r.description:"Schema-derived help is available for this field.",descriptionVi:typeof r.description=="string"?r.description:"Trường này đang hiển thị mô tả được suy ra từ schema."}}function qv(t,e){return t??e??null}function li(t){return t==="auto"?"auto":Array.isArray(t)?t.join(", "):typeof t=="string"?t:""}function Jv(t){const e=t.trim();return(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e).trim().toLowerCase()}function Yv(t){const e=t.trim();if(!e)return[];try{const n=JSON.parse(e);if(typeof n=="string"||Array.isArray(n))return n}catch{}return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1).split(",").map(n=>n.trim()).filter(Boolean):e}function Ym(t){const e=Yv(t),n=(Array.isArray(e)?e:String(e).split(",")).map(Jv).filter(Boolean).filter((r,i,s)=>s.indexOf(r)===i);return n.length===0||n.length===1&&n[0]==="auto"?"auto":n.filter(r=>r!=="auto")}function Qv(t){return t.trim()===""?null:Ym(t)}const Xv=({value:t,onChange:e,onFocus:n,disabled:r})=>h.jsx("input",{type:"text",value:t??"",onChange:i=>e(i.target.value||null),onFocus:n,disabled:r,className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
@@ -219,25 +221,25 @@ Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}
219
221
  text-dash-text placeholder-dash-text-muted
220
222
  focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
221
223
  disabled:opacity-50 disabled:cursor-not-allowed
222
- transition-colors`,placeholder:"Enter passphrase..."}),h.jsx("button",{type:"button",onClick:()=>s(!i),className:"absolute right-2 top-1/2 -translate-y-1/2 text-dash-text-muted hover:text-dash-text transition-colors",children:i?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"})]})})]})},s2={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"},o2=({source:t})=>{const{t:e}=he(),n=()=>{switch(t){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 ${s2[t]}`,children:n()})};function a2(t,e){if(e.includes("passphrase")||e.includes("password"))return"password";if(Array.isArray(t.oneOf)&&t.oneOf.some(r=>r.const==="auto")&&t.oneOf.some(r=>r.type==="array"&&r.items?.type==="string"))return"string-array-union";if(t.enum&&t.enum.length>0)return"enum";switch(Array.isArray(t.type)?t.type.find(r=>r!=="null")||"string":t.type||"string"){case"boolean":return"boolean";case"integer":case"number":return"number";case"array":return"array";case"object":return"object";default:return"string"}}const l2=({fieldPath:t,label:e,description:n,schema:r,value:i,source:s,onChange:o,onFocus:a,disabled:l})=>{const c=a2(r,t),d=()=>{const u={value:i,onChange:o,onFocus:a,schema:r,disabled:l};switch(c){case"boolean":return h.jsx(e2,{...u});case"number":return h.jsx(Zv,{...u});case"enum":return h.jsx(t2,{...u});case"string-array-union":return h.jsx(n2,{...u});case"array":return h.jsx(r2,{...u});case"password":return h.jsx(i2,{...u});case"object":return null;default:return h.jsx(Xv,{...u})}};return c==="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(o2,{source:s})]}),n&&h.jsx("p",{className:"text-xs text-dash-text-muted mb-2 leading-relaxed",children:n}),h.jsx("p",{className:"text-[10px] text-dash-text-muted/50 font-mono mb-2",children:t})]}),h.jsx("div",{className:c==="boolean"?"shrink-0":"w-1/2 max-w-xs",children:d()})]})})},c2=({id:t,title:e,defaultCollapsed:n=!1,children:r})=>{const[i,s]=g.useState(n);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-${t}`,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-${t}`,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})})]})},h2=({schema:t,value:e,sources:n,sections:r,onChange:i,onFieldFocus:s,disabled:o})=>h.jsx("div",{className:"space-y-4",children:r.map((a,l)=>h.jsx(c2,{id:a.id,title:a.title,defaultCollapsed:a.defaultCollapsed??l>1,children:a.fields.map(c=>{const d=Jm(t,c.path),u=mc(e,c.path),f=n[c.path]||"default";return h.jsx(l2,{fieldPath:c.path,label:c.label,description:c.description||d.description,schema:d,value:u,source:f,onChange:p=>i(c.path,p),onFocus:()=>s?.(c.path),disabled:o},c.path)})},a.id))}),Qm=({width:t,isLoading:e,schema:n,config:r,sources:i,sections:s,onChange:o,onFieldFocus:a,onNaturalHeightChange:l})=>{const{t:c}=he(),d=g.useRef(null),u=g.useRef(null),f=g.useRef(null),p=g.useRef(null);return g.useEffect(()=>{if(!l)return;const m=()=>{const x=u.current?.getBoundingClientRect().height??0,w=f.current;if(!w){l(Math.ceil(x));return}const v=window.getComputedStyle(w),S=Number.parseFloat(v.paddingTop||"0"),C=Number.parseFloat(v.paddingBottom||"0"),k=p.current?.getBoundingClientRect().height??0;l(Math.ceil(x+S+C+k))};if(m(),typeof ResizeObserver>"u")return;const b=new ResizeObserver(()=>{m()});return d.current&&b.observe(d.current),u.current&&b.observe(u.current),f.current&&b.observe(f.current),p.current&&b.observe(p.current),()=>b.disconnect()},[l]),h.jsxs("div",{ref:d,"data-form-panel":!0,style:{width:`${t}%`},className:"bg-dash-surface border border-dash-border rounded-xl overflow-hidden flex flex-col shadow-sm min-w-0 h-full",children:[h.jsx("div",{ref:u,"data-form-panel-header":!0,className:"p-3 border-b border-dash-border bg-dash-surface-hover/50 shrink-0",children:h.jsx("h3",{className:"text-xs font-bold text-dash-text-secondary uppercase tracking-widest",children:c("formTab")})}),h.jsx("div",{ref:f,"data-form-panel-scroll":!0,className:"flex-1 overflow-auto p-4",children:h.jsx("div",{ref:p,"data-form-panel-content":!0,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:c("loading")})}):n?h.jsx(h2,{schema:n,value:r,sources:i,sections:s,onChange:o,onFieldFocus:a}):null})})]})},Xm=1024;let d2=0,cl=class{constructor(e,n){this.from=e,this.to=n}};class fe{constructor(e={}){this.id=d2++,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)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}fe.closedBy=new fe({deserialize:t=>t.split(" ")});fe.openedBy=new fe({deserialize:t=>t.split(" ")});fe.group=new fe({deserialize:t=>t.split(" ")});fe.isolate=new fe({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});fe.contextHash=new fe({perNode:!0});fe.lookAhead=new fe({perNode:!0});fe.mounted=new fe({perNode:!0});class ji{constructor(e,n,r,i=!1){this.tree=e,this.overlay=n,this.parser=r,this.bracketed=i}static get(e){return e&&e.props&&e.props[fe.mounted.id]}}const u2=Object.create(null);class pt{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):u2,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new pt(e.name||"",n,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");n[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 n=this.prop(fe.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(fe.group),s=-1;s<(i?i.length:0);s++){let o=n[s<0?r.name:i[s]];if(o)return o}}}}pt.none=new pt("",Object.create(null),0,8);class jh{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let 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}}n.push(i?new pt(r.name,i,r.id,r.flags):r)}return new jh(n)}}const uo=new WeakMap,ou=new WeakMap;var Le;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(Le||(Le={}));class Be{constructor(e,n,r,i,s){if(this.type=e,this.children=n,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=ji.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let i=r.toString();i&&(n&&(n+=","),n+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new bc(this.topNode,e)}cursorAt(e,n=0,r=0){let i=uo.get(this)||this.topNode,s=new bc(i);return s.moveTo(e,n),uo.set(this,s._tree),s}get topNode(){return new Et(this,0,0,null)}resolve(e,n=0){let r=Ii(uo.get(this)||this.topNode,e,n,!1);return uo.set(this,r),r}resolveInner(e,n=0){let r=Ii(ou.get(this)||this.topNode,e,n,!0);return ou.set(this,r),r}resolveStack(e,n=0){return m2(this,e,n)}iterate(e){let{enter:n,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||n(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 n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:Nh(pt.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new Be(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new Be(pt.none,n,r,i)))}static build(e){return g2(e)}}Be.empty=new Be(pt.none,[],[],0);class Oh{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Oh(this.buffer,this.index)}}class Rn{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return pt.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],i=this.set.types[n],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,n,r,i,s){let{buffer:o}=this,a=-1;for(let l=e;l!=n&&!(Zm(s,i,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,n,r){let i=this.buffer,s=new Uint16Array(n-e),o=0;for(let a=e,l=0;a<n;){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 Zm(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function Ii(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let o=!r&&t instanceof Et&&t.index<0?null:t.parent;if(!o)return t;t=o}let s=r?0:Le.IgnoreOverlays;if(r)for(let o=t,a=o.parent;a;o=a,a=o.parent)o instanceof Et&&o.index<0&&((i=a.enter(e,n,s))===null||i===void 0?void 0:i.from)!=o.from&&(t=a);for(;;){let o=t.enter(e,n,s);if(!o)return t;t=o}}class eg{cursor(e=0){return new bc(this,e)}getChild(e,n=null,r=null){let i=au(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return au(this,e,n,r)}resolve(e,n=0){return Ii(this,e,n,!1)}resolveInner(e,n=0){return Ii(this,e,n,!0)}matchContext(e){return gc(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let i=n.lastChild;if(!i||i.to!=n.to)break;i.type.isError&&i.from==i.to?(r=n,n=i.prevSibling):n=i}return r}get node(){return this}get next(){return this.parent}}class Et extends eg{constructor(e,n,r,i){super(),this._tree=e,this.from=n,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,n,r,i,s=0){var o;for(let a=this;;){for(let{children:l,positions:c}=a._tree,d=n>0?l.length:-1;e!=d;e+=n){let u=l[e],f=c[e]+a.from;if(!(!(s&Le.EnterBracketed&&u instanceof Be&&((o=ji.get(u))===null||o===void 0?void 0:o.overlay)===null&&(f>=r||f+u.length<=r))&&!Zm(i,r,f,f+u.length))){if(u instanceof Rn){if(s&Le.ExcludeBuffers)continue;let p=u.findChild(0,u.buffer.length,n,r-f,i);if(p>-1)return new Mn(new f2(a,u,e,f),null,p)}else if(s&Le.IncludeAnonymous||!u.type.isAnonymous||Ph(u)){let p;if(!(s&Le.IgnoreMounts)&&(p=ji.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(n<0?u.children.length-1:0,n,r,i,s)}}}if(s&Le.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+n:e=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,n,r=0){let i;if(!(r&Le.IgnoreOverlays)&&(i=ji.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((n>0||o?a<=s:a<s)&&(n<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,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function au(t,e,n,r){let i=t.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let o=!1;!o;)if(o=i.type.is(n),!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 gc(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class f2{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class Mn extends eg{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-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,n,r=0){if(r&Le.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);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,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Mn(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new Mn(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{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)),n.push(0)}return new Be(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function tg(t){if(!t.length)return null;let e=0,n=t[0];for(let s=1;s<t.length;s++){let o=t[s];(o.from>n.from||o.to<n.to)&&(n=o,e=s)}let r=n instanceof Et&&n.index<0?null:n.parent,i=t.slice();return r?i[e]=r:i.splice(e,1),new p2(i,n)}class p2{constructor(e,n){this.heads=e,this.node=n}get next(){return tg(this.heads)}}function m2(t,e,n){let r=t.resolveInner(e,n),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,n)),s=o}else{let o=ji.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(Ii(a,e,n,!1))}}return i?tg(i):r}class bc{get name(){return this.type.name}constructor(e,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~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,n){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=n||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,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-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,n,r=this.mode){return this.buffer?r&Le.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,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:n}=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(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.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 n,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:n,parent:r}=i)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let s=n+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||Ph(a))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let 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;n=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)n=new Mn(this.buffer,n,this.stack[i]);return this.bufferNode=new Mn(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){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&&n&&n(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return gc(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return gc(this._tree,e,i);let o=r[n.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function Ph(t){return t.children.some(e=>e instanceof Rn||!e.type.isAnonymous||Ph(e))}function g2(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=Xm,reused:s=[],minRepeatType:o=r.types.length}=t,a=Array.isArray(n)?new Oh(n,n.length):n,l=r.types,c=0,d=0;function u(k,O,y,M,A,R){let{id:N,start:L,end:H,size:$}=a,F=d,G=c;if($<0)if(a.next(),$==-1){let pe=s[N];y.push(pe),M.push(L-k);return}else if($==-3){c=N;return}else if($==-4){d=N;return}else throw new RangeError(`Unrecognized record size: ${$}`);let ue=l[N],X,te,oe=L-k;if(H-L<=i&&(te=x(a.pos-O,A))){let pe=new Uint16Array(te.size-te.skip),Y=a.pos-te.size,le=pe.length;for(;a.pos>Y;)le=w(te.start,pe,le);X=new Rn(pe,H-te.start,r),oe=te.start-k}else{let pe=a.pos-$;a.next();let Y=[],le=[],me=N>=o?N:-1,ke=0,Qe=H;for(;a.pos>pe;)me>=0&&a.id==me&&a.size>=0?(a.end<=Qe-i&&(m(Y,le,L,ke,a.end,Qe,me,F,G),ke=Y.length,Qe=a.end),a.next()):R>2500?f(L,pe,Y,le):u(L,pe,Y,le,me,R+1);if(me>=0&&ke>0&&ke<Y.length&&m(Y,le,L,ke,L,Qe,me,F,G),Y.reverse(),le.reverse(),me>-1&&ke>0){let mt=p(ue,G);X=Nh(ue,Y,le,0,Y.length,0,H-L,mt,mt)}else X=b(ue,Y,le,H-L,F-H,G)}y.push(X),M.push(oe)}function f(k,O,y,M){let A=[],R=0,N=-1;for(;a.pos>O;){let{id:L,start:H,end:$,size:F}=a;if(F>4)a.next();else{if(N>-1&&H<N)break;N<0&&(N=$-i),A.push(L,H,$),R++,a.next()}}if(R){let L=new Uint16Array(R*4),H=A[A.length-2];for(let $=A.length-3,F=0;$>=0;$-=3)L[F++]=A[$],L[F++]=A[$+1]-H,L[F++]=A[$+2]-H,L[F++]=F;y.push(new Rn(L,A[2]-H,r)),M.push(H-k)}}function p(k,O){return(y,M,A)=>{let R=0,N=y.length-1,L,H;if(N>=0&&(L=y[N])instanceof Be){if(!N&&L.type==k&&L.length==A)return L;(H=L.prop(fe.lookAhead))&&(R=M[N]+L.length+H)}return b(k,y,M,A,R,O)}}function m(k,O,y,M,A,R,N,L,H){let $=[],F=[];for(;k.length>M;)$.push(k.pop()),F.push(O.pop()+y-A);k.push(b(r.types[N],$,F,R-A,L-R,H)),O.push(A-y)}function b(k,O,y,M,A,R,N){if(R){let L=[fe.contextHash,R];N=N?[L].concat(N):[L]}if(A>25){let L=[fe.lookAhead,A];N=N?[L].concat(N):[L]}return new Be(k,O,y,M,N)}function x(k,O){let y=a.fork(),M=0,A=0,R=0,N=y.end-i,L={size:0,start:0,skip:0};e:for(let H=y.pos-k;y.pos>H;){let $=y.size;if(y.id==O&&$>=0){L.size=M,L.start=A,L.skip=R,R+=4,M+=4,y.next();continue}let F=y.pos-$;if($<0||F<H||y.start<N)break;let G=y.id>=o?4:0,ue=y.start;for(y.next();y.pos>F;){if(y.size<0)if(y.size==-3||y.size==-4)G+=4;else break e;else y.id>=o&&(G+=4);y.next()}A=ue,M+=$,R+=G}return(O<0||M==k)&&(L.size=M,L.start=A,L.skip=R),L.size>4?L:void 0}function w(k,O,y){let{id:M,start:A,end:R,size:N}=a;if(a.next(),N>=0&&M<o){let L=y;if(N>4){let H=a.pos-(N-4);for(;a.pos>H;)y=w(k,O,y)}O[--y]=L,O[--y]=R-k,O[--y]=A-k,O[--y]=M}else N==-3?c=M:N==-4&&(d=M);return y}let v=[],S=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,v,S,-1,0);let C=(e=t.length)!==null&&e!==void 0?e:v.length?S[0]+v[0].length:0;return new Be(l[t.topID],v.reverse(),S.reverse(),C)}const lu=new WeakMap;function Uo(t,e){if(!t.isAnonymous||e instanceof Rn||e.type!=t)return 1;let n=lu.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Be)){n=1;break}n+=Uo(t,r)}lu.set(e,n)}return n}function Nh(t,e,n,r,i,s,o,a,l){let c=0;for(let m=r;m<i;m++)c+=Uo(t,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 C=S,k=b[S],O=Uo(t,m[S]);for(S++;S<w;S++){let y=Uo(t,m[S]);if(O+y>=d)break;O+=y}if(S==C+1){if(O>d){let y=m[C];p(y.children,y.positions,0,y.children.length,b[C]+v);continue}u.push(m[C])}else{let y=b[S-1]+m[S-1].length-k;u.push(Nh(t,m,b,C,S,k,y,null,l))}f.push(k+v-s)}}return p(e,n,r,i,0),(a||l)(u,f,o)}class sr{constructor(e,n,r,i,s=!1,o=!1){this.from=e,this.to=n,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,n=[],r=!1){let i=[new sr(0,e.length,e,0,!1,r)];for(let s of n)s.to>e.length&&i.push(s);return i}static applyChanges(e,n,r=128){if(!n.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<n.length?n[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 sr(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 ng{startParse(e,n,r){return typeof e=="string"&&(e=new b2(e)),r=r?r.length?r.map(i=>new cl(i.from,i.to)):[new cl(0,0)]:[new cl(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let s=i.advance();if(s)return s}}}class b2{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new fe({perNode:!0});var cu={};class na{constructor(e,n,r,i,s,o,a,l,c,d=0,u){this.p=e,this.stack=n,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,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let i=e.parser.context;return new na(e,[],n,r,r,0,[],0,i?new hu(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,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&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.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,n,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(n==r)return;if(o.buffer[a-2]>=n){o.buffer[a-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,n,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]=n,this.buffer[o+2]=r,this.buffer[o+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=i,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,i,4);else{let s=e,{parser:o}=this.p;(i>this.pos||n<=o.maxNode)&&(this.pos=i,o.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,r),this.shiftContext(n,r),n<=o.maxNode&&this.buffer.push(n,r,i,4)}}apply(e,n,r,i){e&65536?this.reduce(e):this.shift(e,n,r,i)}useNode(e,n){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(n,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,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),i=e.bufferBase+n;for(;e&&i==e.bufferBase;)e=e.parent;return new na(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new x2(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if(!(r&65536))return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let i=[];for(let s=0,o;s<n.length;s+=2)(o=n[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&i.push(n[s],o);if(this.stack.length<120)for(let s=0;i.length<8&&s<n.length;s+=2){let o=n[s+1];i.some((a,l)=>l&1&&a==o)||i.push(n[s],o)}n=i}let r=[];for(let i=0;i<n.length&&r.length<4;i+=2){let s=n[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(n[i],this.pos),o.reducePos=this.pos,o.score-=200,r.push(o)}return r}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if(!(n&65536))return!1;if(!e.validAction(this.state,n)){let r=n>>19,i=n&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;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(i,s)=>{if(!n.includes(i))return n.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 n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new hu(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class hu{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class x2{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=i}}class ra{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new ra(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new ra(this.stack,this.pos,this.index)}}function fo(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r<t.length;){let s=0;for(;;){let o=t.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}n?n[i++]=s:n=new e(s)}return n}class Ko{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const du=new Ko;class y2{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=du,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,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(;n<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 n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,i;if(n>=0&&n<this.chunk.length)r=this.pos+e,i=this.chunk.charCodeAt(n);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,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=du,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let i of this.ranges){if(i.from>=n)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,n)))}return r}}class Nr{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;v2(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Nr.prototype.contextual=Nr.prototype.fallback=Nr.prototype.extend=!1;Nr.prototype.fallback=Nr.prototype.extend=!1;function v2(t,e,n,r,i,s){let o=0,a=1<<r,{dialect:l}=n.p.parser;e:for(;a&t[o];){let c=t[o+1];for(let p=o+3;p<c;p+=2)if((t[p+1]&a)>0){let m=t[p];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||w2(m,e.token.value,i,s))){e.acceptToken(m);break}}let d=e.next,u=0,f=t[o+2];if(e.next<0&&f>u&&t[c+f*3-3]==65535){o=t[c+f*3-1];continue e}for(;u<f;){let p=u+f>>1,m=c+p+(p<<1),b=t[m],x=t[m+1]||65536;if(d<b)f=p;else if(d>=x)u=p+1;else{o=t[m+2],e.advance();continue e}}break}}function uu(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function w2(t,e,n,r){let i=uu(n,r,e);return i<0||uu(n,r,t)<i}const bt=typeof process<"u"&&cu&&/\bparse\b/.test(cu.LOG);let hl=null;function fu(t,e,n){let r=t.cursor(Le.IncludeAnonymous);for(r.moveTo(e);;)if(!(n<0?r.childBefore(e):r.childAfter(e)))for(;;){if((n<0?r.to<e:r.from>e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class k2{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?fu(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?fu(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],i=this.index[n];if(i==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=r.children[i],o=this.start[n]+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(fe.lookAhead);if(!l||a+l<this.fragment.to)return s}}this.index[n]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+s.length}}}class S2{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Ko)}getActions(e){let n=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=n;if(u.extended>-1&&(n=this.addActions(e,u.extended,u.end,n)),n=this.addActions(e,u.value,u.end,n),!d.extend&&(r=u,n>f))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new Ko,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new Ko,{pos:r,p:i}=e;return n.start=r,n.end=Math.min(r+1,i.stream.end),n.value=r==i.stream.end?i.parser.eofTerm:0,n}updateCachedToken(e,n,r){let i=this.stream.clipPos(r.pos);if(n.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,n,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++]=n,this.actions[i++]=r,i}addActions(e,n,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),n,r,i));break}a[c]==n&&(i=this.putAction(mn(a,c+1),n,r,i))}return i}}class C2{constructor(e,n,r,i){this.parser=e,this.input=n,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 y2(n,i),this.tokens=new S2(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[na.start(this,e.top[0],s)],this.fragments=r.length&&this.stream.end-s>e.bufferLength*4?new k2(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=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>n)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&&O2(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 "+n);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>n)&&this.recovering--}else if(r.length>1){e:for(let o=0;o<r.length-1;o++){let a=r[o];for(let l=o+1;l<r.length;l++){let 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,n,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(fe.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?n.push(m):r.push(m)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return pu(e,n),!0}}runRecovery(e,n,r){let i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o],l=n[o<<1],c=n[(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)})`),pu(a,r)):(!i||i.score<a.score)&&(i=a)}return i}stackToTree(e){return e.close(),Be.build({buffer:ra.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let n=(hl||(hl=new WeakMap)).get(e);return n||hl.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function pu(t,e){for(let n=0;n<e.length;n++){let r=e[n];if(r.pos==t.pos&&r.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class j2{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}class ia extends ng{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let a=0;a<e.repeatNodeCount;a++)n.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),i=[];for(let a=0;a<n.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=fe[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 jh(n.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=Xm;let o=fo(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(mu),this.states=fo(e.states,Uint32Array),this.data=fo(e.stateData),this.goto=fo(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,n,r){let i=new C2(this,e,n,r);for(let s of this.wrappers)i=s(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let s=i[n+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,n){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==n||o==0)return mn(r,s+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),i=r?n(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=n(mn(this.data,s+1))}return i}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=mn(this.data,r+2);else break;if(!(this.data[r+2]&1)){let i=this.data[r+1];n.some((s,o)=>o&1&&s==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create(ia.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(s=>s.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.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 n.specializers[i]=mu(o),o})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let s of e.split(" ")){let o=n.indexOf(s);o>=0&&(r[o]=!0)}let i=null;for(let s=0;s<n.length;s++)if(!r[s])for(let o=this.dialects[n[s]],a;(a=this.data[o++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new j2(e,r,i)}static deserialize(e){return new ia(e)}}function mn(t,e){return t[e]|t[e+1]<<16}function O2(t){let e=null;for(let n of t){let r=n.p.stoppedAt;(n.pos==n.p.stream.end||r!=null&&n.pos>r)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function mu(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}let P2=0;class At{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=P2++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof At&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let i=new At(r,[],null,[]);if(i.set.push(i),n)for(let s of n.set)i.set.push(s);return i}static defineModifier(e){let n=new sa(e);return r=>r.modified.indexOf(n)>-1?r:sa.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}}let N2=0;class sa{constructor(e){this.name=e,this.instances=[],this.id=N2++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&A2(n,a.modified));if(r)return r;let i=[],s=new At(e.name,i,e,n);for(let a of n)a.instances.push(s);let o=M2(n);for(let a of e.set)if(!a.modified.length)for(let l of o)i.push(sa.get(a,l));return s}}function A2(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function M2(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function rg(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let i of n.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 $i(r,o,l>0?s.slice(0,l):null);e[c]=d.sort(e[c])}}return ig.add(e)}const ig=new fe({combine(t,e){let n,r,i;for(;t||e;){if(!t||e&&t.depth>=e.depth?(i=e,e=e.next):(i=t,t=t.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let s=new $i(i.tags,i.mode,i.context);n?n.next=s:r=s,n=s}return r}});class $i{constructor(e,n,r,i){this.tags=e,this.mode=n,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}}$i.empty=new $i([],2,null);function sg(t,e){let n=Object.create(null);for(let s of t)if(!Array.isArray(s.tag))n[s.tag.id]=s.class;else for(let o of s.tag)n[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=n[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function D2(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function T2(t,e,n,r=0,i=t.length){let s=new E2(r,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),r,i,"",s.highlighters),s.flush(i)}class E2{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,i,s){let{type:o,from:a,to:l}=e;if(a>=r||l<=n)return;o.isTop&&(s=this.highlighters.filter(p=>!p.scope||p.scope(o)));let c=i,d=R2(e)||$i.empty,u=D2(s,d.tags);if(u&&(c&&(c+=" "),c+=u,d.mode==1&&(i+=(i?" ":"")+u)),this.startSpan(Math.max(n,a),c),d.opaque)return;let f=e.tree&&e.tree.prop(fe.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,C=Math.max(n,w),k=Math.min(r,S);if(C<k&&b)for(;e.from<k&&(this.highlightRange(e,C,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>n&&(this.highlightRange(p.cursor(),Math.max(n,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<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,s),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function R2(t){let e=t.type.prop(ig);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const z=At.define,po=z(),Sn=z(),gu=z(Sn),bu=z(Sn),Cn=z(),mo=z(Cn),dl=z(Cn),Yt=z(),qn=z(Yt),Gt=z(),qt=z(),xc=z(),ci=z(xc),go=z(),T={comment:po,lineComment:z(po),blockComment:z(po),docComment:z(po),name:Sn,variableName:z(Sn),typeName:gu,tagName:z(gu),propertyName:bu,attributeName:z(bu),className:z(Sn),labelName:z(Sn),namespace:z(Sn),macroName:z(Sn),literal:Cn,string:mo,docString:z(mo),character:z(mo),attributeValue:z(mo),number:dl,integer:z(dl),float:z(dl),bool:z(Cn),regexp:z(Cn),escape:z(Cn),color:z(Cn),url:z(Cn),keyword:Gt,self:z(Gt),null:z(Gt),atom:z(Gt),unit:z(Gt),modifier:z(Gt),operatorKeyword:z(Gt),controlKeyword:z(Gt),definitionKeyword:z(Gt),moduleKeyword:z(Gt),operator:qt,derefOperator:z(qt),arithmeticOperator:z(qt),logicOperator:z(qt),bitwiseOperator:z(qt),compareOperator:z(qt),updateOperator:z(qt),definitionOperator:z(qt),typeOperator:z(qt),controlOperator:z(qt),punctuation:xc,separator:z(xc),bracket:ci,angleBracket:z(ci),squareBracket:z(ci),paren:z(ci),brace:z(ci),content:Yt,heading:qn,heading1:z(qn),heading2:z(qn),heading3:z(qn),heading4:z(qn),heading5:z(qn),heading6:z(qn),contentSeparator:z(Yt),list:z(Yt),quote:z(Yt),emphasis:z(Yt),strong:z(Yt),link:z(Yt),monospace:z(Yt),strikethrough:z(Yt),inserted:z(),deleted:z(),changed:z(),invalid:z(),meta:go,documentMeta:z(go),annotation:z(go),processingInstruction:z(go),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 t in T){let e=T[t];e instanceof At&&(e.name=t)}sg([{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 L2=rg({String:T.string,Number:T.number,"True False":T.bool,PropertyName:T.propertyName,Null:T.null,", :":T.separator,"[ ]":T.squareBracket,"{ }":T.brace}),I2=ia.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:[L2],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 yc=[],og=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?og:yc).push(n=n+t[e])})();function $2(t){if(t<768)return!1;for(let e=0,n=yc.length;;){let r=e+n>>1;if(t<yc[r])n=r;else if(t>=og[r])e=r+1;else return!0;if(e==n)return!1}}function xu(t){return t>=127462&&t<=127487}const yu=8205;function B2(t,e,n=!0,r=!0){return(n?ag:F2)(t,e,r)}function ag(t,e,n){if(e==t.length)return e;e&&lg(t.charCodeAt(e))&&cg(t.charCodeAt(e-1))&&e--;let r=ul(t,e);for(e+=vu(r);e<t.length;){let i=ul(t,e);if(r==yu||i==yu||n&&$2(i))e+=vu(i),r=i;else if(xu(i)){let s=0,o=e-2;for(;o>=0&&xu(ul(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function F2(t,e,n){for(;e>0;){let r=ag(t,e-2,n);if(r<e)return r;e--}return 0}function ul(t,e){let n=t.charCodeAt(e);if(!cg(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return lg(r)?(n-55296<<10)+(r-56320)+65536:n}function lg(t){return t>=56320&&t<57344}function cg(t){return t>=55296&&t<56320}function vu(t){return t<65536?1:2}class we{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=Ir(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),Xt.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=Ir(this,e,n);let r=[];return this.decompose(e,n,r,0),Xt.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new Oi(this),s=new Oi(e);for(let o=n,a=n;;){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 Oi(this,e)}iterRange(e,n=this.length){return new hg(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new dg(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]?we.empty:e.length<=32?new $e(e):Xt.from($e.split(e,[]))}}class $e extends we{constructor(e,n=V2(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.text[s],a=i+o.length;if((n?r:a)>=e)return new z2(i,a,r,o);i=a+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new $e(wu(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),a=Go(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,n,r){if(!(r instanceof $e))return super.replace(e,n,r);[e,n]=Ir(this,e,n);let i=Go(this.text,Go(r.text,wu(this.text,0,e)),n),s=this.length+r.length-(n-e);return i.length<=32?new $e(i,s):Xt.from($e.split(i,[]),s)}sliceString(e,n=this.length,r=`
224
+ transition-colors`,placeholder:"Enter passphrase..."}),h.jsx("button",{type:"button",onClick:()=>s(!i),className:"absolute right-2 top-1/2 -translate-y-1/2 text-dash-text-muted hover:text-dash-text transition-colors",children:i?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"})]})})]})},s2={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"},o2=({source:t})=>{const{t:e}=he(),n=()=>{switch(t){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 ${s2[t]}`,children:n()})};function a2(t,e){if(e.includes("passphrase")||e.includes("password"))return"password";if(Array.isArray(t.oneOf)&&t.oneOf.some(r=>r.const==="auto")&&t.oneOf.some(r=>r.type==="array"&&r.items?.type==="string"))return"string-array-union";if(t.enum&&t.enum.length>0)return"enum";switch(Array.isArray(t.type)?t.type.find(r=>r!=="null")||"string":t.type||"string"){case"boolean":return"boolean";case"integer":case"number":return"number";case"array":return"array";case"object":return"object";default:return"string"}}const l2=({fieldPath:t,label:e,description:n,schema:r,value:i,source:s,onChange:o,onFocus:a,disabled:l})=>{const c=a2(r,t),d=()=>{const u={value:i,onChange:o,onFocus:a,schema:r,disabled:l};switch(c){case"boolean":return h.jsx(e2,{...u});case"number":return h.jsx(Zv,{...u});case"enum":return h.jsx(t2,{...u});case"string-array-union":return h.jsx(n2,{...u});case"array":return h.jsx(r2,{...u});case"password":return h.jsx(i2,{...u});case"object":return null;default:return h.jsx(Xv,{...u})}};return c==="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(o2,{source:s})]}),n&&h.jsx("p",{className:"text-xs text-dash-text-muted mb-2 leading-relaxed",children:n}),h.jsx("p",{className:"text-[10px] text-dash-text-muted/50 font-mono mb-2",children:t})]}),h.jsx("div",{className:c==="boolean"?"shrink-0":"w-1/2 max-w-xs",children:d()})]})})},c2=({id:t,title:e,defaultCollapsed:n=!1,children:r})=>{const[i,s]=g.useState(n);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-${t}`,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-${t}`,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})})]})},h2=({schema:t,value:e,sources:n,sections:r,onChange:i,onFieldFocus:s,disabled:o})=>h.jsx("div",{className:"space-y-4",children:r.map((a,l)=>h.jsx(c2,{id:a.id,title:a.title,defaultCollapsed:a.defaultCollapsed??l>1,children:a.fields.map(c=>{const d=Jm(t,c.path),u=mc(e,c.path),f=n[c.path]||"default";return h.jsx(l2,{fieldPath:c.path,label:c.label,description:c.description||d.description,schema:d,value:u,source:f,onChange:p=>i(c.path,p),onFocus:()=>s?.(c.path),disabled:o},c.path)})},a.id))}),Qm=({width:t,isLoading:e,schema:n,config:r,sources:i,sections:s,onChange:o,onFieldFocus:a,onNaturalHeightChange:l})=>{const{t:c}=he(),d=g.useRef(null),u=g.useRef(null),f=g.useRef(null),p=g.useRef(null);return g.useEffect(()=>{if(!l)return;const m=()=>{const x=u.current?.getBoundingClientRect().height??0,w=f.current;if(!w){l(Math.ceil(x));return}const v=window.getComputedStyle(w),S=Number.parseFloat(v.paddingTop||"0"),C=Number.parseFloat(v.paddingBottom||"0"),k=p.current?.getBoundingClientRect().height??0;l(Math.ceil(x+S+C+k))};if(m(),typeof ResizeObserver>"u")return;const b=new ResizeObserver(()=>{m()});return d.current&&b.observe(d.current),u.current&&b.observe(u.current),f.current&&b.observe(f.current),p.current&&b.observe(p.current),()=>b.disconnect()},[l]),h.jsxs("div",{ref:d,"data-form-panel":!0,style:{width:`${t}%`},className:"bg-dash-surface border border-dash-border rounded-xl overflow-hidden flex flex-col shadow-sm min-w-0 h-full",children:[h.jsx("div",{ref:u,"data-form-panel-header":!0,className:"p-3 border-b border-dash-border bg-dash-surface-hover/50 shrink-0",children:h.jsx("h3",{className:"text-xs font-bold text-dash-text-secondary uppercase tracking-widest",children:c("formTab")})}),h.jsx("div",{ref:f,"data-form-panel-scroll":!0,className:"flex-1 overflow-auto p-4",children:h.jsx("div",{ref:p,"data-form-panel-content":!0,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:c("loading")})}):n?h.jsx(h2,{schema:n,value:r,sources:i,sections:s,onChange:o,onFieldFocus:a}):null})})]})},Xm=1024;let d2=0,cl=class{constructor(e,n){this.from=e,this.to=n}};class pe{constructor(e={}){this.id=d2++,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)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}pe.closedBy=new pe({deserialize:t=>t.split(" ")});pe.openedBy=new pe({deserialize:t=>t.split(" ")});pe.group=new pe({deserialize:t=>t.split(" ")});pe.isolate=new pe({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});pe.contextHash=new pe({perNode:!0});pe.lookAhead=new pe({perNode:!0});pe.mounted=new pe({perNode:!0});class ji{constructor(e,n,r,i=!1){this.tree=e,this.overlay=n,this.parser=r,this.bracketed=i}static get(e){return e&&e.props&&e.props[pe.mounted.id]}}const u2=Object.create(null);class pt{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):u2,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new pt(e.name||"",n,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");n[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 n=this.prop(pe.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(pe.group),s=-1;s<(i?i.length:0);s++){let o=n[s<0?r.name:i[s]];if(o)return o}}}}pt.none=new pt("",Object.create(null),0,8);class jh{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let 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}}n.push(i?new pt(r.name,i,r.id,r.flags):r)}return new jh(n)}}const uo=new WeakMap,ou=new WeakMap;var Le;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(Le||(Le={}));class Be{constructor(e,n,r,i,s){if(this.type=e,this.children=n,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=ji.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let i=r.toString();i&&(n&&(n+=","),n+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new bc(this.topNode,e)}cursorAt(e,n=0,r=0){let i=uo.get(this)||this.topNode,s=new bc(i);return s.moveTo(e,n),uo.set(this,s._tree),s}get topNode(){return new Et(this,0,0,null)}resolve(e,n=0){let r=Ii(uo.get(this)||this.topNode,e,n,!1);return uo.set(this,r),r}resolveInner(e,n=0){let r=Ii(ou.get(this)||this.topNode,e,n,!0);return ou.set(this,r),r}resolveStack(e,n=0){return m2(this,e,n)}iterate(e){let{enter:n,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||n(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 n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:Nh(pt.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new Be(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new Be(pt.none,n,r,i)))}static build(e){return g2(e)}}Be.empty=new Be(pt.none,[],[],0);class Oh{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Oh(this.buffer,this.index)}}class Rn{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return pt.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],i=this.set.types[n],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,n,r,i,s){let{buffer:o}=this,a=-1;for(let l=e;l!=n&&!(Zm(s,i,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,n,r){let i=this.buffer,s=new Uint16Array(n-e),o=0;for(let a=e,l=0;a<n;){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 Zm(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function Ii(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let o=!r&&t instanceof Et&&t.index<0?null:t.parent;if(!o)return t;t=o}let s=r?0:Le.IgnoreOverlays;if(r)for(let o=t,a=o.parent;a;o=a,a=o.parent)o instanceof Et&&o.index<0&&((i=a.enter(e,n,s))===null||i===void 0?void 0:i.from)!=o.from&&(t=a);for(;;){let o=t.enter(e,n,s);if(!o)return t;t=o}}class eg{cursor(e=0){return new bc(this,e)}getChild(e,n=null,r=null){let i=au(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return au(this,e,n,r)}resolve(e,n=0){return Ii(this,e,n,!1)}resolveInner(e,n=0){return Ii(this,e,n,!0)}matchContext(e){return gc(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let i=n.lastChild;if(!i||i.to!=n.to)break;i.type.isError&&i.from==i.to?(r=n,n=i.prevSibling):n=i}return r}get node(){return this}get next(){return this.parent}}class Et extends eg{constructor(e,n,r,i){super(),this._tree=e,this.from=n,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,n,r,i,s=0){var o;for(let a=this;;){for(let{children:l,positions:c}=a._tree,d=n>0?l.length:-1;e!=d;e+=n){let u=l[e],f=c[e]+a.from;if(!(!(s&Le.EnterBracketed&&u instanceof Be&&((o=ji.get(u))===null||o===void 0?void 0:o.overlay)===null&&(f>=r||f+u.length<=r))&&!Zm(i,r,f,f+u.length))){if(u instanceof Rn){if(s&Le.ExcludeBuffers)continue;let p=u.findChild(0,u.buffer.length,n,r-f,i);if(p>-1)return new Mn(new f2(a,u,e,f),null,p)}else if(s&Le.IncludeAnonymous||!u.type.isAnonymous||Ph(u)){let p;if(!(s&Le.IgnoreMounts)&&(p=ji.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(n<0?u.children.length-1:0,n,r,i,s)}}}if(s&Le.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+n:e=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,n,r=0){let i;if(!(r&Le.IgnoreOverlays)&&(i=ji.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((n>0||o?a<=s:a<s)&&(n<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,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function au(t,e,n,r){let i=t.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let o=!1;!o;)if(o=i.type.is(n),!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 gc(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class f2{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class Mn extends eg{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-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,n,r=0){if(r&Le.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);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,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Mn(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new Mn(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{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)),n.push(0)}return new Be(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function tg(t){if(!t.length)return null;let e=0,n=t[0];for(let s=1;s<t.length;s++){let o=t[s];(o.from>n.from||o.to<n.to)&&(n=o,e=s)}let r=n instanceof Et&&n.index<0?null:n.parent,i=t.slice();return r?i[e]=r:i.splice(e,1),new p2(i,n)}class p2{constructor(e,n){this.heads=e,this.node=n}get next(){return tg(this.heads)}}function m2(t,e,n){let r=t.resolveInner(e,n),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,n)),s=o}else{let o=ji.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(Ii(a,e,n,!1))}}return i?tg(i):r}class bc{get name(){return this.type.name}constructor(e,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~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,n){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=n||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,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-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,n,r=this.mode){return this.buffer?r&Le.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,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:n}=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(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.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 n,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:n,parent:r}=i)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let s=n+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||Ph(a))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let 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;n=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)n=new Mn(this.buffer,n,this.stack[i]);return this.bufferNode=new Mn(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){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&&n&&n(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return gc(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return gc(this._tree,e,i);let o=r[n.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function Ph(t){return t.children.some(e=>e instanceof Rn||!e.type.isAnonymous||Ph(e))}function g2(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=Xm,reused:s=[],minRepeatType:o=r.types.length}=t,a=Array.isArray(n)?new Oh(n,n.length):n,l=r.types,c=0,d=0;function u(k,O,y,M,A,R){let{id:N,start:L,end:_,size:$}=a,F=d,G=c;if($<0)if(a.next(),$==-1){let me=s[N];y.push(me),M.push(L-k);return}else if($==-3){c=N;return}else if($==-4){d=N;return}else throw new RangeError(`Unrecognized record size: ${$}`);let fe=l[N],X,te,oe=L-k;if(_-L<=i&&(te=x(a.pos-O,A))){let me=new Uint16Array(te.size-te.skip),Y=a.pos-te.size,ae=me.length;for(;a.pos>Y;)ae=w(te.start,me,ae);X=new Rn(me,_-te.start,r),oe=te.start-k}else{let me=a.pos-$;a.next();let Y=[],ae=[],de=N>=o?N:-1,ke=0,Qe=_;for(;a.pos>me;)de>=0&&a.id==de&&a.size>=0?(a.end<=Qe-i&&(m(Y,ae,L,ke,a.end,Qe,de,F,G),ke=Y.length,Qe=a.end),a.next()):R>2500?f(L,me,Y,ae):u(L,me,Y,ae,de,R+1);if(de>=0&&ke>0&&ke<Y.length&&m(Y,ae,L,ke,L,Qe,de,F,G),Y.reverse(),ae.reverse(),de>-1&&ke>0){let mt=p(fe,G);X=Nh(fe,Y,ae,0,Y.length,0,_-L,mt,mt)}else X=b(fe,Y,ae,_-L,F-_,G)}y.push(X),M.push(oe)}function f(k,O,y,M){let A=[],R=0,N=-1;for(;a.pos>O;){let{id:L,start:_,end:$,size:F}=a;if(F>4)a.next();else{if(N>-1&&_<N)break;N<0&&(N=$-i),A.push(L,_,$),R++,a.next()}}if(R){let L=new Uint16Array(R*4),_=A[A.length-2];for(let $=A.length-3,F=0;$>=0;$-=3)L[F++]=A[$],L[F++]=A[$+1]-_,L[F++]=A[$+2]-_,L[F++]=F;y.push(new Rn(L,A[2]-_,r)),M.push(_-k)}}function p(k,O){return(y,M,A)=>{let R=0,N=y.length-1,L,_;if(N>=0&&(L=y[N])instanceof Be){if(!N&&L.type==k&&L.length==A)return L;(_=L.prop(pe.lookAhead))&&(R=M[N]+L.length+_)}return b(k,y,M,A,R,O)}}function m(k,O,y,M,A,R,N,L,_){let $=[],F=[];for(;k.length>M;)$.push(k.pop()),F.push(O.pop()+y-A);k.push(b(r.types[N],$,F,R-A,L-R,_)),O.push(A-y)}function b(k,O,y,M,A,R,N){if(R){let L=[pe.contextHash,R];N=N?[L].concat(N):[L]}if(A>25){let L=[pe.lookAhead,A];N=N?[L].concat(N):[L]}return new Be(k,O,y,M,N)}function x(k,O){let y=a.fork(),M=0,A=0,R=0,N=y.end-i,L={size:0,start:0,skip:0};e:for(let _=y.pos-k;y.pos>_;){let $=y.size;if(y.id==O&&$>=0){L.size=M,L.start=A,L.skip=R,R+=4,M+=4,y.next();continue}let F=y.pos-$;if($<0||F<_||y.start<N)break;let G=y.id>=o?4:0,fe=y.start;for(y.next();y.pos>F;){if(y.size<0)if(y.size==-3||y.size==-4)G+=4;else break e;else y.id>=o&&(G+=4);y.next()}A=fe,M+=$,R+=G}return(O<0||M==k)&&(L.size=M,L.start=A,L.skip=R),L.size>4?L:void 0}function w(k,O,y){let{id:M,start:A,end:R,size:N}=a;if(a.next(),N>=0&&M<o){let L=y;if(N>4){let _=a.pos-(N-4);for(;a.pos>_;)y=w(k,O,y)}O[--y]=L,O[--y]=R-k,O[--y]=A-k,O[--y]=M}else N==-3?c=M:N==-4&&(d=M);return y}let v=[],S=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,v,S,-1,0);let C=(e=t.length)!==null&&e!==void 0?e:v.length?S[0]+v[0].length:0;return new Be(l[t.topID],v.reverse(),S.reverse(),C)}const lu=new WeakMap;function Uo(t,e){if(!t.isAnonymous||e instanceof Rn||e.type!=t)return 1;let n=lu.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Be)){n=1;break}n+=Uo(t,r)}lu.set(e,n)}return n}function Nh(t,e,n,r,i,s,o,a,l){let c=0;for(let m=r;m<i;m++)c+=Uo(t,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 C=S,k=b[S],O=Uo(t,m[S]);for(S++;S<w;S++){let y=Uo(t,m[S]);if(O+y>=d)break;O+=y}if(S==C+1){if(O>d){let y=m[C];p(y.children,y.positions,0,y.children.length,b[C]+v);continue}u.push(m[C])}else{let y=b[S-1]+m[S-1].length-k;u.push(Nh(t,m,b,C,S,k,y,null,l))}f.push(k+v-s)}}return p(e,n,r,i,0),(a||l)(u,f,o)}class sr{constructor(e,n,r,i,s=!1,o=!1){this.from=e,this.to=n,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,n=[],r=!1){let i=[new sr(0,e.length,e,0,!1,r)];for(let s of n)s.to>e.length&&i.push(s);return i}static applyChanges(e,n,r=128){if(!n.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<n.length?n[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 sr(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 ng{startParse(e,n,r){return typeof e=="string"&&(e=new b2(e)),r=r?r.length?r.map(i=>new cl(i.from,i.to)):[new cl(0,0)]:[new cl(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let s=i.advance();if(s)return s}}}class b2{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new pe({perNode:!0});var cu={};class na{constructor(e,n,r,i,s,o,a,l,c,d=0,u){this.p=e,this.stack=n,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,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let i=e.parser.context;return new na(e,[],n,r,r,0,[],0,i?new hu(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,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&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.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,n,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(n==r)return;if(o.buffer[a-2]>=n){o.buffer[a-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,n,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]=n,this.buffer[o+2]=r,this.buffer[o+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=i,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,i,4);else{let s=e,{parser:o}=this.p;(i>this.pos||n<=o.maxNode)&&(this.pos=i,o.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,r),this.shiftContext(n,r),n<=o.maxNode&&this.buffer.push(n,r,i,4)}}apply(e,n,r,i){e&65536?this.reduce(e):this.shift(e,n,r,i)}useNode(e,n){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(n,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,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),i=e.bufferBase+n;for(;e&&i==e.bufferBase;)e=e.parent;return new na(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new x2(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if(!(r&65536))return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let i=[];for(let s=0,o;s<n.length;s+=2)(o=n[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&i.push(n[s],o);if(this.stack.length<120)for(let s=0;i.length<8&&s<n.length;s+=2){let o=n[s+1];i.some((a,l)=>l&1&&a==o)||i.push(n[s],o)}n=i}let r=[];for(let i=0;i<n.length&&r.length<4;i+=2){let s=n[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(n[i],this.pos),o.reducePos=this.pos,o.score-=200,r.push(o)}return r}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if(!(n&65536))return!1;if(!e.validAction(this.state,n)){let r=n>>19,i=n&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;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(i,s)=>{if(!n.includes(i))return n.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 n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new hu(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class hu{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class x2{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=i}}class ra{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new ra(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new ra(this.stack,this.pos,this.index)}}function fo(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r<t.length;){let s=0;for(;;){let o=t.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}n?n[i++]=s:n=new e(s)}return n}class Ko{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const du=new Ko;class y2{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=du,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,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(;n<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 n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,i;if(n>=0&&n<this.chunk.length)r=this.pos+e,i=this.chunk.charCodeAt(n);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,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=du,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let i of this.ranges){if(i.from>=n)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,n)))}return r}}class Nr{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;v2(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Nr.prototype.contextual=Nr.prototype.fallback=Nr.prototype.extend=!1;Nr.prototype.fallback=Nr.prototype.extend=!1;function v2(t,e,n,r,i,s){let o=0,a=1<<r,{dialect:l}=n.p.parser;e:for(;a&t[o];){let c=t[o+1];for(let p=o+3;p<c;p+=2)if((t[p+1]&a)>0){let m=t[p];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||w2(m,e.token.value,i,s))){e.acceptToken(m);break}}let d=e.next,u=0,f=t[o+2];if(e.next<0&&f>u&&t[c+f*3-3]==65535){o=t[c+f*3-1];continue e}for(;u<f;){let p=u+f>>1,m=c+p+(p<<1),b=t[m],x=t[m+1]||65536;if(d<b)f=p;else if(d>=x)u=p+1;else{o=t[m+2],e.advance();continue e}}break}}function uu(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function w2(t,e,n,r){let i=uu(n,r,e);return i<0||uu(n,r,t)<i}const bt=typeof process<"u"&&cu&&/\bparse\b/.test(cu.LOG);let hl=null;function fu(t,e,n){let r=t.cursor(Le.IncludeAnonymous);for(r.moveTo(e);;)if(!(n<0?r.childBefore(e):r.childAfter(e)))for(;;){if((n<0?r.to<e:r.from>e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class k2{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?fu(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?fu(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],i=this.index[n];if(i==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=r.children[i],o=this.start[n]+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(pe.lookAhead);if(!l||a+l<this.fragment.to)return s}}this.index[n]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+s.length}}}class S2{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Ko)}getActions(e){let n=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=n;if(u.extended>-1&&(n=this.addActions(e,u.extended,u.end,n)),n=this.addActions(e,u.value,u.end,n),!d.extend&&(r=u,n>f))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new Ko,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new Ko,{pos:r,p:i}=e;return n.start=r,n.end=Math.min(r+1,i.stream.end),n.value=r==i.stream.end?i.parser.eofTerm:0,n}updateCachedToken(e,n,r){let i=this.stream.clipPos(r.pos);if(n.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,n,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++]=n,this.actions[i++]=r,i}addActions(e,n,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),n,r,i));break}a[c]==n&&(i=this.putAction(mn(a,c+1),n,r,i))}return i}}class C2{constructor(e,n,r,i){this.parser=e,this.input=n,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 y2(n,i),this.tokens=new S2(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[na.start(this,e.top[0],s)],this.fragments=r.length&&this.stream.end-s>e.bufferLength*4?new k2(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=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>n)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&&O2(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 "+n);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>n)&&this.recovering--}else if(r.length>1){e:for(let o=0;o<r.length-1;o++){let a=r[o];for(let l=o+1;l<r.length;l++){let 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,n,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(pe.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?n.push(m):r.push(m)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return pu(e,n),!0}}runRecovery(e,n,r){let i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o],l=n[o<<1],c=n[(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)})`),pu(a,r)):(!i||i.score<a.score)&&(i=a)}return i}stackToTree(e){return e.close(),Be.build({buffer:ra.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let n=(hl||(hl=new WeakMap)).get(e);return n||hl.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function pu(t,e){for(let n=0;n<e.length;n++){let r=e[n];if(r.pos==t.pos&&r.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class j2{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}class ia extends ng{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let a=0;a<e.repeatNodeCount;a++)n.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),i=[];for(let a=0;a<n.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=pe[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 jh(n.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=Xm;let o=fo(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(mu),this.states=fo(e.states,Uint32Array),this.data=fo(e.stateData),this.goto=fo(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,n,r){let i=new C2(this,e,n,r);for(let s of this.wrappers)i=s(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let s=i[n+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,n){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==n||o==0)return mn(r,s+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),i=r?n(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=n(mn(this.data,s+1))}return i}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=mn(this.data,r+2);else break;if(!(this.data[r+2]&1)){let i=this.data[r+1];n.some((s,o)=>o&1&&s==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create(ia.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(s=>s.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.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 n.specializers[i]=mu(o),o})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let s of e.split(" ")){let o=n.indexOf(s);o>=0&&(r[o]=!0)}let i=null;for(let s=0;s<n.length;s++)if(!r[s])for(let o=this.dialects[n[s]],a;(a=this.data[o++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new j2(e,r,i)}static deserialize(e){return new ia(e)}}function mn(t,e){return t[e]|t[e+1]<<16}function O2(t){let e=null;for(let n of t){let r=n.p.stoppedAt;(n.pos==n.p.stream.end||r!=null&&n.pos>r)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function mu(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}let P2=0;class At{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=P2++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof At&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let i=new At(r,[],null,[]);if(i.set.push(i),n)for(let s of n.set)i.set.push(s);return i}static defineModifier(e){let n=new sa(e);return r=>r.modified.indexOf(n)>-1?r:sa.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}}let N2=0;class sa{constructor(e){this.name=e,this.instances=[],this.id=N2++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&A2(n,a.modified));if(r)return r;let i=[],s=new At(e.name,i,e,n);for(let a of n)a.instances.push(s);let o=M2(n);for(let a of e.set)if(!a.modified.length)for(let l of o)i.push(sa.get(a,l));return s}}function A2(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function M2(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function rg(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let i of n.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 $i(r,o,l>0?s.slice(0,l):null);e[c]=d.sort(e[c])}}return ig.add(e)}const ig=new pe({combine(t,e){let n,r,i;for(;t||e;){if(!t||e&&t.depth>=e.depth?(i=e,e=e.next):(i=t,t=t.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let s=new $i(i.tags,i.mode,i.context);n?n.next=s:r=s,n=s}return r}});class $i{constructor(e,n,r,i){this.tags=e,this.mode=n,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}}$i.empty=new $i([],2,null);function sg(t,e){let n=Object.create(null);for(let s of t)if(!Array.isArray(s.tag))n[s.tag.id]=s.class;else for(let o of s.tag)n[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=n[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function D2(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function T2(t,e,n,r=0,i=t.length){let s=new E2(r,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),r,i,"",s.highlighters),s.flush(i)}class E2{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,i,s){let{type:o,from:a,to:l}=e;if(a>=r||l<=n)return;o.isTop&&(s=this.highlighters.filter(p=>!p.scope||p.scope(o)));let c=i,d=R2(e)||$i.empty,u=D2(s,d.tags);if(u&&(c&&(c+=" "),c+=u,d.mode==1&&(i+=(i?" ":"")+u)),this.startSpan(Math.max(n,a),c),d.opaque)return;let f=e.tree&&e.tree.prop(pe.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,C=Math.max(n,w),k=Math.min(r,S);if(C<k&&b)for(;e.from<k&&(this.highlightRange(e,C,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>n&&(this.highlightRange(p.cursor(),Math.max(n,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<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,s),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function R2(t){let e=t.type.prop(ig);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const z=At.define,po=z(),Sn=z(),gu=z(Sn),bu=z(Sn),Cn=z(),mo=z(Cn),dl=z(Cn),Yt=z(),qn=z(Yt),Gt=z(),qt=z(),xc=z(),ci=z(xc),go=z(),T={comment:po,lineComment:z(po),blockComment:z(po),docComment:z(po),name:Sn,variableName:z(Sn),typeName:gu,tagName:z(gu),propertyName:bu,attributeName:z(bu),className:z(Sn),labelName:z(Sn),namespace:z(Sn),macroName:z(Sn),literal:Cn,string:mo,docString:z(mo),character:z(mo),attributeValue:z(mo),number:dl,integer:z(dl),float:z(dl),bool:z(Cn),regexp:z(Cn),escape:z(Cn),color:z(Cn),url:z(Cn),keyword:Gt,self:z(Gt),null:z(Gt),atom:z(Gt),unit:z(Gt),modifier:z(Gt),operatorKeyword:z(Gt),controlKeyword:z(Gt),definitionKeyword:z(Gt),moduleKeyword:z(Gt),operator:qt,derefOperator:z(qt),arithmeticOperator:z(qt),logicOperator:z(qt),bitwiseOperator:z(qt),compareOperator:z(qt),updateOperator:z(qt),definitionOperator:z(qt),typeOperator:z(qt),controlOperator:z(qt),punctuation:xc,separator:z(xc),bracket:ci,angleBracket:z(ci),squareBracket:z(ci),paren:z(ci),brace:z(ci),content:Yt,heading:qn,heading1:z(qn),heading2:z(qn),heading3:z(qn),heading4:z(qn),heading5:z(qn),heading6:z(qn),contentSeparator:z(Yt),list:z(Yt),quote:z(Yt),emphasis:z(Yt),strong:z(Yt),link:z(Yt),monospace:z(Yt),strikethrough:z(Yt),inserted:z(),deleted:z(),changed:z(),invalid:z(),meta:go,documentMeta:z(go),annotation:z(go),processingInstruction:z(go),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 t in T){let e=T[t];e instanceof At&&(e.name=t)}sg([{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 L2=rg({String:T.string,Number:T.number,"True False":T.bool,PropertyName:T.propertyName,Null:T.null,", :":T.separator,"[ ]":T.squareBracket,"{ }":T.brace}),I2=ia.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:[L2],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 yc=[],og=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?og:yc).push(n=n+t[e])})();function $2(t){if(t<768)return!1;for(let e=0,n=yc.length;;){let r=e+n>>1;if(t<yc[r])n=r;else if(t>=og[r])e=r+1;else return!0;if(e==n)return!1}}function xu(t){return t>=127462&&t<=127487}const yu=8205;function B2(t,e,n=!0,r=!0){return(n?ag:F2)(t,e,r)}function ag(t,e,n){if(e==t.length)return e;e&&lg(t.charCodeAt(e))&&cg(t.charCodeAt(e-1))&&e--;let r=ul(t,e);for(e+=vu(r);e<t.length;){let i=ul(t,e);if(r==yu||i==yu||n&&$2(i))e+=vu(i),r=i;else if(xu(i)){let s=0,o=e-2;for(;o>=0&&xu(ul(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function F2(t,e,n){for(;e>0;){let r=ag(t,e-2,n);if(r<e)return r;e--}return 0}function ul(t,e){let n=t.charCodeAt(e);if(!cg(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return lg(r)?(n-55296<<10)+(r-56320)+65536:n}function lg(t){return t>=56320&&t<57344}function cg(t){return t>=55296&&t<56320}function vu(t){return t<65536?1:2}class we{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=Ir(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),Xt.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=Ir(this,e,n);let r=[];return this.decompose(e,n,r,0),Xt.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new Oi(this),s=new Oi(e);for(let o=n,a=n;;){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 Oi(this,e)}iterRange(e,n=this.length){return new hg(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new dg(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]?we.empty:e.length<=32?new $e(e):Xt.from($e.split(e,[]))}}class $e extends we{constructor(e,n=V2(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.text[s],a=i+o.length;if((n?r:a)>=e)return new z2(i,a,r,o);i=a+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new $e(wu(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),a=Go(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,n,r){if(!(r instanceof $e))return super.replace(e,n,r);[e,n]=Ir(this,e,n);let i=Go(this.text,Go(r.text,wu(this.text,0,e)),n),s=this.length+r.length-(n-e);return i.length<=32?new $e(i,s):Xt.from($e.split(i,[]),s)}sliceString(e,n=this.length,r=`
223
225
  `){[e,n]=Ir(this,e,n);let i="";for(let s=0,o=0;s<=n&&o<this.text.length;o++){let a=this.text[o],l=s+a.length;s>e&&o&&(i+=r),e<l&&n>s&&(i+=a.slice(Math.max(0,e-s),n-s)),s=l+1}return i}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(n.push(new $e(r,i)),r=[],i=-1);return i>-1&&n.push(new $e(r,i)),n}}class Xt extends we{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.children[s],a=i+o.length,l=r+o.lines-1;if((n?l:a)>=e)return o.lineInner(e,n,r,i);i=a+1,r=l+1}}decompose(e,n,r,i){for(let s=0,o=0;o<=n&&s<this.children.length;s++){let a=this.children[s],l=o+a.length;if(e<=l&&n>=o){let c=i&((o<=e?1:0)|(l>=n?2:0));o>=e&&l<=n&&!c?r.push(a):a.decompose(e-o,n-o,r,c)}o=l+1}}replace(e,n,r){if([e,n]=Ir(this,e,n),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&&n<=a){let l=o.replace(e-s,n-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-(n-e)+r.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=`
224
226
  `){[e,n]=Ir(this,e,n);let i="";for(let s=0,o=0;s<this.children.length&&o<=n;s++){let a=this.children[s],l=o+a.length;o>e&&s&&(i+=r),e<l&&n>o&&(i+=a.sliceString(e-o,n-o,r)),o=l+1}return i}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof Xt))return 0;let r=0,[i,s,o,a]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=n,s+=n){if(i==o||s==a)return r;let l=this.children[i],c=e.children[s];if(l!=c)return r+l.scanIdentical(c,n);r+=l.length+1}}static from(e,n=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,n)}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,n)}}we.empty=new $e([""],0);function V2(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Go(t,e,n=0,r=1e9){for(let i=0,s=0,o=!0;s<t.length&&i<=r;s++){let a=t[s],l=i+a.length;l>=n&&(l>r&&(a=a.slice(0,r-i)),i<n&&(a=a.slice(n-i)),o?(e[e.length-1]+=a,o=!1):e.push(a)),i=l+1}return e}function wu(t,e,n){return Go(t,[""],e,n)}class Oi{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof $e?e.text.length:e.children.length)<<1]}nextInner(e,n){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==(n>0?a:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=`
225
- `,this;e--}else if(i instanceof $e){let l=i.text[o+(n<0?-1:0)];if(this.offsets[r]+=n,l.length>Math.max(0,e))return this.value=e==0?l:n>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(n<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof $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 hg{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new Oi(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*n,this.value=i.length<=r?i:n<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 dg{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:i}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(we.prototype[Symbol.iterator]=function(){return this.iter()},Oi.prototype[Symbol.iterator]=hg.prototype[Symbol.iterator]=dg.prototype[Symbol.iterator]=function(){return this});class z2{constructor(e,n,r,i){this.from=e,this.to=n,this.number=r,this.text=i}get length(){return this.to-this.from}}function Ir(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function _e(t,e,n=!0,r=!0){return B2(t,e,n,r)}function _2(t){return t>=56320&&t<57344}function H2(t){return t>=55296&&t<56320}function ct(t,e){let n=t.charCodeAt(e);if(!H2(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return _2(r)?(n-55296<<10)+(r-56320)+65536:n}function Ah(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Zt(t){return t<65536?1:2}const vc=/\r\n?|\n/;var ot=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(ot||(ot={}));class sn{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];e+=r<0?this.sections[n]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,r=0,i=0;n<this.sections.length;){let s=this.sections[n++],o=this.sections[n++];o<0?(e(r,i,s),i+=s):i+=o,r+=s}}iterChangedRanges(e,n=!1){wc(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];i<0?e.push(r,i):e.push(i,r)}return new sn(e)}composeDesc(e){return this.empty?e:e.empty?this:ug(this,e)}mapDesc(e,n=!1){return e.empty?this:kc(this,e,n)}mapPos(e,n=-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&&n<0&&!a)return e==i||n<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,n=e){for(let r=0,i=0;r<this.sections.length&&i<=n;){let s=this.sections[r++],o=this.sections[r++],a=i+s;if(o>=0&&i<=n&&a>=e)return i<e&&a>n?"cover":!0;i=a}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new sn(e)}static create(e){return new sn(e)}}class ze extends sn{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return wc(this,(n,r,i,s,o)=>e=e.replace(i,i+(r-n),o),!1),e}mapDesc(e,n=!1){return kc(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let i=0,s=0;i<n.length;i+=2){let o=n[i],a=n[i+1];if(a>=0){n[i]=a,n[i+1]=o;let l=i>>1;for(;r.length<l;)r.push(we.empty);r.push(o?e.slice(s,s+o):we.empty)}s+=o}return new ze(n,r)}compose(e){return this.empty?e:e.empty?this:ug(this,e,!0)}map(e,n=!1){return e.empty?this:kc(this,e,n,!0)}iterChanges(e,n=!1){wc(this,e,n)}get desc(){return sn.create(this.sections)}filter(e){let n=[],r=[],i=[],s=new Bi(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(n,d,u),u>0&&Dn(r,n,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(n,d,-1),et(i,d,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(d),a+=d}}return{changes:new ze(n,r),filtered:sn.create(i)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],i=this.sections[n+1];i<0?e.push(r):i==0?e.push([r]):e.push([r].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,r){let i=[],s=[],o=0,a=null;function l(d=!1){if(!d&&!i.length)return;o<n&&et(i,n-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!=n)throw new RangeError(`Mismatched change set length (got ${d.length}, expected ${n})`);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>n)throw new RangeError(`Invalid change range ${u} to ${f} (in doc of length ${n})`);let m=p?typeof p=="string"?we.of(p.split(r||vc)):p:we.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 n=[],r=[];for(let i=0;i<e.length;i++){let s=e[i];if(typeof s=="number")n.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)n.push(s[0],0);else{for(;r.length<i;)r.push(we.empty);r[i]=we.of(s.slice(1)),n.push(s[0],r[i].length)}}}return new ze(n,r)}static createSet(e,n){return new ze(e,n)}}function et(t,e,n,r=!1){if(e==0&&n<=0)return;let i=t.length-2;i>=0&&n<=0&&n==t[i+1]?t[i]+=e:i>=0&&e==0&&t[i]==0?t[i+1]+=n:r?(t[i]+=e,t[i+1]+=n):t.push(e,n)}function Dn(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<r;)t.push(we.empty);t.push(n)}}function wc(t,e,n){let r=t.inserted;for(let i=0,s=0,o=0;o<t.sections.length;){let a=t.sections[o++],l=t.sections[o++];if(l<0)i+=a,s+=a;else{let c=i,d=s,u=we.empty;for(;c+=a,d+=l,l&&r&&(u=u.append(r[o-2>>1])),!(n||o==t.sections.length||t.sections[o+1]<0);)a=t.sections[o++],l=t.sections[o++];e(i,c,s,d,u),i=c,s=d}}}function kc(t,e,n,r=!1){let i=[],s=r?[]:null,o=new Bi(t),a=new Bi(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&&!n))){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 ug(t,e,n=!1){let r=[],i=n?[]:null,s=new Bi(t),o=new Bi(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 Bi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length?we.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?we.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class nr{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new nr(r,i,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return E.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return E.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return E.range(e.anchor,e.head)}static create(e,n,r){return new nr(e,n,r)}}class E{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:E.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new E([this.main],0)}addRange(e,n=!0){return E.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let r=this.ranges.slice();return r[n]=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(n=>nr.fromJSON(n)),e.main)}static single(e,n=e){return new E([E.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;i<e.length;i++){let s=e[i];if(s.empty?s.from<=r:s.from<r)return E.normalized(e.slice(),n);r=s.to}return new E(e,n)}static cursor(e,n=0,r,i){return nr.create(e,e,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(i??16777215)<<6)}static range(e,n,r,i){let s=(r??16777215)<<6|(i==null?7:Math.min(6,i));return n<e?nr.create(n,e,48|s):nr.create(e,n,(n>e?8:0)|s)}static normalized(e,n=0){let r=e[n];e.sort((i,s)=>i.from-s.from),n=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<=n&&n--,e.splice(--i,2,s.anchor>s.head?E.range(l,a):E.range(a,l))}}return new E(e,n)}}function fg(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let Mh=0;class U{constructor(e,n,r,i,s){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=Mh++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new U(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:Dh),!!e.static,e.enables)}of(e){return new qo([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new qo(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new qo(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function Dh(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class qo{constructor(e,n,r,i){this.dependencies=e,this.facet=n,this.type=r,this.value=i,this.id=Mh++}dynamicSlot(e){var n;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:((n=e[u.id])!==null&&n!==void 0?n: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)||Sc(u,d)){let p=r(u);if(a?!ku(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=aa(f,m);if(this.dependencies.every(x=>x instanceof U?f.facet(x)===u.facet(x):x instanceof Ye?f.field(x,!1)==u.field(x,!1):!0)||(a?ku(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 ku(t,e,n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!n(t[r],e[r]))return!1;return!0}function Sc(t,e){let n=!1;for(let r of e)Pi(t,r)&1&&(n=!0);return n}function W2(t,e,n){let r=n.map(l=>t[l.id]),i=n.map(l=>l.type),s=r.filter(l=>!(l&1)),o=t[e.id]>>1;function a(l){let c=[];for(let d=0;d<r.length;d++){let u=aa(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)Pi(l,c);return l.values[o]=a(l),1},update(l,c){if(!Sc(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=Sc(l,r),u=c.config.facets[e.id],f=c.facet(e);if(u&&!d&&Dh(n,u))return l.values[o]=f,0;let p=a(l);return e.compare(p,f)?(l.values[o]=f,0):(l.values[o]=p,1)}}}const bo=U.define({static:!0});class Ye{constructor(e,n,r,i,s){this.id=e,this.createF=n,this.updateF=r,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let n=new Ye(Mh++,e.create,e.update,e.compare||((r,i)=>r===i),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(bo).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,i)=>{let s=r.values[n],o=this.updateF(s,i);return this.compareF(s,o)?0:(r.values[n]=o,1)},reconfigure:(r,i)=>{let s=r.facet(bo),o=i.facet(bo),a;return(a=s.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(r.values[n]=a.create(r),1):i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,bo.of({field:this,create:e})]}get extension(){return this}}const Yn={lowest:4,low:3,default:2,high:1,highest:0};function hi(t){return e=>new pg(e,t)}const ur={highest:hi(Yn.highest),high:hi(Yn.high),default:hi(Yn.default),low:hi(Yn.low),lowest:hi(Yn.lowest)};class pg{constructor(e,n){this.inner=e,this.prec=n}}class La{of(e){return new Cc(this,e)}reconfigure(e){return La.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Cc{constructor(e,n){this.compartment=e,this.inner=n}}class oa{constructor(e,n,r,i,s,o){for(this.base=e,this.compartments=n,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 n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,r){let i=[],s=Object.create(null),o=new Map;for(let f of U2(e,n,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,Dh(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=>W2(x,m,p))}}let u=c.map(f=>f(a));return new oa(e,o,u,a,l,s)}}function U2(t,e,n){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 Cc&&n.delete(o.compartment)}if(i.set(o,a),Array.isArray(o))for(let c of o)s(c,a);else if(o instanceof Cc){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;n.set(o.compartment,c),s(c,a)}else if(o instanceof pg)s(o.inner,o.prec);else if(o instanceof Ye)r[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof qo)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(t,Yn.default),r.reduce((o,a)=>o.concat(a))}function Pi(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let i=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|i}function aa(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const mg=U.define(),jc=U.define({combine:t=>t.some(e=>e),static:!0}),gg=U.define({combine:t=>t.length?t[0]:void 0,static:!0}),bg=U.define(),xg=U.define(),yg=U.define(),vg=U.define({combine:t=>t.length?t[0]:!1});class ln{constructor(e,n){this.type=e,this.value=n}static define(){return new K2}}class K2{of(e){return new ln(this,e)}}class G2{constructor(e){this.map=e}of(e){return new ce(this,e)}}class ce{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new ce(this.type,n)}is(e){return this.type==e}static define(e={}){return new G2(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let i of e){let s=i.map(n);s&&r.push(s)}return r}}ce.reconfigure=ce.define();ce.appendConfig=ce.define();class He{constructor(e,n,r,i,s,o){this.startState=e,this.changes=n,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&fg(r,n.newLength),s.some(a=>a.type==He.time)||(this.annotations=s.concat(He.time.of(Date.now())))}static create(e,n,r,i,s,o){return new He(e,n,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 n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(He.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}He.time=ln.define();He.userEvent=ln.define();He.addToHistory=ln.define();He.remote=ln.define();function q2(t,e){let n=[];for(let r=0,i=0;;){let s,o;if(r<t.length&&(i==e.length||e[i]>=t[r]))s=t[r++],o=t[r++];else if(i<e.length)s=e[i++],o=e[i++];else return n;!n.length||n[n.length-1]<s?n.push(s,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function wg(t,e,n){var r;let i,s,o;return n?(i=e.changes,s=ze.empty(e.changes.length),o=t.changes.compose(e.changes)):(i=e.changes.map(t.changes),s=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(i)),{changes:o,selection:e.selection?e.selection.map(s):(r=t.selection)===null||r===void 0?void 0:r.map(i),effects:ce.mapEffects(t.effects,i).concat(ce.mapEffects(e.effects,s)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Oc(t,e,n){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||[],n,t.facet(gg)),selection:r&&(r instanceof E?r:E.single(r.anchor,r.head)),effects:Ar(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function kg(t,e,n){let r=Oc(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(n=!1);let o=!!e[s].sequential;r=wg(r,Oc(t,e[s],o?r.changes.newLength:t.doc.length),o)}let i=He.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return Y2(n?J2(i):i)}function J2(t){let e=t.startState,n=!0;for(let i of e.facet(bg)){let s=i(t);if(s===!1){n=!1;break}Array.isArray(s)&&(n=n===!0?s:q2(n,s))}if(n!==!0){let i,s;if(n===!1)s=t.changes.invertedDesc,i=ze.empty(e.doc.length);else{let o=t.changes.filter(n);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}t=He.create(e,i,t.selection&&t.selection.map(s),ce.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let r=e.facet(xg);for(let i=r.length-1;i>=0;i--){let s=r[i](t);s instanceof He?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof He?t=s[0]:t=kg(e,Ar(s),!1)}return t}function Y2(t){let e=t.startState,n=e.facet(yg),r=t;for(let i=n.length-1;i>=0;i--){let s=n[i](t);s&&Object.keys(s).length&&(r=wg(r,Oc(e,s,t.changes.newLength),!0))}return r==t?t:He.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const Q2=[];function Ar(t){return t==null?Q2:Array.isArray(t)?t:[t]}var Te=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Te||(Te={}));const X2=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Pc;try{Pc=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Z2(t){if(Pc)return Pc.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>"€"&&(n.toUpperCase()!=n.toLowerCase()||X2.test(n)))return!0}return!1}function ew(t){return e=>{if(!/\S/.test(e))return Te.Space;if(Z2(e))return Te.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return Te.Word;return Te.Other}}class be{constructor(e,n,r,i,s,o){this.config=e,this.doc=n,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++)Pi(this,a<<1);this.computeSlot=null}field(e,n=!0){let r=this.config.address[e.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return Pi(this,r),aa(this,r)}update(...e){return kg(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:i}=n;for(let a of e.effects)a.is(La.reconfigure)?(n&&(i=new Map,n.compartments.forEach((l,c)=>i.set(c,l)),n=null),i.set(a.value.compartment,a.value.extension)):a.is(ce.reconfigure)?(n=null,r=a.value):a.is(ce.appendConfig)&&(n=null,r=Ar(r).concat(a.value));let s;n?s=e.startState.values.slice():(n=oa.resolve(r,i,this),s=new be(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=e.startState.facet(jc)?e.newSelection:e.newSelection.asSingle();new be(n,e.newDoc,o,s,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:E.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),i=this.changes(r.changes),s=[r.range],o=Ar(r.effects);for(let a=1;a<n.ranges.length;a++){let l=e(n.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=ce.mapEffects(o,d).concat(ce.mapEffects(Ar(l.effects),u))}return{changes:i,selection:E.create(s,n.mainIndex),effects:o}}changes(e=[]){return e instanceof ze?e:ze.of(e,this.doc.length,this.facet(be.lineSeparator))}toText(e){return we.of(e.split(this.facet(be.lineSeparator)||vc))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(Pi(this,n),aa(this,n))}toJSON(e){let n={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&&(n[r]=i.spec.toJSON(this.field(e[r]),this))}return n}static fromJSON(e,n={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let 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 be.create({doc:e.doc,selection:E.fromJSON(e.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(e={}){let n=oa.resolve(e.extensions||[],new Map),r=e.doc instanceof we?e.doc:we.of((e.doc||"").split(n.staticFacet(be.lineSeparator)||vc)),i=e.selection?e.selection instanceof E?e.selection:E.single(e.selection.anchor,e.selection.head):E.single(0);return fg(i,r.length),n.staticFacet(jc)||(i=i.asSingle()),new be(n,r,i,n.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(be.tabSize)}get lineBreak(){return this.facet(be.lineSeparator)||`
226
- `}get readOnly(){return this.facet(vg)}phrase(e,...n){for(let r of this.facet(be.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>n.length?r:n[s-1]})),e}languageDataAt(e,n,r=-1){let i=[];for(let s of this.facet(mg))for(let o of s(this,n,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){let n=this.languageDataAt("wordChars",e);return ew(n.length?n[0]:"")}wordAt(e){let{text:n,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let l=_e(n,o,!1);if(s(n.slice(l,o))!=Te.Word)break;o=l}for(;a<i;){let l=_e(n,a);if(s(n.slice(a,l))!=Te.Word)break;a=l}return o==a?null:E.range(o+r,a+r)}}be.allowMultipleSelections=jc;be.tabSize=U.define({combine:t=>t.length?t[0]:4});be.lineSeparator=gg;be.readOnly=vg;be.phrases=U.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(i=>t[i]==e[i])}});be.languageData=mg;be.changeFilter=bg;be.transactionFilter=xg;be.transactionExtender=yg;La.reconfigure=ce.define();function cn(t,e,n={}){let r={};for(let i of t)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(n,s))r[s]=n[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,n=e){return Fi.create(e,n,this)}}Ln.prototype.startSide=Ln.prototype.endSide=0;Ln.prototype.point=!1;Ln.prototype.mapMode=ot.TrackDel;function Th(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}class Fi{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new Fi(e,n,r)}}function Nc(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Eh{constructor(e,n,r,i){this.from=e,this.to=n,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,n,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)-n;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,n,r,i){for(let s=this.findIndex(n,-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,n){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=n.mapPos(d,c.startSide,c.mapMode);if(m==null||(f=p=m,c.startSide!=c.endSide&&(p=n.mapPos(d,c.endSide),p<f)))continue}else if(f=n.mapPos(d,c.startSide),p=n.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 Eh(i,s,r,a):null,pos:o}}}class ge{constructor(e,n,r,i){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=i}static create(e,n,r,i){return new ge(e,n,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 n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(Nc)),this.isEmpty)return n.length?ge.of(n):this;let a=new Sg(this,null,-1).goto(0),l=0,c=[],d=new xn;for(;a.value||l<n.length;)if(l<n.length&&(a.from-n[l].from||a.startSide-n[l].value.startSide)>=0){let u=n[l++];d.addInner(u.from,u.to,u.value)||c.push(u)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==n.length||this.chunkEnd(a.chunkIndex)<n[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(Fi.create(a.from,a.to,a.value))),a.next());return d.finishInner(this.nextLayer.isEmpty&&!c.length?ge.empty:this.nextLayer.update({add:c,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let n=[],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),n.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),n.push(d),r.push(u))}}let s=this.nextLayer.map(e);return n.length==0?s:new ge(r,n,s||ge.empty,i)}between(e,n,r){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(n>=s&&e<=s+o.length&&o.between(s,e-s,n-s,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return Vi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return Vi.from(e).goto(n)}static compare(e,n,r,i,s=-1){let o=e.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=s),a=n.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=s),l=Su(o,a,r),c=new di(o,l,s),d=new di(a,l,s);r.iterGaps((u,f,p)=>Cu(c,u,d,f,p,i)),r.empty&&r.length==0&&Cu(c,0,d,0,0,i)}static eq(e,n,r=0,i){i==null&&(i=999999999);let s=e.filter(d=>!d.isEmpty&&n.indexOf(d)<0),o=n.filter(d=>!d.isEmpty&&e.indexOf(d)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let a=Su(s,o),l=new di(s,a,0).goto(r),c=new di(o,a,0).goto(r);for(;;){if(l.to!=c.to||!Ac(l.active,c.active)||l.point&&(!c.point||!Th(l.point,c.point)))return!1;if(l.to>i)return!0;l.next(),c.next()}}static spans(e,n,r,i,s=-1){let o=new di(e,null,s).goto(n),a=n,l=o.openStart;for(;;){let c=Math.min(o.to,r);if(o.point){let d=o.activeForPoint(o.to),u=o.pointFrom<n?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,n=!1){let r=new xn;for(let i of e instanceof Fi?[e]:n?tw(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return ge.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=ge.empty;i=i.nextLayer)n=new ge(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}}ge.empty=new ge([],[],null,-1);function tw(t){if(t.length>1)for(let e=t[0],n=1;n<t.length;n++){let r=t[n];if(Nc(e,r)>0)return t.slice().sort(Nc);e=r}return t}ge.empty.nextLayer=ge.empty;class xn{finishChunk(e){this.chunks.push(new Eh(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new xn)).add(e,n,r)}addInner(e,n,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(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(ge.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=ge.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function Su(t,e,n){let r=new Map;for(let s of t)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&&(n?n.mapPos(a):a)==s.chunkPos[o]&&!n?.touchesRange(a,a+s.chunk[o].length)&&i.add(s.chunk[o])}return i}class Sg{constructor(e,n,r,i=0){this.layer=e,this.skip=n,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,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,n,!1),this}gotoInner(e,n,r){for(;this.chunkIndex<this.layer.chunk.length;){let 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],n,!0);(!r||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,n){(this.to-e||this.endSide-n)<0&&this.gotoInner(e,n,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],n=this.layer.chunk[this.chunkIndex],r=e+n.from[this.rangeIndex];if(this.from=r,this.to=e+n.to[this.rangeIndex],this.value=n.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Vi{constructor(e){this.heap=e}static from(e,n=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 Sg(o,n,r,s));return i.length==1?i[0]:new Vi(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)fl(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)fl(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),fl(this.heap,0)}}}function fl(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let i=t[r];if(r+1<t.length&&i.compare(t[r+1])>=0&&(i=t[r+1],r++),n.compare(i)<0)break;t[r]=n,t[e]=i,e=r}}class di{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Vi.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){xo(this.active,e),xo(this.activeTo,e),xo(this.activeRank,e),this.minActive=ju(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:i,rank:s}=this.cursor;for(;n<this.activeRank.length&&(s-this.activeRank[n]||i-this.activeTo[n])>0;)n++;yo(this.active,n,r),yo(this.activeTo,n,i),yo(this.activeRank,n,s),e&&yo(e,n,this.cursor.from),this.minActive=ju(this.active,this.activeTo)}next(){let e=this.to,n=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&&xo(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(n&&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 n=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function Cu(t,e,n,r,i,s){t.goto(e),n.goto(r);let o=r+i,a=r,l=r-e,c=!!s.boundChange;for(let d=!1;;){let u=t.to+l-n.to,f=u||t.endSide-n.endSide,p=f<0?t.to+l:n.to,m=Math.min(p,o);if(t.point||n.point?(t.point&&n.point&&Th(t.point,n.point)&&Ac(t.activeForPoint(t.to),n.activeForPoint(n.to))||s.comparePoint(a,m,t.point,n.point),d=!1):(d&&s.boundChange(a),m>a&&!Ac(t.active,n.active)&&s.compareRange(a,m,t.active,n.active),c&&m<o&&(u||t.openEnd(p)!=n.openEnd(p))&&(d=!0)),p>o)break;a=p,f<=0&&t.next(),f>=0&&n.next()}}function Ac(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n]&&!Th(t[n],e[n]))return!1;return!0}function xo(t,e){for(let n=e,r=t.length-1;n<r;n++)t[n]=t[n+1];t.pop()}function yo(t,e,n){for(let r=t.length-1;r>=e;r--)t[r+1]=t[r];t[e]=n}function ju(t,e){let n=-1,r=1e9;for(let i=0;i<e.length;i++)(e[i]-r||t[i].endSide-t[n].endSide)<0&&(n=i,r=e[i]);return n}function Ur(t,e,n=t.length){let r=0;for(let i=0;i<n&&i<t.length;)t.charCodeAt(i)==9?(r+=e-r%e,i++):(r++,i=_e(t,i));return r}function Mc(t,e,n,r){for(let i=0,s=0;;){if(s>=e)return i;if(i==t.length)break;s+=t.charCodeAt(i)==9?n-s%n:1,i=_e(t,i)}return r===!0?-1:t.length}const Dc="ͼ",Ou=typeof Symbol>"u"?"__"+Dc:Symbol.for(Dc),Tc=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Pu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class In{constructor(e,n){this.rules=[];let{finish:r}=n||{};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(`
227
+ `,this;e--}else if(i instanceof $e){let l=i.text[o+(n<0?-1:0)];if(this.offsets[r]+=n,l.length>Math.max(0,e))return this.value=e==0?l:n>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(n<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof $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 hg{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new Oi(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*n,this.value=i.length<=r?i:n<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 dg{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:i}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(we.prototype[Symbol.iterator]=function(){return this.iter()},Oi.prototype[Symbol.iterator]=hg.prototype[Symbol.iterator]=dg.prototype[Symbol.iterator]=function(){return this});class z2{constructor(e,n,r,i){this.from=e,this.to=n,this.number=r,this.text=i}get length(){return this.to-this.from}}function Ir(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function He(t,e,n=!0,r=!0){return B2(t,e,n,r)}function H2(t){return t>=56320&&t<57344}function _2(t){return t>=55296&&t<56320}function ct(t,e){let n=t.charCodeAt(e);if(!_2(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return H2(r)?(n-55296<<10)+(r-56320)+65536:n}function Ah(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Zt(t){return t<65536?1:2}const vc=/\r\n?|\n/;var ot=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(ot||(ot={}));class sn{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];e+=r<0?this.sections[n]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,r=0,i=0;n<this.sections.length;){let s=this.sections[n++],o=this.sections[n++];o<0?(e(r,i,s),i+=s):i+=o,r+=s}}iterChangedRanges(e,n=!1){wc(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];i<0?e.push(r,i):e.push(i,r)}return new sn(e)}composeDesc(e){return this.empty?e:e.empty?this:ug(this,e)}mapDesc(e,n=!1){return e.empty?this:kc(this,e,n)}mapPos(e,n=-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&&n<0&&!a)return e==i||n<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,n=e){for(let r=0,i=0;r<this.sections.length&&i<=n;){let s=this.sections[r++],o=this.sections[r++],a=i+s;if(o>=0&&i<=n&&a>=e)return i<e&&a>n?"cover":!0;i=a}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new sn(e)}static create(e){return new sn(e)}}class ze extends sn{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return wc(this,(n,r,i,s,o)=>e=e.replace(i,i+(r-n),o),!1),e}mapDesc(e,n=!1){return kc(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let i=0,s=0;i<n.length;i+=2){let o=n[i],a=n[i+1];if(a>=0){n[i]=a,n[i+1]=o;let l=i>>1;for(;r.length<l;)r.push(we.empty);r.push(o?e.slice(s,s+o):we.empty)}s+=o}return new ze(n,r)}compose(e){return this.empty?e:e.empty?this:ug(this,e,!0)}map(e,n=!1){return e.empty?this:kc(this,e,n,!0)}iterChanges(e,n=!1){wc(this,e,n)}get desc(){return sn.create(this.sections)}filter(e){let n=[],r=[],i=[],s=new Bi(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(n,d,u),u>0&&Dn(r,n,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(n,d,-1),et(i,d,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(d),a+=d}}return{changes:new ze(n,r),filtered:sn.create(i)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],i=this.sections[n+1];i<0?e.push(r):i==0?e.push([r]):e.push([r].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,r){let i=[],s=[],o=0,a=null;function l(d=!1){if(!d&&!i.length)return;o<n&&et(i,n-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!=n)throw new RangeError(`Mismatched change set length (got ${d.length}, expected ${n})`);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>n)throw new RangeError(`Invalid change range ${u} to ${f} (in doc of length ${n})`);let m=p?typeof p=="string"?we.of(p.split(r||vc)):p:we.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 n=[],r=[];for(let i=0;i<e.length;i++){let s=e[i];if(typeof s=="number")n.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)n.push(s[0],0);else{for(;r.length<i;)r.push(we.empty);r[i]=we.of(s.slice(1)),n.push(s[0],r[i].length)}}}return new ze(n,r)}static createSet(e,n){return new ze(e,n)}}function et(t,e,n,r=!1){if(e==0&&n<=0)return;let i=t.length-2;i>=0&&n<=0&&n==t[i+1]?t[i]+=e:i>=0&&e==0&&t[i]==0?t[i+1]+=n:r?(t[i]+=e,t[i+1]+=n):t.push(e,n)}function Dn(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<r;)t.push(we.empty);t.push(n)}}function wc(t,e,n){let r=t.inserted;for(let i=0,s=0,o=0;o<t.sections.length;){let a=t.sections[o++],l=t.sections[o++];if(l<0)i+=a,s+=a;else{let c=i,d=s,u=we.empty;for(;c+=a,d+=l,l&&r&&(u=u.append(r[o-2>>1])),!(n||o==t.sections.length||t.sections[o+1]<0);)a=t.sections[o++],l=t.sections[o++];e(i,c,s,d,u),i=c,s=d}}}function kc(t,e,n,r=!1){let i=[],s=r?[]:null,o=new Bi(t),a=new Bi(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&&!n))){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 ug(t,e,n=!1){let r=[],i=n?[]:null,s=new Bi(t),o=new Bi(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 Bi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length?we.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?we.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class nr{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new nr(r,i,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return E.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return E.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return E.range(e.anchor,e.head)}static create(e,n,r){return new nr(e,n,r)}}class E{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:E.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new E([this.main],0)}addRange(e,n=!0){return E.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let r=this.ranges.slice();return r[n]=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(n=>nr.fromJSON(n)),e.main)}static single(e,n=e){return new E([E.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;i<e.length;i++){let s=e[i];if(s.empty?s.from<=r:s.from<r)return E.normalized(e.slice(),n);r=s.to}return new E(e,n)}static cursor(e,n=0,r,i){return nr.create(e,e,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(i??16777215)<<6)}static range(e,n,r,i){let s=(r??16777215)<<6|(i==null?7:Math.min(6,i));return n<e?nr.create(n,e,48|s):nr.create(e,n,(n>e?8:0)|s)}static normalized(e,n=0){let r=e[n];e.sort((i,s)=>i.from-s.from),n=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<=n&&n--,e.splice(--i,2,s.anchor>s.head?E.range(l,a):E.range(a,l))}}return new E(e,n)}}function fg(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let Mh=0;class U{constructor(e,n,r,i,s){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=Mh++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new U(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:Dh),!!e.static,e.enables)}of(e){return new qo([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new qo(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new qo(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function Dh(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class qo{constructor(e,n,r,i){this.dependencies=e,this.facet=n,this.type=r,this.value=i,this.id=Mh++}dynamicSlot(e){var n;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:((n=e[u.id])!==null&&n!==void 0?n: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)||Sc(u,d)){let p=r(u);if(a?!ku(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=aa(f,m);if(this.dependencies.every(x=>x instanceof U?f.facet(x)===u.facet(x):x instanceof Ye?f.field(x,!1)==u.field(x,!1):!0)||(a?ku(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 ku(t,e,n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!n(t[r],e[r]))return!1;return!0}function Sc(t,e){let n=!1;for(let r of e)Pi(t,r)&1&&(n=!0);return n}function W2(t,e,n){let r=n.map(l=>t[l.id]),i=n.map(l=>l.type),s=r.filter(l=>!(l&1)),o=t[e.id]>>1;function a(l){let c=[];for(let d=0;d<r.length;d++){let u=aa(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)Pi(l,c);return l.values[o]=a(l),1},update(l,c){if(!Sc(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=Sc(l,r),u=c.config.facets[e.id],f=c.facet(e);if(u&&!d&&Dh(n,u))return l.values[o]=f,0;let p=a(l);return e.compare(p,f)?(l.values[o]=f,0):(l.values[o]=p,1)}}}const bo=U.define({static:!0});class Ye{constructor(e,n,r,i,s){this.id=e,this.createF=n,this.updateF=r,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let n=new Ye(Mh++,e.create,e.update,e.compare||((r,i)=>r===i),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(bo).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,i)=>{let s=r.values[n],o=this.updateF(s,i);return this.compareF(s,o)?0:(r.values[n]=o,1)},reconfigure:(r,i)=>{let s=r.facet(bo),o=i.facet(bo),a;return(a=s.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(r.values[n]=a.create(r),1):i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,bo.of({field:this,create:e})]}get extension(){return this}}const Yn={lowest:4,low:3,default:2,high:1,highest:0};function hi(t){return e=>new pg(e,t)}const ur={highest:hi(Yn.highest),high:hi(Yn.high),default:hi(Yn.default),low:hi(Yn.low),lowest:hi(Yn.lowest)};class pg{constructor(e,n){this.inner=e,this.prec=n}}class La{of(e){return new Cc(this,e)}reconfigure(e){return La.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Cc{constructor(e,n){this.compartment=e,this.inner=n}}class oa{constructor(e,n,r,i,s,o){for(this.base=e,this.compartments=n,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 n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,r){let i=[],s=Object.create(null),o=new Map;for(let f of U2(e,n,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,Dh(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=>W2(x,m,p))}}let u=c.map(f=>f(a));return new oa(e,o,u,a,l,s)}}function U2(t,e,n){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 Cc&&n.delete(o.compartment)}if(i.set(o,a),Array.isArray(o))for(let c of o)s(c,a);else if(o instanceof Cc){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;n.set(o.compartment,c),s(c,a)}else if(o instanceof pg)s(o.inner,o.prec);else if(o instanceof Ye)r[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof qo)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(t,Yn.default),r.reduce((o,a)=>o.concat(a))}function Pi(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let i=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|i}function aa(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const mg=U.define(),jc=U.define({combine:t=>t.some(e=>e),static:!0}),gg=U.define({combine:t=>t.length?t[0]:void 0,static:!0}),bg=U.define(),xg=U.define(),yg=U.define(),vg=U.define({combine:t=>t.length?t[0]:!1});class ln{constructor(e,n){this.type=e,this.value=n}static define(){return new K2}}class K2{of(e){return new ln(this,e)}}class G2{constructor(e){this.map=e}of(e){return new ce(this,e)}}class ce{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new ce(this.type,n)}is(e){return this.type==e}static define(e={}){return new G2(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let i of e){let s=i.map(n);s&&r.push(s)}return r}}ce.reconfigure=ce.define();ce.appendConfig=ce.define();class _e{constructor(e,n,r,i,s,o){this.startState=e,this.changes=n,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&fg(r,n.newLength),s.some(a=>a.type==_e.time)||(this.annotations=s.concat(_e.time.of(Date.now())))}static create(e,n,r,i,s,o){return new _e(e,n,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 n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(_e.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}_e.time=ln.define();_e.userEvent=ln.define();_e.addToHistory=ln.define();_e.remote=ln.define();function q2(t,e){let n=[];for(let r=0,i=0;;){let s,o;if(r<t.length&&(i==e.length||e[i]>=t[r]))s=t[r++],o=t[r++];else if(i<e.length)s=e[i++],o=e[i++];else return n;!n.length||n[n.length-1]<s?n.push(s,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function wg(t,e,n){var r;let i,s,o;return n?(i=e.changes,s=ze.empty(e.changes.length),o=t.changes.compose(e.changes)):(i=e.changes.map(t.changes),s=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(i)),{changes:o,selection:e.selection?e.selection.map(s):(r=t.selection)===null||r===void 0?void 0:r.map(i),effects:ce.mapEffects(t.effects,i).concat(ce.mapEffects(e.effects,s)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Oc(t,e,n){let r=e.selection,i=Ar(e.annotations);return e.userEvent&&(i=i.concat(_e.userEvent.of(e.userEvent))),{changes:e.changes instanceof ze?e.changes:ze.of(e.changes||[],n,t.facet(gg)),selection:r&&(r instanceof E?r:E.single(r.anchor,r.head)),effects:Ar(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function kg(t,e,n){let r=Oc(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(n=!1);let o=!!e[s].sequential;r=wg(r,Oc(t,e[s],o?r.changes.newLength:t.doc.length),o)}let i=_e.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return Y2(n?J2(i):i)}function J2(t){let e=t.startState,n=!0;for(let i of e.facet(bg)){let s=i(t);if(s===!1){n=!1;break}Array.isArray(s)&&(n=n===!0?s:q2(n,s))}if(n!==!0){let i,s;if(n===!1)s=t.changes.invertedDesc,i=ze.empty(e.doc.length);else{let o=t.changes.filter(n);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}t=_e.create(e,i,t.selection&&t.selection.map(s),ce.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let r=e.facet(xg);for(let i=r.length-1;i>=0;i--){let s=r[i](t);s instanceof _e?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof _e?t=s[0]:t=kg(e,Ar(s),!1)}return t}function Y2(t){let e=t.startState,n=e.facet(yg),r=t;for(let i=n.length-1;i>=0;i--){let s=n[i](t);s&&Object.keys(s).length&&(r=wg(r,Oc(e,s,t.changes.newLength),!0))}return r==t?t:_e.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const Q2=[];function Ar(t){return t==null?Q2:Array.isArray(t)?t:[t]}var Te=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Te||(Te={}));const X2=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Pc;try{Pc=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Z2(t){if(Pc)return Pc.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>"€"&&(n.toUpperCase()!=n.toLowerCase()||X2.test(n)))return!0}return!1}function ew(t){return e=>{if(!/\S/.test(e))return Te.Space;if(Z2(e))return Te.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return Te.Word;return Te.Other}}class be{constructor(e,n,r,i,s,o){this.config=e,this.doc=n,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++)Pi(this,a<<1);this.computeSlot=null}field(e,n=!0){let r=this.config.address[e.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return Pi(this,r),aa(this,r)}update(...e){return kg(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:i}=n;for(let a of e.effects)a.is(La.reconfigure)?(n&&(i=new Map,n.compartments.forEach((l,c)=>i.set(c,l)),n=null),i.set(a.value.compartment,a.value.extension)):a.is(ce.reconfigure)?(n=null,r=a.value):a.is(ce.appendConfig)&&(n=null,r=Ar(r).concat(a.value));let s;n?s=e.startState.values.slice():(n=oa.resolve(r,i,this),s=new be(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=e.startState.facet(jc)?e.newSelection:e.newSelection.asSingle();new be(n,e.newDoc,o,s,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:E.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),i=this.changes(r.changes),s=[r.range],o=Ar(r.effects);for(let a=1;a<n.ranges.length;a++){let l=e(n.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=ce.mapEffects(o,d).concat(ce.mapEffects(Ar(l.effects),u))}return{changes:i,selection:E.create(s,n.mainIndex),effects:o}}changes(e=[]){return e instanceof ze?e:ze.of(e,this.doc.length,this.facet(be.lineSeparator))}toText(e){return we.of(e.split(this.facet(be.lineSeparator)||vc))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(Pi(this,n),aa(this,n))}toJSON(e){let n={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&&(n[r]=i.spec.toJSON(this.field(e[r]),this))}return n}static fromJSON(e,n={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let 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 be.create({doc:e.doc,selection:E.fromJSON(e.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(e={}){let n=oa.resolve(e.extensions||[],new Map),r=e.doc instanceof we?e.doc:we.of((e.doc||"").split(n.staticFacet(be.lineSeparator)||vc)),i=e.selection?e.selection instanceof E?e.selection:E.single(e.selection.anchor,e.selection.head):E.single(0);return fg(i,r.length),n.staticFacet(jc)||(i=i.asSingle()),new be(n,r,i,n.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(be.tabSize)}get lineBreak(){return this.facet(be.lineSeparator)||`
228
+ `}get readOnly(){return this.facet(vg)}phrase(e,...n){for(let r of this.facet(be.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>n.length?r:n[s-1]})),e}languageDataAt(e,n,r=-1){let i=[];for(let s of this.facet(mg))for(let o of s(this,n,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){let n=this.languageDataAt("wordChars",e);return ew(n.length?n[0]:"")}wordAt(e){let{text:n,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let l=He(n,o,!1);if(s(n.slice(l,o))!=Te.Word)break;o=l}for(;a<i;){let l=He(n,a);if(s(n.slice(a,l))!=Te.Word)break;a=l}return o==a?null:E.range(o+r,a+r)}}be.allowMultipleSelections=jc;be.tabSize=U.define({combine:t=>t.length?t[0]:4});be.lineSeparator=gg;be.readOnly=vg;be.phrases=U.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(i=>t[i]==e[i])}});be.languageData=mg;be.changeFilter=bg;be.transactionFilter=xg;be.transactionExtender=yg;La.reconfigure=ce.define();function cn(t,e,n={}){let r={};for(let i of t)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(n,s))r[s]=n[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,n=e){return Fi.create(e,n,this)}}Ln.prototype.startSide=Ln.prototype.endSide=0;Ln.prototype.point=!1;Ln.prototype.mapMode=ot.TrackDel;function Th(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}class Fi{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new Fi(e,n,r)}}function Nc(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Eh{constructor(e,n,r,i){this.from=e,this.to=n,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,n,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)-n;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,n,r,i){for(let s=this.findIndex(n,-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,n){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=n.mapPos(d,c.startSide,c.mapMode);if(m==null||(f=p=m,c.startSide!=c.endSide&&(p=n.mapPos(d,c.endSide),p<f)))continue}else if(f=n.mapPos(d,c.startSide),p=n.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 Eh(i,s,r,a):null,pos:o}}}class ge{constructor(e,n,r,i){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=i}static create(e,n,r,i){return new ge(e,n,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 n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(Nc)),this.isEmpty)return n.length?ge.of(n):this;let a=new Sg(this,null,-1).goto(0),l=0,c=[],d=new xn;for(;a.value||l<n.length;)if(l<n.length&&(a.from-n[l].from||a.startSide-n[l].value.startSide)>=0){let u=n[l++];d.addInner(u.from,u.to,u.value)||c.push(u)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==n.length||this.chunkEnd(a.chunkIndex)<n[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(Fi.create(a.from,a.to,a.value))),a.next());return d.finishInner(this.nextLayer.isEmpty&&!c.length?ge.empty:this.nextLayer.update({add:c,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let n=[],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),n.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),n.push(d),r.push(u))}}let s=this.nextLayer.map(e);return n.length==0?s:new ge(r,n,s||ge.empty,i)}between(e,n,r){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(n>=s&&e<=s+o.length&&o.between(s,e-s,n-s,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return Vi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return Vi.from(e).goto(n)}static compare(e,n,r,i,s=-1){let o=e.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=s),a=n.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=s),l=Su(o,a,r),c=new di(o,l,s),d=new di(a,l,s);r.iterGaps((u,f,p)=>Cu(c,u,d,f,p,i)),r.empty&&r.length==0&&Cu(c,0,d,0,0,i)}static eq(e,n,r=0,i){i==null&&(i=999999999);let s=e.filter(d=>!d.isEmpty&&n.indexOf(d)<0),o=n.filter(d=>!d.isEmpty&&e.indexOf(d)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let a=Su(s,o),l=new di(s,a,0).goto(r),c=new di(o,a,0).goto(r);for(;;){if(l.to!=c.to||!Ac(l.active,c.active)||l.point&&(!c.point||!Th(l.point,c.point)))return!1;if(l.to>i)return!0;l.next(),c.next()}}static spans(e,n,r,i,s=-1){let o=new di(e,null,s).goto(n),a=n,l=o.openStart;for(;;){let c=Math.min(o.to,r);if(o.point){let d=o.activeForPoint(o.to),u=o.pointFrom<n?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,n=!1){let r=new xn;for(let i of e instanceof Fi?[e]:n?tw(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return ge.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=ge.empty;i=i.nextLayer)n=new ge(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}}ge.empty=new ge([],[],null,-1);function tw(t){if(t.length>1)for(let e=t[0],n=1;n<t.length;n++){let r=t[n];if(Nc(e,r)>0)return t.slice().sort(Nc);e=r}return t}ge.empty.nextLayer=ge.empty;class xn{finishChunk(e){this.chunks.push(new Eh(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new xn)).add(e,n,r)}addInner(e,n,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(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(ge.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=ge.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function Su(t,e,n){let r=new Map;for(let s of t)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&&(n?n.mapPos(a):a)==s.chunkPos[o]&&!n?.touchesRange(a,a+s.chunk[o].length)&&i.add(s.chunk[o])}return i}class Sg{constructor(e,n,r,i=0){this.layer=e,this.skip=n,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,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,n,!1),this}gotoInner(e,n,r){for(;this.chunkIndex<this.layer.chunk.length;){let 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],n,!0);(!r||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,n){(this.to-e||this.endSide-n)<0&&this.gotoInner(e,n,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],n=this.layer.chunk[this.chunkIndex],r=e+n.from[this.rangeIndex];if(this.from=r,this.to=e+n.to[this.rangeIndex],this.value=n.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Vi{constructor(e){this.heap=e}static from(e,n=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 Sg(o,n,r,s));return i.length==1?i[0]:new Vi(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)fl(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)fl(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),fl(this.heap,0)}}}function fl(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let i=t[r];if(r+1<t.length&&i.compare(t[r+1])>=0&&(i=t[r+1],r++),n.compare(i)<0)break;t[r]=n,t[e]=i,e=r}}class di{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Vi.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){xo(this.active,e),xo(this.activeTo,e),xo(this.activeRank,e),this.minActive=ju(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:i,rank:s}=this.cursor;for(;n<this.activeRank.length&&(s-this.activeRank[n]||i-this.activeTo[n])>0;)n++;yo(this.active,n,r),yo(this.activeTo,n,i),yo(this.activeRank,n,s),e&&yo(e,n,this.cursor.from),this.minActive=ju(this.active,this.activeTo)}next(){let e=this.to,n=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&&xo(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(n&&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 n=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function Cu(t,e,n,r,i,s){t.goto(e),n.goto(r);let o=r+i,a=r,l=r-e,c=!!s.boundChange;for(let d=!1;;){let u=t.to+l-n.to,f=u||t.endSide-n.endSide,p=f<0?t.to+l:n.to,m=Math.min(p,o);if(t.point||n.point?(t.point&&n.point&&Th(t.point,n.point)&&Ac(t.activeForPoint(t.to),n.activeForPoint(n.to))||s.comparePoint(a,m,t.point,n.point),d=!1):(d&&s.boundChange(a),m>a&&!Ac(t.active,n.active)&&s.compareRange(a,m,t.active,n.active),c&&m<o&&(u||t.openEnd(p)!=n.openEnd(p))&&(d=!0)),p>o)break;a=p,f<=0&&t.next(),f>=0&&n.next()}}function Ac(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n]&&!Th(t[n],e[n]))return!1;return!0}function xo(t,e){for(let n=e,r=t.length-1;n<r;n++)t[n]=t[n+1];t.pop()}function yo(t,e,n){for(let r=t.length-1;r>=e;r--)t[r+1]=t[r];t[e]=n}function ju(t,e){let n=-1,r=1e9;for(let i=0;i<e.length;i++)(e[i]-r||t[i].endSide-t[n].endSide)<0&&(n=i,r=e[i]);return n}function Ur(t,e,n=t.length){let r=0;for(let i=0;i<n&&i<t.length;)t.charCodeAt(i)==9?(r+=e-r%e,i++):(r++,i=He(t,i));return r}function Mc(t,e,n,r){for(let i=0,s=0;;){if(s>=e)return i;if(i==t.length)break;s+=t.charCodeAt(i)==9?n-s%n:1,i=He(t,i)}return r===!0?-1:t.length}const Dc="ͼ",Ou=typeof Symbol>"u"?"__"+Dc:Symbol.for(Dc),Tc=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Pu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class In{constructor(e,n){this.rules=[];let{finish:r}=n||{};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(`
227
229
  `)}static newName(){let e=Pu[Ou]||1;return Pu[Ou]=e+1,Dc+e.toString(36)}static mount(e,n,r){let i=e[Tc],s=r&&r.nonce;i?s&&i.setNonce(s):i=new nw(e,s),i.mount(Array.isArray(n)?n:[n],e)}}let Nu=new Map;class nw{constructor(e,n){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=Nu.get(r);if(s)return e[Tc]=s;this.sheet=new i.CSSStyleSheet,Nu.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[Tc]=this}mount(e,n){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)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
228
- `;this.styleTag.textContent=o;let a=n.head||n;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var $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:"'"},zi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},rw=typeof navigator<"u"&&/Mac/.test(navigator.platform),iw=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),zi[qe]=String.fromCharCode(qe);for(var pl in $n)zi.hasOwnProperty(pl)||(zi[pl]=$n[pl]);function sw(t){var e=rw&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||iw&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?zi:$n)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function Oe(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i=="string"?t.setAttribute(r,i):i!=null&&(t[r]=i)}e++}for(;e<arguments.length;e++)Cg(t,arguments[e]);return t}function Cg(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var n=0;n<e.length;n++)Cg(t,e[n]);else throw new RangeError("Unsupported child node: "+e)}let st=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Ec=typeof document<"u"?document:{documentElement:{style:{}}};const Rc=/Edge\/(\d+)/.exec(st.userAgent),jg=/MSIE \d/.test(st.userAgent),Lc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(st.userAgent),Ia=!!(jg||Lc||Rc),Au=!Ia&&/gecko\/(\d+)/i.test(st.userAgent),ml=!Ia&&/Chrome\/(\d+)/.exec(st.userAgent),ow="webkitFontSmoothing"in Ec.documentElement.style,Ic=!Ia&&/Apple Computer/.test(st.vendor),Mu=Ic&&(/Mobile\/\w+/.test(st.userAgent)||st.maxTouchPoints>2);var W={mac:Mu||/Mac/.test(st.platform),windows:/Win/.test(st.platform),linux:/Linux|X11/.test(st.platform),ie:Ia,ie_version:jg?Ec.documentMode||6:Lc?+Lc[1]:Rc?+Rc[1]:0,gecko:Au,gecko_version:Au?+(/Firefox\/(\d+)/.exec(st.userAgent)||[0,0])[1]:0,chrome:!!ml,chrome_version:ml?+ml[1]:0,ios:Mu,android:/Android\b/.test(st.userAgent),webkit_version:ow?+(/\bAppleWebKit\/(\d+)/.exec(st.userAgent)||[0,0])[1]:0,safari:Ic,safari_version:Ic?+(/\bVersion\/(\d+(\.\d+)?)/.exec(st.userAgent)||[0,0])[1]:0,tabSize:Ec.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Rh(t,e){for(let n in t)n=="class"&&e.class?e.class+=" "+t.class:n=="style"&&e.style?e.style+=";"+t.style:e[n]=t[n];return e}const la=Object.create(null);function Lh(t,e,n){if(t==e)return!0;t||(t=la),e||(e=la);let r=Object.keys(t),i=Object.keys(e);if(r.length-0!=i.length-0)return!1;for(let s of r)if(s!=n&&(i.indexOf(s)==-1||t[s]!==e[s]))return!1;return!0}function aw(t,e){for(let n=t.attributes.length-1;n>=0;n--){let r=t.attributes[n].name;e[r]==null&&t.removeAttribute(r)}for(let n in e){let r=e[n];n=="style"?t.style.cssText=r:t.getAttribute(n)!=r&&t.setAttribute(n,r)}}function Du(t,e,n){let r=!1;if(e)for(let i in e)n&&i in n||(r=!0,i=="style"?t.style.cssText="":t.removeAttribute(i));if(n)for(let i in n)e&&e[i]==n[i]||(r=!0,i=="style"?t.style.cssText=n[i]:t.setAttribute(i,n[i]));return r}function lw(t){let e=Object.create(null);for(let n=0;n<t.attributes.length;n++){let r=t.attributes[n];e[r.name]=r.value}return e}class hn{eq(e){return!1}updateDOM(e,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,n,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Je=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Je||(Je={}));class re extends Ln{constructor(e,n,r,i){super(),this.startSide=e,this.endSide=n,this.widget=r,this.spec=i}get heightRelevant(){return!1}static mark(e){return new _s(e)}static widget(e){let n=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return n+=r&&!e.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new ar(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,i;if(e.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:o}=Og(e,n);r=(s?n?-3e8:-1:5e8)-1,i=(o?n?2e8:1:-6e8)+1}return new ar(e,r,i,n,e.widget||null,!0)}static line(e){return new Hs(e)}static set(e,n=!1){return ge.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}re.none=ge.empty;class _s extends re{constructor(e){let{start:n,end:r}=Og(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Rh(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||la}eq(e){return this==e||e instanceof _s&&this.tagName==e.tagName&&Lh(this.attrs,e.attrs)}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}_s.prototype.point=!1;class Hs extends re{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Hs&&this.spec.class==e.spec.class&&Lh(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}Hs.prototype.mapMode=ot.TrackBefore;Hs.prototype.point=!0;class ar extends re{constructor(e,n,r,i,s,o){super(n,r,s,e),this.block=i,this.isReplace=o,this.mapMode=i?n<=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 ar&&cw(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}ar.prototype.point=!0;function Og(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function cw(t,e){return t==e||!!(t&&e&&t.compare(e))}function Mr(t,e,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=t?n[i]=Math.max(n[i],e):n.push(t,e)}class _i extends Ln{constructor(e,n){super(),this.tagName=e,this.attributes=n}eq(e){return e==this||e instanceof _i&&this.tagName==e.tagName&&Lh(this.attributes,e.attributes)}static create(e){return new _i(e.tagName,e.attributes||la)}static set(e,n=!1){return ge.of(e,n)}}_i.prototype.startSide=_i.prototype.endSide=-1;function Hi(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function $c(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Jo(t,e){if(!e.anchorNode)return!1;try{return $c(t,e.anchorNode)}catch{return!1}}function Ni(t){return t.nodeType==3?Ui(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function Ai(t,e,n,r){return n?Tu(t,e,n,r,-1)||Tu(t,e,n,r,1):!1}function Bn(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function ca(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function Tu(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:yn(t))){if(t.nodeName=="DIV")return!1;let s=t.parentNode;if(!s||s.nodeType!=1)return!1;e=Bn(t)+(i<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=i<0?yn(t):0}else return!1}}function yn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Wi(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function hw(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function Pg(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function dw(t,e,n,r,i,s,o,a){let l=t.ownerDocument,c=l.defaultView||window;for(let d=t,u=!1;d&&!u;)if(d.nodeType==1){let f,p=d==l.body,m=1,b=1;if(p)f=hw(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}=Pg(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),n>0&&e.bottom>f.bottom+w&&(w=e.bottom-f.bottom+o)):e.bottom>f.bottom&&(w=e.bottom-f.bottom+o,n<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"&&n<0?e.top-o:e.bottom-S+o)-f.top}if(r=="nearest"?e.left<f.left?(x=e.left-(f.left+s),n>0&&e.right>f.right+x&&(x=e.right-f.right+s)):e.right>f.right&&(x=e.right-f.right+s,n<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 C=d.scrollTop;d.scrollTop+=w/b,S=(d.scrollTop-C)*b}if(x){let C=d.scrollLeft;d.scrollLeft+=x/m,v=(d.scrollLeft-C)*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 uw(t){let e=t.ownerDocument,n,r;for(let i=t.parentNode;i&&!(i==e.body||n&&r);)if(i.nodeType==1)!r&&i.scrollHeight>i.clientHeight&&(r=i),!n&&i.scrollWidth>i.clientWidth&&(n=i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;return{x:n,y:r}}class fw{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?yn(n):0),r,Math.min(e.focusOffset,r?yn(r):0))}set(e,n,r,i){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=i}}let Jn=null;W.safari&&W.safari_version>=26&&(Jn=!1);function Ng(t){if(t.setActive)return t.setActive();if(Jn)return t.focus(Jn);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(Jn==null?{get preventScroll(){return Jn={preventScroll:!0},!0}}:void 0),!Jn){Jn=!1;for(let n=0;n<e.length;){let r=e[n++],i=e[n++],s=e[n++];r.scrollTop!=i&&(r.scrollTop=i),r.scrollLeft!=s&&(r.scrollLeft=s)}}}let Eu;function Ui(t,e,n=e){let r=Eu||(Eu=document.createRange());return r.setEnd(t,n),r.setStart(t,e),r}function Dr(t,e,n,r){let i={key:e,code:e,keyCode:n,which:n,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,t.dispatchEvent(s);let o=new KeyboardEvent("keyup",i);return o.synthetic=!0,t.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function pw(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function mw(t,e){let n=e.focusNode,r=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=r)return!1;for(r=Math.min(r,yn(n));;)if(r){if(n.nodeType!=1)return!1;let i=n.childNodes[r-1];i.contentEditable=="false"?r--:(n=i,r=yn(n))}else{if(n==t)return!0;r=Bn(n),n=n.parentNode}}function Ag(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function Mg(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=yn(n)}else if(n.parentNode&&!ca(n))r=Bn(n),n=n.parentNode;else return null}}function Dg(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r<n.nodeValue.length)return{node:n,offset:r};if(n.nodeType==1&&r<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!ca(n))r=Bn(n)+1,n=n.parentNode;else return null}}class Ft{constructor(e,n,r=!0){this.node=e,this.offset=n,this.precise=r}static before(e,n){return new Ft(e.parentNode,Bn(e),n)}static after(e,n){return new Ft(e.parentNode,Bn(e)+1,n)}}var Ne=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Ne||(Ne={}));const lr=Ne.LTR,Ih=Ne.RTL;function Tg(t){let e=[];for(let n=0;n<t.length;n++)e.push(1<<+t[n]);return e}const gw=Tg("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),bw=Tg("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Bc=Object.create(null),Jt=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),n=t.charCodeAt(1);Bc[e]=n,Bc[n]=-e}function Eg(t){return t<=247?gw[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?bw[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const xw=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class bn{get dir(){return this.level%2?Ih:lr}constructor(e,n,r){this.from=e,this.to=n,this.level=r}side(e,n){return this.dir==n==e?this.to:this.from}forward(e,n){return e==(this.dir==n)}static find(e,n,r,i){let s=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=n&&a.to>=n){if(a.level==r)return o;(s<0||(i!=0?i<0?a.from<n:a.to>n:e[s].level>a.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function Rg(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++){let r=t[n],i=e[n];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!Rg(r.inner,i.inner))return!1}return!0}const Pe=[];function yw(t,e,n,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:n,l=s?256:i;for(let c=o,d=l,u=l;c<a;c++){let f=Eg(t.charCodeAt(c));f==512?f=d:f==8&&u==4&&(f=16),Pe[c]=f==4?2:f,f&7&&(u=f),d=f}for(let c=o,d=l,u=l;c<a;c++){let f=Pe[c];if(f==128)c<a-1&&d==Pe[c+1]&&d&24?f=Pe[c]=d:Pe[c]=256;else if(f==64){let p=c+1;for(;p<a&&Pe[p]==64;)p++;let m=c&&d==8||p<n&&Pe[p]==8?u==1?1:8:256;for(let b=c;b<p;b++)Pe[b]=m;c=p-1}else f==8&&u==1&&(Pe[c]=1);d=f,f&7&&(u=f)}}}function vw(t,e,n,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:n;for(let u=c,f,p,m;u<d;u++)if(p=Bc[f=t.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&&(Pe[u]=Pe[Jt[b]]=w),a=b;break}}else{if(Jt.length==189)break;Jt[a++]=u,Jt[a++]=f,Jt[a++]=l}else if((m=Pe[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 ww(t,e,n,r){for(let i=0,s=r;i<=n.length;i++){let o=i?n[i-1].to:t,a=i<n.length?n[i].from:e;for(let l=o;l<a;){let c=Pe[l];if(c==256){let d=l+1;for(;;)if(d==a){if(i==n.length)break;d=n[i++].to,a=i<n.length?n[i].from:e}else if(Pe[d]==256)d++;else break;let u=s==1,f=(d<e?Pe[d]:r)==1,p=u==f?u?1:2:r;for(let m=d,b=i,x=b?n[b-1].to:t;m>l;)m==x&&(m=n[--b].from,x=b?n[b-1].to:t),Pe[--m]=p;l=d}else s=c,l++}}}function Fc(t,e,n,r,i,s,o){let a=r%2?2:1;if(r%2==i%2)for(let l=e,c=0;l<n;){let d=!0,u=!1;if(c==s.length||l<s[c].from){let b=Pe[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==n)break e;if(w<s.length&&s[w].from==x)x=s[w++].to;else{if(Pe[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==lr!=!(p%2);Vc(t,x?r+1:r,i,b.inner,b.from,b.to,o),l=b.to}m=b.to}else{if(m==n||(d?Pe[m]!=a:Pe[m]==a))break;m++}f?Fc(t,l,m,r+1,i,f,o):l<m&&o.push(new bn(l,m,p)),l=m}else for(let l=n,c=s.length;l>e;){let d=!0,u=!1;if(!c||l>s[c-1].to){let b=Pe[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(Pe[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==lr!=!(p%2);Vc(t,x?r+1:r,i,b.inner,b.from,b.to,o),l=b.from}m=b.from}else{if(m==e||(d?Pe[m-1]!=a:Pe[m-1]==a))break;m--}f?Fc(t,m,l,r+1,i,f,o):m<l&&o.push(new bn(m,l,p)),l=m}}function Vc(t,e,n,r,i,s,o){let a=e%2?2:1;yw(t,i,s,r,a),vw(t,i,s,r,a),ww(i,s,r,a),Fc(t,i,s,e,n,r,o)}function kw(t,e,n){if(!t)return[new bn(0,0,e==Ih?1:0)];if(e==lr&&!n.length&&!xw.test(t))return Lg(t.length);if(n.length)for(;t.length>Pe.length;)Pe[Pe.length]=256;let r=[],i=e==lr?0:1;return Vc(t,i,i,n,0,t.length,r),r}function Lg(t){return[new bn(0,t,0)]}let Ig="";function Sw(t,e,n,r,i){var s;let o=r.head-t.from,a=bn.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),l=e[a],c=l.side(i,n);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,n),c=l.side(i,n)}let d=_e(t.text,o,l.forward(i,n));(d<l.from||d>l.to)&&(d=c),Ig=t.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,n)+t.from,u.forward(i,n)?1:-1,u.level):E.cursor(d+t.from,l.forward(i,n)?-1:1,l.level)}function Cw(t,e,n){for(let r=e;r<n;r++){let i=Eg(t.charCodeAt(r));if(i==1)return lr;if(i==2||i==4)return Ih}return lr}const $g=U.define(),Bg=U.define(),Fg=U.define(),Vg=U.define(),zc=U.define(),zg=U.define(),_g=U.define(),$h=U.define(),Bh=U.define(),Hg=U.define({combine:t=>t.some(e=>e)}),Wg=U.define({combine:t=>t.some(e=>e)}),Ug=U.define();class Tr{constructor(e,n="nearest",r="nearest",i=5,s=5,o=!1){this.range=e,this.y=n,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 vo=ce.define({map:(t,e)=>t.map(e)}),Kg=ce.define();function ut(t,e,n){let r=t.facet(Vg);r.length?r[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const gn=U.define({combine:t=>t.length?t[0]:!0});let jw=0;const kr=U.define({combine(t){return t.filter((e,n)=>{for(let r=0;r<n;r++)if(t[r].plugin==e.plugin)return!1;return!0})}});class Fe{constructor(e,n,r,i,s){this.id=e,this.create=n,this.domEventHandlers=r,this.domEventObservers=i,this.baseExtensions=s(this),this.extension=this.baseExtensions.concat(kr.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(kr.of({plugin:this,arg:e}))}static define(e,n){const{eventHandlers:r,eventObservers:i,provide:s,decorations:o}=n||{};return new Fe(jw++,e,r,i,a=>{let l=[];return o&&l.push(Ki.of(c=>{let d=c.plugin(a);return d?o(d):re.none})),s&&l.push(s(a)),l})}static fromClass(e,n){return Fe.define((r,i)=>new e(r,i),n)}}class gl{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(ut(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(n){ut(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){ut(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Gg=U.define(),Fh=U.define(),Ki=U.define(),qg=U.define(),Jg=U.define(),Ws=U.define(),Yg=U.define();function Ru(t,e){let n=t.state.facet(Yg);if(!n.length)return n;let r=n.map(s=>s instanceof Function?s(t):s),i=[];return ge.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=Cw(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 Qg=U.define();function Vh(t){let e=0,n=0,r=0,i=0;for(let s of t.state.facet(Qg)){let o=s(t);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:n,top:r,bottom:i}}const vi=U.define();class Mt{constructor(e,n,r,i){this.fromA=e,this.toA=n,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 n=e.length,r=this;for(;n>0;n--){let i=e[n-1];if(!(i.fromA>r.toA)){if(i.toA<r.fromA)break;r=r.join(i),e.splice(n-1,1)}}return e.splice(n,0,r),e}static extendWithRanges(e,n){if(n.length==0)return e;let r=[];for(let i=0,s=0,o=0;;){let a=i<e.length?e[i].fromB:1e9,l=s<n.length?n[s]:1e9,c=Math.min(a,l);if(c==1e9)break;let d=c+o,u=c,f=d;for(;;)if(s<n.length&&n[s]<=u){let p=n[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 ha{constructor(e,n,r){this.view=e,this.state=n,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,n,r){return new ha(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const Ow=[];class Ve{constructor(e,n,r=0){this.dom=e,this.length=n,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return Ow}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let n=this.domAttrs;n&&aw(this.dom,n)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,n=this.posAtStart){let r=n;for(let 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,n){return null}domPosFor(e,n){let r=Bn(this.dom),i=this.length?e>0:n>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 Ba)return e;return null}static get(e){return e.cmTile}}class $a 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 n=this.dom,r=null,i,s=e?.node==n?e:null,o=0;for(let a of this.children){if(a.sync(e),o+=a.length+a.breakAfter,i=r?r.nextSibling:n.firstChild,s&&i!=a.dom&&(s.written=!0),a.dom.parentNode==n)for(;i&&i!=a.dom;)i=Lu(i);else n.insertBefore(a.dom,i);r=a.dom}for(i=r?r.nextSibling:n.firstChild,s&&i&&(s.written=!0);i;)i=Lu(i);this.length=o}}function Lu(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Ba extends $a{constructor(e,n){super(n),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let n=Ve.get(e);if(n&&this.owns(n))return n;e=e.parentNode}}blockTiles(e){for(let n=[],r=this,i=0,s=0;;)if(i==r.children.length){if(!n.length)return;r=r.parent,r.breakAfter&&s++,i=n.pop()}else{let o=r.children[i++];if(o instanceof Tn)n.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,n){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()&&n>=-1&&n<=1){if(a.flags&32)return!0;a.flags&16&&(r=void 0)}(l<e||e==c&&(n<-1?a.length:a.covers(1)))&&(!r||!a.isWidget()&&r.isWidget())&&(r=a,i=e-l),(c>e||e==l&&(n>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&&n<0||!s?{tile:r,offset:i}:{tile:s,offset:o}}}class Tn extends $a{constructor(e,n){super(e),this.wrapper=n}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,n){let r=new Tn(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class $r extends $a{constructor(e,n){super(e),this.attrs=n}isLine(){return!0}static start(e,n,r){let i=new $r(n||document.createElement("div"),e);return(!n||!r)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,n,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&&(n>0||r&&Nw(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=(n<0?i:o)||i||o;return c?{tile:c,offset:c==i?s:a}:null}coordsIn(e,n){let r=this.resolveInline(e,n,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),n):Pw(this)}domIn(e,n){let r=this.resolveInline(e,n);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:n);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 Pw(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=Ni(e);return n[n.length-1]||null}function Nw(t,e){let n=t.coordsIn(0,1),r=e.coordsIn(0,1);return n&&r&&r.top<n.bottom}class dt extends $a{constructor(e,n){super(e),this.mark=n}get domAttrs(){return this.mark.attrs}static of(e,n){let r=new dt(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class rr extends Ve{constructor(e,n){super(e,n.length),this.text=n}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,n){let r=this.dom.nodeValue.length;e>r&&(e=r);let i=e,s=e,o=0;e==0&&n<0||e==r&&n>=0?W.chrome||W.gecko||(e?(i--,o=1):s<r&&(s++,o=-1)):n<0?i--:s<r&&s++;let a=Ui(this.dom,i,s).getClientRects();if(!a.length)return null;let l=a[(o?o<0:n>=0)?0:a.length-1];return W.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?Wi(l,o<0):l||null}static of(e,n){let r=new rr(n||document.createTextNode(e),e);return n||(r.flags|=2),r}}class Br extends Ve{constructor(e,n,r,i){super(e,n,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,n){return this.coordsInWidget(e,n,!1)}coordsInWidget(e,n,r){let i=this.widget.coordsAt(this.dom,e,n);if(i)return i;if(r)return Wi(this.dom.getBoundingClientRect(),this.length?e==0:n<=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 Wi(o,!a)}}get overrideDOMText(){if(!this.length)return we.empty;let{root:e}=this;if(!e)return we.empty;let n=this.posAtStart;return e.view.state.doc.slice(n,n+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,n,r,i,s){return s||(s=e.toDOM(n),e.editable||(s.contentEditable="false")),new Br(s,r,e,i)}}class da extends Ve{constructor(e){let n=document.createElement("img");n.className="cm-widgetBuffer",n.setAttribute("aria-hidden","true"),super(n,0,e)}get isHidden(){return!1}get overrideDOMText(){return we.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class Aw{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,n,r){let{tile:i,index:s,beforeBreak:o,parents:a}=this;for(;e||n>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;(n>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 Mw{constructor(e,n,r,i){this.from=e,this.to=n,this.wrapper=r,this.rank=i}}class Dw{constructor(e,n,r){this.cache=e,this.root=n,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,n,r,i){var s;this.flushBuffer();let o=this.ensureMarks(n,r),a=o.lastChild;if(a&&a.isText()&&!(a.flags&8)){this.cache.reused.set(a,2);let l=o.children[o.children.length-1]=new rr(a.dom,a.text+e);l.parent=o}else o.append(i||rr.of(e,(s=this.cache.find(rr))===null||s===void 0?void 0:s.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,n){let r=this.curLine;r.dom!=n.line.dom&&(r.setDOM(this.cache.reused.has(n.line)?bl(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let i=r;for(let a=n.marks.length-1;a>=0;a--){let l=n.marks[a],c=i.lastChild;if(c instanceof dt&&c.mark.eq(l.mark))c.dom!=l.dom&&c.setDOM(bl(l.dom)),i=c;else{if(this.cache.reused.get(l)){let u=Ve.get(l.dom);u&&u.setDOM(bl(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 rr(e.text,e.text.nodeValue);o.flags|=8,i.append(o)}addInlineWidget(e,n,r){let i=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);i||this.flushBuffer();let s=this.ensureMarks(n,r);!i&&!(e.flags&16)&&s.append(this.getBuffer(1)),s.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,n,r){this.flushBuffer(),this.ensureMarks(n,r).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let n=this.afterWidget||this.lastBlock;n.length+=e,this.pos+=e}addLineStart(e,n){var r;e||(e=Xg);let i=$r.start(e,n||((r=this.cache.find($r))===null||r===void 0?void 0:r.dom),!!n);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,n){var r;let i=this.curLine;for(let s=e.length-1;s>=0;s--){let o=e[s],a;if(n>0&&(a=i.lastChild)&&a instanceof dt&&a.mark.eq(o))i=a,n--;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,n=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!Iu(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(W.ios&&Iu(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(xl,0,32)||new Br(xl.toDOM(),0,xl,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let n=new Mw(e.from,e.to,e.value,e.rank),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-n.rank||this.wrappers[r-1].to-n.to)<0;)r--;this.wrappers.splice(r,0,n)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let n=this.root;for(let r of this.wrappers){let i=n.lastChild;if(r.from<this.pos&&i instanceof Tn&&i.wrapper.eq(r.wrapper))n=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);n.append(s),n=s}}return n}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let n=2|(e<0?16:32),r=this.cache.find(da,void 0,1);return r&&(r.flags=n),r||new da(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class Tw{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 n=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,n);return this.textOff=n,r}}const ua=[Br,$r,rr,dt,da,Tn,Ba];for(let t=0;t<ua.length;t++)ua[t].bucket=t;class Ew{constructor(e){this.view=e,this.buckets=ua.map(()=>[]),this.index=ua.map(()=>0),this.reused=new Map}add(e){let n=e.constructor.bucket,r=this.buckets[n];r.length<6?r.push(e):r[this.index[n]=(this.index[n]+1)%6]=e}find(e,n,r=2){let 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((!n||n(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,n,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=n,a.flags=a.flags&-498|r,a}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,n=2){if(!this.reused.has(e))return this.reused.set(e,n),e.dom}}class Rw{constructor(e,n,r,i,s){this.view=e,this.decorations=i,this.disallowBlockEffectsFor=s,this.openWidget=!1,this.openMarks=0,this.cache=new Ew(e),this.text=new Tw(e.state.doc),this.builder=new Dw(this.cache,new Ba(e,e.contentDOM),ge.iter(r)),this.cache.reused.set(n,2),this.old=new Aw(n),this.reuseWalker={skip:(o,a,l)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,n){let r=n&&this.getCompositionContext(n.text);for(let 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),n&&a.fromA<=n.range.fromA&&a.toA>=n.range.toA?(this.emit(s,n.range.fromB),this.builder.addComposition(n,r),this.text.skip(n.range.toB-n.range.fromB),this.emit(n.range.toB,a.toB)):this.emit(s,a.toB),s=a.toB,i=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,n,r){let i=$w(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 da)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,n){let r=null,i=this.builder,s=0,o=ge.spans(this.decorations,e,n,{point:(a,l,c,d,u,f)=>{if(c instanceof ar){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=Lw(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=Iw(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,n){n-e<=10?this.old.advance(n-e,1,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-e-10,-1),this.old.advance(5,1,this.reuseWalker))}getCompositionContext(e){let n=[],r=null;for(let i=e.parentNode;;i=i.parentNode){let s=Ve.get(i);if(i==this.view.contentDOM)break;s instanceof dt?n.push(s):s?.isLine()?r=s:i.nodeName=="DIV"&&!r&&i!=this.view.contentDOM?r=new $r(i,Xg):n.push(dt.of(new _s({tagName:i.nodeName.toLowerCase(),attributes:lw(i)}),i))}return{line:r,marks:n}}}function Iu(t,e){let n=r=>{for(let i of r.children)if((e?i.isText():i.length)||n(i))return!0;return!1};return n(t)}function Lw(t){let e=t.isReplace?(t.startSide<0?64:0)|(t.endSide>0?128:0):t.startSide>0?32:16;return t.block&&(e|=256),e}const Xg={class:"cm-line"};function Iw(t,e){let n=e.spec.attributes,r=e.spec.class;return!n&&!r||(t||(t={class:"cm-line"}),n&&Rh(n,t),r&&(t.class+=" "+r)),t}function $w(t){let e=[];for(let n=t.parents.length;n>1;n--){let r=n==t.parents.length?t.tile:t.parents[n].tile;r instanceof dt&&e.push(r.mark)}return e}function bl(t){let e=Ve.get(t);return e&&e.setDOM(t.cloneNode()),t}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 xl=new class extends hn{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class $u{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=re.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 Ba(e,e.contentDOM),this.updateInner([new Mt(0,0,0,e.state.doc.length)],null)}update(e){var n;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&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?i=this.domChanged.newSel.head:!Kw(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?Fw(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,(W.ie||W.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=_w(o,this.decorations,e.changes);l.length&&(r=Mt.extendWithRanges(r,l));let c=Ww(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,n){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(n||e.length){let o=this.tile,a=new Rw(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=a.run(e,n),_c(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=W.chrome||W.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 yl&&i.push(s.dom);r.updateGaps(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(Kg)&&(this.editContextFormatting=r.value)}updateSelection(e=!1,n=!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)&&Jo(r,this.view.observer.selectionRange)&&!(i&&r.contains(i));if(!(s||n||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)),W.gecko&&l.empty&&!this.hasComposition&&Bw(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||(!Ai(c.node,c.offset,u.anchorNode,u.anchorOffset)||!Ai(d.node,d.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,l))&&(this.view.observer.ignore(()=>{W.android&&W.chrome&&r.contains(u.focusNode)&&Uw(u.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let f=Hi(this.view.root);if(f)if(l.empty){if(W.gecko){let p=Vw(c.node,c.offset);if(p&&p!=3){let m=(p==1?Mg:Dg)(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,n){return this.hasComposition&&n.empty&&Ai(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=Hi(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let o=this.lineAt(n.head,n.assoc);if(!o)return;let a=o.posAtStart;if(n.head==a||n.head==a+o.length)return;let l=this.coordsAt(n.head,-1),c=this.coordsAt(n.head,1);if(!l||!c||l.bottom>c.top)return;let d=this.domAtPos(n.head+n.assoc,n.assoc);r.collapse(d.node,d.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=n.from&&r.collapse(i,s)}posFromDOM(e,n){let r=this.tile.nearest(e);if(!r)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let i=r.posAtStart;if(r.isComposite()){let s;if(e==r.dom)s=r.dom.childNodes[n];else{let o=yn(e)==0?0:n==0?-1:1;for(;;){let a=e.parentNode;if(a==r.dom)break;o==0&&a.firstChild!=a.lastChild&&(e==a.firstChild?o=-1:o=1),e=a}o<0?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+n:i+(n?r.length:0):i}domAtPos(e,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,n);return r.isWidget()?r.domPosFor(e,n):r.domIn(i,n)}inlineDOMNearPos(e,n){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,n):(s&&o?r=null:l&&r&&(o=null),r&&n<0||!o?r.domIn(i,n):o.domIn(a,n))}coordsAt(e,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,n);return r.isWidget()?r.widget instanceof yl?null:r.coordsInWidget(i,n,!0):r.coordsIn(i,n)}lineAt(e,n){let{tile:r}=this.tile.resolveBlock(e,n);return r.isLine()?r:null}coordsForChar(e){let{tile:n,offset:r}=this.tile.resolveBlock(e,1);if(!n.isLine())return null;function 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=Ui(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(n,r)}measureVisibleLineHeights(e){let n=[],{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==Ne.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&&n.push(-c),n.push(v+c),c=0,o)){let S=b.dom.lastChild,C=S?Ni(S):[];if(C.length){let k=C[C.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),n}textDirectionAt(e){let{tile:n}=this.tile.resolveBlock(e,1);return getComputedStyle(n.dom).direction=="rtl"?Ne.RTL:Ne.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=Ni(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 n=document.createElement("div"),r,i,s;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let o=Ni(n.firstChild)[0];r=n.getBoundingClientRect().height,i=o&&o.width?o.width/27:7,s=o&&o.height?o.height:r,n.remove()}),{lineHeight:r,charWidth:i,textHeight:s}}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,i=0;;i++){let s=i==n.viewports.length?null:n.viewports[i],o=s?s.from-1:this.view.state.doc.length;if(o>r){let a=(n.lineBlockAt(o).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(re.replace({widget:new yl(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return re.set(e)}updateDeco(){let e=1,n=this.view.state.facet(Ki).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(Jg).map((s,o)=>{let a=typeof s=="function";return a&&(r=!0),a?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[e++]=r,n.push(ge.join(i))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(qg).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(Ug))try{if(c(this.view,e.range,e))return!0}catch(d){ut(this.view.state,d,"scroll handler")}let{range:n}=e,r=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1),i;if(!r)return;!n.empty&&(i=this.coordsAt(n.anchor,n.anchor>n.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=Vh(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;dw(this.view.scrollDOM,o,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,a),-a),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==Ne.LTR)}lineHasWidget(e){let n=r=>r.isWidget()||r.children.some(n);return n(this.tile.resolveBlock(e,1).tile)}destroy(){_c(this.tile)}}function _c(t,e){let n=e?.get(t);if(n!=1){n==null&&t.destroy();for(let r of t.children)_c(r,e)}}function Bw(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function Zg(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=Mg(n.focusNode,n.focusOffset),i=Dg(n.focusNode,n.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(t.docView.lastCompositionAfterCursor){let l=Ve.get(r.node);!l||l.isText()&&l.text!=r.node.nodeValue||(s=i)}}if(t.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 Fw(t,e,n){let r=Zg(t,n);if(!r)return null;let{node:i,from:s,to:o}=r,a=i.nodeValue;if(/[\n\r]/.test(a)||t.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 Vw(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e<t.childNodes.length&&t.childNodes[e].contentEditable=="false"?2:0)}let zw=class{constructor(){this.changes=[]}compareRange(e,n){Mr(e,n,this.changes)}comparePoint(e,n){Mr(e,n,this.changes)}boundChange(e){Mr(e,e,this.changes)}};function _w(t,e,n){let r=new zw;return ge.compare(t,e,n,r),r.changes}class Hw{constructor(){this.changes=[]}compareRange(e,n){Mr(e,n,this.changes)}comparePoint(){}boundChange(e){Mr(e,e,this.changes)}}function Ww(t,e,n){let r=new Hw;return ge.compare(t,e,n,r),r.changes}function Uw(t,e){for(let n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function Kw(t,e){let n=!1;return e&&t.iterChangedRanges((r,i)=>{r<e.to&&i>e.from&&(n=!0)}),n}class yl 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 Gw(t,e,n=1){let r=t.charCategorizer(e),i=t.doc.lineAt(e),s=e-i.from;if(i.length==0)return E.cursor(e);s==0?n=1:s==i.length&&(n=-1);let o=s,a=s;n<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 qw(t,e,n,r,i){let s=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let a=t.viewState.heightOracle.textHeight,l=Math.floor((i-n.top-(t.defaultLineHeight-a)*.5)/a);s+=l*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(n.from,n.to);return n.from+Mc(o,s,t.state.tabSize)}function Hc(t,e,n){let r=t.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||(n<0?s.from<e:s.to>e)))&&(i=s)}}return i||r}return r}function Jw(t,e,n,r){let i=Hc(t,e.head,e.assoc||-1),s=!r||i.type!=Je.Text||!(t.lineWrapping||i.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=t.dom.getBoundingClientRect(),a=t.textDirectionAt(i.from),l=t.posAtCoords({x:n==(a==Ne.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(l!=null)return E.cursor(l,n?-1:1)}return E.cursor(n?i.to:i.from,n?-1:1)}function Bu(t,e,n,r){let i=t.state.doc.lineAt(e.head),s=t.bidiSpans(i),o=t.textDirectionAt(i.from);for(let a=e,l=null;;){let c=Sw(i,s,o,a,n),d=Ig;if(!c){if(i.number==(n?t.state.doc.lines:1))return a;d=`
229
- `,i=t.state.doc.line(i.number+(n?1:-1)),s=t.bidiSpans(i),c=t.visualLineSide(i,!n)}if(l){if(!l(d))return a}else{if(!r)return c;l=r(d)}a=c}}function Yw(t,e,n){let r=t.state.charCategorizer(e),i=r(n);return s=>{let o=r(s);return i==Te.Space&&(i=o),i==o}}function Qw(t,e,n,r){let i=e.head,s=n?1:-1;if(i==(n?t.state.doc.length:0))return E.cursor(i,e.assoc);let o=e.goalColumn,a,l=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(i,e.assoc||-1),d=t.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let p=t.viewState.lineBlockAt(i);o==null&&(o=Math.min(l.right-l.left,t.defaultCharacterWidth*(i-p.from))),a=(s<0?p.top:p.bottom)+d}let u=l.left+o,f=r??t.viewState.heightOracle.textHeight>>1;for(let p=0;;p+=10){let m=a+(f+p)*s,b=Wc(t,{x:u,y:m},!1,s);return E.cursor(b.pos,b.assoc,void 0,o)}}function Mi(t,e,n){for(;;){let r=0;for(let i of t)i.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=r||n||(e-s<o-e?-1:1);e=l<0?s:o,r=l}});if(!r)return e}}function e0(t,e){let n=null;for(let r=0;r<e.ranges.length;r++){let i=e.ranges[r],s=null;if(i.empty){let o=Mi(t,i.from,0);o!=i.from&&(s=E.cursor(o,-1))}else{let o=Mi(t,i.from,-1),a=Mi(t,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&&(n||(n=e.ranges.slice()),n[r]=s)}return n?E.create(n,e.mainIndex):e}function vl(t,e,n){let r=Mi(t.state.facet(Ws).map(i=>i(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:E.cursor(r,r<n.from?1:-1)}class en{constructor(e,n){this.pos=e,this.assoc=n}}function Wc(t,e,n,r){let i=t.contentDOM.getBoundingClientRect(),s=i.top+t.viewState.paddingTop,{x:o,y:a}=e,l=a-s,c;for(;;){if(l<0)return new en(0,1);if(l>t.viewState.docHeight)return new en(t.state.doc.length,-1);if(c=t.elementAtHeight(l),r==null)break;if(c.type==Je.Text){let f=t.docView.coordsAt(r<0?c.from:c.to,r);if(f&&(r<0?f.top<=l+s:f.bottom>=l+s))break}let u=t.viewState.heightOracle.textHeight/2;l=r>0?c.bottom+u:c.top-u}if(t.viewport.from>=c.to||t.viewport.to<=c.from){if(n)return null;if(c.type==Je.Text){let u=qw(t,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=t.docView.lineAt(c.from,2);return(!d||d.length!=c.length)&&(d=t.docView.lineAt(c.from,-2)),t0(t,d,c.from,o,a)}function t0(t,e,n,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(Ui(e.dom,p,m).getClientRects(),p),!a&&!l)break;p=m}return r>(o.left+o.right)/2==(Fu(t,s+n)==Ne.LTR)?new en(n+_e(e.text,s),-1):new en(n+s,1)}else{if(!e.length)return new en(n,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:Ui(x.dom,0,x.length)).getClientRects();if(u(w,b),!a&&!l)break}let f=e.children[s],p=e.posBefore(f,n);return f.isComposite()||f.isText()?t0(t,f,p,Math.max(o.left,Math.min(o.right,r)),i):r>(o.left+o.right)/2==(Fu(t,s+n)==Ne.LTR)?new en(p+f.length,-1):new en(p,1)}}function Fu(t,e){let n=t.state.doc.lineAt(e);return t.bidiSpans(n)[bn.find(t.bidiSpans(n),e-n.from,-1,1)].dir}const wi="￿";class Xw{constructor(e,n){this.points=e,this.view=n,this.text="",this.lineSeparator=n.state.facet(be.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=wi}readRange(e,n){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==n){o?.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=Ve.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:ca(i))||ca(a)&&(i.nodeName!="BR"||o?.isWidget())&&this.text.length>s)&&!ek(a,n)&&this.lineBreak(),i=a}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,a;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=i.exec(n))&&(s=a.index,o=a[0].length),this.append(n.slice(r,s<0?n.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 n=Ve.get(e),r=n&&n.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,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(Zw(e,r.node,r.offset)?n:0))}}function Zw(t,e,n){for(;;){if(!e||n<yn(e))return!1;if(e==t)return!0;n=Bn(e)+1,e=e.parentNode}}function ek(t,e){let n;for(;!(t==e||!t);t=t.nextSibling){let r=Ve.get(t);if(!r?.isWidget())return!1;r&&(n||(n=[])).push(r)}if(n)for(let r of n){let i=r.overrideDOMText;if(i?.length)return!1}return!0}class Vu{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}}class tk{constructor(e,n,r,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=n0(e.docView.tile,n,r,0))){let a=s||o?[]:rk(e),l=new Xw(a,e);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=ik(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!$c(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||!$c(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),d=e.viewport;if((W.ios||W.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 n0(t,e,n,r){if(t.isComposite()){let i=-1,s=-1,o=-1,a=-1;for(let l=0,c=r,d=r;l<t.children.length;l++){let u=t.children[l],f=c+u.length;if(c<e&&f>n)return n0(u,e,n,c);if(f>=e&&i==-1&&(i=l,s=c),c>n&&u.dom.parentNode==t.dom){o=l,a=d;break}d=f,c=f+u.breakAfter}return{from:s,to:a<0?r+t.length:a,startDOM:(i?t.children[i-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:o<t.children.length&&o>=0?t.children[o].dom:null}}else return t.isText()?{from:r,to:r+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function r0(t,e){let n,{newSel:r}=e,i=t.state.selection.main,s=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,l=i.from,c=null;(s===8||W.android&&e.text.length<a-o)&&(l=i.to,c="end");let d=i0(t.state.doc.sliceString(o,a,wi),e.text,l-o,c);d&&(W.chrome&&s==13&&d.toB==d.from+2&&e.text.slice(d.from,d.toB)==wi+wi&&d.toB--,n={from:o+d.from,to:o+d.toA,insert:we.of(e.text.slice(d.from,d.toB).split(wi))})}else r&&(!t.hasFocus&&t.state.facet(gn)||r.main.eq(i))&&(r=null);if(!n&&!r)return!1;if(!n&&e.typeOver&&!i.empty&&r&&r.main.empty?n={from:i.from,to:i.to,insert:t.state.doc.slice(i.from,i.to)}:(W.mac||W.android)&&n&&n.from==n.to&&n.from==i.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=E.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:we.of([n.insert.toString().replace("."," ")])}):n&&n.from>=i.from&&n.to<=i.to&&(n.from!=i.from||n.to!=i.to)&&i.to-i.from-(n.to-n.from)<=4?n={from:i.from,to:i.to,insert:t.state.doc.slice(i.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,i.to))}:t.state.doc.lineAt(i.from).to<i.to&&t.docView.lineHasWidget(i.to)&&t.inputState.insertingTextAt>Date.now()-50?n={from:i.from,to:i.to,insert:t.state.toText(t.inputState.insertingText)}:W.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==`
230
- `&&t.lineWrapping&&(r&&(r=E.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:we.of([" "])}),n)return zh(t,n,r,s);if(r&&!r.main.eq(i)){let o=!1,a="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),a=t.inputState.lastSelectionOrigin,a=="select.pointer"&&(r=e0(t.state.facet(Ws).map(l=>l(t)),r))),t.dispatch({selection:r,scrollIntoView:o,userEvent:a}),!0}else return!1}function zh(t,e,n,r=-1){if(W.ios&&t.inputState.flushIOSKey(e))return!0;let i=t.state.selection.main;if(W.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&t.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Dr(t.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(t.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&Dr(t.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,a=()=>o||(o=nk(t,e,n));return t.state.facet(zg).some(l=>l(t,e.from,e.to,s,a))||t.dispatch(a()),!0}function nk(t,e,n){let r,i=t.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=Mi(i.facet(Ws).map(u=>u(t)),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&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.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(t.state.toText(l+e.insert.sliceString(0,void 0,t.state.lineBreak)+c))}else{let l=i.changes(e),c=n&&n.main.to<=l.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let d=t.state.sliceDoc(e.from,e.to),u,f=n&&Zg(t,n.main.head);if(f){let m=e.insert.length-(e.to-e.from);u={from:f.from,to:f.to-m}}else u=t.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(t.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(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,a+=".compose",t.inputState.compositionFirstChange&&(a+=".start",t.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:a,scrollIntoView:!0})}function i0(t,e,n,r){let i=Math.min(t.length,e.length),s=0;for(;s<i&&t.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&t.length==e.length)return null;let o=t.length,a=e.length;for(;o>0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,s-Math.min(o,a));n-=o+l-s}if(o<s&&t.length<e.length){let l=n<=s&&n>=o?s-n:0;s-=l,a=s+(a-o),o=s}else if(a<s){let l=n<=s&&n>=a?s-n:0;s-=l,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function rk(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}=t.observer.selectionRange;return n&&(e.push(new Vu(n,r)),(i!=n||s!=r)&&e.push(new Vu(i,s))),e}function ik(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?E.single(n+e,r+e):null}class sk{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,W.safari&&e.contentDOM.addEventListener("input",()=>null),W.gecko&&vk(e.contentDOM.ownerDocument)}handleEvent(e){!fk(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,n);for(let i of r.handlers){if(n.defaultPrevented)break;if(i(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=ok(e),r=this.handlers,i=this.view.contentDOM;for(let s in n)if(s!="scroll"){let o=!n[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"&&!n[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&o0.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),W.android&&W.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return W.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=s0.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||ak.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Dr(this.view.contentDOM,n.key,n.keyCode,n instanceof KeyboardEvent?n:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:W.safari&&!W.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 zu(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(i){ut(n.state,i)}}}function ok(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){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&&n(a).handlers.push(zu(r.value,l))}if(o)for(let a in o){let l=o[a];l&&n(a).observers.push(zu(r.value,l))}}for(let r in zt)n(r).handlers.push(zt[r]);for(let r in Lt)n(r).observers.push(Lt[r]);return e}const s0=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],ak="dthko",o0=[16,17,18,20,91,92,224,225],wo=6;function ko(t){return Math.max(0,t)*.7+8}function lk(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class ck{constructor(e,n,r,i){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=uw(e.contentDOM),this.atoms=e.state.facet(Ws).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=n.shiftKey,this.multiple=e.state.facet(be.allowMultipleSelections)&&hk(e,n),this.dragging=uk(e,n)&&c0(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&lk(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=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=Vh(this.view);e.clientX-l.left<=i+wo?n=-ko(i-e.clientX):e.clientX+l.right>=o-wo&&(n=ko(e.clientX-o)),e.clientY-l.top<=s+wo?r=-ko(s-e.clientY):e.clientY+l.bottom>=a-wo&&(r=ko(e.clientY-a)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=e0(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function hk(t,e){let n=t.state.facet($g);return n.length?n[0](e):W.mac?e.metaKey:e.ctrlKey}function dk(t,e){let n=t.state.facet(Bg);return n.length?n[0](e):W.mac?!e.altKey:!e.ctrlKey}function uk(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=Hi(t.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 fk(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=Ve.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const zt=Object.create(null),Lt=Object.create(null),a0=W.ie&&W.ie_version<15||W.ios&&W.webkit_version<604;function pk(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),l0(t,n.value)},50)}function Fa(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function l0(t,e){e=Fa(t.state,$h,e);let{state:n}=t,r,i=1,s=n.toText(e),o=s.lines==n.selection.ranges.length;if(Uc!=null&&n.selection.ranges.every(l=>l.empty)&&Uc==s.toString()){let l=-1;r=n.changeByRange(c=>{let d=n.doc.lineAt(c.from);if(d.from==l)return{range:c};l=d.from;let u=n.toText((o?s.line(i++).text:e)+n.lineBreak);return{changes:{from:d.from,insert:u},range:E.cursor(c.from+u.length)}})}else o?r=n.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=n.replaceSelection(s);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Lt.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};zt.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Lt.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Lt.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};zt.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(Fg))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=gk(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new ck(t,e,n,r)),r&&t.observer.ignore(()=>{Ng(t.contentDOM);let s=t.root.activeElement;s&&!s.contains(t.contentDOM)&&s.blur()});let i=t.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function _u(t,e,n,r){if(r==1)return E.cursor(e,n);if(r==2)return Gw(t.state,e,n);{let i=t.docView.lineAt(e,n),s=t.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,a=i?i.posAtEnd:s.to;return a<t.state.doc.length&&a==s.to&&a++,E.range(o,a)}}const mk=W.ie&&W.ie_version<=11;let Hu=null,Wu=0,Uu=0;function c0(t){if(!mk)return t.detail;let e=Hu,n=Uu;return Hu=t,Uu=Date.now(),Wu=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Wu+1)%3:1}function gk(t,e){let n=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=c0(e),i=t.state.selection;return{update(s){s.docChanged&&(n.pos=s.changes.mapPos(n.pos),i=i.map(s.changes))},get(s,o,a){let l=t.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),c,d=_u(t,l.pos,l.assoc,r);if(n.pos!=l.pos&&!o){let u=_u(t,n.pos,n.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=bk(i,l.pos))?c:a?i.addRange(d):E.create([d])}}}function bk(t,e){for(let n=0;n<t.ranges.length;n++){let{from:r,to:i}=t.ranges[n];if(r<=e&&i>=e)return E.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}zt.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let i=t.docView.tile.nearest(e.target);if(i&&i.isWidget()){let s=i.posAtStart,o=s+i.length;(s>=n.to||o<=n.from)&&(n=E.range(s,o))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",Fa(t.state,Bh,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};zt.dragend=t=>(t.inputState.draggedContent=null,!1);function Ku(t,e,n,r){if(n=Fa(t.state,$h,n),!n)return;let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=r&&s&&dk(t,e)?{from:s.from,to:s.to}:null,a={from:i,insert:n},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}zt.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,s=()=>{++i==n.length&&Ku(t,e,r.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o<n.length;o++){let a=new FileReader;a.onerror=s,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[o]=a.result),s()},a.readAsText(n[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Ku(t,e,r,!0),!0}return!1};zt.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=a0?null:e.clipboardData;return n?(l0(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(pk(t),!1)};function xk(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function yk(t){let e=[],n=[],r=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),n.push(i));if(!e.length){let i=-1;for(let{from:s}of t.selection.ranges){let o=t.doc.lineAt(s);o.number>i&&(e.push(o.text),n.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),i=o.number}r=!0}return{text:Fa(t,Bh,e.join(t.lineBreak)),ranges:n,linewise:r}}let Uc=null;zt.copy=zt.cut=(t,e)=>{let{text:n,ranges:r,linewise:i}=yk(t.state);if(!n&&!i)return!1;Uc=i?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=a0?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(xk(t,n),!1)};const h0=ln.define();function d0(t,e){let n=[];for(let r of t.facet(_g)){let i=r(t,e);i&&n.push(i)}return n.length?t.update({effects:n,annotations:h0.of(!0)}):null}function u0(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=d0(t.state,e);n?t.dispatch(n):t.update([])}},10)}Lt.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),u0(t)};Lt.blur=t=>{t.observer.clearSelectionRange(),u0(t)};Lt.compositionstart=Lt.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Lt.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,W.chrome&&W.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Lt.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};zt.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let s=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let a=o[0],l=t.posAtDOM(a.startContainer,a.startOffset),c=t.posAtDOM(a.endContainer,a.endOffset);return zh(t,{from:l,to:c,insert:t.state.toText(s)},null),!0}}let i;if(W.chrome&&W.android&&(i=s0.find(s=>s.inputType==e.inputType))&&(t.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&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return W.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),W.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Lt.compositionend(t,e),20),!1};const Gu=new Set;function vk(t){Gu.has(t)||(Gu.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const qu=["pre-wrap","normal","pre-line","break-spaces"];let Vr=!1;function Ju(){Vr=!1}class wk{constructor(e){this.lineWrapping=e,this.doc=we.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return qu.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];i<0?r++:this.heightSamples[Math.floor(i*10)]||(n=!0,this.heightSamples[Math.floor(i*10)]=!0)}return n}refresh(e,n,r,i,s,o){let a=qu.indexOf(e)>-1,l=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=n,this.charWidth=r,this.textHeight=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 kk{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class Bt{constructor(e,n,r,i,s){this.from=e,this.length=n,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 ar?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Bt(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var Ae=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(Ae||(Ae={}));const Yo=.001;class at{constructor(e,n,r=2){this.length=e,this.height=n,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Yo&&(Vr=!0),this.height=e)}replace(e,n,r){return at.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,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,Ae.ByPosNoHeight,r.setDoc(n),0,0),p=f.to>=c?f:s.lineAt(c,Ae.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,Ae.ByPosNoHeight,r,0,0));d+=f.from-l,l=f.from;let m=_h.build(r.setDoc(o),e,d,u);s=fa(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 n=0,r=e.length,i=0,s=0;for(;;)if(n==r)if(i>s*2){let a=e[n-1];a.break?e.splice(--n,1,a.left,null,a.right):e.splice(--n,1,a.left,a.right),r+=1+a.break,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[n++];a&&(i+=a.size)}else{let a=e[--r];a&&(s+=a.size)}let o=0;return e[n-1]==null?(o=1,n--):e[n]==null&&(o=1,r++),new Ck(at.of(e.slice(0,n)),o,at.of(e.slice(r)))}}function fa(t,e){return t==e?t:(t.constructor!=e.constructor&&(Vr=!0),e)}at.prototype.size=1;const Sk=re.replace({});class f0 extends at{constructor(e,n,r){super(e,n),this.deco=r,this.spaceAbove=0}mainBlock(e,n){return new Bt(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,n,r,i){return this.spaceAbove&&e<r+this.spaceAbove?new Bt(i,0,r,this.spaceAbove,Sk):this.mainBlock(r,i)}lineAt(e,n,r,i,s){let o=this.mainBlock(i,s);return this.spaceAbove?this.blockAt(0,r,i,s).join(o):o}forEachLine(e,n,r,i,s,o){e<=s+this.length&&n>=s&&o(this.lineAt(0,Ae.ByPos,r,i,s))}setMeasuredHeight(e){let n=e.heights[e.index++];n<0?(this.spaceAbove=-n,n=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class yt extends f0{constructor(e,n,r){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,n){return new Bt(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,n,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,n=0,r=!1,i){return i&&i.from<=n&&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,n){let r=e.doc.lineAt(n).number,i=e.doc.lineAt(n+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,n,r,i){let{firstLine:s,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(n,i);if(n.lineWrapping){let c=i+(e<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),d=n.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}=n.doc.line(s+c);return new Bt(d,u,r+a*c,a,0)}}lineAt(e,n,r,i,s){if(n==Ae.ByHeight)return this.blockAt(e,r,i,s);if(n==Ae.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,n,r,i,s,o){e=Math.max(e,s),n=Math.min(n,s+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(r,s);for(let d=e,u=i;d<=n;){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,n,r){let i=this.length-n;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,n){n.push(new Ge(e-1),null)}decomposeRight(e,n){n.push(null,new Ge(this.length-e-1))}updateHeight(e,n=0,r=!1,i){let s=n+this.length;if(i&&i.from<=n+this.length&&i.more){let o=[],a=Math.max(n,i.from),l=-1;for(i.from>n&&o.push(new Ge(i.from-n-1).updateHeight(e,n));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)>=Yo&&(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)>=Yo||Math.abs(l-this.heightMetrics(e,n).perLine)>=Yo)&&(Vr=!0),fa(this,c)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Ck extends at{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,i){let s=r+this.left.height;return e<s?this.left.blockAt(e,n,r,i):this.right.blockAt(e,n,s,i+this.left.length+this.break)}lineAt(e,n,r,i,s){let o=i+this.left.height,a=s+this.left.length+this.break,l=n==Ae.ByHeight?e<o:e<a,c=l?this.left.lineAt(e,n,r,i,s):this.right.lineAt(e,n,r,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let d=n==Ae.ByPosNoHeight?Ae.ByPosNoHeight:Ae.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,n,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,n,r,i,s,o),n>=l&&this.right.forEachLine(e,n,r,a,l,o);else{let c=this.lineAt(l,Ae.ByPos,r,i,s);e<c.from&&this.left.forEachLine(e,c.from-1,r,i,s,o),c.to>=e&&c.from<=n&&o(c),n>c.to&&this.right.forEachLine(c.to+1,n,r,a,l,o)}}replace(e,n,r){let i=this.left.length+this.break;if(n<i)return this.balanced(this.left.replace(e,n,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,n-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&&Yu(s,o-1),n<this.length){let a=s.length;this.decomposeRight(n,s),Yu(s,a)}return at.of(s)}decomposeLeft(e,n){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(r++,e>=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,n);e<r&&this.left.decomposeRight(e,n),this.break&&e<i&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?at.of(this.break?[e,null,n]:[e,n]):(this.left=fa(this.left,e),this.right=fa(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,i){let{left:s,right:o}=this,a=n+s.length+this.break,l=null;return i&&i.from<=n+s.length&&i.more?l=s=s.updateHeight(e,n,r,i):s.updateHeight(e,n,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 Yu(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof Ge&&(r=t[e+1])instanceof Ge&&t.splice(e-1,3,new Ge(n.length+1+r.length))}const jk=5;class _h{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),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,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e<n||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=n-e;r.block?this.addBlock(new f0(o,i,r)):(o||s||i>=jk)&&this.addLineDeco(i,s,o)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new yt(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,n){let r=new Ge(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof yt)return e;let n=new yt(0,-1,0);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof yt)&&!this.isCovered?this.nodes.push(new yt(0,-1,0)):(this.writtenTo<this.pos||n==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,n,r,i){let s=new _h(r,e);return ge.spans(n,r,i,s,0),s.finish(r)}}function Ok(t,e,n){let r=new Pk;return ge.compare(t,e,n,r,0),r.changes}class Pk{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,r,i){(e<n||r&&r.heightRelevant||i&&i.heightRelevant)&&Mr(e,n,this.changes,5)}}function Nk(t,e){let n=t.getBoundingClientRect(),r=t.ownerDocument,i=r.defaultView||window,s=Math.max(0,n.left),o=Math.min(i.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(i.innerHeight,n.bottom);for(let c=t.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==t.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-n.left,right:Math.max(s,o)-n.left,top:a-(n.top+e),bottom:Math.max(a,l)-(n.top+e)}}function Ak(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left<n.innerWidth&&e.right>0&&e.top<n.innerHeight&&e.bottom>0}function Mk(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class wl{constructor(e,n,r,i){this.from=e,this.to=n,this.size=r,this.displaySize=i}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],s=n[r];if(i.from!=s.from||i.to!=s.to||i.size!=s.size)return!1}return!0}draw(e,n){return re.replace({widget:new Dk(this.displaySize*(n?e.scaleY:e.scaleX),n)}).range(this.from,this.to)}}class Dk extends hn{constructor(e,n){super(),this.size=e,this.vertical=n}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class 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=Xu,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Ne.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=e.facet(Fh).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new wk(n),this.stateDeco=e.facet(Ki).filter(r=>typeof r!="function"),this.heightMap=at.empty().applyChanges(this.stateDeco,we.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=re.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let i=r?n.head:n.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new So(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?Xu:new Hh(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(ki(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Ki).filter(d=>typeof d!="function");let i=e.changedRanges,s=Mt.extendWithRanges(i,Ok(r,this.stateDeco,e?e.changes:ze.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Ju(),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;(n&&(n.range.head<l.from||n.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,n));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),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Wg)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Ne.RTL:Ne.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),a=n.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:C,scaleY:k}=Pg(n,a);(C>.005&&Math.abs(this.scaleX-C)>.005||k>.005&&Math.abs(this.scaleY-k)>.005)&&(this.scaleX=C,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=Ag(e.scrollDOM);let m=(this.printing?Mk:Nk)(n,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&&!Ak(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 C=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(C)&&(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),C),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)),Ju();for(let k of this.viewports){let O=k.from==this.viewport.from?C:e.docView.measureVisibleLineHeights(k);this.heightMap=(o?at.empty().applyChanges(this.stateDeco,we.empty,this.heightOracle,[new Mt(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new kk(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,n){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 So(i.lineAt(o-r*1e3,Ae.ByHeight,s,0,0).from,i.lineAt(a+(1-r)*1e3,Ae.ByHeight,s,0,0).to);if(n){let{head:c}=n.range;if(c<l.from||c>l.to){let d=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),u=i.lineAt(c,Ae.ByPos,s,0,0),f;n.y=="center"?f=(u.top+u.bottom)/2-d/2:n.y=="start"||n.y=="nearest"&&c<l.from?f=u.top:f=u.bottom-d,l=new So(i.lineAt(f-1e3/2,Ae.ByHeight,s,0,0).from,i.lineAt(f+d+1e3/2,Ae.ByHeight,s,0,0).to)}}return l}mapViewport(e,n){let r=n.mapPos(e.from,-1),i=n.mapPos(e.to,1);return new So(this.heightMap.lineAt(r,Ae.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,Ae.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:n},r=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,Ae.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(n,Ae.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||i<=o-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||s>=a+Math.max(10,Math.min(r,250)))&&i>o-2*1e3&&s<a+2*1e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let r=[];for(let i of e)n.touchesRange(i.from,i.to)||r.push(new wl(n.mapPos(i.from),n.mapPos(i.to),i.size,i.displaySize));return r}ensureLineGaps(e,n){let r=this.heightOracle.lineWrapping,i=r?1e4:2e3,s=i>>1,o=i<<1;if(this.defaultTextDirection!=Ne.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=Ek(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&&n&&r&&n.visibleRanges.some(S=>S.from<=u&&S.to>=u)){let S=n.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 wl(d,u,w,v)}a.push(x)},c=d=>{if(d.length<o||d.type!=Je.Text)return;let u=Tk(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=jo(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=Co(u,x),m=Co(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,C,k;if(f!=null){let O=jo(u,f),y=((S-v)/2+x)/b;C=O-y,k=O+y}else C=(v-x)/b,k=(S+x)/b;p=Co(u,C),m=Co(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,n,r,i){let s=jo(i,r)-jo(i,n);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){wl.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=re.set(e.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];ge.spans(n,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(n=>n.from<=e&&n.to>=e)||ki(this.heightMap.lineAt(e,Ae.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||ki(this.heightMap.lineAt(this.scaler.fromDOM(e),Ae.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return ki(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 So{constructor(e,n){this.from=e,this.to=n}}function Tk(t,e,n){let r=[],i=t,s=0;return ge.spans(n,t,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 Co({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let i=0;;i++){let{from:s,to:o}=e[i],a=o-s;if(r<=a)return s+r;r-=a}}function jo(t,e){let n=0;for(let{from:r,to:i}of t.ranges){if(e<=i){n+=e-r;break}n+=i-r}return n/t.total}function Ek(t,e){for(let n of t)if(e(n))return n}const Xu={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class Hh{constructor(e,n,r){let i=0,s=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let c=n.lineAt(a,Ae.ByPos,e,0,0).top,d=n.lineAt(l,Ae.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)/(n.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 n=0,r=0,i=0;;n++){let s=n<this.viewports.length?this.viewports[n]: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 n=0,r=0,i=0;;n++){let s=n<this.viewports.length?this.viewports[n]: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 Hh?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((n,r)=>n.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function ki(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new Bt(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(i=>ki(i,e)):t._content)}const Oo=U.define({combine:t=>t.join(" ")}),Kc=U.define({combine:t=>t.indexOf(!0)>-1}),Gc=In.newName(),p0=In.newName(),m0=In.newName(),g0={"&light":"."+p0,"&dark":"."+m0};function qc(t,e,n){return new In(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return t;if(!n||!n[i])throw new RangeError(`Unsupported selector: ${i}`);return n[i]}):t+" "+r}})}const Rk=qc("."+Gc,{"&":{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"}},g0),Lk={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},kl=W.ie&&W.ie_version<=11;class Ik{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new fw,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(W.ie&&W.ie_version<=11||W.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&W.android&&e.constructor.EDIT_CONTEXT!==!1&&!(W.chrome&&W.chrome_version<126)&&(this.editContext=new Bk(e),e.state.facet(gn)&&(e.contentDOM.editContext=this.editContext.editContext)),kl&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,i=this.selectionRange;if(r.state.facet(gn)?r.root.activeElement!=this.dom:!Jo(this.dom,i))return;let s=i.anchorNode&&r.docView.tile.nearest(i.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(W.ie&&W.ie_version<=11||W.android&&W.chrome)&&!r.state.selection.main.empty&&i.focusNode&&Ai(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=Hi(e.root);if(!n)return!1;let r=W.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&$k(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let i=Jo(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&mw(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let r=this.dom;r;)if(r.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),n){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=n)r.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Lk),kl&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),kl&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){var r;if(!this.delayedAndroidKey){let 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:n,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),n==-1?{from:n,to:r}=o:(n=Math.min(o.from,n),r=Math.max(o.to,r)))}return{from:n,to:r,typeOver:i}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),i=this.selectionChanged&&Jo(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 tk(this.view,e,n,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 n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=r0(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),i}readMutation(e){let n=this.view.docView.tile.nearest(e.target);if(!n||n.isWidget())return null;if(n.markDirty(e.type=="attributes"),e.type=="childList"){let r=Zu(n,e.previousSibling||e.target.previousSibling,-1),i=Zu(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:i?n.posBefore(i):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(gn)!=e.state.facet(gn)&&(e.view.contentDOM.editContext=e.state.facet(gn)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let 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 Zu(t,e,n){for(;e;){let r=Ve.get(e);if(r&&r.parent==t)return r;let i=e.parentNode;e=i!=t.dom?i:n>0?e.nextSibling:e.previousSibling}return null}function ef(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor,1);return Ai(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function $k(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return ef(t,i)}let n=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?ef(t,n):null}class Bk{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let 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=i0(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:we.of(r.text.slice(d.from,d.toB).split(`
231
- `))};if((W.mac||W.android)&&u.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(u={from:a,to:l,insert:we.of([r.text.replace("."," ")])}),this.pendingContextChange=u,!e.state.readOnly){let f=this.to-this.from+(u.to-u.from+u.insert.length);zh(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(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let 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)}n.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(re.mark({attributes:{style:d}}).range(l,c))}}}e.dispatch({effects:Kg.of(re.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)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let i=Hi(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=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,n+=d,this.to+=d;return}else i=null,this.revertPending(e.state);if(s+=n,o+=n,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}n+=d}),i&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(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||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),i=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class _{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(i=>i.forEach(s=>r(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||pw(e.parent)||document,this.viewState=new Qu(e.state||be.create(e)),e.scrollTo&&e.scrollTo.is(vo)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(kr).map(i=>new gl(i));for(let i of this.plugins)i.update(this);this.observer=new Ik(this),this.inputState=new sk(this),this.inputState.ensureHandlers(this.plugins),this.docView=new $u(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let n=e.length==1&&e[0]instanceof He?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,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(h0))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=d0(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(be.phrases)!=this.state.facet(be.phrases))return this.setState(s);i=ha.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(vo)&&(u=p.value.clip(this.state))}this.viewState.update(i,u),this.bidiCache=pa.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(vi)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Oo)!=i.state.facet(Oo)&&(this.viewState.mustMeasureContent=!0),(n||r||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let f of this.state.facet(zc))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&&!r0(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 n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new Qu(e),this.plugins=e.facet(kr).map(r=>new gl(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new $u(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(kr),r=e.state.facet(kr);if(n!=r){let i=[];for(let s of r){let o=n.indexOf(s);if(o<0)i.push(new gl(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);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){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 n=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(Ag(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),tf}}),u=ha.create(this,this.state,[]),f=!1;u.flags|=l,n?n.flags|=l:n=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),f=this.docView.update(u),f&&this.docViewUpdate());for(let p=0;p<c.length;p++)if(d[p]!=tf)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(n&&!n.empty)for(let a of this.state.facet(zc))a(n)}get themeClasses(){return Gc+" "+(this.state.facet(Kc)?m0:p0)+" "+this.state.facet(Oo)}updateAttrs(){let e=nf(this,Gg,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(gn)?"true":"false",class:"cm-content",style:`${W.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),nf(this,Fh,n);let r=this.observer.ignore(()=>{let i=Du(this.contentDOM,this.contentAttrs,n),s=Du(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let i of r.effects)if(i.is(_.announce)){n&&(this.announceDOM.textContent=""),n=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(vi);let e=this.state.facet(_.cspNonce);In.mount(this.root,this.styleModules.concat(Rk).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.plugin!=e)&&this.pluginMap.set(e,n=this.plugins.find(r=>r.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return vl(this,e,Bu(this,e,n,r))}moveByGroup(e,n){return vl(this,e,Bu(this,e,n,r=>Yw(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),s=r[n?r.length-1:0];return E.cursor(s.side(n,i)+e.from,s.forward(!n,i)?1:-1)}moveToLineBoundary(e,n,r=!0){return Jw(this,e,n,r)}moveVertically(e,n,r){return vl(this,e,Qw(this,e,n,r))}domAtPos(e,n=1){return this.docView.domAtPos(e,n)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){this.readMeasured();let r=Wc(this,e,n);return r&&r.pos}posAndSideAtCoords(e,n=!0){return this.readMeasured(),Wc(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),o=s[bn.find(s,e-i.from,-1,n)];return Wi(r,o.dir==Ne.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Hg)||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>Fk)return Lg(e.length);let n=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==n&&(s.fresh||Rg(s.isolates,r=Ru(this,e))))return s.order;r||(r=Ru(this,e));let i=kw(e.text,n,r);return this.bidiCache.push(new pa(e.from,e.to,n,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||W.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Ng(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return vo.of(new Tr(typeof e=="number"?E.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return vo.of(new Tr(E.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Fe.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Fe.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=In.newName(),i=[Oo.of(r),vi.of(qc(`.${r}`,e))];return n&&n.dark&&i.push(Kc.of(!0)),i}static baseTheme(e){return ur.lowest(vi.of(qc("."+Gc,e,g0)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),i=r&&Ve.get(r)||Ve.get(e);return((n=i?.root)===null||n===void 0?void 0:n.view)||null}}_.styleModule=vi;_.inputHandler=zg;_.clipboardInputFilter=$h;_.clipboardOutputFilter=Bh;_.scrollHandler=Ug;_.focusChangeEffect=_g;_.perLineTextDirection=Hg;_.exceptionSink=Vg;_.updateListener=zc;_.editable=gn;_.mouseSelectionStyle=Fg;_.dragMovesSelection=Bg;_.clickAddsSelectionRange=$g;_.decorations=Ki;_.blockWrappers=qg;_.outerDecorations=Jg;_.atomicRanges=Ws;_.bidiIsolatedRanges=Yg;_.scrollMargins=Qg;_.darkTheme=Kc;_.cspNonce=U.define({combine:t=>t.length?t[0]:""});_.contentAttributes=Fh;_.editorAttributes=Gg;_.lineWrapping=_.contentAttributes.of({class:"cm-lineWrapping"});_.announce=ce.define();const Fk=4096,tf={};class pa{constructor(e,n,r,i,s,o){this.from=e,this.to=n,this.dir=r,this.isolates=i,this.fresh=s,this.order=o}static update(e,n){if(n.empty&&!e.some(s=>s.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:Ne.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==i&&!n.touchesRange(o.from,o.to)&&r.push(new pa(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function nf(t,e,n){for(let r=t.state.facet(e),i=r.length-1;i>=0;i--){let s=r[i],o=typeof s=="function"?s(t):s;o&&Rh(o,n)}return n}const Vk=W.mac?"mac":W.windows?"win":W.linux?"linux":"key";function zk(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let i,s,o,a;for(let l=0;l<n.length-1;++l){const c=n[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 Po(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n!==!1&&e.shiftKey&&(t="Shift-"+t),t}const _k=ur.default(_.domEventHandlers({keydown(t,e){return x0(b0(e.state),t,e,"editor")}})),Va=U.define({enables:_k}),rf=new WeakMap;function b0(t){let e=t.facet(Va),n=rf.get(e);return n||rf.set(e,n=Uk(e.reduce((r,i)=>r.concat(i),[]))),n}function Hk(t,e,n){return x0(b0(t.state),e,t,n)}let Nn=null;const Wk=4e3;function Uk(t,e=Vk){let n=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=n[o]||(n[o]=Object.create(null)),m=a.split(/ (?!$)/).map(w=>zk(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 C=Nn={view:S,prefix:v,scope:o};return setTimeout(()=>{Nn==C&&(Nn=null)},Wk),!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 t){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let d=n[c]||(n[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,Jc))}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 n}let Jc=null;function x0(t,e,n,r){Jc=e;let i=sw(e),s=ct(i,0),o=Zt(s)==i.length&&i!=" ",a="",l=!1,c=!1,d=!1;Nn&&Nn.view==n&&Nn.scope==r&&(a=Nn.prefix+" ",o0.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(n)))return x.stopPropagation&&(d=!0),!0;x.preventDefault&&(x.stopPropagation&&(d=!0),c=!0)}return!1},p=t[r],m,b;return p&&(f(p[a+Po(i,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(W.windows&&e.ctrlKey&&e.altKey)&&!(W.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(m=$n[e.keyCode])&&m!=i?(f(p[a+Po(m,e,!0)])||e.shiftKey&&(b=zi[e.keyCode])!=i&&b!=m&&f(p[a+Po(b,e,!1)]))&&(l=!0):o&&e.shiftKey&&f(p[a+Po(i,e,!0)])&&(l=!0),!l&&f(p._any)&&(l=!0)),c&&(l=!0),l&&d&&e.stopPropagation(),Jc=null,l}class Us{constructor(e,n,r,i,s){this.className=e,this.left=n,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,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let i=e.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let s=y0(e);return[new Us(n,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return Kk(e,n,r)}}function y0(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Ne.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function sf(t,e,n,r){let i=t.coordsAtPos(e,n*2);if(!i)return r;let s=t.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,a=t.posAtCoords({x:s.left+1,y:o}),l=t.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 Kk(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),i=Math.min(n.to,t.viewport.to),s=t.textDirection==Ne.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=y0(t),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=Hc(t,r,1),m=Hc(t,i,-1),b=p.type==Je.Text?p:null,x=m.type==Je.Text?m:null;if(b&&(t.lineWrapping||p.widgetLineBreaks)&&(b=sf(t,r,1,b)),x&&(t.lineWrapping||m.widgetLineBreaks)&&(x=sf(t,i,-1,x)),b&&x&&b.from==x.from&&b.to==x.to)return v(S(n.from,n.to,b));{let k=b?S(n.from,null,b):C(p,!1),O=x?S(null,n.to,x):C(m,!0),y=[];return(b||p).to<(x||m).from-(b&&x?1:0)||p.widgetLineBreaks>1&&k.bottom+t.defaultLineHeight/2<O.top?y.push(w(u,k.bottom,f,O.top)):k.bottom<O.top&&t.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,M){return new Us(e,k-l.left,O-l.top,y-k,M-O)}function v({top:k,bottom:O,horizontal:y}){let M=[];for(let A=0;A<y.length;A+=2)M.push(w(y[A],k,y[A+1],O));return M}function S(k,O,y){let M=1e9,A=-1e9,R=[];function N($,F,G,ue,X){let te=t.coordsAtPos($,$==y.to?-2:2),oe=t.coordsAtPos(G,G==y.from?2:-2);!te||!oe||(M=Math.min(te.top,oe.top,M),A=Math.max(te.bottom,oe.bottom,A),X==Ne.LTR?R.push(s&&F?u:te.left,s&&ue?f:oe.right):R.push(!s&&ue?u:oe.left,!s&&F?f:te.right))}let L=k??y.from,H=O??y.to;for(let $ of t.visibleRanges)if($.to>L&&$.from<H)for(let F=Math.max($.from,L),G=Math.min($.to,H);;){let ue=t.state.doc.lineAt(F);for(let X of t.bidiSpans(ue)){let te=X.from+ue.from,oe=X.to+ue.from;if(te>=G)break;oe>F&&N(Math.max(te,F),k==null&&te<=L,Math.min(oe,G),O==null&&oe>=H,X.dir)}if(F=ue.to+1,F>=G)break}return R.length==0&&N(L,k==null,H,O==null,t.textDirection),{top:M,bottom:A,horizontal:R}}function C(k,O){let y=a.top+(O?k.top:k.bottom);return{top:y,bottom:y,horizontal:[]}}}function Gk(t,e){return t.constructor==e.constructor&&t.eq(e)}class qk{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(Qo)!=e.state.facet(Qo)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(Qo);for(;n<r.length&&r[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:n}=this.view;(e!=this.scaleX||n!=this.scaleY)&&(this.scaleX=e,this.scaleY=n,this.dom.style.transform=`scale(${1/e}, ${1/n})`)}draw(e){if(e.length!=this.drawn.length||e.some((n,r)=>!Gk(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let i of e)i.update&&n&&i.constructor&&this.drawn[r].constructor&&i.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(i.draw(),n);for(;n;){let i=n.nextSibling;n.remove(),n=i}this.drawn=e,W.safari&&W.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 Qo=U.define();function v0(t){return[Fe.define(e=>new qk(e,t)),Qo.of(t)]}const Gi=U.define({combine(t){return cn(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function Jk(t={}){return[Gi.of(t),Yk,Qk,Xk,Wg.of(!0)]}function w0(t){return t.startState.facet(Gi)!=t.state.facet(Gi)}const Yk=v0({above:!0,markers(t){let{state:e}=t,n=e.facet(Gi),r=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty||n.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 Us.forRange(t,o,a))r.push(l)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=w0(t);return n&&of(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){of(e.state,t)},class:"cm-cursorLayer"});function of(t,e){e.style.animationDuration=t.facet(Gi).cursorBlinkRate+"ms"}const Qk=v0({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:Us.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||w0(t)},class:"cm-selectionLayer"}),Xk=ur.highest(_.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),k0=ce.define({map(t,e){return t==null?null:e.mapPos(t)}}),Si=Ye.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(k0)?r.value:n,t)}}),Zk=Fe.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(Si);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Si)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Si),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Si)!=t&&this.view.dispatch({effects:k0.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function eS(){return[Si,Zk]}function af(t,e,n,r,i){e.lastIndex=0;for(let s=t.iterRange(n,r),o=n,a;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;a=e.exec(s.value);)i(o+a.index,a)}function tS(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:i,to:s}of n)i=Math.max(t.state.doc.lineAt(i).from,i-e),s=Math.min(t.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 nS{constructor(e){const{regexp:n,decoration:r,decorate:i,boundary:s,maxLength:o=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,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 n=new xn,r=n.add.bind(n);for(let{from:i,to:s}of tS(e,this.maxLength))af(e.state.doc,this.regexp,i,s,(o,a)=>this.addMatch(a,e,o,r));return n.finish()}updateDeco(e,n){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,n.map(e.changes),r,i):n}updateRange(e,n,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 af(e.state.doc,this.regexp,d,u,(b,x)=>this.addMatch(x,e,b,m));n=n.update({filterFrom:d,filterTo:u,filter:(b,x)=>b<d||x>u,add:f})}}return n}}const Yc=/x/.unicode!=null?"gu":"g",rS=new RegExp(`[\0-\b
232
- --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,Yc),iS={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 Sl=null;function sS(){var t;if(Sl==null&&typeof document<"u"&&document.body){let e=document.body.style;Sl=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Sl||!1}const Xo=U.define({combine(t){let e=cn(t,{render:null,specialChars:rS,addSpecialChars:null});return(e.replaceTabs=!sS())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Yc)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Yc)),e}});function oS(t={}){return[Xo.of(t),aS()]}let lf=null;function aS(){return lf||(lf=Fe.fromClass(class{constructor(t){this.view=t,this.decorations=re.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Xo)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new nS({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:i}=n.state,s=ct(e[0],0);if(s==9){let o=i.lineAt(r),a=n.state.tabSize,l=Ur(o.text,a,r-o.from);return re.replace({widget:new dS((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=re.replace({widget:new hS(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Xo);t.startState.facet(Xo)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const lS="•";function cS(t){return t>=32?lS:t==10?"␤":String.fromCharCode(9216+t)}class hS extends hn{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=cS(this.code),r=e.state.phrase("Control character")+" "+(iS[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,n);if(i)return i;let s=document.createElement("span");return s.textContent=n,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class dS 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 uS(){return pS}const fS=re.line({class:"cm-activeLine"}),pS=Fe.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let i=t.lineBlockAt(r.head);i.from>e&&(n.push(fS.range(i.from)),e=i.from)}return re.set(n)}},{decorations:t=>t.decorations});class mS extends hn{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?Ni(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),i=Wi(n[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 gS(t){let e=Fe.fromClass(class{constructor(n){this.view=n,this.placeholder=t?re.set([re.widget({widget:new mS(t),side:1}).range(0)]):re.none}get decorations(){return this.view.state.doc.length?re.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,_.contentAttributes.of({"aria-placeholder":t})]:e}const Qc=2e3;function bS(t,e,n){let r=Math.min(e.line,n.line),i=Math.max(e.line,n.line),s=[];if(e.off>Qc||n.off>Qc||e.col<0||n.col<0){let o=Math.min(e.off,n.off),a=Math.max(e.off,n.off);for(let l=r;l<=i;l++){let c=t.doc.line(l);c.length<=a&&s.push(E.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,n.col),a=Math.max(e.col,n.col);for(let l=r;l<=i;l++){let c=t.doc.line(l),d=Mc(c.text,o,t.tabSize,!0);if(d<0)s.push(E.cursor(c.to));else{let u=Mc(c.text,a,t.tabSize);s.push(E.range(c.from+d,c.from+u))}}}return s}function xS(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function cf(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),i=n-r.from,s=i>Qc?-1:i==r.length?xS(t,e.clientX):Ur(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:s,off:i}}function yS(t,e){let n=cf(t,e),r=t.state.selection;return n?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(n.line).from),o=i.state.doc.lineAt(s);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},r=r.map(i.changes)}},get(i,s,o){let a=cf(t,i);if(!a)return r;let l=bS(t.state,n,a);return l.length?o?E.create(l.concat(r.ranges)):E.create(l):r}}:null}function vS(t){let e=n=>n.altKey&&n.button==0;return _.mouseSelectionStyle.of((n,r)=>e(r)?yS(n,r):null)}const wS={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},kS={style:"cursor: crosshair"};function SS(t={}){let[e,n]=wS[t.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||n(i))},keyup(i){(i.keyCode==e||!n(i))&&this.set(!1)},mousemove(i){this.set(n(i))}}});return[r,_.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?kS:null})]}const No="-10000px";class S0{constructor(e,n,r,i){this.facet=n,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(n),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,n){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=n?[]: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]=n[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 n&&(a.forEach((l,c)=>n[c]=l),n.length=a.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function CS(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Cl=U.define({combine:t=>{var e,n,r;return{position:W.ios?"absolute":((e=t.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(i=>i.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||CS}}}),hf=new WeakMap,Wh=Fe.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Cl);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new S0(t,Uh,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(Cl);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",n.dom.appendChild(i)}return n.dom.style.position=this.position,n.dom.style.top=No,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(W.safari){let o=s.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(t=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=Vh(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(Cl).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:s}=t,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=t.pos[a],f=t.size[a];if(!u||l.clip!==!1&&(u.bottom<=Math.max(n.top,r.top)||u.top>=Math.min(n.bottom,r.bottom)||u.right<Math.max(n.left,r.left)-.1||u.left>Math.min(n.right,r.right)+.1)){d.style.top=No;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,m=p?7:0,b=f.right-f.left,x=(e=hf.get(c))!==null&&e!==void 0?e:f.bottom-f.top,w=c.offset||OS,v=this.view.textDirection==Ne.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),C=this.above[a];!l.strictSide&&(C?u.top-x-m-w.y<r.top:u.bottom+x+m+w.y>r.bottom)&&C==r.bottom-u.bottom>u.top-r.top&&(C=this.above[a]=!C);let k=(C?u.top-r.top:r.bottom-u.bottom)-m;if(k<x&&c.resize!==!1){if(k<this.view.defaultLineHeight){d.style.top=No;continue}hf.set(c,x),d.style.height=(x=k)/s+"px"}else d.style.height&&(d.style.height="");let O=C?u.top-x-m-w.y:u.bottom+m+w.y,y=S+b;if(c.overlap!==!0)for(let M of o)M.left<y&&M.right>S&&M.top<O+x&&M.bottom>O&&(O=C?M.top-x-2-m:M.bottom+m+2);if(this.position=="absolute"?(d.style.top=(O-t.parent.top)/s+"px",df(d,(S-t.parent.left)/i)):(d.style.top=O/s+"px",df(d,S/i)),p){let M=u.left+(v?w.x:-w.x)-(S+14-7);p.style.left=M/i+"px"}c.overlap!==!0&&o.push({left:S,top:O,right:y,bottom:O+x}),d.classList.toggle("cm-tooltip-above",C),d.classList.toggle("cm-tooltip-below",!C),c.positioned&&c.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=No}},{eventObservers:{scroll(){this.maybeMeasure()}}});function df(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const jS=_.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"}}}),OS={x:0,y:0},Uh=U.define({enables:[Wh,jS]}),ma=U.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class za{static create(e){return new za(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new S0(e,ma,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let i=r[e];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const PS=Uh.compute([ma],t=>{let e=t.facet(ma);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:za.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class NS{constructor(e,n,r,i,s){this.view=e,this.source=n,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:n}=this,r=e.docView.tile.nearest(n.target);if(!r)return;let i,s=1;if(r.isWidget())i=r.posAtStart;else{if(i=e.posAtCoords(n),i==null)return;let a=e.coordsAtPos(i);if(!a||n.y<a.top||n.y>a.bottom||n.x<a.left-e.defaultCharacterWidth||n.x>a.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(i)).find(d=>d.from<=i&&d.to>=i),c=l&&l.dir==Ne.RTL?-1:1;s=n.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(Wh),n=e?e.manager.tooltips.findIndex(r=>r.create==za.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:s}=this;if(i.length&&s&&!AS(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,a=(r=(n=i[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!MS(this.view,o,a,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Ao=4;function AS(t,e){let{left:n,right:r,top:i,bottom:s}=t.getBoundingClientRect(),o;if(o=t.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();i=Math.min(a.top,i),s=Math.max(a.bottom,s)}return e.clientX>=n-Ao&&e.clientX<=r+Ao&&e.clientY>=i-Ao&&e.clientY<=s+Ao}function MS(t,e,n,r,i,s){let o=t.scrollDOM.getBoundingClientRect(),a=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,a)<i)return!1;let l=t.posAtCoords({x:r,y:i},!1);return l>=e&&l<=n}function DS(t,e={}){let n=ce.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(n)&&(i=o.value),o.is(TS)&&(i=[]);return i},provide:i=>ma.from(i)});return{active:r,extension:[r,Fe.define(i=>new NS(i,t,r,n,e.hoverTime||300)),PS]}}function C0(t,e){let n=t.plugin(Wh);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const TS=ce.define(),uf=U.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function qi(t,e){let n=t.plugin(j0),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const j0=Fe.fromClass(class{constructor(t){this.input=t.state.facet(Ji),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(uf);this.top=new Mo(t,!0,e.topContainer),this.bottom=new Mo(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(uf);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Mo(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Mo(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Ji);if(n!=this.input){let r=n.filter(l=>l),i=[],s=[],o=[],a=[];for(let l of r){let c=this.specs.indexOf(l),d;c<0?(d=l(t.view),a.push(d)):(d=this.panels[c],d.update&&d.update(t)),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(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>_.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Mo{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=ff(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=ff(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 ff(t){let e=t.nextSibling;return t.remove(),e}const Ji=U.define({enables:j0});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 Zo=U.define(),ES=U.define(),RS={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>ge.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Di=U.define();function LS(t){return[O0(),Di.of({...RS,...t})]}const pf=U.define({combine:t=>t.some(e=>e)});function O0(t){return[IS]}const IS=Fe.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(Di).map(e=>new gf(t,e)),this.fixed=!t.state.facet(pf);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(pf)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=ge.iter(this.view.state.facet(Zo),this.view.viewport.from),r=[],i=this.gutters.map(s=>new $S(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){Xc(n,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){Xc(n,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();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(Di),n=t.state.facet(Di),r=t.docChanged||t.heightChanged||t.viewportChanged||!ge.eq(t.startState.facet(Zo),t.state.facet(Zo),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let i of this.gutters)i.update(t)&&(r=!0);else{r=!0;let i=[];for(let s of n){let o=e.indexOf(s);o<0?i.push(new gf(this.view,s)):(this.gutters[o].update(t),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 t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>_.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,i=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Ne.LTR?{left:r,right:i}:{right:r,left:i}})});function mf(t){return Array.isArray(t)?t:[t]}function Xc(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class $S{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=ge.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:i}=this,s=(n.top-this.height)/e.scaleY,o=n.height/e.scaleY;if(this.i==i.elements.length){let a=new P0(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=n.bottom,this.i++}line(e,n,r){let i=[];Xc(this.cursor,i,n.from),r.length&&(i=i.concat(r));let s=this.gutter.config.lineMarker(e,n,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,n,i)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),i=r?[r]:null;for(let s of e.state.facet(ES)){let o=s(e,n.widget,n);o&&(i||(i=[])).push(o)}i&&this.addElement(e,n,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class gf{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,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);n.domEventHandlers[r](e,a,i)&&i.preventDefault()});this.markers=mf(n.markers(e)),n.initialSpacer&&(this.spacer=new P0(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=mf(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!ge.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class P0{constructor(e,n,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,i)}update(e,n,r,i){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),BS(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,n){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let a=o,l=s<n.length?n[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=n}destroy(){this.setMarkers(null,[])}}function BS(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].compare(e[n]))return!1;return!0}const FS=U.define(),VS=U.define(),Sr=U.define({combine(t){return cn(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,n){let r=Object.assign({},e);for(let i in n){let s=r[i],o=n[i];r[i]=s?(a,l,c)=>s(a,l,c)||o(a,l,c):o}return r}})}});class jl extends vn{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Ol(t,e){return t.state.facet(Sr).formatNumber(e,t.state)}const zS=Di.compute([Sr],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(FS)},lineMarker(e,n,r){return r.some(i=>i.toDOM)?null:new jl(Ol(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let i of e.state.facet(VS)){let s=i(e,n,r);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(Sr)!=e.state.facet(Sr),initialSpacer(e){return new jl(Ol(e,bf(e.state.doc.lines)))},updateSpacer(e,n){let r=Ol(n.view,bf(n.view.state.doc.lines));return r==e.number?e:new jl(r)},domEventHandlers:t.facet(Sr).domEventHandlers,side:"before"}));function _S(t={}){return[Sr.of(t),O0(),zS]}function bf(t){let e=9;for(;e<t;)e=e*10+9;return e}const HS=new class extends vn{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},WS=Zo.compute(["selection"],t=>{let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.head).from;i>n&&(n=i,e.push(HS.range(i)))}return ge.of(e)});function US(){return WS}var Pl;const Cr=new fe;function KS(t){return U.define({combine:t?e=>e.concat(t):void 0})}const GS=new fe;class Vt{constructor(e,n,r=[],i=""){this.data=e,this.name=i,be.prototype.hasOwnProperty("tree")||Object.defineProperty(be.prototype,"tree",{get(){return nt(this)}}),this.parser=n,this.extension=[Fn.of(this),be.languageData.of((s,o,a)=>{let l=xf(s,o,a),c=l.type.prop(Cr);if(!c)return[];let d=s.facet(c),u=l.type.prop(GS);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,n,r=-1){return xf(e,n,r).type.prop(Cr)==this.data}findRegions(e){let n=e.facet(Fn);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(Cr)==this.data){r.push({from:o,to:o+s.length});return}let a=s.prop(fe.mounted);if(a){if(a.tree.prop(Cr)==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=ce.define();function xf(t,e,n){let r=t.facet(Fn),i=nt(t).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(e,n,Le.ExcludeBuffers|Le.EnterBracketed))s.type.isTop&&(i=s);return i}class ga extends Vt{constructor(e,n,r){super(e,n,[],r),this.parser=n}static define(e){let n=KS(e.languageData);return new ga(n,e.parser.configure({props:[Cr.add(r=>r.isTop?n:void 0)]}),e.name)}configure(e,n){return new ga(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function nt(t){let e=t.field(Vt.state,!1);return e?e.tree:Be.empty}class qS{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e<r||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let ui=null;class ba{constructor(e,n,r=[],i,s,o,a,l){this.parser=e,this.state=n,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,n,r){return new ba(e,n,[],Be.empty,0,r,[],null)}startParse(){return this.parser.startParse(new qS(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Be.empty&&this.isDone(n??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()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(sr.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<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(sr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=ui;ui=this;try{return e()}finally{ui=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=yf(e,n.from,n.to);return e}changes(e,n){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=sr.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 ba(this.parser,n,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 n=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=yf(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends ng{createParse(n,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let l=ui;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 n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return ui}}function yf(t,e,n){return sr.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class zr{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new zr(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=ba.create(e.facet(Fn).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new zr(r)}}Vt.state=Ye.define({create:zr.init,update(t,e){for(let n of e.effects)if(n.is(Vt.setState))return n.value;return e.startState.facet(Fn)!=e.state.facet(Fn)?zr.init(e.state):t.apply(e)}});let N0=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(N0=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Nl=typeof navigator<"u"&&(!((Pl=navigator.scheduling)===null||Pl===void 0)&&Pl.isInputPending)?()=>navigator.scheduling.isInputPending():null,JS=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 n=this.view.state.field(Vt.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(Vt.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=N0(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to: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&&!Nl?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<i&&r.doc.length>i+1e3,l=s.context.work(()=>Nl&&Nl()||Date.now()>o,i+(a?0:1e5));this.chunkBudget-=Date.now()-n,(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(n=>ut(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Fn=U.define({combine(t){return t.length?t[0]:null},enables:t=>[Vt.state,JS,_.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class YS{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const QS=U.define(),_a=U.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function xa(t){let e=t.facet(_a);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Yi(t,e){let n="",r=t.tabSize,i=t.facet(_a)[0];if(i==" "){for(;e>=r;)n+=" ",e-=r;i=" "}for(let s=0;s<e;s++)n+=i;return n}function Kh(t,e){t instanceof be&&(t=new Ha(t));for(let r of t.state.facet(QS)){let i=r(t,e);if(i!==void 0)return i}let n=nt(t.state);return n.length>=e?XS(t,n,e):null}class Ha{constructor(e,n={}){this.state=e,this.options=n,this.unit=xa(e)}lineAt(e,n=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}:(n<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,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:i}=this.lineAt(e,n);return r.slice(e-i,Math.min(r.length,e+100-i))}column(e,n=1){let{text:r,from:i}=this.lineAt(e,n),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,n=e.length){return Ur(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:i}=this.lineAt(e,n),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 A0=new fe;function XS(t,e,n){let r=e.resolveStack(n),i=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);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 M0(r,t,n)}function M0(t,e,n){for(let r=t;r;r=r.next){let i=e3(r.node);if(i)return i(Gh.create(e,n,r))}return 0}function ZS(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function e3(t){let e=t.type.prop(A0);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(fe.closedBy))){let i=t.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>i3(o,!0,1,void 0,s&&!ZS(o)?i.from:void 0)}return t.parent==null?t3:null}function t3(){return 0}class Gh extends Ha{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new Gh(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(n3(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return M0(this.context.next,this.base,this.pos)}}function n3(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function r3(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let i=t.options.simulateBreak,s=t.state.doc.lineAt(n.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let a=n.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let c=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+c}}a=l.to}}function i3(t,e,n,r,i){let s=t.textAfter,o=s.match(/^\s*/)[0].length,a=r&&s.slice(o,o+r.length)==r||i==t.pos+o,l=r3(t);return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*n)}function vf({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const s3=200;function o3(){return be.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,i=n.lineAt(r);if(r>i.from+s3)return t;let s=n.sliceString(i.from,r);if(!e.some(c=>c.test(s)))return t;let{state:o}=t,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=Kh(o,d.from);if(u==null)continue;let f=/^\s*/.exec(d.text)[0],p=Yi(o,u);f!=p&&l.push({from:d.from,to:d.from+f.length,insert:p})}return l.length?[t,{changes:l,sequential:!0}]:t})}const a3=U.define(),D0=new fe;function l3(t){let e=t.firstChild,n=t.lastChild;return e&&e.to<n.from?{from:e.to,to:n.type.isError?t.to:n.from}:null}function c3(t,e,n){let r=nt(t);if(r.length<n)return null;let i=r.resolveStack(n,1),s=null;for(let o=i;o;o=o.next){let a=o.node;if(a.to<=n||a.from>n)continue;if(s&&a.from<e)break;let l=a.type.prop(D0);if(l&&(a.to<r.length-50||r.length==t.doc.length||!h3(a))){let c=l(a,t);c&&c.from<=n&&c.from>=e&&c.to>n&&(s=c)}}return s}function h3(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function ya(t,e,n){for(let r of t.facet(a3)){let i=r(t,e,n);if(i)return i}return c3(t,e,n)}function T0(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const Wa=ce.define({map:T0}),Ks=ce.define({map:T0});function E0(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const cr=Ye.define({create(){return re.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=wf(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(Wa)&&!d3(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(I0),i=r?re.replace({widget:new x3(r(e.state,n.value))}):kf;t=t.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(Ks)&&(t=t.update({filter:(r,i)=>n.value.from!=r||n.value.to!=i,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=wf(t,e.selection.main.head)),t},provide:t=>_.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,i)=>{n.push(r,i)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n<t.length;){let r=t[n++],i=t[n++];if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(kf.range(r,i))}return re.set(e,!0)}});function wf(t,e,n=e){let r=!1;return t.between(e,n,(i,s)=>{i<n&&s>e&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(i,s)=>i>=n||s<=e}):t}function va(t,e,n){var r;let i=null;return(r=t.field(cr,!1))===null||r===void 0||r.between(e,n,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function d3(t,e,n){let r=!1;return t.between(e,e,(i,s)=>{i==e&&s==n&&(r=!0)}),r}function R0(t,e){return t.field(cr,!1)?e:e.concat(ce.appendConfig.of($0()))}const u3=t=>{for(let e of E0(t)){let n=ya(t.state,e.from,e.to);if(n)return t.dispatch({effects:R0(t.state,[Wa.of(n),L0(t,n)])}),!0}return!1},f3=t=>{if(!t.state.field(cr,!1))return!1;let e=[];for(let n of E0(t)){let r=va(t.state,n.from,n.to);r&&e.push(Ks.of(r),L0(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function L0(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,i=t.state.doc.lineAt(e.to).number;return _.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${i}.`)}const p3=t=>{let{state:e}=t,n=[];for(let r=0;r<e.doc.length;){let i=t.lineBlockAt(r),s=ya(e,i.from,i.to);s&&n.push(Wa.of(s)),r=(s?t.lineBlockAt(s.to):i).to+1}return n.length&&t.dispatch({effects:R0(t.state,n)}),!!n.length},m3=t=>{let e=t.state.field(cr,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,i)=>{n.push(Ks.of({from:r,to:i}))}),t.dispatch({effects:n}),!0},g3=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:u3},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:f3},{key:"Ctrl-Alt-[",run:p3},{key:"Ctrl-Alt-]",run:m3}],b3={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},I0=U.define({combine(t){return cn(t,b3)}});function $0(t){return[cr,w3]}function B0(t,e){let{state:n}=t,r=n.facet(I0),i=o=>{let a=t.lineBlockAt(t.posAtDOM(o.target)),l=va(t.state,a.from,a.to);l&&t.dispatch({effects:Ks.of(l)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,i,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const kf=re.replace({widget:new class extends hn{toDOM(t){return B0(t,null)}}});class x3 extends hn{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return B0(e,this.value)}}const y3={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Al extends vn{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function v3(t={}){let e={...y3,...t},n=new Al(e,!0),r=new Al(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(cr,!1)!=o.state.field(cr,!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=va(o.state,l.from,l.to)?r:ya(o.state,l.from,l.to)?n:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:s}=e;return[i,LS({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(i))===null||a===void 0?void 0:a.markers)||ge.empty},initialSpacer(){return new Al(e,!1)},domEventHandlers:{...s,click:(o,a,l)=>{if(s.click&&s.click(o,a,l))return!0;let c=va(o.state,a.from,a.to);if(c)return o.dispatch({effects:Ks.of(c)}),!0;let d=ya(o.state,a.from,a.to);return d?(o.dispatch({effects:Wa.of(d)}),!0):!1}}}),$0()]}const w3=_.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,n){this.specs=e;let r;function i(a){let l=In.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const s=typeof n.all=="string"?n.all:n.all?i(n.all):void 0,o=n.scope;this.scope=o instanceof Vt?a=>a.prop(Cr)==o.data:o?a=>a==o:void 0,this.style=sg(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=n.themeType}static define(e,n){return new Kr(e,n||{})}}const Zc=U.define(),F0=U.define({combine(t){return t.length?[t[0]]:null}});function Ml(t){let e=t.facet(Zc);return e.length?e:t.facet(F0)}function qh(t,e){let n=[S3],r;return t instanceof Kr&&(t.module&&n.push(_.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(F0.of(t)):r?n.push(Zc.computeN([_.darkTheme],i=>i.facet(_.darkTheme)==(r=="dark")?[t]:[])):n.push(Zc.of(t)),n}class k3{constructor(e){this.markCache=Object.create(null),this.tree=nt(e.state),this.decorations=this.buildDeco(e,Ml(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=nt(e.state),r=Ml(e.state),i=r!=Ml(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);n.length<s.to&&!i&&n.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(n!=this.tree||e.viewportChanged||i)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,n){if(!n||!this.tree.length)return re.none;let r=new xn;for(let{from:i,to:s}of e.visibleRanges)T2(this.tree,n,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=re.mark({class:l})))},i,s);return r.finish()}}const S3=ur.high(Fe.fromClass(k3,{decorations:t=>t.decorations})),C3=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"}]),j3=_.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),V0=1e4,z0="()[]{}",_0=U.define({combine(t){return cn(t,{afterCursor:!0,brackets:z0,maxScanDistance:V0,renderMatch:N3})}}),O3=re.mark({class:"cm-matchingBracket"}),P3=re.mark({class:"cm-nonmatchingBracket"});function N3(t){let e=[],n=t.matched?O3:P3;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const A3=Ye.define({create(){return re.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(_0);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&&(n=n.concat(r.renderMatch(s,e.state)))}return re.set(n,!0)},provide:t=>_.decorations.from(t)}),M3=[A3,j3];function D3(t={}){return[_0.of(t),M3]}const T3=new fe;function eh(t,e,n){let r=t.prop(e<0?fe.openedBy:fe.closedBy);if(r)return r;if(t.name.length==1){let i=n.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[n[i+e]]}return null}function th(t){let e=t.type.prop(T3);return e?e(t.node):t}function tn(t,e,n,r={}){let i=r.maxScanDistance||V0,s=r.brackets||z0,o=nt(t),a=o.resolveInner(e,n);for(let l=a;l;l=l.parent){let c=eh(l.type,n,s);if(c&&l.from<l.to){let d=th(l);if(d&&(n>0?e>=d.from&&e<d.to:e>d.from&&e<=d.to))return E3(t,e,n,l,d,c,s)}}return R3(t,e,n,o,a.type,i,s)}function E3(t,e,n,r,i,s,o){let a=r.parent,l={from:i.from,to:i.to},c=0,d=a?.cursor();if(d&&(n<0?d.childBefore(r.from):d.childAfter(r.to)))do if(n<0?d.to<=r.from:d.from>=r.to){if(c==0&&s.indexOf(d.type.name)>-1&&d.from<d.to){let u=th(d);return{start:l,end:u?{from:u.from,to:u.to}:void 0,matched:!0}}else if(eh(d.type,n,o))c++;else if(eh(d.type,-n,o)){if(c==0){let u=th(d);return{start:l,end:u&&u.from<u.to?{from:u.from,to:u.to}:void 0,matched:!1}}c--}}while(n<0?d.prevSibling():d.nextSibling());return{start:l,matched:!1}}function R3(t,e,n,r,i,s,o){let a=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?e-1:e,to:n>0?e+1:e},d=t.doc.iterRange(e,n>0?t.doc.length:0),u=0;for(let f=0;!d.next().done&&f<=s;){let p=d.value;n<0&&(f+=p.length);let m=e+f*n;for(let b=n>0?0:p.length-1,x=n>0?p.length:-1;b!=x;b+=n){let w=o.indexOf(p[b]);if(!(w<0||r.resolveInner(m+b,1).type!=i))if(w%2==0==n>0)u++;else{if(u==1)return{start:c,end:{from:m+b,to:m+b+1},matched:w>>1==l>>1};u--}}n>0&&(f+=p.length)}return d.done?{start:c,matched:!1}:null}const L3=Object.create(null),Sf=[pt.none],Cf=[],jf=Object.create(null),I3=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])I3[t]=$3(L3,e);function Dl(t,e){Cf.indexOf(t)>-1||(Cf.push(t),console.warn(e))}function $3(t,e){let n=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let d=t[c]||T[c];d?typeof d=="function"?l.length?l=l.map(d):Dl(c,`Modifier ${c} used at start of tag`):l.length?Dl(c,`Tag ${c} used as modifier`):l=Array.isArray(d)?d:[d]:Dl(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+n.map(a=>a.id),s=jf[i];if(s)return s.id;let o=jf[i]=pt.define({id:Sf.length,name:r,props:[rg({[r]:n})]});return Sf.push(o),o.id}Ne.RTL,Ne.LTR;const B3=ga.define({name:"json",parser:I2.configure({props:[A0.add({Object:vf({except:/^\s*\}/}),Array:vf({except:/^\s*\]/})}),D0.add({"Object Array":l3})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function F3(){return new YS(B3)}function nh(){return nh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},nh.apply(null,arguments)}function V3(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}const z3=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Yh(t.state,n.from);return r.line?_3(t):r.block?W3(t):!1};function Jh(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=t(e,n);return i?(r(n.update(i)),!0):!1}}const _3=Jh(G3,0),H3=Jh(H0,0),W3=Jh((t,e)=>H0(t,e,K3(e)),0);function Yh(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const fi=50;function U3(t,{open:e,close:n},r,i){let s=t.sliceDoc(r-fi,r),o=t.sliceDoc(i,i+fi),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+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:i+l,margin:l&&1}};let d,u;i-r<=2*fi?d=u=t.sliceDoc(r,i):(d=t.sliceDoc(r,r+fi),u=t.sliceDoc(i-fi,i));let f=/^\s*/.exec(d)[0].length,p=/\s*$/.exec(u)[0].length,m=u.length-p-n.length;return d.slice(f,f+e.length)==e&&u.slice(m,m+n.length)==n?{open:{pos:r+f+e.length,margin:/\s/.test(d.charAt(f+e.length))?1:0},close:{pos:i-p-n.length,margin:/\s/.test(u.charAt(m-1))?1:0}}:null}function K3(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),i=n.to<=r.to?r:t.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:t.doc.lineAt(n.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 H0(t,e,n=e.selection.ranges){let r=n.map(s=>Yh(e,s.from).block);if(!r.every(s=>s))return null;let i=n.map((s,o)=>U3(e,r[o],s.from,s.to));if(t!=2&&!i.every(s=>s))return{changes:e.changes(n.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(t!=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 G3(t,e,n=e.selection.ranges){let r=[],i=-1;for(let{from:s,to:o}of n){let a=r.length,l=1e9,c=Yh(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(t!=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(t!=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 rh=ln.define(),q3=ln.define(),J3=U.define(),W0=U.define({combine(t){return cn(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,i)=>e(r,i)||n(r,i)})}}),U0=Ye.define({create(){return nn.empty},update(t,e){let n=e.state.facet(W0),r=e.annotation(rh);if(r){let l=ft.fromTransaction(e,r.selection),c=r.side,d=c==0?t.undone:t.done;return l?d=wa(d,d.length,n.minDepth,l):d=q0(d,e.startState.selection),new nn(c==0?r.rest:d,c==0?d:r.rest)}let i=e.annotation(q3);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(He.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let s=ft.fromTransaction(e),o=e.annotation(He.time),a=e.annotation(He.userEvent);return s?t=t.addChanges(s,o,a,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,n.newGroupDelay)),(i=="full"||i=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new nn(t.done.map(ft.fromJSON),t.undone.map(ft.fromJSON))}});function Y3(t={}){return[U0,W0.of(t),_.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?K0:e.inputType=="historyRedo"?ih:null;return r?(e.preventDefault(),r(n)):!1}})]}function Ua(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let i=n.field(U0,!1);if(!i)return!1;let s=i.pop(t,n,e);return s?(r(s),!0):!1}}const K0=Ua(0,!1),ih=Ua(1,!1),Q3=Ua(0,!0),X3=Ua(1,!0);class ft{constructor(e,n,r,i,s){this.changes=e,this.effects=n,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,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(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,n){let r=Dt;for(let i of e.startState.facet(J3)){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,n||e.startState.selection,Dt)}static selection(e){return new ft(void 0,Dt,void 0,void 0,e)}}function wa(t,e,n,r){let i=e+1>n+20?e-n-1:0,s=t.slice(i,e);return s.push(r),s}function Z3(t,e){let n=[],r=!1;return t.iterChangedRanges((i,s)=>n.push(i,s)),e.iterChangedRanges((i,s,o,a)=>{for(let l=0;l<n.length;){let c=n[l++],d=n[l++];a>=c&&o<=d&&(r=!0)}}),r}function e4(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function G0(t,e){return t.length?e.length?t.concat(e):t:e}const Dt=[],t4=200;function q0(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-t4));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),wa(t,t.length-1,1e9,n.setSelAfter(r)))}else return[ft.selection([e])]}function n4(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Tl(t,e){if(!t.length)return t;let n=t.length,r=Dt;for(;n;){let i=r4(t[n-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=t.slice(0,n);return s[n-1]=i,s}else e=i.mapped,n--,r=i.selectionsAfter}return r.length?[ft.selection(r)]:Dt}function r4(t,e,n){let r=G0(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):Dt,n);if(!t.changes)return ft.selection(r);let i=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new ft(i,ce.mapEffects(t.effects,e),o,t.startSelection.map(s),r)}const i4=/^(input\.type|delete)($|\.)/;class nn{constructor(e,n,r=0,i=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new nn(this.done,this.undone):this}addChanges(e,n,r,i,s){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||i4.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,Z3(a.changes,e.changes))||r=="input.type.compose")?o=wa(o,o.length-1,i.minDepth,new ft(e.changes.compose(a.changes),G0(ce.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,Dt)):o=wa(o,o.length,i.minDepth,e),new nn(o,Dt,n,r)}addSelection(e,n,r,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Dt;return s.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&e4(s[s.length-1],e)?this:new nn(q0(this.done,e),this.undone,n,r)}addMapping(e){return new nn(Tl(this.done,e),Tl(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,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]||n.selection;if(r&&s.selectionsAfter.length)return n.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:rh.of({side:e,rest:n4(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=Tl(a,s.mapped)),n.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:rh.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 s4=[{key:"Mod-z",run:K0,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:ih,preventDefault:!0},{linux:"Ctrl-Shift-z",run:ih,preventDefault:!0},{key:"Mod-u",run:Q3,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:X3,preventDefault:!0}];function Gr(t,e){return E.create(t.ranges.map(e),t.mainIndex)}function Ht(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Wt({state:t,dispatch:e},n){let r=Gr(t.selection,n);return r.eq(t.selection,!0)?!1:(e(Ht(t,r)),!0)}function Ka(t,e){return E.cursor(e?t.to:t.from)}function J0(t,e){return Wt(t,n=>n.empty?t.moveByChar(n,e):Ka(n,e))}function rt(t){return t.textDirectionAt(t.state.selection.main.head)==Ne.LTR}const Y0=t=>J0(t,!rt(t)),Q0=t=>J0(t,rt(t));function X0(t,e){return Wt(t,n=>n.empty?t.moveByGroup(n,e):Ka(n,e))}const o4=t=>X0(t,!rt(t)),a4=t=>X0(t,rt(t));function l4(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Ga(t,e,n){let r=nt(t).resolveInner(e.head),i=n?fe.closedBy:fe.openedBy;for(let l=e.head;;){let c=n?r.childAfter(l):r.childBefore(l);if(!c)break;l4(t,c,i)?r=c:l=n?c.to:c.from}let s=r.type.prop(i),o,a;return s&&(o=n?tn(t,r.from,1):tn(t,r.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?r.to:r.from,E.cursor(a,n?-1:1)}const c4=t=>Wt(t,e=>Ga(t.state,e,!rt(t))),h4=t=>Wt(t,e=>Ga(t.state,e,rt(t)));function Z0(t,e){return Wt(t,n=>{if(!n.empty)return Ka(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const eb=t=>Z0(t,!1),tb=t=>Z0(t,!0);function nb(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,i;if(e){for(let s of t.state.facet(_.scrollMargins)){let o=s(t);o?.top&&(n=Math.max(o?.top,n)),o?.bottom&&(r=Math.max(o?.bottom,r))}i=t.scrollDOM.clientHeight-n-r}else i=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,i-5)}}function rb(t,e){let n=nb(t),{state:r}=t,i=Gr(r.selection,o=>o.empty?t.moveVertically(o,e,n.height):Ka(o,e));if(i.eq(r.selection))return!1;let s;if(n.selfScroll){let o=t.coordsAtPos(r.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+n.marginTop,c=a.bottom-n.marginBottom;o&&o.top>l&&o.bottom<c&&(s=_.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-l}))}return t.dispatch(Ht(r,i),{effects:s}),!0}const Of=t=>rb(t,!1),sh=t=>rb(t,!0);function zn(t,e,n){let r=t.lineBlockAt(e.head),i=t.moveToLineBoundary(e,n);if(i.head==e.head&&i.head!=(n?r.to:r.from)&&(i=t.moveToLineBoundary(e,n,!1)),!n&&i.head==r.from&&r.length){let s=/^\s*/.exec(t.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 d4=t=>Wt(t,e=>zn(t,e,!0)),u4=t=>Wt(t,e=>zn(t,e,!1)),f4=t=>Wt(t,e=>zn(t,e,!rt(t))),p4=t=>Wt(t,e=>zn(t,e,rt(t))),m4=t=>Wt(t,e=>E.cursor(t.lineBlockAt(e.head).from,1)),g4=t=>Wt(t,e=>E.cursor(t.lineBlockAt(e.head).to,-1));function b4(t,e,n){let r=!1,i=Gr(t.selection,s=>{let o=tn(t,s.head,-1)||tn(t,s.head,1)||s.head>0&&tn(t,s.head-1,1)||s.head<t.doc.length&&tn(t,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(t,i)),!0):!1}const x4=({state:t,dispatch:e})=>b4(t,e);function $t(t,e){let n=Gr(t.state.selection,r=>{let i=e(r);return E.range(r.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(Ht(t.state,n)),!0)}function ib(t,e){return $t(t,n=>t.moveByChar(n,e))}const sb=t=>ib(t,!rt(t)),ob=t=>ib(t,rt(t));function ab(t,e){return $t(t,n=>t.moveByGroup(n,e))}const y4=t=>ab(t,!rt(t)),v4=t=>ab(t,rt(t)),w4=t=>$t(t,e=>Ga(t.state,e,!rt(t))),k4=t=>$t(t,e=>Ga(t.state,e,rt(t)));function lb(t,e){return $t(t,n=>t.moveVertically(n,e))}const cb=t=>lb(t,!1),hb=t=>lb(t,!0);function db(t,e){return $t(t,n=>t.moveVertically(n,e,nb(t).height))}const Pf=t=>db(t,!1),Nf=t=>db(t,!0),S4=t=>$t(t,e=>zn(t,e,!0)),C4=t=>$t(t,e=>zn(t,e,!1)),j4=t=>$t(t,e=>zn(t,e,!rt(t))),O4=t=>$t(t,e=>zn(t,e,rt(t))),P4=t=>$t(t,e=>E.cursor(t.lineBlockAt(e.head).from)),N4=t=>$t(t,e=>E.cursor(t.lineBlockAt(e.head).to)),Af=({state:t,dispatch:e})=>(e(Ht(t,{anchor:0})),!0),Mf=({state:t,dispatch:e})=>(e(Ht(t,{anchor:t.doc.length})),!0),Df=({state:t,dispatch:e})=>(e(Ht(t,{anchor:t.selection.main.anchor,head:0})),!0),Tf=({state:t,dispatch:e})=>(e(Ht(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),A4=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),M4=({state:t,dispatch:e})=>{let n=qa(t).map(({from:r,to:i})=>E.range(r,Math.min(i+1,t.doc.length)));return e(t.update({selection:E.create(n),userEvent:"select"})),!0},D4=({state:t,dispatch:e})=>{let n=Gr(t.selection,r=>{let i=nt(t),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 n.eq(t.selection)?!1:(e(Ht(t,n)),!0)};function ub(t,e){let{state:n}=t,r=n.selection,i=n.selection.ranges.slice();for(let s of n.selection.ranges){let o=n.doc.lineAt(s.head);if(e?o.to<t.state.doc.length:o.from>0)for(let a=s;;){let l=t.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:(t.dispatch(Ht(n,E.create(i,i.length-1))),!0)}const T4=t=>ub(t,!1),E4=t=>ub(t,!0),R4=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=E.create([n.main]):n.main.empty||(r=E.create([E.cursor(n.main.head)])),r?(e(Ht(t,r)),!0):!1};function Gs(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,i=r.changeByRange(s=>{let{from:o,to:a}=s;if(o==a){let l=e(s);l<o?(n="delete.backward",l=Do(t,l,!1)):l>o&&(n="delete.forward",l=Do(t,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=Do(t,o,!1),a=Do(t,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:(t.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?_.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Do(t,e,n){if(t instanceof _)for(let r of t.state.facet(_.atomicRanges).map(i=>i(t)))r.between(e,e,(i,s)=>{i<e&&s>e&&(e=n?s:i)});return e}const fb=(t,e,n)=>Gs(t,r=>{let i=r.from,{state:s}=t,o=s.doc.lineAt(i),a,l;if(n&&!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%xa(s)||xa(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}),oh=t=>fb(t,!1,!0),pb=t=>fb(t,!0,!1),mb=(t,e)=>Gs(t,n=>{let r=n.head,{state:i}=t,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let a=null;;){if(r==(e?s.to:s.from)){r==n.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!=n.head)&&(a=d),r=l}return r}),gb=t=>mb(t,!1),L4=t=>mb(t,!0),I4=t=>Gs(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),$4=t=>Gs(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),B4=t=>Gs(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),F4=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:we.of(["",""])},range:E.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},V4=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let i=r.from,s=t.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:t.doc.slice(i,a).append(t.doc.slice(o,i))},range:E.cursor(a)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function qa(t){let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.from),s=t.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=t.doc.lineAt(r.to-1)),n>=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]});n=s.number+1}return e}function bb(t,e,n){if(t.readOnly)return!1;let r=[],i=[];for(let s of qa(t)){if(n?s.to==t.doc.length:s.from==0)continue;let o=t.doc.lineAt(n?s.to+1:s.from-1),a=o.length+1;if(n){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+t.lineBreak});for(let l of s.ranges)i.push(E.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:t.lineBreak+o.text});for(let l of s.ranges)i.push(E.range(l.anchor-a,l.head-a))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:E.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const z4=({state:t,dispatch:e})=>bb(t,e,!1),_4=({state:t,dispatch:e})=>bb(t,e,!0);function xb(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of qa(t))n?r.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):r.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});let i=t.changes(r);return e(t.update({changes:i,selection:t.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const H4=({state:t,dispatch:e})=>xb(t,e,!1),W4=({state:t,dispatch:e})=>xb(t,e,!0),U4=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(qa(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(t.lineWrapping){let o=t.lineBlockAt(i.head),a=t.coordsAtPos(i.head,i.assoc||1);a&&(s=o.bottom+t.documentTop-a.bottom+t.defaultLineHeight/2)}return t.moveVertically(i,!0,s)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function K4(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=nt(t).resolveInner(e),r=n.childBefore(e),i=n.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(fe.closedBy))&&s.indexOf(i.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(i.from).from&&!/\S/.test(t.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const Ef=yb(!1),G4=yb(!0);function yb(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,a=e.doc.lineAt(s),l=!t&&s==o&&K4(e,s);t&&(s=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new Ha(e,{simulateBreak:s,simulateDoubleBreak:!!l}),d=Kh(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=["",Yi(e,d)];return l&&u.push(Yi(e,c.lineIndent(a.from,-1))),{changes:{from:s,to:o,insert:we.of(u)},range:E.cursor(s+1+u[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Qh(t,e){let n=-1;return t.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let a=t.doc.lineAt(o);a.number>n&&(r.empty||r.to>a.from)&&(e(a,i,r),n=a.number),o=a.to+1}let s=t.changes(i);return{changes:i,range:E.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const q4=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Ha(t,{overrideIndentation:s=>{let o=n[s];return o??-1}}),i=Qh(t,(s,o,a)=>{let l=Kh(r,s.from);if(l==null)return;/\S/.test(s.text)||(l=0);let c=/^\s*/.exec(s.text)[0],d=Yi(t,l);(c!=d||a.from<s.from+c.length)&&(n[s.from]=l,o.push({from:s.from,to:s.from+c.length,insert:d}))});return i.changes.empty||e(t.update(i,{userEvent:"indent"})),!0},vb=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Qh(t,(n,r)=>{r.push({from:n.from,insert:t.facet(_a)})}),{userEvent:"input.indent"})),!0),wb=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Qh(t,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let s=Ur(i,t.tabSize),o=0,a=Yi(t,Math.max(0,s-xa(t)));for(;o<i.length&&o<a.length&&i.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+i.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),J4=t=>(t.setTabFocusMode(),!0),Y4=[{key:"Ctrl-b",run:Y0,shift:sb,preventDefault:!0},{key:"Ctrl-f",run:Q0,shift:ob},{key:"Ctrl-p",run:eb,shift:cb},{key:"Ctrl-n",run:tb,shift:hb},{key:"Ctrl-a",run:m4,shift:P4},{key:"Ctrl-e",run:g4,shift:N4},{key:"Ctrl-d",run:pb},{key:"Ctrl-h",run:oh},{key:"Ctrl-k",run:I4},{key:"Ctrl-Alt-h",run:gb},{key:"Ctrl-o",run:F4},{key:"Ctrl-t",run:V4},{key:"Ctrl-v",run:sh}],Q4=[{key:"ArrowLeft",run:Y0,shift:sb,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:o4,shift:y4,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:f4,shift:j4,preventDefault:!0},{key:"ArrowRight",run:Q0,shift:ob,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:a4,shift:v4,preventDefault:!0},{mac:"Cmd-ArrowRight",run:p4,shift:O4,preventDefault:!0},{key:"ArrowUp",run:eb,shift:cb,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Af,shift:Df},{mac:"Ctrl-ArrowUp",run:Of,shift:Pf},{key:"ArrowDown",run:tb,shift:hb,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Mf,shift:Tf},{mac:"Ctrl-ArrowDown",run:sh,shift:Nf},{key:"PageUp",run:Of,shift:Pf},{key:"PageDown",run:sh,shift:Nf},{key:"Home",run:u4,shift:C4,preventDefault:!0},{key:"Mod-Home",run:Af,shift:Df},{key:"End",run:d4,shift:S4,preventDefault:!0},{key:"Mod-End",run:Mf,shift:Tf},{key:"Enter",run:Ef,shift:Ef},{key:"Mod-a",run:A4},{key:"Backspace",run:oh,shift:oh,preventDefault:!0},{key:"Delete",run:pb,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:gb,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:L4,preventDefault:!0},{mac:"Mod-Backspace",run:$4,preventDefault:!0},{mac:"Mod-Delete",run:B4,preventDefault:!0}].concat(Y4.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),X4=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:c4,shift:w4},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:h4,shift:k4},{key:"Alt-ArrowUp",run:z4},{key:"Shift-Alt-ArrowUp",run:H4},{key:"Alt-ArrowDown",run:_4},{key:"Shift-Alt-ArrowDown",run:W4},{key:"Mod-Alt-ArrowUp",run:T4},{key:"Mod-Alt-ArrowDown",run:E4},{key:"Escape",run:R4},{key:"Mod-Enter",run:G4},{key:"Alt-l",mac:"Ctrl-l",run:M4},{key:"Mod-i",run:D4,preventDefault:!0},{key:"Mod-[",run:wb},{key:"Mod-]",run:vb},{key:"Mod-Alt-\\",run:q4},{key:"Shift-Mod-k",run:U4},{key:"Shift-Mod-\\",run:x4},{key:"Mod-/",run:z3},{key:"Alt-A",run:H3},{key:"Ctrl-m",mac:"Shift-Alt-m",run:J4}].concat(Q4),Z4={key:"Tab",run:vb,shift:wb},Rf=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class _r{constructor(e,n,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(Rf(a)):Rf,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return 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 n=Ah(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Zt(e);let i=this.normalize(n);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<n.length&&n.charCodeAt(s)==a&&o++}}}match(e,n,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:n,to:r}:this.matches.push(1,n)),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 kb={from:-1,to:-1,match:/.*/.exec("")},Xh="gm"+(/x/.unicode==null?"":"u");class Sb{constructor(e,n,r,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=kb,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new Cb(e,n,r,i,s);this.re=new RegExp(n,Xh+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=ka(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 n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,i=r+n[0].length;if(this.matchPos=ka(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,n)))return this.value={from:r,to:i,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const El=new WeakMap;class Er{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let i=El.get(e);if(!i||i.from>=r||i.to<=n){let a=new Er(n,e.sliceString(n,r));return El.set(e,a),a}if(i.from==n&&i.to==r)return i;let{text:s,from:o}=i;return o>n&&(s=e.sliceString(n,o)+s,o=n),i.to<r&&(s+=e.sliceString(i.to,r)),El.set(e,new Er(o,s)),new Er(n,s.slice(n-o,r-o))}}class Cb{constructor(e,n,r,i,s){this.text=e,this.to=s,this.done=!1,this.value=kb,this.matchPos=ka(e,i),this.re=new RegExp(n,Xh+(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,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,i=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,match:n},this.matchPos=ka(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"&&(Sb.prototype[Symbol.iterator]=Cb.prototype[Symbol.iterator]=function(){return this});function e5(t){try{return new RegExp(t,Xh),!0}catch{return!1}}function ka(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e<n.to&&(r=n.text.charCodeAt(e-n.from))>=56320&&r<57344;)e++;return e}function ah(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=Oe("input",{class:"cm-textfield",name:"line",value:e}),r=Oe("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),t.dispatch({effects:Ti.of(!1)}),t.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},Oe("label",t.state.phrase("Go to line"),": ",n)," ",Oe("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),Oe("button",{name:"close",onclick:()=>{t.dispatch({effects:Ti.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!s)return;let{state:o}=t,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)));t.dispatch({effects:[Ti.of(!1),_.scrollIntoView(b.from,{y:"center"})],selection:b}),t.focus()}return{dom:r}}const Ti=ce.define(),Lf=Ye.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(Ti)&&(t=n.value);return t},provide:t=>Ji.from(t,e=>e?ah:null)}),t5=t=>{let e=qi(t,ah);if(!e){let n=[Ti.of(!0)];t.state.field(Lf,!1)==null&&n.push(ce.appendConfig.of([Lf,n5])),t.dispatch({effects:n}),e=qi(t,ah)}return e&&e.dom.querySelector("input").select(),!0},n5=_.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"}}}),r5={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},i5=U.define({combine(t){return cn(t,r5,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function s5(t){return[h5,c5]}const o5=re.mark({class:"cm-selectionMatch"}),a5=re.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function If(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Te.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Te.Word)}function l5(t,e,n,r){return t(e.sliceDoc(n,n+1))==Te.Word&&t(e.sliceDoc(r-1,r))==Te.Word}const c5=Fe.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(i5),{state:n}=t,r=n.selection;if(r.ranges.length>1)return re.none;let i=r.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return re.none;let l=n.wordAt(i.head);if(!l)return re.none;o=n.charCategorizer(i.head),s=n.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l<e.minSelectionLength||l>200)return re.none;if(e.wholeWords){if(s=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(If(o,n,i.from,i.to)&&l5(o,n,i.from,i.to)))return re.none}else if(s=n.sliceDoc(i.from,i.to),!s)return re.none}let a=[];for(let l of t.visibleRanges){let c=new _r(n.doc,s,l.from,l.to);for(;!c.next().done;){let{from:d,to:u}=c.value;if((!o||If(o,n,d,u))&&(i.empty&&d<=i.from&&u>=i.to?a.push(a5.range(d,u)):(d>=i.to||u<=i.from)&&a.push(o5.range(d,u)),a.length>e.maxMatches))return re.none}}return re.set(a)}},{decorations:t=>t.decorations}),h5=_.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),d5=({state:t,dispatch:e})=>{let{selection:n}=t,r=E.create(n.ranges.map(i=>t.wordAt(i.head)||E.cursor(i.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function u5(t,e){let{main:n,ranges:r}=t.selection,i=t.wordAt(n.head),s=i&&i.from==n.from&&i.to==n.to;for(let o=!1,a=new _r(t.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new _r(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(l=>l.from==a.value.from))continue;if(s){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const f5=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(s=>s.from===s.to))return d5({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(s=>t.sliceDoc(s.from,s.to)!=r))return!1;let i=u5(t,r);return i?(e(t.update({selection:t.selection.addRange(E.range(i.from,i.to),!1),effects:_.scrollIntoView(i.to)})),!0):!1},qr=U.define({combine(t){return cn(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new j5(e),scrollToMatch:e=>_.scrollIntoView(e)})}});class jb{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||e5(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?`
233
- `: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 b5(this):new m5(this)}getCursor(e,n=0,r){let i=e.doc?e:be.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?vr(this,i,n,r):yr(this,i,n,r)}}class Ob{constructor(e){this.spec=e}}function yr(t,e,n,r){return new _r(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:i=>i.toLowerCase(),t.wholeWord?p5(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function p5(t,e){return(n,r,i,s)=>((s>n||s+i.length<r)&&(s=Math.max(0,n-2),i=t.sliceString(s,Math.min(t.length,r+2))),(e(Sa(i,n-s))!=Te.Word||e(Ca(i,n-s))!=Te.Word)&&(e(Ca(i,r-s))!=Te.Word||e(Sa(i,r-s))!=Te.Word))}class m5 extends Ob{constructor(e){super(e)}nextMatch(e,n,r){let i=yr(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let s=Math.min(e.doc.length,n+this.spec.unquoted.length);i=yr(this.spec,e,0,s).nextOverlapping()}return i.done||i.value.from==n&&i.value.to==r?null:i.value}prevMatchInRange(e,n,r){for(let i=r;;){let s=Math.max(n,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==n)return null;i-=1e4}}prevMatch(e,n,r){let i=this.prevMatchInRange(e,0,n);return i||(i=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=n||i.to!=r)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let r=yr(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let s=yr(this.spec,e,Math.max(0,n-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 vr(t,e,n,r){return new Sb(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?g5(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function Sa(t,e){return t.slice(_e(t,e,!1),e)}function Ca(t,e){return t.slice(e,_e(t,e))}function g5(t){return(e,n,r)=>!r[0].length||(t(Sa(r.input,r.index))!=Te.Word||t(Ca(r.input,r.index))!=Te.Word)&&(t(Ca(r.input,r.index+r[0].length))!=Te.Word||t(Sa(r.input,r.index+r[0].length))!=Te.Word)}class b5 extends Ob{nextMatch(e,n,r){let i=vr(this.spec,e,r,e.doc.length).next();return i.done&&(i=vr(this.spec,e,0,n).next()),i.done?null:i.value}prevMatchInRange(e,n,r){for(let i=1;;i++){let s=Math.max(n,r-i*1e4),o=vr(this.spec,e,s,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==n||a.from>s+10))return a;if(s==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let 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 n})}matchAll(e,n){let r=vr(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let s=vr(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const Qi=ce.define(),Zh=ce.define(),En=Ye.define({create(t){return new Rl(lh(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Qi)?t=new Rl(n.value.create(),t.panel):n.is(Zh)&&(t=new Rl(t.query,n.value?ed:null));return t},provide:t=>Ji.from(t,e=>e.panel)});class Rl{constructor(e,n){this.query=e,this.panel=n}}const x5=re.mark({class:"cm-searchMatch"}),y5=re.mark({class:"cm-searchMatch cm-searchMatch-selected"}),v5=Fe.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(En))}update(t){let e=t.state.field(En);(e!=t.startState.field(En)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return re.none;let{view:n}=this,r=new xn;for(let i=0,s=n.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;t.highlight(n.state,a,l,(c,d)=>{let u=n.state.selection.ranges.some(f=>f.from==c&&f.to==d);r.add(c,d,u?y5:x5)})}return r.finish()}},{decorations:t=>t.decorations});function qs(t){return e=>{let n=e.state.field(En,!1);return n&&n.query.spec.valid?t(e,n):Ab(e)}}const ja=qs((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let i=E.single(r.from,r.to),s=t.state.facet(qr);return t.dispatch({selection:i,effects:[td(t,r),s.scrollToMatch(i.main,t)],userEvent:"select.search"}),Nb(t),!0}),Oa=qs((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,i=e.prevMatch(n,r,r);if(!i)return!1;let s=E.single(i.from,i.to),o=t.state.facet(qr);return t.dispatch({selection:s,effects:[td(t,i),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),Nb(t),!0}),w5=qs((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:E.create(n.map(r=>E.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),k5=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,s=[],o=0;for(let a=new _r(t.doc,t.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(t.update({selection:E.create(s,o),userEvent:"select.search.matches"})),!0},$f=qs((t,{query:e})=>{let{state:n}=t,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let s=e.nextMatch(n,r,r);if(!s)return!1;let o=s,a=[],l,c,d=[];o.from==r&&o.to==i&&(c=n.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:c}),o=e.nextMatch(n,o.from,o.to),d.push(_.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let u=t.state.changes(a);return o&&(l=E.single(o.from,o.to).map(u),d.push(td(t,o)),d.push(n.facet(qr).scrollToMatch(l.main,t))),t.dispatch({changes:u,selection:l,effects:d,userEvent:"input.replace"}),!0}),S5=qs((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(i=>{let{from:s,to:o}=i;return{from:s,to:o,insert:e.getReplacement(i)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:_.announce.of(r),userEvent:"input.replace.all"}),!0});function ed(t){return t.state.facet(qr).createPanel(t)}function lh(t,e){var n,r,i,s,o;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=t.facet(qr);return new jb({search:((n=e?.literal)!==null&&n!==void 0?n: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 Pb(t){let e=qi(t,ed);return e&&e.dom.querySelector("[main-field]")}function Nb(t){let e=Pb(t);e&&e==t.root.activeElement&&e.select()}const Ab=t=>{let e=t.state.field(En,!1);if(e&&e.panel){let n=Pb(t);if(n&&n!=t.root.activeElement){let r=lh(t.state,e.query.spec);r.valid&&t.dispatch({effects:Qi.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[Zh.of(!0),e?Qi.of(lh(t.state,e.query.spec)):ce.appendConfig.of(P5)]});return!0},Mb=t=>{let e=t.state.field(En,!1);if(!e||!e.panel)return!1;let n=qi(t,ed);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Zh.of(!1)}),!0},C5=[{key:"Mod-f",run:Ab,scope:"editor search-panel"},{key:"F3",run:ja,shift:Oa,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ja,shift:Oa,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Mb,scope:"editor search-panel"},{key:"Mod-Shift-l",run:k5},{key:"Mod-Alt-g",run:t5},{key:"Mod-d",run:f5,preventDefault:!0}];class j5{constructor(e){this.view=e;let n=this.query=e.state.field(En).query.spec;this.commit=this.commit.bind(this),this.searchField=Oe("input",{value:n.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=Oe("input",{value:n.replace,placeholder:xt(e,"Replace"),"aria-label":xt(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Oe("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Oe("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Oe("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(i,s,o){return Oe("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=Oe("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>ja(e),[xt(e,"next")]),r("prev",()=>Oa(e),[xt(e,"previous")]),r("select",()=>w5(e),[xt(e,"all")]),Oe("label",null,[this.caseField,xt(e,"match case")]),Oe("label",null,[this.reField,xt(e,"regexp")]),Oe("label",null,[this.wordField,xt(e,"by word")]),...e.state.readOnly?[]:[Oe("br"),this.replaceField,r("replace",()=>$f(e),[xt(e,"replace")]),r("replaceAll",()=>S5(e),[xt(e,"replace all")])],Oe("button",{name:"close",onclick:()=>Mb(e),"aria-label":xt(e,"close"),type:"button"},["×"])])}commit(){let e=new jb({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:Qi.of(e)}))}keydown(e){Hk(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Oa:ja)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),$f(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Qi)&&!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(t,e){return t.state.phrase(e)}const To=30,Eo=/[\s\.,:;?!]/;function td(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),i=t.state.doc.lineAt(n).to,s=Math.max(r.from,e-To),o=Math.min(i,n+To),a=t.state.sliceDoc(s,o);if(s!=r.from){for(let l=0;l<To;l++)if(!Eo.test(a[l+1])&&Eo.test(a[l])){a=a.slice(l);break}}if(o!=i){for(let l=a.length-1;l>a.length-To;l--)if(!Eo.test(a[l-1])&&Eo.test(a[l])){a=a.slice(0,l);break}}return _.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${r.number}.`)}const O5=_.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"}}),P5=[En,ur.low(v5),O5];class Db{constructor(e,n,r,i){this.state=e,this.pos=n,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=nt(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),i=n.text.slice(r-n.from,this.pos-n.from),s=i.search(Tb(e,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function Bf(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function N5(t){let e=Object.create(null),n=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let s=1;s<i.length;s++)n[i[s]]=!0}let r=Bf(e)+Bf(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function A5(t){let e=t.map(i=>typeof i=="string"?{label:i}:i),[n,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:N5(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:n}:null}}class Ff{constructor(e,n,r,i){this.completion=e,this.source=n,this.match=r,this.score=i}}function or(t){return t.selection.main.from}function Tb(t,e){var n;let{source:r}=t,i=e&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?t:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const Eb=ln.define();function M5(t,e,n,r){let{main:i}=t.selection,s=n-i.from,o=r-i.from;return{...t.changeByRange(a=>{if(a!=i&&n!=r&&t.sliceDoc(a.from+s,a.from+o)!=t.sliceDoc(n,r))return{range:a};let l=t.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 Vf=new WeakMap;function D5(t){if(!Array.isArray(t))return t;let e=Vf.get(t);return e||Vf.set(t,e=A5(t)),e}const Pa=ce.define(),Xi=ce.define();class T5{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let r=ct(e,n),i=Zt(r);this.chars.push(r);let s=e.slice(n,n+i),o=s.toUpperCase();this.folded.push(ct(o==s?s.toLowerCase():o,0)),n+=i}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:i,precise:s,byWord:o}=this;if(n.length==1){let v=ct(e,0),S=Zt(v),C=S==e.length?0:-100;if(v!=n[0])if(v==r[0])C+=-200;else return null;return this.ret(C,[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=n.length,c=0;if(a<0){for(let v=0,S=Math.min(e.length,200);v<S&&c<l;){let C=ct(e,v);(C==n[c]||C==r[c])&&(i[c++]=v),v+=Zt(C)}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),C=0;v<S&&u<l;){let k=ct(e,v);a<0&&(d<l&&k==n[d]&&(s[d++]=v),p<l&&(k==n[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=Ah(k))!=O.toLowerCase()?1:O!=O.toUpperCase()?2:0;(!v||y==1&&x||C==0&&y!=0)&&(n[u]==k||r[u]==k&&(f=!0)?o[u++]=v:o.length&&(w=!1)),C=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):n.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,n,r){let i=[],s=0;for(let o of n){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 E5{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.slice(0,this.pattern.length),r=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,n.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const Ue=U.define({combine(t){return cn(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:R5,filterStrict:!1,compareCompletions:(e,n)=>(e.sortText||e.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>zf(e(r),n(r)),optionClass:(e,n)=>r=>zf(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function zf(t,e){return t?e?t+" "+e:t:e}function R5(t,e,n,r,i,s){let o=t.textDirection==Ne.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(n.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=n.bottom-e.top:(c="bottom",d=e.bottom-n.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 L5(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,i,s){let o=document.createElement("span");o.className="cm-completionLabel";let a=n.displayLabel||n.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(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),e.sort((n,r)=>n.position-r.position).map(n=>n.render)}function Ll(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let i=Math.floor(e/n);return{from:i*n,to:(i+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class I5{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=e.state.field(n),{options:s,selected:o}=i.open,a=e.state.facet(Ue);this.optionContent=L5(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=Ll(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(n).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:Xi.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),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=Ll(s.length,o,e.state.facet(Ue).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),a!=((n=i.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=Ll(n.options.length,n.selected,this.view.state.facet(Ue).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:i}=n.options[n.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,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;r.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=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"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&B5(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),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,n.bottom)-10||i.bottom<Math.max(s.top,n.top)+10?null:this.view.state.facet(Ue).positionInfo(this.view,n,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,n,r){const i=document.createElement("ul");i.id=n,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=n+"-"+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 $5(t,e){return n=>new I5(n,t,e)}function B5(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=n.height/t.offsetHeight;r.top<n.top?t.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/i)}function _f(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function F5(t,e){let n=[],r=null,i=null,s=d=>{n.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 t)if(d.hasResult()){let u=d.result.getMatch;if(d.result.filter===!1)for(let f of d.result.options)s(new Ff(f,d.source,u?u(f):[],1e9-n.length));else{let f=e.sliceDoc(d.from,d.to),p,m=o.filterStrict?new E5(f):new T5(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 Ff(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 n){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 n.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):_f(d.completion)>_f(l)&&(a[a.length-1]=d),l=d.completion}return a}class jr{constructor(e,n,r,i,s,o){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new jr(this.options,Hf(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,i,s,o){if(i&&!o&&e.some(c=>c.isPending))return i.setDisabled();let a=F5(e,n);if(!a.length)return i&&e.some(c=>c.isPending)?i.setDisabled():null;let l=n.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 jr(a,Hf(r,l),{pos:e.reduce((c,d)=>d.hasResult()?Math.min(c,d.from):c,1e8),create:U5,above:s.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new jr(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new jr(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Na{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new Na(H5,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(Ue),s=(r.override||n.languageDataAt("autocomplete",or(n)).map(D5)).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(nd));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!V5(s,this.active)||a?o=jr.build(s,n,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(Lb)&&(o=o&&o.setSelected(l.value,this.id));return s==this.active&&o==this.open?this:new Na(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?z5:_5}}function V5(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;r<e.length&&!e[r].hasResult();)r++;let i=n==t.length,s=r==e.length;if(i||s)return i==s;if(t[n++].result!=e[r++].result)return!1}}const z5={"aria-autocomplete":"list"},_5={};function Hf(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const H5=[];function Rb(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(Eb);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Tt{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=Rb(e,n),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(Pa))i=new Tt(i.source,1,s.value);else if(s.is(Xi))i=new Tt(i.source,0);else if(s.is(nd))for(let o of s.value)o.source==i.source&&(i=o);return i}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(or(e.state))}}class Rr extends Tt{constructor(e,n,r,i,s,o){super(e,3,n),this.limit=r,this.result=i,this.from=s,this.to=o}hasResult(){return!0}updateFor(e,n){var r;if(!(n&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=or(e.state);if(a>o||!i||n&2&&(or(e.startState)==this.from||a<this.limit))return new Tt(this.source,n&4?1:0);let l=e.changes.mapPos(this.limit);return W5(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 Db(e.state,a,!1)))?new Rr(this.source,this.explicit,l,i,i.from,(r=i.to)!==null&&r!==void 0?r:or(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 W5(t,e,n,r){if(!t)return!1;let i=e.sliceDoc(n,r);return typeof t=="function"?t(i,n,r,e):Tb(t,!0).test(i)}const nd=ce.define({map(t,e){return t.map(n=>n.map(e))}}),Lb=ce.define(),ht=Ye.define({create(){return Na.start()},update(t,e){return t.update(e)},provide:t=>[Uh.from(t,e=>e.tooltip),_.contentAttributes.from(t,e=>e.attrs)]});function rd(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(ht).active.find(i=>i.source==e.source);return r instanceof Rr?(typeof n=="string"?t.dispatch({...M5(t.state,n,r.from,r.to),annotations:Eb.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const U5=$5(ht,rd);function Ro(t,e="option"){return n=>{let r=n.state.field(ht,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(Ue).interactionDelay)return!1;let i=1,s;e=="page"&&(s=C0(n,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*(t?1:-1):t?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),n.dispatch({effects:Lb.of(a)}),!0}}const K5=t=>{let e=t.state.field(ht,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(Ue).interactionDelay?!1:rd(t,e.open.options[e.open.selected])},Il=t=>t.state.field(ht,!1)?(t.dispatch({effects:Pa.of(!0)}),!0):!1,G5=t=>{let e=t.state.field(ht,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Xi.of(null)}),!0)};class q5{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const J5=50,Y5=1e3,Q5=Fe.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(ht).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(ht),n=t.state.facet(Ue);if(!t.selectionSet&&!t.docChanged&&t.startState.field(ht)==e)return;let r=t.transactions.some(s=>{let o=Rb(s,n);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&&t.docChanged||o.updates.length+t.transactions.length>J5&&Date.now()-o.time>Y5){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(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(s=>s.effects.some(o=>o.is(Pa)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.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 t.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:t}=this.view,e=t.field(ht);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ue).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=or(e),r=new Db(e,n,t.explicit,this.view),i=new q5(t,r);this.running.push(i),Promise.resolve(t.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:Xi.of(null)}),ut(this.view.state,s)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ue).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=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=or(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,(t=s.done.to)!==null&&t!==void 0?t:a);for(let d of s.updates)c=c.update(d,n);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,n);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:nd.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(ht,!1);if(e&&e.tooltip&&this.view.state.facet(Ue).closeOnBlur){let n=e.open&&C0(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Xi.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Pa.of(!1)}),20),this.composing=0}}}),X5=typeof navigator=="object"&&/Win/.test(navigator.platform),Z5=ur.highest(_.domEventHandlers({keydown(t,e){let n=e.state.field(ht,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(X5&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(o=>o.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(t.key)>-1&&rd(e,r),!1}})),eC=_.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"}}}),Zi={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},ir=ce.define({map(t,e){let n=e.mapPos(t,-1,ot.TrackAfter);return n??void 0}}),id=new class extends Ln{};id.startSide=1;id.endSide=-1;const Ib=Ye.define({create(){return ge.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(ir)&&(t=t.update({add:[id.range(n.value,n.value+1)]}));return t}});function tC(){return[rC,Ib]}const $l="()[]{}<>«»»«[]{}";function $b(t){for(let e=0;e<$l.length;e+=2)if($l.charCodeAt(e)==t)return $l.charAt(e+1);return Ah(t<128?t:t+1)}function Bb(t,e){return t.languageDataAt("closeBrackets",e)[0]||Zi}const nC=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),rC=_.inputHandler.of((t,e,n,r)=>{if((nC?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(r.length>2||r.length==2&&Zt(ct(r,0))==1||e!=i.from||n!=i.to)return!1;let s=oC(t.state,r);return s?(t.dispatch(s),!0):!1}),iC=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=Bb(t,t.selection.main.head).brackets||Zi.brackets,i=null,s=t.changeByRange(o=>{if(o.empty){let a=aC(t.doc,o.head);for(let l of r)if(l==a&&Ja(t.doc,o.head)==$b(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(t.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},sC=[{key:"Backspace",run:iC}];function oC(t,e){let n=Bb(t,t.selection.main.head),r=n.brackets||Zi.brackets;for(let i of r){let s=$b(ct(i,0));if(e==i)return s==i?hC(t,i,r.indexOf(i+i+i)>-1,n):lC(t,i,s,n.before||Zi.before);if(e==s&&Fb(t,t.selection.main.from))return cC(t,i,s)}return null}function Fb(t,e){let n=!1;return t.field(Ib).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function Ja(t,e){let n=t.sliceString(e,e+2);return n.slice(0,Zt(ct(n,0)))}function aC(t,e){let n=t.sliceString(e-2,e);return Zt(ct(n,0))==n.length?n:n.slice(1)}function lC(t,e,n,r){let i=null,s=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:n,from:o.to}],effects:ir.of(o.to+e.length),range:E.range(o.anchor+e.length,o.head+e.length)};let a=Ja(t.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+n,from:o.head},effects:ir.of(o.head+e.length),range:E.cursor(o.head+e.length)}:{range:i=o}});return i?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function cC(t,e,n){let r=null,i=t.changeByRange(s=>s.empty&&Ja(t.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:E.cursor(s.head+n.length)}:r={range:s});return r?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function hC(t,e,n,r){let i=r.stringPrefixes||Zi.stringPrefixes,s=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:ir.of(a.to+e.length),range:E.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=Ja(t.doc,l),d;if(c==e){if(Wf(t,l))return{changes:{insert:e+e,from:l},effects:ir.of(l+e.length),range:E.cursor(l+e.length)};if(Fb(t,l)){let f=n&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+f.length,insert:f},range:E.cursor(l+f.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(d=Uf(t,l-2*e.length,i))>-1&&Wf(t,d))return{changes:{insert:e+e+e+e,from:l},effects:ir.of(l+e.length),range:E.cursor(l+e.length)};if(t.charCategorizer(l)(c)!=Te.Word&&Uf(t,l,i)>-1&&!dC(t,l,e,i))return{changes:{insert:e+e,from:l},effects:ir.of(l+e.length),range:E.cursor(l+e.length)}}return{range:s=a}});return s?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Wf(t,e){let n=nt(t).resolveInner(e+1);return n.parent&&n.from==e}function dC(t,e,n,r){let i=nt(t).resolveInner(e,-1),s=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=t.sliceDoc(i.from,Math.min(i.to,i.from+n.length+s)),l=a.indexOf(n);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>n.length+l;){if(t.sliceDoc(d.to-n.length,d.to)==n)return!1;d=d.firstChild}return!0}let c=i.to==e&&i.parent;if(!c)break;i=c}return!1}function Uf(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Te.Word)return e;for(let i of n){let s=e-i.length;if(t.sliceDoc(s,e)==i&&r(t.sliceDoc(s-1,s))!=Te.Word)return s}return-1}function uC(t={}){return[Z5,ht,Ue.of(t),Q5,fC,eC]}const Vb=[{key:"Ctrl-Space",run:Il},{mac:"Alt-`",run:Il},{mac:"Alt-i",run:Il},{key:"Escape",run:G5},{key:"ArrowDown",run:Ro(!0)},{key:"ArrowUp",run:Ro(!1)},{key:"PageDown",run:Ro(!0,"page")},{key:"PageUp",run:Ro(!1,"page")},{key:"Enter",run:K5}],fC=ur.highest(Va.computeN([Ue],t=>t.facet(Ue).defaultKeymap?[Vb]:[]));class Kf{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class Qn{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let i=r.facet(es).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,C)=>Math.min(S,C.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 C=b;;){if(C>=x){w=!0;break}if(!c.lineBreak&&d+c.value.length>C)break;C=d+c.value.length,d+=c.value.length,c.next()}}let v=OC(a);if(w)o.add(b,b,re.widget({widget:new kC(v),diagnostics:a.slice()}));else{let S=a.reduce((C,k)=>k.markClass?C+" "+k.markClass:C,"");o.add(b,x,re.mark({class:"cm-lintRange cm-lintRange-"+v+S,diagnostics:a.slice(),inclusiveEnd:a.some(C=>C.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,n,Hr(f))}}function Hr(t,e=null,n=0){let r=null;return t.between(n,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new Kf(i,s,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new Kf(r.from,s,r.diagnostic)}}),r}function pC(t,e){let n=e.pos,r=e.end||n,i=t.state.facet(es).hideOn(t,n,r);if(i!=null)return i;let s=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(o=>o.is(zb))||t.changes.touchesRange(s.from,Math.max(s.to,r)))}function mC(t,e){return t.field(wt,!1)?e:e.concat(ce.appendConfig.of(PC))}const zb=ce.define(),sd=ce.define(),_b=ce.define(),wt=Ye.define({create(){return new Qn(re.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,i=t.panel;if(t.selected){let s=e.changes.mapPos(t.selected.from,1);r=Hr(n,t.selected.diagnostic,s)||Hr(n,null,s)}!n.size&&i&&e.state.facet(es).autoPanel&&(i=null),t=new Qn(n,i,r)}for(let n of e.effects)if(n.is(zb)){let r=e.state.facet(es).autoPanel?n.value.length?ts.open:null:t.panel;t=Qn.init(n.value,r,e.state)}else n.is(sd)?t=new Qn(t.diagnostics,n.value?ts.open:null,t.selected):n.is(_b)&&(t=new Qn(t.diagnostics,t.panel,n.value));return t},provide:t=>[Ji.from(t,e=>e.panel),_.decorations.from(t,e=>e.diagnostics)]}),gC=re.mark({class:"cm-lintRange cm-lintRange-active"});function bC(t,e,n){let{diagnostics:r}=t.state.field(wt),i,s=-1,o=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(l,c,{spec:d})=>{if(e>=l&&e<=c&&(l==c||(e>l||n>0)&&(e<c||n<0)))return i=d.diagnostics,s=l,o=c,!1});let a=t.state.facet(es).tooltipFilter;return i&&a&&(i=a(i,t.state)),i?{pos:s,end:o,above:t.state.doc.lineAt(s).to<o,create(){return{dom:xC(t,i)}}}:null}function xC(t,e){return Oe("ul",{class:"cm-tooltip-lint"},e.map(n=>Wb(t,n,!1)))}const yC=t=>{let e=t.state.field(wt,!1);(!e||!e.panel)&&t.dispatch({effects:mC(t.state,[sd.of(!0)])});let n=qi(t,ts.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},Gf=t=>{let e=t.state.field(wt,!1);return!e||!e.panel?!1:(t.dispatch({effects:sd.of(!1)}),!0)},vC=t=>{let e=t.state.field(wt,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},wC=[{key:"Mod-Shift-m",run:yC,preventDefault:!0},{key:"F8",run:vC}],es=U.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...cn(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:qf,tooltipFilter:qf,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,i,s)=>e(r,i,s)||n(r,i,s):e:n,autoPanel:(e,n)=>e||n})}}});function qf(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function Hb(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;r<n.length;r++){let i=n[r];if(/[a-zA-Z]/.test(i)&&!e.some(s=>s.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function Wb(t,e,n){var r;let i=n?Hb(e.actions):[];return Oe("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Oe("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):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(t.state.field(wt).diagnostics,e);m&&s.apply(t,m.from,m.to)},{name:c}=s,d=i[o]?c.indexOf(i[o]):-1,u=d<0?c:[c.slice(0,d),Oe("u",c.slice(d,d+1)),c.slice(d+1)],f=s.markClass?" "+s.markClass:"";return Oe("button",{type:"button",class:"cm-diagnosticAction"+f,onclick:l,onmousedown:l,"aria-label":` Action: ${c}${d<0?"":` (access key "${i[o]})"`}.`},u)}),e.source&&Oe("div",{class:"cm-diagnosticSource"},e.source))}class kC extends hn{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Oe("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Jf{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Wb(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class ts{constructor(e){this.view=e,this.items=[];let n=i=>{if(i.keyCode==27)Gf(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=Hb(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=Oe("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=Oe("div",{class:"cm-panel-lint"},this.list,Oe("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Gf(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(wt).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(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 Jf(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)),n&&f.diagnostic==n.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 Jf(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 n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(wt),r=Hr(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:_b.of(r)})}static open(e){return new ts(e)}}function SC(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function Lo(t){return SC(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const CC=_.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:Lo("#d11")},".cm-lintRange-warning":{backgroundImage:Lo("orange")},".cm-lintRange-info":{backgroundImage:Lo("#999")},".cm-lintRange-hint":{backgroundImage:Lo("#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 jC(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function OC(t){let e="hint",n=1;for(let r of t){let i=jC(r.severity);i>n&&(n=i,e=r.severity)}return e}const PC=[wt,_.decorations.compute([wt],t=>{let{selected:e,panel:n}=t.field(wt);return!e||!n||e.from==e.to?re.none:re.set([gC.range(e.from,e.to)])}),DS(bC,{hideOn:pC}),CC];var Yf=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(sC)),e.defaultKeymap!==!1&&(r=r.concat(X4)),e.searchKeymap!==!1&&(r=r.concat(C5)),e.historyKeymap!==!1&&(r=r.concat(s4)),e.foldKeymap!==!1&&(r=r.concat(g3)),e.completionKeymap!==!1&&(r=r.concat(Vb)),e.lintKeymap!==!1&&(r=r.concat(wC));var i=[];return e.lineNumbers!==!1&&i.push(_S()),e.highlightActiveLineGutter!==!1&&i.push(US()),e.highlightSpecialChars!==!1&&i.push(oS()),e.history!==!1&&i.push(Y3()),e.foldGutter!==!1&&i.push(v3()),e.drawSelection!==!1&&i.push(Jk()),e.dropCursor!==!1&&i.push(eS()),e.allowMultipleSelections!==!1&&i.push(be.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&i.push(o3()),e.syntaxHighlighting!==!1&&i.push(qh(C3,{fallback:!0})),e.bracketMatching!==!1&&i.push(D3()),e.closeBrackets!==!1&&i.push(tC()),e.autocompletion!==!1&&i.push(uC()),e.rectangularSelection!==!1&&i.push(vS()),n!==!1&&i.push(SS()),e.highlightActiveLine!==!1&&i.push(uS()),e.highlightSelectionMatches!==!1&&i.push(s5()),e.tabSize&&typeof e.tabSize=="number"&&i.push(_a.of(" ".repeat(e.tabSize))),i.concat([Va.of(r.flat())]).filter(Boolean)};const NC="#e5c07b",Qf="#e06c75",AC="#56b6c2",MC="#ffffff",ea="#abb2bf",ch="#7d8799",DC="#61afef",TC="#98c379",Xf="#d19a66",EC="#c678dd",RC="#21252b",Zf="#2c313a",ep="#282c34",Bl="#353a42",LC="#3E4451",tp="#528bff",IC=_.theme({"&":{color:ea,backgroundColor:ep},".cm-content":{caretColor:tp},".cm-cursor, .cm-dropCursor":{borderLeftColor:tp},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:LC},".cm-panels":{backgroundColor:RC,color:ea},".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:ep,color:ch,border:"none"},".cm-activeLineGutter":{backgroundColor:Zf},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Bl},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Bl,borderBottomColor:Bl},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Zf,color:ea}}},{dark:!0}),$C=Kr.define([{tag:T.keyword,color:EC},{tag:[T.name,T.deleted,T.character,T.propertyName,T.macroName],color:Qf},{tag:[T.function(T.variableName),T.labelName],color:DC},{tag:[T.color,T.constant(T.name),T.standard(T.name)],color:Xf},{tag:[T.definition(T.name),T.separator],color:ea},{tag:[T.typeName,T.className,T.number,T.changed,T.annotation,T.modifier,T.self,T.namespace],color:NC},{tag:[T.operator,T.operatorKeyword,T.url,T.escape,T.regexp,T.link,T.special(T.string)],color:AC},{tag:[T.meta,T.comment],color:ch},{tag:T.strong,fontWeight:"bold"},{tag:T.emphasis,fontStyle:"italic"},{tag:T.strikethrough,textDecoration:"line-through"},{tag:T.link,color:ch,textDecoration:"underline"},{tag:T.heading,fontWeight:"bold",color:Qf},{tag:[T.atom,T.bool,T.special(T.variableName)],color:Xf},{tag:[T.processingInstruction,T.string,T.inserted],color:TC},{tag:T.invalid,color:MC}]),BC=[IC,qh($C)];var FC=_.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),VC=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:i=!1,theme:s="light",placeholder:o="",basicSetup:a=!0}=e,l=[];switch(n&&l.unshift(Va.of([Z4])),a&&(typeof a=="boolean"?l.unshift(Yf()):l.unshift(Yf(a))),o&&l.unshift(gS(o)),s){case"light":l.push(FC);break;case"dark":l.push(BC);break;case"none":break;default:l.push(s);break}return r===!1&&l.push(_.editable.of(!1)),i&&l.push(be.readOnly.of(!0)),[...l]},zC=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class _C{constructor(e,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class np{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 Fl=null,HC=()=>typeof window>"u"?new np:(Fl||(Fl=new np),Fl),rp=ln.define(),WC=200,UC=[];function KC(t){var{value:e,selection:n,onChange:r,onStatistics:i,onCreateEditor:s,onUpdate:o,extensions:a=UC,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:C=!0,root:k,initialState:O}=t,[y,M]=g.useState(),[A,R]=g.useState(),[N,L]=g.useState(),H=g.useState(()=>({current:null}))[0],$=g.useState(()=>({current:null}))[0],F=_.theme({"&":{height:d,minHeight:u,maxHeight:f,width:p,minWidth:m,maxWidth:b},"& .cm-scroller":{height:"100% !important"}}),G=_.updateListener.of(te=>{if(te.docChanged&&typeof r=="function"&&!te.transactions.some(Y=>Y.annotation(rp))){H.current?H.current.reset():(H.current=new _C(()=>{if($.current){var Y=$.current;$.current=null,Y()}H.current=null},WC),HC().add(H.current));var oe=te.state.doc,pe=oe.toString();r(pe,te)}i&&i(zC(te))}),ue=VC({theme:c,editable:w,readOnly:v,placeholder:x,indentWithTab:S,basicSetup:C}),X=[G,F,...ue];return o&&typeof o=="function"&&X.push(_.updateListener.of(o)),X=X.concat(a),g.useLayoutEffect(()=>{if(y&&!N){var te={doc:e,selection:n,extensions:X},oe=O?be.fromJSON(O.json,te,O.fields):be.create(te);if(L(oe),!A){var pe=new _({state:oe,parent:y,root:k});R(pe),s&&s(pe,oe)}}return()=>{A&&(L(void 0),R(void 0))}},[y,N]),g.useEffect(()=>{t.container&&M(t.container)},[t.container]),g.useEffect(()=>()=>{A&&(A.destroy(),R(void 0)),H.current&&(H.current.cancel(),H.current=null)},[A]),g.useEffect(()=>{l&&A&&A.focus()},[l,A]),g.useEffect(()=>{A&&A.dispatch({effects:ce.reconfigure.of(X)})},[c,a,d,u,f,p,m,b,x,w,v,S,C,r,o]),g.useEffect(()=>{if(e!==void 0){var te=A?A.state.doc.toString():"";if(A&&e!==te){var oe=H.current&&!H.current.isDone,pe=()=>{A&&e!==A.state.doc.toString()&&A.dispatch({changes:{from:0,to:A.state.doc.toString().length,insert:e||""},annotations:[rp.of(!0)]})};oe?$.current=pe:pe()}}},[e,A]),{state:N,setState:L,view:A,setView:R,container:y,setContainer:M}}var GC=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Ub=g.forwardRef((t,e)=>{var{className:n,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:C,editable:k,readOnly:O,root:y,initialState:M}=t,A=V3(t,GC),R=g.useRef(null),{state:N,view:L,container:H,setContainer:$}=KC({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:C,editable:k,readOnly:O,selection:i,onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:c,extensions:s,initialState:M});g.useImperativeHandle(e,()=>({editor:R.current,state:N,view:L}),[R,H,N,L]);var F=g.useCallback(ue=>{R.current=ue,$(ue)},[$]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var G=typeof u=="string"?"cm-theme-"+u:"cm-theme";return h.jsx("div",nh({ref:F,className:""+G+(n?" "+n:"")},A))});Ub.displayName="CodeMirror";const qC=()=>{const t=_.theme({"&":{backgroundColor:"var(--dash-surface)",color:"var(--dash-text)",height:"100%"},".cm-editor":{height:"100% !important"},".cm-content":{caretColor:"var(--dash-accent)",fontFamily:"'JetBrains Mono', Menlo, monospace",padding:"1rem"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--dash-accent)"},"& ::selection":{backgroundColor:"var(--dash-accent-selection) !important",color:"inherit !important"},".cm-gutters":{backgroundColor:"var(--dash-surface)",color:"var(--dash-text-muted)",border:"none",borderRight:"1px solid var(--dash-border)",paddingRight:"0.5rem"},".cm-lineNumbers .cm-gutterElement":{padding:"0 0.5rem 0 1rem",minWidth:"3rem"},".cm-activeLineGutter":{backgroundColor:"var(--dash-accent-subtle)",color:"var(--dash-accent)",fontWeight:"600"},".cm-activeLine":{backgroundColor:"color-mix(in srgb, var(--dash-accent) 8%, transparent)"},".cm-matchingBracket":{backgroundColor:"var(--dash-accent-subtle)",outline:"1px solid var(--dash-accent)"},".cm-scroller":{overflow:"auto !important",height:"100%",maxHeight:"100%"}}),e=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[t,qh(e)]},JC=({value:t,onChange:e,onCursorLineChange:n,onEditorFocus:r,height:i="100%",readOnly:s=!1,className:o})=>{const a=g.useMemo(()=>[F3(),_.lineWrapping,...qC()],[]),l=g.useMemo(()=>{if(n)return c=>{const d=c.state.selection.main.head,u=c.view.state.doc.lineAt(d).number-1;n(u)}},[n]);return h.jsx("div",{className:`h-full [&_.cm-editor]:h-full [&_.cm-editor]:outline-none [&_.cm-focused]:outline-none ${o??""}`.trim(),children:h.jsx(Ub,{value:t,height:i,extensions:a,onChange:e,onFocus:r,onUpdate:l,theme:"none",readOnly:s,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}})})},od=({width:t,isLoading:e,jsonText:n,cursorLine:r,syntaxError:i,onChange:s,onEditorFocus:o,onCursorLineChange:a,readOnly:l=!1,headerTitle:c,headerPath:d,headerActions:u})=>{const{t:f}=he(),p=m=>{if(l||!m.target.closest(".cm-editor"))return;const x=m.currentTarget;x.scrollHeight<=x.clientHeight||(x.scrollTop+=m.deltaY)};return h.jsxs("div",{style:{width:`${t}%`},className:"bg-dash-surface border border-dash-border rounded-xl overflow-hidden flex flex-col shadow-sm min-w-0 h-full",children:[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:c??f("jsonTab")}),d&&h.jsx("p",{className:"mt-1 mono text-[11px] text-dash-text-muted truncate",children:d})]}),u&&h.jsx("div",{className:"flex items-center gap-2 shrink-0",children:u})]})}),h.jsx("div",{className:"flex-1 min-h-0 overflow-auto",onWheelCapture:p,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:f("loading")})}):l?h.jsx("pre",{className:"h-full overflow-auto p-4 font-mono text-xs leading-4 text-dash-text whitespace-pre m-0",children:n}):h.jsx(JC,{value:n,onChange:s,onEditorFocus:o,onCursorLineChange:a,readOnly:l,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:[l&&h.jsx("span",{children:f("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"}),f("syntaxValid")]})]})]})]})},ip=({label:t,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:[t,":"]}),h.jsx("span",{className:"text-[10px] mono font-bold text-dash-text-secondary",children:e})]}),Kb=({width:t,fieldDoc:e,activeFieldPath:n,extraContent:r,overrideBadge:i})=>{const{t:s,lang:o}=he(),a=e??(n?qm[n]??{path:n,type:"unknown",default:"n/a",description:"Help is being resolved for this field. Try editing the value or switching to the JSON view for schema-based details.",descriptionVi:"Đang tải trợ giúp cho trường này. Hãy thử chỉnh sửa giá trị hoặc chuyển sang chế độ JSON để xem mô tả suy ra từ schema."}:null);return h.jsxs("div",{style:{width:`${t}%`},className:"bg-dash-surface border border-dash-border rounded-xl flex flex-col shadow-sm overflow-hidden min-w-0",children:[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:a?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:a.path}),i]}),h.jsxs("div",{className:"flex flex-wrap gap-2 mt-2",children:[h.jsx(ip,{label:s("type"),value:a.type}),h.jsx(ip,{label:s("default"),value:a.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"?a.descriptionVi:a.description})]}),a.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:a.validValues.map(l=>h.jsx("span",{className:"px-2 py-0.5 bg-dash-bg border border-dash-border rounded text-[11px] mono text-dash-text",children:l},l))})]}),a.effect&&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"&&a.effectVi?a.effectVi:a.effect})]}),a.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:a.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")})]})]})}),a&&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")]})})]})},YC=({variant:t="development"})=>{const{t:e}=he(),n={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:n[t]})},sp={codex:{heavy:{model:"gpt-5.4",effort:"xhigh"},balanced:{model:"gpt-5.4",effort:"high"},light:{model:"gpt-5.4-mini",effort:"medium"}},"gemini-cli":{heavy:{model:"gemini-3.1-pro-preview"},balanced:{model:"gemini-3.1-pro-preview"},light:{model:"gemini-3-flash-preview"}}},QC={codex:"Codex","gemini-cli":"Gemini CLI"},op=["heavy","balanced","light"];function ap(t,e){return e.split(".").reduce((n,r)=>{if(n!=null&&typeof n=="object"&&r in n)return n[r]},t)}const lp="bg-transparent border border-dash-border rounded px-2 py-1 text-sm text-dash-text placeholder:text-dash-text-muted focus:border-dash-accent focus:outline-none w-full",XC=({config:t,onChange:e,isCollapsed:n,onCollapsedChange:r})=>{const{t:i}=he(),[s,o]=g.useState(!1),a=n??s,l=f=>{r?.(f),n===void 0&&o(f)},c=(f,p,m,b)=>{const x=`modelTaxonomy.${f}.${p}.${m}`;e(x,b===""?void 0:b)},d=f=>{for(const p of op)e(`modelTaxonomy.${f}.${p}.model`,void 0),sp[f]?.[p]?.effort!==void 0&&e(`modelTaxonomy.${f}.${p}.effort`,void 0)},u=f=>i(f==="heavy"?"taxonomyTierHeavy":f==="balanced"?"taxonomyTierBalanced":"taxonomyTierLight");return h.jsxs("div",{"data-model-taxonomy":!0,className:`bg-dash-surface border border-dash-border rounded-lg overflow-hidden ${a?"shrink-0":"h-full min-h-0 flex flex-col"}`,children:[h.jsxs("button",{type:"button",onClick:()=>l(!a),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":!a,"aria-controls":"section-model-taxonomy",children:[h.jsx("h3",{className:"text-sm font-bold text-dash-text uppercase tracking-wider",children:i("sectionModelTaxonomy")}),h.jsx("svg",{className:`w-4 h-4 text-dash-text-muted transition-transform duration-200 ${a?"":"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"})})]}),!a&&h.jsx("div",{id:"section-model-taxonomy","data-model-taxonomy-content":!0,className:"flex-1 min-h-0 overflow-y-auto",children:h.jsxs("div",{className:"px-4 py-3 space-y-4 h-full",children:[h.jsx("p",{className:"text-xs text-dash-text-secondary",children:i("taxonomyDescription")}),Object.entries(sp).map(([f,p])=>{const m=Object.values(p).some(b=>b.effort!==void 0);return h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-xs font-semibold text-dash-text uppercase tracking-wider",children:QC[f]??f}),h.jsx("button",{type:"button",onClick:()=>d(f),className:"text-xs text-dash-text-muted hover:text-dash-text px-2 py-0.5 rounded border border-dash-border hover:border-dash-accent transition-colors",children:i("taxonomyResetProvider")})]}),h.jsx("div",{className:"overflow-hidden rounded border border-dash-border",children:h.jsxs("table",{className:"w-full text-xs",children:[h.jsx("thead",{children:h.jsxs("tr",{className:"bg-dash-surface-hover/40 border-b border-dash-border",children:[h.jsx("th",{className:"text-left px-3 py-2 text-dash-text-secondary font-medium w-1/4",children:i("taxonomyTier")}),h.jsx("th",{className:"text-left px-3 py-2 text-dash-text-secondary font-medium",children:i("taxonomyModel")}),m&&h.jsx("th",{className:"text-left px-3 py-2 text-dash-text-secondary font-medium w-1/4",children:i("taxonomyEffort")})]})}),h.jsx("tbody",{children:op.map(b=>{const x=p[b],w=ap(t,`modelTaxonomy.${f}.${b}.model`),v=ap(t,`modelTaxonomy.${f}.${b}.effort`);return h.jsxs("tr",{className:"border-b border-dash-border last:border-0",children:[h.jsx("td",{className:"px-3 py-2 text-dash-text-secondary",children:u(b)}),h.jsx("td",{className:"px-3 py-2",children:h.jsx("input",{type:"text",className:lp,placeholder:x?.model??"",value:w??"",onChange:S=>c(f,b,"model",S.target.value)})}),m&&h.jsx("td",{className:"px-3 py-2",children:x?.effort!==void 0?h.jsx("input",{type:"text",className:lp,placeholder:x.effort,value:v??"",onChange:S=>c(f,b,"effort",S.target.value)}):null})]},b)})})]})})]},f)})]})})]})},ZC=({components:t,isChecking:e,isUpdating:n,onCheckAll:r,onUpdateAll:i,className:s})=>{const{t:o}=he(),a=t.filter(d=>d.status==="update-available").length,l=t.length>0&&t.every(d=>d.status==="up-to-date"||d.status==="idle"),c=t.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||n,className:"dash-focus-ring px-3 py-2 rounded-lg text-xs font-semibold border border-dash-border bg-dash-surface text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:o("checkAll")}),a>0&&h.jsx("button",{type:"button",onClick:i,disabled:n,className:"dash-focus-ring px-3 py-2 rounded-lg text-xs font-semibold bg-dash-accent text-dash-bg hover:bg-dash-accent-hover disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:o("updateAll")})]})},ej=({value:t,onChange:e,disabled:n=!1})=>{const{t:r}=he();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 ${t==="stable"?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover"} ${n?"opacity-50 cursor-not-allowed":""}`,children:[h.jsx("input",{type:"radio",name:"channel",value:"stable",checked:t==="stable",onChange:()=>e("stable"),disabled:n,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 ${t==="beta"?"bg-amber-500/15 text-amber-500":"text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover"} ${n?"opacity-50 cursor-not-allowed":""}`,children:[h.jsx("input",{type:"radio",name:"channel",value:"beta",checked:t==="beta",onChange:()=>e("beta"),disabled:n,className:"sr-only"}),r("channelBeta")]})]})},tj={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}},Gb=({status:t,ariaLabel:e,size:n="sm"})=>{const r=tj[t],i=n==="sm"?"w-2 h-2":"w-2.5 h-2.5";return h.jsx("span",{className:`
230
+ `;this.styleTag.textContent=o;let a=n.head||n;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var $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:"'"},zi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},rw=typeof navigator<"u"&&/Mac/.test(navigator.platform),iw=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),zi[qe]=String.fromCharCode(qe);for(var pl in $n)zi.hasOwnProperty(pl)||(zi[pl]=$n[pl]);function sw(t){var e=rw&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||iw&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?zi:$n)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function Oe(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i=="string"?t.setAttribute(r,i):i!=null&&(t[r]=i)}e++}for(;e<arguments.length;e++)Cg(t,arguments[e]);return t}function Cg(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var n=0;n<e.length;n++)Cg(t,e[n]);else throw new RangeError("Unsupported child node: "+e)}let st=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Ec=typeof document<"u"?document:{documentElement:{style:{}}};const Rc=/Edge\/(\d+)/.exec(st.userAgent),jg=/MSIE \d/.test(st.userAgent),Lc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(st.userAgent),Ia=!!(jg||Lc||Rc),Au=!Ia&&/gecko\/(\d+)/i.test(st.userAgent),ml=!Ia&&/Chrome\/(\d+)/.exec(st.userAgent),ow="webkitFontSmoothing"in Ec.documentElement.style,Ic=!Ia&&/Apple Computer/.test(st.vendor),Mu=Ic&&(/Mobile\/\w+/.test(st.userAgent)||st.maxTouchPoints>2);var W={mac:Mu||/Mac/.test(st.platform),windows:/Win/.test(st.platform),linux:/Linux|X11/.test(st.platform),ie:Ia,ie_version:jg?Ec.documentMode||6:Lc?+Lc[1]:Rc?+Rc[1]:0,gecko:Au,gecko_version:Au?+(/Firefox\/(\d+)/.exec(st.userAgent)||[0,0])[1]:0,chrome:!!ml,chrome_version:ml?+ml[1]:0,ios:Mu,android:/Android\b/.test(st.userAgent),webkit_version:ow?+(/\bAppleWebKit\/(\d+)/.exec(st.userAgent)||[0,0])[1]:0,safari:Ic,safari_version:Ic?+(/\bVersion\/(\d+(\.\d+)?)/.exec(st.userAgent)||[0,0])[1]:0,tabSize:Ec.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Rh(t,e){for(let n in t)n=="class"&&e.class?e.class+=" "+t.class:n=="style"&&e.style?e.style+=";"+t.style:e[n]=t[n];return e}const la=Object.create(null);function Lh(t,e,n){if(t==e)return!0;t||(t=la),e||(e=la);let r=Object.keys(t),i=Object.keys(e);if(r.length-0!=i.length-0)return!1;for(let s of r)if(s!=n&&(i.indexOf(s)==-1||t[s]!==e[s]))return!1;return!0}function aw(t,e){for(let n=t.attributes.length-1;n>=0;n--){let r=t.attributes[n].name;e[r]==null&&t.removeAttribute(r)}for(let n in e){let r=e[n];n=="style"?t.style.cssText=r:t.getAttribute(n)!=r&&t.setAttribute(n,r)}}function Du(t,e,n){let r=!1;if(e)for(let i in e)n&&i in n||(r=!0,i=="style"?t.style.cssText="":t.removeAttribute(i));if(n)for(let i in n)e&&e[i]==n[i]||(r=!0,i=="style"?t.style.cssText=n[i]:t.setAttribute(i,n[i]));return r}function lw(t){let e=Object.create(null);for(let n=0;n<t.attributes.length;n++){let r=t.attributes[n];e[r.name]=r.value}return e}class hn{eq(e){return!1}updateDOM(e,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,n,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Je=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Je||(Je={}));class re extends Ln{constructor(e,n,r,i){super(),this.startSide=e,this.endSide=n,this.widget=r,this.spec=i}get heightRelevant(){return!1}static mark(e){return new Hs(e)}static widget(e){let n=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return n+=r&&!e.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new ar(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,i;if(e.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:o}=Og(e,n);r=(s?n?-3e8:-1:5e8)-1,i=(o?n?2e8:1:-6e8)+1}return new ar(e,r,i,n,e.widget||null,!0)}static line(e){return new _s(e)}static set(e,n=!1){return ge.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}re.none=ge.empty;class Hs extends re{constructor(e){let{start:n,end:r}=Og(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Rh(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||la}eq(e){return this==e||e instanceof Hs&&this.tagName==e.tagName&&Lh(this.attrs,e.attrs)}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}Hs.prototype.point=!1;class _s extends re{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof _s&&this.spec.class==e.spec.class&&Lh(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}_s.prototype.mapMode=ot.TrackBefore;_s.prototype.point=!0;class ar extends re{constructor(e,n,r,i,s,o){super(n,r,s,e),this.block=i,this.isReplace=o,this.mapMode=i?n<=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 ar&&cw(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}ar.prototype.point=!0;function Og(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function cw(t,e){return t==e||!!(t&&e&&t.compare(e))}function Mr(t,e,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=t?n[i]=Math.max(n[i],e):n.push(t,e)}class Hi extends Ln{constructor(e,n){super(),this.tagName=e,this.attributes=n}eq(e){return e==this||e instanceof Hi&&this.tagName==e.tagName&&Lh(this.attributes,e.attributes)}static create(e){return new Hi(e.tagName,e.attributes||la)}static set(e,n=!1){return ge.of(e,n)}}Hi.prototype.startSide=Hi.prototype.endSide=-1;function _i(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function $c(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Jo(t,e){if(!e.anchorNode)return!1;try{return $c(t,e.anchorNode)}catch{return!1}}function Ni(t){return t.nodeType==3?Ui(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function Ai(t,e,n,r){return n?Tu(t,e,n,r,-1)||Tu(t,e,n,r,1):!1}function Bn(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function ca(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function Tu(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:yn(t))){if(t.nodeName=="DIV")return!1;let s=t.parentNode;if(!s||s.nodeType!=1)return!1;e=Bn(t)+(i<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=i<0?yn(t):0}else return!1}}function yn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Wi(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function hw(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function Pg(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function dw(t,e,n,r,i,s,o,a){let l=t.ownerDocument,c=l.defaultView||window;for(let d=t,u=!1;d&&!u;)if(d.nodeType==1){let f,p=d==l.body,m=1,b=1;if(p)f=hw(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}=Pg(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),n>0&&e.bottom>f.bottom+w&&(w=e.bottom-f.bottom+o)):e.bottom>f.bottom&&(w=e.bottom-f.bottom+o,n<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"&&n<0?e.top-o:e.bottom-S+o)-f.top}if(r=="nearest"?e.left<f.left?(x=e.left-(f.left+s),n>0&&e.right>f.right+x&&(x=e.right-f.right+s)):e.right>f.right&&(x=e.right-f.right+s,n<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 C=d.scrollTop;d.scrollTop+=w/b,S=(d.scrollTop-C)*b}if(x){let C=d.scrollLeft;d.scrollLeft+=x/m,v=(d.scrollLeft-C)*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 uw(t){let e=t.ownerDocument,n,r;for(let i=t.parentNode;i&&!(i==e.body||n&&r);)if(i.nodeType==1)!r&&i.scrollHeight>i.clientHeight&&(r=i),!n&&i.scrollWidth>i.clientWidth&&(n=i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;return{x:n,y:r}}class fw{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?yn(n):0),r,Math.min(e.focusOffset,r?yn(r):0))}set(e,n,r,i){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=i}}let Jn=null;W.safari&&W.safari_version>=26&&(Jn=!1);function Ng(t){if(t.setActive)return t.setActive();if(Jn)return t.focus(Jn);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(Jn==null?{get preventScroll(){return Jn={preventScroll:!0},!0}}:void 0),!Jn){Jn=!1;for(let n=0;n<e.length;){let r=e[n++],i=e[n++],s=e[n++];r.scrollTop!=i&&(r.scrollTop=i),r.scrollLeft!=s&&(r.scrollLeft=s)}}}let Eu;function Ui(t,e,n=e){let r=Eu||(Eu=document.createRange());return r.setEnd(t,n),r.setStart(t,e),r}function Dr(t,e,n,r){let i={key:e,code:e,keyCode:n,which:n,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,t.dispatchEvent(s);let o=new KeyboardEvent("keyup",i);return o.synthetic=!0,t.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function pw(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function mw(t,e){let n=e.focusNode,r=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=r)return!1;for(r=Math.min(r,yn(n));;)if(r){if(n.nodeType!=1)return!1;let i=n.childNodes[r-1];i.contentEditable=="false"?r--:(n=i,r=yn(n))}else{if(n==t)return!0;r=Bn(n),n=n.parentNode}}function Ag(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function Mg(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=yn(n)}else if(n.parentNode&&!ca(n))r=Bn(n),n=n.parentNode;else return null}}function Dg(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r<n.nodeValue.length)return{node:n,offset:r};if(n.nodeType==1&&r<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!ca(n))r=Bn(n)+1,n=n.parentNode;else return null}}class Ft{constructor(e,n,r=!0){this.node=e,this.offset=n,this.precise=r}static before(e,n){return new Ft(e.parentNode,Bn(e),n)}static after(e,n){return new Ft(e.parentNode,Bn(e)+1,n)}}var Ne=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Ne||(Ne={}));const lr=Ne.LTR,Ih=Ne.RTL;function Tg(t){let e=[];for(let n=0;n<t.length;n++)e.push(1<<+t[n]);return e}const gw=Tg("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),bw=Tg("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Bc=Object.create(null),Jt=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),n=t.charCodeAt(1);Bc[e]=n,Bc[n]=-e}function Eg(t){return t<=247?gw[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?bw[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const xw=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class bn{get dir(){return this.level%2?Ih:lr}constructor(e,n,r){this.from=e,this.to=n,this.level=r}side(e,n){return this.dir==n==e?this.to:this.from}forward(e,n){return e==(this.dir==n)}static find(e,n,r,i){let s=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=n&&a.to>=n){if(a.level==r)return o;(s<0||(i!=0?i<0?a.from<n:a.to>n:e[s].level>a.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function Rg(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++){let r=t[n],i=e[n];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!Rg(r.inner,i.inner))return!1}return!0}const Pe=[];function yw(t,e,n,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:n,l=s?256:i;for(let c=o,d=l,u=l;c<a;c++){let f=Eg(t.charCodeAt(c));f==512?f=d:f==8&&u==4&&(f=16),Pe[c]=f==4?2:f,f&7&&(u=f),d=f}for(let c=o,d=l,u=l;c<a;c++){let f=Pe[c];if(f==128)c<a-1&&d==Pe[c+1]&&d&24?f=Pe[c]=d:Pe[c]=256;else if(f==64){let p=c+1;for(;p<a&&Pe[p]==64;)p++;let m=c&&d==8||p<n&&Pe[p]==8?u==1?1:8:256;for(let b=c;b<p;b++)Pe[b]=m;c=p-1}else f==8&&u==1&&(Pe[c]=1);d=f,f&7&&(u=f)}}}function vw(t,e,n,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:n;for(let u=c,f,p,m;u<d;u++)if(p=Bc[f=t.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&&(Pe[u]=Pe[Jt[b]]=w),a=b;break}}else{if(Jt.length==189)break;Jt[a++]=u,Jt[a++]=f,Jt[a++]=l}else if((m=Pe[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 ww(t,e,n,r){for(let i=0,s=r;i<=n.length;i++){let o=i?n[i-1].to:t,a=i<n.length?n[i].from:e;for(let l=o;l<a;){let c=Pe[l];if(c==256){let d=l+1;for(;;)if(d==a){if(i==n.length)break;d=n[i++].to,a=i<n.length?n[i].from:e}else if(Pe[d]==256)d++;else break;let u=s==1,f=(d<e?Pe[d]:r)==1,p=u==f?u?1:2:r;for(let m=d,b=i,x=b?n[b-1].to:t;m>l;)m==x&&(m=n[--b].from,x=b?n[b-1].to:t),Pe[--m]=p;l=d}else s=c,l++}}}function Fc(t,e,n,r,i,s,o){let a=r%2?2:1;if(r%2==i%2)for(let l=e,c=0;l<n;){let d=!0,u=!1;if(c==s.length||l<s[c].from){let b=Pe[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==n)break e;if(w<s.length&&s[w].from==x)x=s[w++].to;else{if(Pe[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==lr!=!(p%2);Vc(t,x?r+1:r,i,b.inner,b.from,b.to,o),l=b.to}m=b.to}else{if(m==n||(d?Pe[m]!=a:Pe[m]==a))break;m++}f?Fc(t,l,m,r+1,i,f,o):l<m&&o.push(new bn(l,m,p)),l=m}else for(let l=n,c=s.length;l>e;){let d=!0,u=!1;if(!c||l>s[c-1].to){let b=Pe[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(Pe[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==lr!=!(p%2);Vc(t,x?r+1:r,i,b.inner,b.from,b.to,o),l=b.from}m=b.from}else{if(m==e||(d?Pe[m-1]!=a:Pe[m-1]==a))break;m--}f?Fc(t,m,l,r+1,i,f,o):m<l&&o.push(new bn(m,l,p)),l=m}}function Vc(t,e,n,r,i,s,o){let a=e%2?2:1;yw(t,i,s,r,a),vw(t,i,s,r,a),ww(i,s,r,a),Fc(t,i,s,e,n,r,o)}function kw(t,e,n){if(!t)return[new bn(0,0,e==Ih?1:0)];if(e==lr&&!n.length&&!xw.test(t))return Lg(t.length);if(n.length)for(;t.length>Pe.length;)Pe[Pe.length]=256;let r=[],i=e==lr?0:1;return Vc(t,i,i,n,0,t.length,r),r}function Lg(t){return[new bn(0,t,0)]}let Ig="";function Sw(t,e,n,r,i){var s;let o=r.head-t.from,a=bn.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),l=e[a],c=l.side(i,n);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,n),c=l.side(i,n)}let d=He(t.text,o,l.forward(i,n));(d<l.from||d>l.to)&&(d=c),Ig=t.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,n)+t.from,u.forward(i,n)?1:-1,u.level):E.cursor(d+t.from,l.forward(i,n)?-1:1,l.level)}function Cw(t,e,n){for(let r=e;r<n;r++){let i=Eg(t.charCodeAt(r));if(i==1)return lr;if(i==2||i==4)return Ih}return lr}const $g=U.define(),Bg=U.define(),Fg=U.define(),Vg=U.define(),zc=U.define(),zg=U.define(),Hg=U.define(),$h=U.define(),Bh=U.define(),_g=U.define({combine:t=>t.some(e=>e)}),Wg=U.define({combine:t=>t.some(e=>e)}),Ug=U.define();class Tr{constructor(e,n="nearest",r="nearest",i=5,s=5,o=!1){this.range=e,this.y=n,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 vo=ce.define({map:(t,e)=>t.map(e)}),Kg=ce.define();function ut(t,e,n){let r=t.facet(Vg);r.length?r[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const gn=U.define({combine:t=>t.length?t[0]:!0});let jw=0;const kr=U.define({combine(t){return t.filter((e,n)=>{for(let r=0;r<n;r++)if(t[r].plugin==e.plugin)return!1;return!0})}});class Fe{constructor(e,n,r,i,s){this.id=e,this.create=n,this.domEventHandlers=r,this.domEventObservers=i,this.baseExtensions=s(this),this.extension=this.baseExtensions.concat(kr.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(kr.of({plugin:this,arg:e}))}static define(e,n){const{eventHandlers:r,eventObservers:i,provide:s,decorations:o}=n||{};return new Fe(jw++,e,r,i,a=>{let l=[];return o&&l.push(Ki.of(c=>{let d=c.plugin(a);return d?o(d):re.none})),s&&l.push(s(a)),l})}static fromClass(e,n){return Fe.define((r,i)=>new e(r,i),n)}}class gl{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(ut(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(n){ut(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){ut(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Gg=U.define(),Fh=U.define(),Ki=U.define(),qg=U.define(),Jg=U.define(),Ws=U.define(),Yg=U.define();function Ru(t,e){let n=t.state.facet(Yg);if(!n.length)return n;let r=n.map(s=>s instanceof Function?s(t):s),i=[];return ge.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=Cw(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 Qg=U.define();function Vh(t){let e=0,n=0,r=0,i=0;for(let s of t.state.facet(Qg)){let o=s(t);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:n,top:r,bottom:i}}const vi=U.define();class Mt{constructor(e,n,r,i){this.fromA=e,this.toA=n,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 n=e.length,r=this;for(;n>0;n--){let i=e[n-1];if(!(i.fromA>r.toA)){if(i.toA<r.fromA)break;r=r.join(i),e.splice(n-1,1)}}return e.splice(n,0,r),e}static extendWithRanges(e,n){if(n.length==0)return e;let r=[];for(let i=0,s=0,o=0;;){let a=i<e.length?e[i].fromB:1e9,l=s<n.length?n[s]:1e9,c=Math.min(a,l);if(c==1e9)break;let d=c+o,u=c,f=d;for(;;)if(s<n.length&&n[s]<=u){let p=n[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 ha{constructor(e,n,r){this.view=e,this.state=n,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,n,r){return new ha(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const Ow=[];class Ve{constructor(e,n,r=0){this.dom=e,this.length=n,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return Ow}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let n=this.domAttrs;n&&aw(this.dom,n)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,n=this.posAtStart){let r=n;for(let 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,n){return null}domPosFor(e,n){let r=Bn(this.dom),i=this.length?e>0:n>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 Ba)return e;return null}static get(e){return e.cmTile}}class $a 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 n=this.dom,r=null,i,s=e?.node==n?e:null,o=0;for(let a of this.children){if(a.sync(e),o+=a.length+a.breakAfter,i=r?r.nextSibling:n.firstChild,s&&i!=a.dom&&(s.written=!0),a.dom.parentNode==n)for(;i&&i!=a.dom;)i=Lu(i);else n.insertBefore(a.dom,i);r=a.dom}for(i=r?r.nextSibling:n.firstChild,s&&i&&(s.written=!0);i;)i=Lu(i);this.length=o}}function Lu(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Ba extends $a{constructor(e,n){super(n),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let n=Ve.get(e);if(n&&this.owns(n))return n;e=e.parentNode}}blockTiles(e){for(let n=[],r=this,i=0,s=0;;)if(i==r.children.length){if(!n.length)return;r=r.parent,r.breakAfter&&s++,i=n.pop()}else{let o=r.children[i++];if(o instanceof Tn)n.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,n){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()&&n>=-1&&n<=1){if(a.flags&32)return!0;a.flags&16&&(r=void 0)}(l<e||e==c&&(n<-1?a.length:a.covers(1)))&&(!r||!a.isWidget()&&r.isWidget())&&(r=a,i=e-l),(c>e||e==l&&(n>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&&n<0||!s?{tile:r,offset:i}:{tile:s,offset:o}}}class Tn extends $a{constructor(e,n){super(e),this.wrapper=n}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,n){let r=new Tn(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class $r extends $a{constructor(e,n){super(e),this.attrs=n}isLine(){return!0}static start(e,n,r){let i=new $r(n||document.createElement("div"),e);return(!n||!r)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,n,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&&(n>0||r&&Nw(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=(n<0?i:o)||i||o;return c?{tile:c,offset:c==i?s:a}:null}coordsIn(e,n){let r=this.resolveInline(e,n,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),n):Pw(this)}domIn(e,n){let r=this.resolveInline(e,n);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:n);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 Pw(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=Ni(e);return n[n.length-1]||null}function Nw(t,e){let n=t.coordsIn(0,1),r=e.coordsIn(0,1);return n&&r&&r.top<n.bottom}class dt extends $a{constructor(e,n){super(e),this.mark=n}get domAttrs(){return this.mark.attrs}static of(e,n){let r=new dt(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class rr extends Ve{constructor(e,n){super(e,n.length),this.text=n}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,n){let r=this.dom.nodeValue.length;e>r&&(e=r);let i=e,s=e,o=0;e==0&&n<0||e==r&&n>=0?W.chrome||W.gecko||(e?(i--,o=1):s<r&&(s++,o=-1)):n<0?i--:s<r&&s++;let a=Ui(this.dom,i,s).getClientRects();if(!a.length)return null;let l=a[(o?o<0:n>=0)?0:a.length-1];return W.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?Wi(l,o<0):l||null}static of(e,n){let r=new rr(n||document.createTextNode(e),e);return n||(r.flags|=2),r}}class Br extends Ve{constructor(e,n,r,i){super(e,n,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,n){return this.coordsInWidget(e,n,!1)}coordsInWidget(e,n,r){let i=this.widget.coordsAt(this.dom,e,n);if(i)return i;if(r)return Wi(this.dom.getBoundingClientRect(),this.length?e==0:n<=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 Wi(o,!a)}}get overrideDOMText(){if(!this.length)return we.empty;let{root:e}=this;if(!e)return we.empty;let n=this.posAtStart;return e.view.state.doc.slice(n,n+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,n,r,i,s){return s||(s=e.toDOM(n),e.editable||(s.contentEditable="false")),new Br(s,r,e,i)}}class da extends Ve{constructor(e){let n=document.createElement("img");n.className="cm-widgetBuffer",n.setAttribute("aria-hidden","true"),super(n,0,e)}get isHidden(){return!1}get overrideDOMText(){return we.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class Aw{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,n,r){let{tile:i,index:s,beforeBreak:o,parents:a}=this;for(;e||n>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;(n>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 Mw{constructor(e,n,r,i){this.from=e,this.to=n,this.wrapper=r,this.rank=i}}class Dw{constructor(e,n,r){this.cache=e,this.root=n,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,n,r,i){var s;this.flushBuffer();let o=this.ensureMarks(n,r),a=o.lastChild;if(a&&a.isText()&&!(a.flags&8)){this.cache.reused.set(a,2);let l=o.children[o.children.length-1]=new rr(a.dom,a.text+e);l.parent=o}else o.append(i||rr.of(e,(s=this.cache.find(rr))===null||s===void 0?void 0:s.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,n){let r=this.curLine;r.dom!=n.line.dom&&(r.setDOM(this.cache.reused.has(n.line)?bl(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let i=r;for(let a=n.marks.length-1;a>=0;a--){let l=n.marks[a],c=i.lastChild;if(c instanceof dt&&c.mark.eq(l.mark))c.dom!=l.dom&&c.setDOM(bl(l.dom)),i=c;else{if(this.cache.reused.get(l)){let u=Ve.get(l.dom);u&&u.setDOM(bl(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 rr(e.text,e.text.nodeValue);o.flags|=8,i.append(o)}addInlineWidget(e,n,r){let i=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);i||this.flushBuffer();let s=this.ensureMarks(n,r);!i&&!(e.flags&16)&&s.append(this.getBuffer(1)),s.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,n,r){this.flushBuffer(),this.ensureMarks(n,r).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let n=this.afterWidget||this.lastBlock;n.length+=e,this.pos+=e}addLineStart(e,n){var r;e||(e=Xg);let i=$r.start(e,n||((r=this.cache.find($r))===null||r===void 0?void 0:r.dom),!!n);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,n){var r;let i=this.curLine;for(let s=e.length-1;s>=0;s--){let o=e[s],a;if(n>0&&(a=i.lastChild)&&a instanceof dt&&a.mark.eq(o))i=a,n--;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,n=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!Iu(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(W.ios&&Iu(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(xl,0,32)||new Br(xl.toDOM(),0,xl,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let n=new Mw(e.from,e.to,e.value,e.rank),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-n.rank||this.wrappers[r-1].to-n.to)<0;)r--;this.wrappers.splice(r,0,n)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let n=this.root;for(let r of this.wrappers){let i=n.lastChild;if(r.from<this.pos&&i instanceof Tn&&i.wrapper.eq(r.wrapper))n=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);n.append(s),n=s}}return n}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let n=2|(e<0?16:32),r=this.cache.find(da,void 0,1);return r&&(r.flags=n),r||new da(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class Tw{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 n=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,n);return this.textOff=n,r}}const ua=[Br,$r,rr,dt,da,Tn,Ba];for(let t=0;t<ua.length;t++)ua[t].bucket=t;class Ew{constructor(e){this.view=e,this.buckets=ua.map(()=>[]),this.index=ua.map(()=>0),this.reused=new Map}add(e){let n=e.constructor.bucket,r=this.buckets[n];r.length<6?r.push(e):r[this.index[n]=(this.index[n]+1)%6]=e}find(e,n,r=2){let 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((!n||n(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,n,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=n,a.flags=a.flags&-498|r,a}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,n=2){if(!this.reused.has(e))return this.reused.set(e,n),e.dom}}class Rw{constructor(e,n,r,i,s){this.view=e,this.decorations=i,this.disallowBlockEffectsFor=s,this.openWidget=!1,this.openMarks=0,this.cache=new Ew(e),this.text=new Tw(e.state.doc),this.builder=new Dw(this.cache,new Ba(e,e.contentDOM),ge.iter(r)),this.cache.reused.set(n,2),this.old=new Aw(n),this.reuseWalker={skip:(o,a,l)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,n){let r=n&&this.getCompositionContext(n.text);for(let 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),n&&a.fromA<=n.range.fromA&&a.toA>=n.range.toA?(this.emit(s,n.range.fromB),this.builder.addComposition(n,r),this.text.skip(n.range.toB-n.range.fromB),this.emit(n.range.toB,a.toB)):this.emit(s,a.toB),s=a.toB,i=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,n,r){let i=$w(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 da)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,n){let r=null,i=this.builder,s=0,o=ge.spans(this.decorations,e,n,{point:(a,l,c,d,u,f)=>{if(c instanceof ar){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=Lw(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=Iw(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,n){n-e<=10?this.old.advance(n-e,1,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-e-10,-1),this.old.advance(5,1,this.reuseWalker))}getCompositionContext(e){let n=[],r=null;for(let i=e.parentNode;;i=i.parentNode){let s=Ve.get(i);if(i==this.view.contentDOM)break;s instanceof dt?n.push(s):s?.isLine()?r=s:i.nodeName=="DIV"&&!r&&i!=this.view.contentDOM?r=new $r(i,Xg):n.push(dt.of(new Hs({tagName:i.nodeName.toLowerCase(),attributes:lw(i)}),i))}return{line:r,marks:n}}}function Iu(t,e){let n=r=>{for(let i of r.children)if((e?i.isText():i.length)||n(i))return!0;return!1};return n(t)}function Lw(t){let e=t.isReplace?(t.startSide<0?64:0)|(t.endSide>0?128:0):t.startSide>0?32:16;return t.block&&(e|=256),e}const Xg={class:"cm-line"};function Iw(t,e){let n=e.spec.attributes,r=e.spec.class;return!n&&!r||(t||(t={class:"cm-line"}),n&&Rh(n,t),r&&(t.class+=" "+r)),t}function $w(t){let e=[];for(let n=t.parents.length;n>1;n--){let r=n==t.parents.length?t.tile:t.parents[n].tile;r instanceof dt&&e.push(r.mark)}return e}function bl(t){let e=Ve.get(t);return e&&e.setDOM(t.cloneNode()),t}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 xl=new class extends hn{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class $u{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=re.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 Ba(e,e.contentDOM),this.updateInner([new Mt(0,0,0,e.state.doc.length)],null)}update(e){var n;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&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?i=this.domChanged.newSel.head:!Kw(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?Fw(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,(W.ie||W.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=Hw(o,this.decorations,e.changes);l.length&&(r=Mt.extendWithRanges(r,l));let c=Ww(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,n){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(n||e.length){let o=this.tile,a=new Rw(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=a.run(e,n),Hc(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=W.chrome||W.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 yl&&i.push(s.dom);r.updateGaps(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(Kg)&&(this.editContextFormatting=r.value)}updateSelection(e=!1,n=!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)&&Jo(r,this.view.observer.selectionRange)&&!(i&&r.contains(i));if(!(s||n||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)),W.gecko&&l.empty&&!this.hasComposition&&Bw(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||(!Ai(c.node,c.offset,u.anchorNode,u.anchorOffset)||!Ai(d.node,d.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,l))&&(this.view.observer.ignore(()=>{W.android&&W.chrome&&r.contains(u.focusNode)&&Uw(u.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let f=_i(this.view.root);if(f)if(l.empty){if(W.gecko){let p=Vw(c.node,c.offset);if(p&&p!=3){let m=(p==1?Mg:Dg)(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,n){return this.hasComposition&&n.empty&&Ai(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=_i(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let o=this.lineAt(n.head,n.assoc);if(!o)return;let a=o.posAtStart;if(n.head==a||n.head==a+o.length)return;let l=this.coordsAt(n.head,-1),c=this.coordsAt(n.head,1);if(!l||!c||l.bottom>c.top)return;let d=this.domAtPos(n.head+n.assoc,n.assoc);r.collapse(d.node,d.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=n.from&&r.collapse(i,s)}posFromDOM(e,n){let r=this.tile.nearest(e);if(!r)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let i=r.posAtStart;if(r.isComposite()){let s;if(e==r.dom)s=r.dom.childNodes[n];else{let o=yn(e)==0?0:n==0?-1:1;for(;;){let a=e.parentNode;if(a==r.dom)break;o==0&&a.firstChild!=a.lastChild&&(e==a.firstChild?o=-1:o=1),e=a}o<0?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+n:i+(n?r.length:0):i}domAtPos(e,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,n);return r.isWidget()?r.domPosFor(e,n):r.domIn(i,n)}inlineDOMNearPos(e,n){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,n):(s&&o?r=null:l&&r&&(o=null),r&&n<0||!o?r.domIn(i,n):o.domIn(a,n))}coordsAt(e,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,n);return r.isWidget()?r.widget instanceof yl?null:r.coordsInWidget(i,n,!0):r.coordsIn(i,n)}lineAt(e,n){let{tile:r}=this.tile.resolveBlock(e,n);return r.isLine()?r:null}coordsForChar(e){let{tile:n,offset:r}=this.tile.resolveBlock(e,1);if(!n.isLine())return null;function 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=He(s.text,o);if(a==o)return null;let l=Ui(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(n,r)}measureVisibleLineHeights(e){let n=[],{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==Ne.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&&n.push(-c),n.push(v+c),c=0,o)){let S=b.dom.lastChild,C=S?Ni(S):[];if(C.length){let k=C[C.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),n}textDirectionAt(e){let{tile:n}=this.tile.resolveBlock(e,1);return getComputedStyle(n.dom).direction=="rtl"?Ne.RTL:Ne.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=Ni(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 n=document.createElement("div"),r,i,s;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let o=Ni(n.firstChild)[0];r=n.getBoundingClientRect().height,i=o&&o.width?o.width/27:7,s=o&&o.height?o.height:r,n.remove()}),{lineHeight:r,charWidth:i,textHeight:s}}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,i=0;;i++){let s=i==n.viewports.length?null:n.viewports[i],o=s?s.from-1:this.view.state.doc.length;if(o>r){let a=(n.lineBlockAt(o).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(re.replace({widget:new yl(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return re.set(e)}updateDeco(){let e=1,n=this.view.state.facet(Ki).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(Jg).map((s,o)=>{let a=typeof s=="function";return a&&(r=!0),a?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[e++]=r,n.push(ge.join(i))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(qg).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(Ug))try{if(c(this.view,e.range,e))return!0}catch(d){ut(this.view.state,d,"scroll handler")}let{range:n}=e,r=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1),i;if(!r)return;!n.empty&&(i=this.coordsAt(n.anchor,n.anchor>n.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=Vh(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;dw(this.view.scrollDOM,o,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,a),-a),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==Ne.LTR)}lineHasWidget(e){let n=r=>r.isWidget()||r.children.some(n);return n(this.tile.resolveBlock(e,1).tile)}destroy(){Hc(this.tile)}}function Hc(t,e){let n=e?.get(t);if(n!=1){n==null&&t.destroy();for(let r of t.children)Hc(r,e)}}function Bw(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function Zg(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=Mg(n.focusNode,n.focusOffset),i=Dg(n.focusNode,n.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(t.docView.lastCompositionAfterCursor){let l=Ve.get(r.node);!l||l.isText()&&l.text!=r.node.nodeValue||(s=i)}}if(t.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 Fw(t,e,n){let r=Zg(t,n);if(!r)return null;let{node:i,from:s,to:o}=r,a=i.nodeValue;if(/[\n\r]/.test(a)||t.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 Vw(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e<t.childNodes.length&&t.childNodes[e].contentEditable=="false"?2:0)}let zw=class{constructor(){this.changes=[]}compareRange(e,n){Mr(e,n,this.changes)}comparePoint(e,n){Mr(e,n,this.changes)}boundChange(e){Mr(e,e,this.changes)}};function Hw(t,e,n){let r=new zw;return ge.compare(t,e,n,r),r.changes}class _w{constructor(){this.changes=[]}compareRange(e,n){Mr(e,n,this.changes)}comparePoint(){}boundChange(e){Mr(e,e,this.changes)}}function Ww(t,e,n){let r=new _w;return ge.compare(t,e,n,r),r.changes}function Uw(t,e){for(let n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function Kw(t,e){let n=!1;return e&&t.iterChangedRanges((r,i)=>{r<e.to&&i>e.from&&(n=!0)}),n}class yl 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 Gw(t,e,n=1){let r=t.charCategorizer(e),i=t.doc.lineAt(e),s=e-i.from;if(i.length==0)return E.cursor(e);s==0?n=1:s==i.length&&(n=-1);let o=s,a=s;n<0?o=He(i.text,s,!1):a=He(i.text,s);let l=r(i.text.slice(o,a));for(;o>0;){let c=He(i.text,o,!1);if(r(i.text.slice(c,o))!=l)break;o=c}for(;a<i.length;){let c=He(i.text,a);if(r(i.text.slice(a,c))!=l)break;a=c}return E.range(o+i.from,a+i.from)}function qw(t,e,n,r,i){let s=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let a=t.viewState.heightOracle.textHeight,l=Math.floor((i-n.top-(t.defaultLineHeight-a)*.5)/a);s+=l*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(n.from,n.to);return n.from+Mc(o,s,t.state.tabSize)}function _c(t,e,n){let r=t.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||(n<0?s.from<e:s.to>e)))&&(i=s)}}return i||r}return r}function Jw(t,e,n,r){let i=_c(t,e.head,e.assoc||-1),s=!r||i.type!=Je.Text||!(t.lineWrapping||i.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=t.dom.getBoundingClientRect(),a=t.textDirectionAt(i.from),l=t.posAtCoords({x:n==(a==Ne.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(l!=null)return E.cursor(l,n?-1:1)}return E.cursor(n?i.to:i.from,n?-1:1)}function Bu(t,e,n,r){let i=t.state.doc.lineAt(e.head),s=t.bidiSpans(i),o=t.textDirectionAt(i.from);for(let a=e,l=null;;){let c=Sw(i,s,o,a,n),d=Ig;if(!c){if(i.number==(n?t.state.doc.lines:1))return a;d=`
231
+ `,i=t.state.doc.line(i.number+(n?1:-1)),s=t.bidiSpans(i),c=t.visualLineSide(i,!n)}if(l){if(!l(d))return a}else{if(!r)return c;l=r(d)}a=c}}function Yw(t,e,n){let r=t.state.charCategorizer(e),i=r(n);return s=>{let o=r(s);return i==Te.Space&&(i=o),i==o}}function Qw(t,e,n,r){let i=e.head,s=n?1:-1;if(i==(n?t.state.doc.length:0))return E.cursor(i,e.assoc);let o=e.goalColumn,a,l=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(i,e.assoc||-1),d=t.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let p=t.viewState.lineBlockAt(i);o==null&&(o=Math.min(l.right-l.left,t.defaultCharacterWidth*(i-p.from))),a=(s<0?p.top:p.bottom)+d}let u=l.left+o,f=r??t.viewState.heightOracle.textHeight>>1;for(let p=0;;p+=10){let m=a+(f+p)*s,b=Wc(t,{x:u,y:m},!1,s);return E.cursor(b.pos,b.assoc,void 0,o)}}function Mi(t,e,n){for(;;){let r=0;for(let i of t)i.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=r||n||(e-s<o-e?-1:1);e=l<0?s:o,r=l}});if(!r)return e}}function e0(t,e){let n=null;for(let r=0;r<e.ranges.length;r++){let i=e.ranges[r],s=null;if(i.empty){let o=Mi(t,i.from,0);o!=i.from&&(s=E.cursor(o,-1))}else{let o=Mi(t,i.from,-1),a=Mi(t,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&&(n||(n=e.ranges.slice()),n[r]=s)}return n?E.create(n,e.mainIndex):e}function vl(t,e,n){let r=Mi(t.state.facet(Ws).map(i=>i(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:E.cursor(r,r<n.from?1:-1)}class en{constructor(e,n){this.pos=e,this.assoc=n}}function Wc(t,e,n,r){let i=t.contentDOM.getBoundingClientRect(),s=i.top+t.viewState.paddingTop,{x:o,y:a}=e,l=a-s,c;for(;;){if(l<0)return new en(0,1);if(l>t.viewState.docHeight)return new en(t.state.doc.length,-1);if(c=t.elementAtHeight(l),r==null)break;if(c.type==Je.Text){let f=t.docView.coordsAt(r<0?c.from:c.to,r);if(f&&(r<0?f.top<=l+s:f.bottom>=l+s))break}let u=t.viewState.heightOracle.textHeight/2;l=r>0?c.bottom+u:c.top-u}if(t.viewport.from>=c.to||t.viewport.to<=c.from){if(n)return null;if(c.type==Je.Text){let u=qw(t,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=t.docView.lineAt(c.from,2);return(!d||d.length!=c.length)&&(d=t.docView.lineAt(c.from,-2)),t0(t,d,c.from,o,a)}function t0(t,e,n,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=He(e.text,p);if(u(Ui(e.dom,p,m).getClientRects(),p),!a&&!l)break;p=m}return r>(o.left+o.right)/2==(Fu(t,s+n)==Ne.LTR)?new en(n+He(e.text,s),-1):new en(n+s,1)}else{if(!e.length)return new en(n,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:Ui(x.dom,0,x.length)).getClientRects();if(u(w,b),!a&&!l)break}let f=e.children[s],p=e.posBefore(f,n);return f.isComposite()||f.isText()?t0(t,f,p,Math.max(o.left,Math.min(o.right,r)),i):r>(o.left+o.right)/2==(Fu(t,s+n)==Ne.LTR)?new en(p+f.length,-1):new en(p,1)}}function Fu(t,e){let n=t.state.doc.lineAt(e);return t.bidiSpans(n)[bn.find(t.bidiSpans(n),e-n.from,-1,1)].dir}const wi="￿";class Xw{constructor(e,n){this.points=e,this.view=n,this.text="",this.lineSeparator=n.state.facet(be.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=wi}readRange(e,n){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==n){o?.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=Ve.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:ca(i))||ca(a)&&(i.nodeName!="BR"||o?.isWidget())&&this.text.length>s)&&!ek(a,n)&&this.lineBreak(),i=a}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,a;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=i.exec(n))&&(s=a.index,o=a[0].length),this.append(n.slice(r,s<0?n.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 n=Ve.get(e),r=n&&n.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,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(Zw(e,r.node,r.offset)?n:0))}}function Zw(t,e,n){for(;;){if(!e||n<yn(e))return!1;if(e==t)return!0;n=Bn(e)+1,e=e.parentNode}}function ek(t,e){let n;for(;!(t==e||!t);t=t.nextSibling){let r=Ve.get(t);if(!r?.isWidget())return!1;r&&(n||(n=[])).push(r)}if(n)for(let r of n){let i=r.overrideDOMText;if(i?.length)return!1}return!0}class Vu{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}}class tk{constructor(e,n,r,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=n0(e.docView.tile,n,r,0))){let a=s||o?[]:rk(e),l=new Xw(a,e);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=ik(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!$c(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||!$c(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),d=e.viewport;if((W.ios||W.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 n0(t,e,n,r){if(t.isComposite()){let i=-1,s=-1,o=-1,a=-1;for(let l=0,c=r,d=r;l<t.children.length;l++){let u=t.children[l],f=c+u.length;if(c<e&&f>n)return n0(u,e,n,c);if(f>=e&&i==-1&&(i=l,s=c),c>n&&u.dom.parentNode==t.dom){o=l,a=d;break}d=f,c=f+u.breakAfter}return{from:s,to:a<0?r+t.length:a,startDOM:(i?t.children[i-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:o<t.children.length&&o>=0?t.children[o].dom:null}}else return t.isText()?{from:r,to:r+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function r0(t,e){let n,{newSel:r}=e,i=t.state.selection.main,s=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,l=i.from,c=null;(s===8||W.android&&e.text.length<a-o)&&(l=i.to,c="end");let d=i0(t.state.doc.sliceString(o,a,wi),e.text,l-o,c);d&&(W.chrome&&s==13&&d.toB==d.from+2&&e.text.slice(d.from,d.toB)==wi+wi&&d.toB--,n={from:o+d.from,to:o+d.toA,insert:we.of(e.text.slice(d.from,d.toB).split(wi))})}else r&&(!t.hasFocus&&t.state.facet(gn)||r.main.eq(i))&&(r=null);if(!n&&!r)return!1;if(!n&&e.typeOver&&!i.empty&&r&&r.main.empty?n={from:i.from,to:i.to,insert:t.state.doc.slice(i.from,i.to)}:(W.mac||W.android)&&n&&n.from==n.to&&n.from==i.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=E.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:we.of([n.insert.toString().replace("."," ")])}):n&&n.from>=i.from&&n.to<=i.to&&(n.from!=i.from||n.to!=i.to)&&i.to-i.from-(n.to-n.from)<=4?n={from:i.from,to:i.to,insert:t.state.doc.slice(i.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,i.to))}:t.state.doc.lineAt(i.from).to<i.to&&t.docView.lineHasWidget(i.to)&&t.inputState.insertingTextAt>Date.now()-50?n={from:i.from,to:i.to,insert:t.state.toText(t.inputState.insertingText)}:W.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==`
232
+ `&&t.lineWrapping&&(r&&(r=E.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:we.of([" "])}),n)return zh(t,n,r,s);if(r&&!r.main.eq(i)){let o=!1,a="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),a=t.inputState.lastSelectionOrigin,a=="select.pointer"&&(r=e0(t.state.facet(Ws).map(l=>l(t)),r))),t.dispatch({selection:r,scrollIntoView:o,userEvent:a}),!0}else return!1}function zh(t,e,n,r=-1){if(W.ios&&t.inputState.flushIOSKey(e))return!0;let i=t.state.selection.main;if(W.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&t.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Dr(t.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(t.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&Dr(t.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,a=()=>o||(o=nk(t,e,n));return t.state.facet(zg).some(l=>l(t,e.from,e.to,s,a))||t.dispatch(a()),!0}function nk(t,e,n){let r,i=t.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=Mi(i.facet(Ws).map(u=>u(t)),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&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.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(t.state.toText(l+e.insert.sliceString(0,void 0,t.state.lineBreak)+c))}else{let l=i.changes(e),c=n&&n.main.to<=l.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let d=t.state.sliceDoc(e.from,e.to),u,f=n&&Zg(t,n.main.head);if(f){let m=e.insert.length-(e.to-e.from);u={from:f.from,to:f.to-m}}else u=t.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(t.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(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,a+=".compose",t.inputState.compositionFirstChange&&(a+=".start",t.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:a,scrollIntoView:!0})}function i0(t,e,n,r){let i=Math.min(t.length,e.length),s=0;for(;s<i&&t.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&t.length==e.length)return null;let o=t.length,a=e.length;for(;o>0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,s-Math.min(o,a));n-=o+l-s}if(o<s&&t.length<e.length){let l=n<=s&&n>=o?s-n:0;s-=l,a=s+(a-o),o=s}else if(a<s){let l=n<=s&&n>=a?s-n:0;s-=l,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function rk(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}=t.observer.selectionRange;return n&&(e.push(new Vu(n,r)),(i!=n||s!=r)&&e.push(new Vu(i,s))),e}function ik(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?E.single(n+e,r+e):null}class sk{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,W.safari&&e.contentDOM.addEventListener("input",()=>null),W.gecko&&vk(e.contentDOM.ownerDocument)}handleEvent(e){!fk(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,n);for(let i of r.handlers){if(n.defaultPrevented)break;if(i(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=ok(e),r=this.handlers,i=this.view.contentDOM;for(let s in n)if(s!="scroll"){let o=!n[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"&&!n[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&o0.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),W.android&&W.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return W.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=s0.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||ak.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Dr(this.view.contentDOM,n.key,n.keyCode,n instanceof KeyboardEvent?n:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:W.safari&&!W.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 zu(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(i){ut(n.state,i)}}}function ok(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){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&&n(a).handlers.push(zu(r.value,l))}if(o)for(let a in o){let l=o[a];l&&n(a).observers.push(zu(r.value,l))}}for(let r in zt)n(r).handlers.push(zt[r]);for(let r in Lt)n(r).observers.push(Lt[r]);return e}const s0=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],ak="dthko",o0=[16,17,18,20,91,92,224,225],wo=6;function ko(t){return Math.max(0,t)*.7+8}function lk(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class ck{constructor(e,n,r,i){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=uw(e.contentDOM),this.atoms=e.state.facet(Ws).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=n.shiftKey,this.multiple=e.state.facet(be.allowMultipleSelections)&&hk(e,n),this.dragging=uk(e,n)&&c0(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&lk(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=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=Vh(this.view);e.clientX-l.left<=i+wo?n=-ko(i-e.clientX):e.clientX+l.right>=o-wo&&(n=ko(e.clientX-o)),e.clientY-l.top<=s+wo?r=-ko(s-e.clientY):e.clientY+l.bottom>=a-wo&&(r=ko(e.clientY-a)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=e0(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function hk(t,e){let n=t.state.facet($g);return n.length?n[0](e):W.mac?e.metaKey:e.ctrlKey}function dk(t,e){let n=t.state.facet(Bg);return n.length?n[0](e):W.mac?!e.altKey:!e.ctrlKey}function uk(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=_i(t.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 fk(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=Ve.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const zt=Object.create(null),Lt=Object.create(null),a0=W.ie&&W.ie_version<15||W.ios&&W.webkit_version<604;function pk(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),l0(t,n.value)},50)}function Fa(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function l0(t,e){e=Fa(t.state,$h,e);let{state:n}=t,r,i=1,s=n.toText(e),o=s.lines==n.selection.ranges.length;if(Uc!=null&&n.selection.ranges.every(l=>l.empty)&&Uc==s.toString()){let l=-1;r=n.changeByRange(c=>{let d=n.doc.lineAt(c.from);if(d.from==l)return{range:c};l=d.from;let u=n.toText((o?s.line(i++).text:e)+n.lineBreak);return{changes:{from:d.from,insert:u},range:E.cursor(c.from+u.length)}})}else o?r=n.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=n.replaceSelection(s);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Lt.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};zt.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Lt.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Lt.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};zt.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(Fg))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=gk(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new ck(t,e,n,r)),r&&t.observer.ignore(()=>{Ng(t.contentDOM);let s=t.root.activeElement;s&&!s.contains(t.contentDOM)&&s.blur()});let i=t.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function Hu(t,e,n,r){if(r==1)return E.cursor(e,n);if(r==2)return Gw(t.state,e,n);{let i=t.docView.lineAt(e,n),s=t.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,a=i?i.posAtEnd:s.to;return a<t.state.doc.length&&a==s.to&&a++,E.range(o,a)}}const mk=W.ie&&W.ie_version<=11;let _u=null,Wu=0,Uu=0;function c0(t){if(!mk)return t.detail;let e=_u,n=Uu;return _u=t,Uu=Date.now(),Wu=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Wu+1)%3:1}function gk(t,e){let n=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=c0(e),i=t.state.selection;return{update(s){s.docChanged&&(n.pos=s.changes.mapPos(n.pos),i=i.map(s.changes))},get(s,o,a){let l=t.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),c,d=Hu(t,l.pos,l.assoc,r);if(n.pos!=l.pos&&!o){let u=Hu(t,n.pos,n.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=bk(i,l.pos))?c:a?i.addRange(d):E.create([d])}}}function bk(t,e){for(let n=0;n<t.ranges.length;n++){let{from:r,to:i}=t.ranges[n];if(r<=e&&i>=e)return E.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}zt.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let i=t.docView.tile.nearest(e.target);if(i&&i.isWidget()){let s=i.posAtStart,o=s+i.length;(s>=n.to||o<=n.from)&&(n=E.range(s,o))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",Fa(t.state,Bh,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};zt.dragend=t=>(t.inputState.draggedContent=null,!1);function Ku(t,e,n,r){if(n=Fa(t.state,$h,n),!n)return;let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=r&&s&&dk(t,e)?{from:s.from,to:s.to}:null,a={from:i,insert:n},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}zt.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,s=()=>{++i==n.length&&Ku(t,e,r.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o<n.length;o++){let a=new FileReader;a.onerror=s,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[o]=a.result),s()},a.readAsText(n[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Ku(t,e,r,!0),!0}return!1};zt.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=a0?null:e.clipboardData;return n?(l0(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(pk(t),!1)};function xk(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function yk(t){let e=[],n=[],r=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),n.push(i));if(!e.length){let i=-1;for(let{from:s}of t.selection.ranges){let o=t.doc.lineAt(s);o.number>i&&(e.push(o.text),n.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),i=o.number}r=!0}return{text:Fa(t,Bh,e.join(t.lineBreak)),ranges:n,linewise:r}}let Uc=null;zt.copy=zt.cut=(t,e)=>{let{text:n,ranges:r,linewise:i}=yk(t.state);if(!n&&!i)return!1;Uc=i?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=a0?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(xk(t,n),!1)};const h0=ln.define();function d0(t,e){let n=[];for(let r of t.facet(Hg)){let i=r(t,e);i&&n.push(i)}return n.length?t.update({effects:n,annotations:h0.of(!0)}):null}function u0(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=d0(t.state,e);n?t.dispatch(n):t.update([])}},10)}Lt.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),u0(t)};Lt.blur=t=>{t.observer.clearSelectionRange(),u0(t)};Lt.compositionstart=Lt.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Lt.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,W.chrome&&W.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Lt.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};zt.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let s=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let a=o[0],l=t.posAtDOM(a.startContainer,a.startOffset),c=t.posAtDOM(a.endContainer,a.endOffset);return zh(t,{from:l,to:c,insert:t.state.toText(s)},null),!0}}let i;if(W.chrome&&W.android&&(i=s0.find(s=>s.inputType==e.inputType))&&(t.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&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return W.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),W.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Lt.compositionend(t,e),20),!1};const Gu=new Set;function vk(t){Gu.has(t)||(Gu.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const qu=["pre-wrap","normal","pre-line","break-spaces"];let Vr=!1;function Ju(){Vr=!1}class wk{constructor(e){this.lineWrapping=e,this.doc=we.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return qu.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];i<0?r++:this.heightSamples[Math.floor(i*10)]||(n=!0,this.heightSamples[Math.floor(i*10)]=!0)}return n}refresh(e,n,r,i,s,o){let a=qu.indexOf(e)>-1,l=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=n,this.charWidth=r,this.textHeight=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 kk{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class Bt{constructor(e,n,r,i,s){this.from=e,this.length=n,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 ar?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Bt(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var Ae=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(Ae||(Ae={}));const Yo=.001;class at{constructor(e,n,r=2){this.length=e,this.height=n,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Yo&&(Vr=!0),this.height=e)}replace(e,n,r){return at.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,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,Ae.ByPosNoHeight,r.setDoc(n),0,0),p=f.to>=c?f:s.lineAt(c,Ae.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,Ae.ByPosNoHeight,r,0,0));d+=f.from-l,l=f.from;let m=Hh.build(r.setDoc(o),e,d,u);s=fa(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 n=0,r=e.length,i=0,s=0;for(;;)if(n==r)if(i>s*2){let a=e[n-1];a.break?e.splice(--n,1,a.left,null,a.right):e.splice(--n,1,a.left,a.right),r+=1+a.break,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[n++];a&&(i+=a.size)}else{let a=e[--r];a&&(s+=a.size)}let o=0;return e[n-1]==null?(o=1,n--):e[n]==null&&(o=1,r++),new Ck(at.of(e.slice(0,n)),o,at.of(e.slice(r)))}}function fa(t,e){return t==e?t:(t.constructor!=e.constructor&&(Vr=!0),e)}at.prototype.size=1;const Sk=re.replace({});class f0 extends at{constructor(e,n,r){super(e,n),this.deco=r,this.spaceAbove=0}mainBlock(e,n){return new Bt(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,n,r,i){return this.spaceAbove&&e<r+this.spaceAbove?new Bt(i,0,r,this.spaceAbove,Sk):this.mainBlock(r,i)}lineAt(e,n,r,i,s){let o=this.mainBlock(i,s);return this.spaceAbove?this.blockAt(0,r,i,s).join(o):o}forEachLine(e,n,r,i,s,o){e<=s+this.length&&n>=s&&o(this.lineAt(0,Ae.ByPos,r,i,s))}setMeasuredHeight(e){let n=e.heights[e.index++];n<0?(this.spaceAbove=-n,n=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class yt extends f0{constructor(e,n,r){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,n){return new Bt(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,n,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,n=0,r=!1,i){return i&&i.from<=n&&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,n){let r=e.doc.lineAt(n).number,i=e.doc.lineAt(n+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,n,r,i){let{firstLine:s,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(n,i);if(n.lineWrapping){let c=i+(e<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),d=n.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}=n.doc.line(s+c);return new Bt(d,u,r+a*c,a,0)}}lineAt(e,n,r,i,s){if(n==Ae.ByHeight)return this.blockAt(e,r,i,s);if(n==Ae.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,n,r,i,s,o){e=Math.max(e,s),n=Math.min(n,s+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(r,s);for(let d=e,u=i;d<=n;){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,n,r){let i=this.length-n;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,n){n.push(new Ge(e-1),null)}decomposeRight(e,n){n.push(null,new Ge(this.length-e-1))}updateHeight(e,n=0,r=!1,i){let s=n+this.length;if(i&&i.from<=n+this.length&&i.more){let o=[],a=Math.max(n,i.from),l=-1;for(i.from>n&&o.push(new Ge(i.from-n-1).updateHeight(e,n));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)>=Yo&&(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)>=Yo||Math.abs(l-this.heightMetrics(e,n).perLine)>=Yo)&&(Vr=!0),fa(this,c)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Ck extends at{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,i){let s=r+this.left.height;return e<s?this.left.blockAt(e,n,r,i):this.right.blockAt(e,n,s,i+this.left.length+this.break)}lineAt(e,n,r,i,s){let o=i+this.left.height,a=s+this.left.length+this.break,l=n==Ae.ByHeight?e<o:e<a,c=l?this.left.lineAt(e,n,r,i,s):this.right.lineAt(e,n,r,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let d=n==Ae.ByPosNoHeight?Ae.ByPosNoHeight:Ae.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,n,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,n,r,i,s,o),n>=l&&this.right.forEachLine(e,n,r,a,l,o);else{let c=this.lineAt(l,Ae.ByPos,r,i,s);e<c.from&&this.left.forEachLine(e,c.from-1,r,i,s,o),c.to>=e&&c.from<=n&&o(c),n>c.to&&this.right.forEachLine(c.to+1,n,r,a,l,o)}}replace(e,n,r){let i=this.left.length+this.break;if(n<i)return this.balanced(this.left.replace(e,n,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,n-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&&Yu(s,o-1),n<this.length){let a=s.length;this.decomposeRight(n,s),Yu(s,a)}return at.of(s)}decomposeLeft(e,n){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(r++,e>=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,n);e<r&&this.left.decomposeRight(e,n),this.break&&e<i&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?at.of(this.break?[e,null,n]:[e,n]):(this.left=fa(this.left,e),this.right=fa(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,i){let{left:s,right:o}=this,a=n+s.length+this.break,l=null;return i&&i.from<=n+s.length&&i.more?l=s=s.updateHeight(e,n,r,i):s.updateHeight(e,n,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 Yu(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof Ge&&(r=t[e+1])instanceof Ge&&t.splice(e-1,3,new Ge(n.length+1+r.length))}const jk=5;class Hh{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),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,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e<n||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=n-e;r.block?this.addBlock(new f0(o,i,r)):(o||s||i>=jk)&&this.addLineDeco(i,s,o)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new yt(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,n){let r=new Ge(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof yt)return e;let n=new yt(0,-1,0);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof yt)&&!this.isCovered?this.nodes.push(new yt(0,-1,0)):(this.writtenTo<this.pos||n==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,n,r,i){let s=new Hh(r,e);return ge.spans(n,r,i,s,0),s.finish(r)}}function Ok(t,e,n){let r=new Pk;return ge.compare(t,e,n,r,0),r.changes}class Pk{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,r,i){(e<n||r&&r.heightRelevant||i&&i.heightRelevant)&&Mr(e,n,this.changes,5)}}function Nk(t,e){let n=t.getBoundingClientRect(),r=t.ownerDocument,i=r.defaultView||window,s=Math.max(0,n.left),o=Math.min(i.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(i.innerHeight,n.bottom);for(let c=t.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==t.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-n.left,right:Math.max(s,o)-n.left,top:a-(n.top+e),bottom:Math.max(a,l)-(n.top+e)}}function Ak(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left<n.innerWidth&&e.right>0&&e.top<n.innerHeight&&e.bottom>0}function Mk(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class wl{constructor(e,n,r,i){this.from=e,this.to=n,this.size=r,this.displaySize=i}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],s=n[r];if(i.from!=s.from||i.to!=s.to||i.size!=s.size)return!1}return!0}draw(e,n){return re.replace({widget:new Dk(this.displaySize*(n?e.scaleY:e.scaleX),n)}).range(this.from,this.to)}}class Dk extends hn{constructor(e,n){super(),this.size=e,this.vertical=n}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class 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=Xu,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Ne.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=e.facet(Fh).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new wk(n),this.stateDeco=e.facet(Ki).filter(r=>typeof r!="function"),this.heightMap=at.empty().applyChanges(this.stateDeco,we.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=re.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let i=r?n.head:n.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new So(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?Xu:new _h(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(ki(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Ki).filter(d=>typeof d!="function");let i=e.changedRanges,s=Mt.extendWithRanges(i,Ok(r,this.stateDeco,e?e.changes:ze.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Ju(),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;(n&&(n.range.head<l.from||n.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,n));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),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Wg)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Ne.RTL:Ne.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),a=n.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:C,scaleY:k}=Pg(n,a);(C>.005&&Math.abs(this.scaleX-C)>.005||k>.005&&Math.abs(this.scaleY-k)>.005)&&(this.scaleX=C,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=Ag(e.scrollDOM);let m=(this.printing?Mk:Nk)(n,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&&!Ak(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 C=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(C)&&(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),C),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)),Ju();for(let k of this.viewports){let O=k.from==this.viewport.from?C:e.docView.measureVisibleLineHeights(k);this.heightMap=(o?at.empty().applyChanges(this.stateDeco,we.empty,this.heightOracle,[new Mt(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new kk(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,n){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 So(i.lineAt(o-r*1e3,Ae.ByHeight,s,0,0).from,i.lineAt(a+(1-r)*1e3,Ae.ByHeight,s,0,0).to);if(n){let{head:c}=n.range;if(c<l.from||c>l.to){let d=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),u=i.lineAt(c,Ae.ByPos,s,0,0),f;n.y=="center"?f=(u.top+u.bottom)/2-d/2:n.y=="start"||n.y=="nearest"&&c<l.from?f=u.top:f=u.bottom-d,l=new So(i.lineAt(f-1e3/2,Ae.ByHeight,s,0,0).from,i.lineAt(f+d+1e3/2,Ae.ByHeight,s,0,0).to)}}return l}mapViewport(e,n){let r=n.mapPos(e.from,-1),i=n.mapPos(e.to,1);return new So(this.heightMap.lineAt(r,Ae.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,Ae.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:n},r=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,Ae.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(n,Ae.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||i<=o-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||s>=a+Math.max(10,Math.min(r,250)))&&i>o-2*1e3&&s<a+2*1e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let r=[];for(let i of e)n.touchesRange(i.from,i.to)||r.push(new wl(n.mapPos(i.from),n.mapPos(i.to),i.size,i.displaySize));return r}ensureLineGaps(e,n){let r=this.heightOracle.lineWrapping,i=r?1e4:2e3,s=i>>1,o=i<<1;if(this.defaultTextDirection!=Ne.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=Ek(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&&n&&r&&n.visibleRanges.some(S=>S.from<=u&&S.to>=u)){let S=n.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 wl(d,u,w,v)}a.push(x)},c=d=>{if(d.length<o||d.type!=Je.Text)return;let u=Tk(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=jo(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=Co(u,x),m=Co(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,C,k;if(f!=null){let O=jo(u,f),y=((S-v)/2+x)/b;C=O-y,k=O+y}else C=(v-x)/b,k=(S+x)/b;p=Co(u,C),m=Co(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,n,r,i){let s=jo(i,r)-jo(i,n);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){wl.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=re.set(e.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];ge.spans(n,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(n=>n.from<=e&&n.to>=e)||ki(this.heightMap.lineAt(e,Ae.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||ki(this.heightMap.lineAt(this.scaler.fromDOM(e),Ae.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return ki(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 So{constructor(e,n){this.from=e,this.to=n}}function Tk(t,e,n){let r=[],i=t,s=0;return ge.spans(n,t,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 Co({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let i=0;;i++){let{from:s,to:o}=e[i],a=o-s;if(r<=a)return s+r;r-=a}}function jo(t,e){let n=0;for(let{from:r,to:i}of t.ranges){if(e<=i){n+=e-r;break}n+=i-r}return n/t.total}function Ek(t,e){for(let n of t)if(e(n))return n}const Xu={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class _h{constructor(e,n,r){let i=0,s=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let c=n.lineAt(a,Ae.ByPos,e,0,0).top,d=n.lineAt(l,Ae.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)/(n.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 n=0,r=0,i=0;;n++){let s=n<this.viewports.length?this.viewports[n]: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 n=0,r=0,i=0;;n++){let s=n<this.viewports.length?this.viewports[n]: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 _h?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((n,r)=>n.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function ki(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new Bt(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(i=>ki(i,e)):t._content)}const Oo=U.define({combine:t=>t.join(" ")}),Kc=U.define({combine:t=>t.indexOf(!0)>-1}),Gc=In.newName(),p0=In.newName(),m0=In.newName(),g0={"&light":"."+p0,"&dark":"."+m0};function qc(t,e,n){return new In(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return t;if(!n||!n[i])throw new RangeError(`Unsupported selector: ${i}`);return n[i]}):t+" "+r}})}const Rk=qc("."+Gc,{"&":{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"}},g0),Lk={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},kl=W.ie&&W.ie_version<=11;class Ik{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new fw,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(W.ie&&W.ie_version<=11||W.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&W.android&&e.constructor.EDIT_CONTEXT!==!1&&!(W.chrome&&W.chrome_version<126)&&(this.editContext=new Bk(e),e.state.facet(gn)&&(e.contentDOM.editContext=this.editContext.editContext)),kl&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,i=this.selectionRange;if(r.state.facet(gn)?r.root.activeElement!=this.dom:!Jo(this.dom,i))return;let s=i.anchorNode&&r.docView.tile.nearest(i.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(W.ie&&W.ie_version<=11||W.android&&W.chrome)&&!r.state.selection.main.empty&&i.focusNode&&Ai(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=_i(e.root);if(!n)return!1;let r=W.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&$k(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let i=Jo(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&mw(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let r=this.dom;r;)if(r.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),n){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=n)r.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Lk),kl&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),kl&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){var r;if(!this.delayedAndroidKey){let 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:n,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),n==-1?{from:n,to:r}=o:(n=Math.min(o.from,n),r=Math.max(o.to,r)))}return{from:n,to:r,typeOver:i}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),i=this.selectionChanged&&Jo(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 tk(this.view,e,n,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 n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=r0(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),i}readMutation(e){let n=this.view.docView.tile.nearest(e.target);if(!n||n.isWidget())return null;if(n.markDirty(e.type=="attributes"),e.type=="childList"){let r=Zu(n,e.previousSibling||e.target.previousSibling,-1),i=Zu(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:i?n.posBefore(i):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(gn)!=e.state.facet(gn)&&(e.view.contentDOM.editContext=e.state.facet(gn)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let 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 Zu(t,e,n){for(;e;){let r=Ve.get(e);if(r&&r.parent==t)return r;let i=e.parentNode;e=i!=t.dom?i:n>0?e.nextSibling:e.previousSibling}return null}function ef(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor,1);return Ai(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function $k(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return ef(t,i)}let n=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?ef(t,n):null}class Bk{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let 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=i0(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:we.of(r.text.slice(d.from,d.toB).split(`
233
+ `))};if((W.mac||W.android)&&u.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(u={from:a,to:l,insert:we.of([r.text.replace("."," ")])}),this.pendingContextChange=u,!e.state.readOnly){let f=this.to-this.from+(u.to-u.from+u.insert.length);zh(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(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let 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)}n.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(re.mark({attributes:{style:d}}).range(l,c))}}}e.dispatch({effects:Kg.of(re.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)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let i=_i(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=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,n+=d,this.to+=d;return}else i=null,this.revertPending(e.state);if(s+=n,o+=n,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}n+=d}),i&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(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||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),i=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class 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 n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(i=>i.forEach(s=>r(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||pw(e.parent)||document,this.viewState=new Qu(e.state||be.create(e)),e.scrollTo&&e.scrollTo.is(vo)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(kr).map(i=>new gl(i));for(let i of this.plugins)i.update(this);this.observer=new Ik(this),this.inputState=new sk(this),this.inputState.ensureHandlers(this.plugins),this.docView=new $u(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let n=e.length==1&&e[0]instanceof _e?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,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(h0))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=d0(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(be.phrases)!=this.state.facet(be.phrases))return this.setState(s);i=ha.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(vo)&&(u=p.value.clip(this.state))}this.viewState.update(i,u),this.bidiCache=pa.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(vi)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Oo)!=i.state.facet(Oo)&&(this.viewState.mustMeasureContent=!0),(n||r||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let f of this.state.facet(zc))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&&!r0(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 n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new Qu(e),this.plugins=e.facet(kr).map(r=>new gl(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new $u(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(kr),r=e.state.facet(kr);if(n!=r){let i=[];for(let s of r){let o=n.indexOf(s);if(o<0)i.push(new gl(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);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){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 n=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(Ag(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),tf}}),u=ha.create(this,this.state,[]),f=!1;u.flags|=l,n?n.flags|=l:n=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),f=this.docView.update(u),f&&this.docViewUpdate());for(let p=0;p<c.length;p++)if(d[p]!=tf)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(n&&!n.empty)for(let a of this.state.facet(zc))a(n)}get themeClasses(){return Gc+" "+(this.state.facet(Kc)?m0:p0)+" "+this.state.facet(Oo)}updateAttrs(){let e=nf(this,Gg,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(gn)?"true":"false",class:"cm-content",style:`${W.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),nf(this,Fh,n);let r=this.observer.ignore(()=>{let i=Du(this.contentDOM,this.contentAttrs,n),s=Du(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let i of r.effects)if(i.is(H.announce)){n&&(this.announceDOM.textContent=""),n=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(vi);let e=this.state.facet(H.cspNonce);In.mount(this.root,this.styleModules.concat(Rk).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.plugin!=e)&&this.pluginMap.set(e,n=this.plugins.find(r=>r.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return vl(this,e,Bu(this,e,n,r))}moveByGroup(e,n){return vl(this,e,Bu(this,e,n,r=>Yw(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),s=r[n?r.length-1:0];return E.cursor(s.side(n,i)+e.from,s.forward(!n,i)?1:-1)}moveToLineBoundary(e,n,r=!0){return Jw(this,e,n,r)}moveVertically(e,n,r){return vl(this,e,Qw(this,e,n,r))}domAtPos(e,n=1){return this.docView.domAtPos(e,n)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){this.readMeasured();let r=Wc(this,e,n);return r&&r.pos}posAndSideAtCoords(e,n=!0){return this.readMeasured(),Wc(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),o=s[bn.find(s,e-i.from,-1,n)];return Wi(r,o.dir==Ne.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(_g)||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>Fk)return Lg(e.length);let n=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==n&&(s.fresh||Rg(s.isolates,r=Ru(this,e))))return s.order;r||(r=Ru(this,e));let i=kw(e.text,n,r);return this.bidiCache.push(new pa(e.from,e.to,n,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||W.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Ng(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return vo.of(new Tr(typeof e=="number"?E.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return vo.of(new Tr(E.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Fe.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Fe.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=In.newName(),i=[Oo.of(r),vi.of(qc(`.${r}`,e))];return n&&n.dark&&i.push(Kc.of(!0)),i}static baseTheme(e){return ur.lowest(vi.of(qc("."+Gc,e,g0)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),i=r&&Ve.get(r)||Ve.get(e);return((n=i?.root)===null||n===void 0?void 0:n.view)||null}}H.styleModule=vi;H.inputHandler=zg;H.clipboardInputFilter=$h;H.clipboardOutputFilter=Bh;H.scrollHandler=Ug;H.focusChangeEffect=Hg;H.perLineTextDirection=_g;H.exceptionSink=Vg;H.updateListener=zc;H.editable=gn;H.mouseSelectionStyle=Fg;H.dragMovesSelection=Bg;H.clickAddsSelectionRange=$g;H.decorations=Ki;H.blockWrappers=qg;H.outerDecorations=Jg;H.atomicRanges=Ws;H.bidiIsolatedRanges=Yg;H.scrollMargins=Qg;H.darkTheme=Kc;H.cspNonce=U.define({combine:t=>t.length?t[0]:""});H.contentAttributes=Fh;H.editorAttributes=Gg;H.lineWrapping=H.contentAttributes.of({class:"cm-lineWrapping"});H.announce=ce.define();const Fk=4096,tf={};class pa{constructor(e,n,r,i,s,o){this.from=e,this.to=n,this.dir=r,this.isolates=i,this.fresh=s,this.order=o}static update(e,n){if(n.empty&&!e.some(s=>s.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:Ne.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==i&&!n.touchesRange(o.from,o.to)&&r.push(new pa(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function nf(t,e,n){for(let r=t.state.facet(e),i=r.length-1;i>=0;i--){let s=r[i],o=typeof s=="function"?s(t):s;o&&Rh(o,n)}return n}const Vk=W.mac?"mac":W.windows?"win":W.linux?"linux":"key";function zk(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let i,s,o,a;for(let l=0;l<n.length-1;++l){const c=n[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 Po(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n!==!1&&e.shiftKey&&(t="Shift-"+t),t}const Hk=ur.default(H.domEventHandlers({keydown(t,e){return x0(b0(e.state),t,e,"editor")}})),Va=U.define({enables:Hk}),rf=new WeakMap;function b0(t){let e=t.facet(Va),n=rf.get(e);return n||rf.set(e,n=Uk(e.reduce((r,i)=>r.concat(i),[]))),n}function _k(t,e,n){return x0(b0(t.state),e,t,n)}let Nn=null;const Wk=4e3;function Uk(t,e=Vk){let n=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=n[o]||(n[o]=Object.create(null)),m=a.split(/ (?!$)/).map(w=>zk(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 C=Nn={view:S,prefix:v,scope:o};return setTimeout(()=>{Nn==C&&(Nn=null)},Wk),!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 t){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let d=n[c]||(n[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,Jc))}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 n}let Jc=null;function x0(t,e,n,r){Jc=e;let i=sw(e),s=ct(i,0),o=Zt(s)==i.length&&i!=" ",a="",l=!1,c=!1,d=!1;Nn&&Nn.view==n&&Nn.scope==r&&(a=Nn.prefix+" ",o0.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(n)))return x.stopPropagation&&(d=!0),!0;x.preventDefault&&(x.stopPropagation&&(d=!0),c=!0)}return!1},p=t[r],m,b;return p&&(f(p[a+Po(i,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(W.windows&&e.ctrlKey&&e.altKey)&&!(W.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(m=$n[e.keyCode])&&m!=i?(f(p[a+Po(m,e,!0)])||e.shiftKey&&(b=zi[e.keyCode])!=i&&b!=m&&f(p[a+Po(b,e,!1)]))&&(l=!0):o&&e.shiftKey&&f(p[a+Po(i,e,!0)])&&(l=!0),!l&&f(p._any)&&(l=!0)),c&&(l=!0),l&&d&&e.stopPropagation(),Jc=null,l}class Us{constructor(e,n,r,i,s){this.className=e,this.left=n,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,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let i=e.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let s=y0(e);return[new Us(n,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return Kk(e,n,r)}}function y0(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Ne.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function sf(t,e,n,r){let i=t.coordsAtPos(e,n*2);if(!i)return r;let s=t.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,a=t.posAtCoords({x:s.left+1,y:o}),l=t.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 Kk(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),i=Math.min(n.to,t.viewport.to),s=t.textDirection==Ne.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=y0(t),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=_c(t,r,1),m=_c(t,i,-1),b=p.type==Je.Text?p:null,x=m.type==Je.Text?m:null;if(b&&(t.lineWrapping||p.widgetLineBreaks)&&(b=sf(t,r,1,b)),x&&(t.lineWrapping||m.widgetLineBreaks)&&(x=sf(t,i,-1,x)),b&&x&&b.from==x.from&&b.to==x.to)return v(S(n.from,n.to,b));{let k=b?S(n.from,null,b):C(p,!1),O=x?S(null,n.to,x):C(m,!0),y=[];return(b||p).to<(x||m).from-(b&&x?1:0)||p.widgetLineBreaks>1&&k.bottom+t.defaultLineHeight/2<O.top?y.push(w(u,k.bottom,f,O.top)):k.bottom<O.top&&t.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,M){return new Us(e,k-l.left,O-l.top,y-k,M-O)}function v({top:k,bottom:O,horizontal:y}){let M=[];for(let A=0;A<y.length;A+=2)M.push(w(y[A],k,y[A+1],O));return M}function S(k,O,y){let M=1e9,A=-1e9,R=[];function N($,F,G,fe,X){let te=t.coordsAtPos($,$==y.to?-2:2),oe=t.coordsAtPos(G,G==y.from?2:-2);!te||!oe||(M=Math.min(te.top,oe.top,M),A=Math.max(te.bottom,oe.bottom,A),X==Ne.LTR?R.push(s&&F?u:te.left,s&&fe?f:oe.right):R.push(!s&&fe?u:oe.left,!s&&F?f:te.right))}let L=k??y.from,_=O??y.to;for(let $ of t.visibleRanges)if($.to>L&&$.from<_)for(let F=Math.max($.from,L),G=Math.min($.to,_);;){let fe=t.state.doc.lineAt(F);for(let X of t.bidiSpans(fe)){let te=X.from+fe.from,oe=X.to+fe.from;if(te>=G)break;oe>F&&N(Math.max(te,F),k==null&&te<=L,Math.min(oe,G),O==null&&oe>=_,X.dir)}if(F=fe.to+1,F>=G)break}return R.length==0&&N(L,k==null,_,O==null,t.textDirection),{top:M,bottom:A,horizontal:R}}function C(k,O){let y=a.top+(O?k.top:k.bottom);return{top:y,bottom:y,horizontal:[]}}}function Gk(t,e){return t.constructor==e.constructor&&t.eq(e)}class qk{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(Qo)!=e.state.facet(Qo)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(Qo);for(;n<r.length&&r[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:n}=this.view;(e!=this.scaleX||n!=this.scaleY)&&(this.scaleX=e,this.scaleY=n,this.dom.style.transform=`scale(${1/e}, ${1/n})`)}draw(e){if(e.length!=this.drawn.length||e.some((n,r)=>!Gk(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let i of e)i.update&&n&&i.constructor&&this.drawn[r].constructor&&i.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(i.draw(),n);for(;n;){let i=n.nextSibling;n.remove(),n=i}this.drawn=e,W.safari&&W.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 Qo=U.define();function v0(t){return[Fe.define(e=>new qk(e,t)),Qo.of(t)]}const Gi=U.define({combine(t){return cn(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function Jk(t={}){return[Gi.of(t),Yk,Qk,Xk,Wg.of(!0)]}function w0(t){return t.startState.facet(Gi)!=t.state.facet(Gi)}const Yk=v0({above:!0,markers(t){let{state:e}=t,n=e.facet(Gi),r=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty||n.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 Us.forRange(t,o,a))r.push(l)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=w0(t);return n&&of(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){of(e.state,t)},class:"cm-cursorLayer"});function of(t,e){e.style.animationDuration=t.facet(Gi).cursorBlinkRate+"ms"}const Qk=v0({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:Us.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||w0(t)},class:"cm-selectionLayer"}),Xk=ur.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"}}}})),k0=ce.define({map(t,e){return t==null?null:e.mapPos(t)}}),Si=Ye.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(k0)?r.value:n,t)}}),Zk=Fe.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(Si);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Si)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Si),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Si)!=t&&this.view.dispatch({effects:k0.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function eS(){return[Si,Zk]}function af(t,e,n,r,i){e.lastIndex=0;for(let s=t.iterRange(n,r),o=n,a;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;a=e.exec(s.value);)i(o+a.index,a)}function tS(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:i,to:s}of n)i=Math.max(t.state.doc.lineAt(i).from,i-e),s=Math.min(t.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 nS{constructor(e){const{regexp:n,decoration:r,decorate:i,boundary:s,maxLength:o=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,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 n=new xn,r=n.add.bind(n);for(let{from:i,to:s}of tS(e,this.maxLength))af(e.state.doc,this.regexp,i,s,(o,a)=>this.addMatch(a,e,o,r));return n.finish()}updateDeco(e,n){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,n.map(e.changes),r,i):n}updateRange(e,n,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 af(e.state.doc,this.regexp,d,u,(b,x)=>this.addMatch(x,e,b,m));n=n.update({filterFrom:d,filterTo:u,filter:(b,x)=>b<d||x>u,add:f})}}return n}}const Yc=/x/.unicode!=null?"gu":"g",rS=new RegExp(`[\0-\b
234
+ --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,Yc),iS={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 Sl=null;function sS(){var t;if(Sl==null&&typeof document<"u"&&document.body){let e=document.body.style;Sl=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Sl||!1}const Xo=U.define({combine(t){let e=cn(t,{render:null,specialChars:rS,addSpecialChars:null});return(e.replaceTabs=!sS())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Yc)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Yc)),e}});function oS(t={}){return[Xo.of(t),aS()]}let lf=null;function aS(){return lf||(lf=Fe.fromClass(class{constructor(t){this.view=t,this.decorations=re.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Xo)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new nS({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:i}=n.state,s=ct(e[0],0);if(s==9){let o=i.lineAt(r),a=n.state.tabSize,l=Ur(o.text,a,r-o.from);return re.replace({widget:new dS((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=re.replace({widget:new hS(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Xo);t.startState.facet(Xo)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const lS="•";function cS(t){return t>=32?lS:t==10?"␤":String.fromCharCode(9216+t)}class hS extends hn{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=cS(this.code),r=e.state.phrase("Control character")+" "+(iS[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,n);if(i)return i;let s=document.createElement("span");return s.textContent=n,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class dS 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 uS(){return pS}const fS=re.line({class:"cm-activeLine"}),pS=Fe.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let i=t.lineBlockAt(r.head);i.from>e&&(n.push(fS.range(i.from)),e=i.from)}return re.set(n)}},{decorations:t=>t.decorations});class mS extends hn{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?Ni(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),i=Wi(n[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 gS(t){let e=Fe.fromClass(class{constructor(n){this.view=n,this.placeholder=t?re.set([re.widget({widget:new mS(t),side:1}).range(0)]):re.none}get decorations(){return this.view.state.doc.length?re.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,H.contentAttributes.of({"aria-placeholder":t})]:e}const Qc=2e3;function bS(t,e,n){let r=Math.min(e.line,n.line),i=Math.max(e.line,n.line),s=[];if(e.off>Qc||n.off>Qc||e.col<0||n.col<0){let o=Math.min(e.off,n.off),a=Math.max(e.off,n.off);for(let l=r;l<=i;l++){let c=t.doc.line(l);c.length<=a&&s.push(E.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,n.col),a=Math.max(e.col,n.col);for(let l=r;l<=i;l++){let c=t.doc.line(l),d=Mc(c.text,o,t.tabSize,!0);if(d<0)s.push(E.cursor(c.to));else{let u=Mc(c.text,a,t.tabSize);s.push(E.range(c.from+d,c.from+u))}}}return s}function xS(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function cf(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),i=n-r.from,s=i>Qc?-1:i==r.length?xS(t,e.clientX):Ur(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:s,off:i}}function yS(t,e){let n=cf(t,e),r=t.state.selection;return n?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(n.line).from),o=i.state.doc.lineAt(s);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},r=r.map(i.changes)}},get(i,s,o){let a=cf(t,i);if(!a)return r;let l=bS(t.state,n,a);return l.length?o?E.create(l.concat(r.ranges)):E.create(l):r}}:null}function vS(t){let e=n=>n.altKey&&n.button==0;return H.mouseSelectionStyle.of((n,r)=>e(r)?yS(n,r):null)}const wS={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},kS={style:"cursor: crosshair"};function SS(t={}){let[e,n]=wS[t.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||n(i))},keyup(i){(i.keyCode==e||!n(i))&&this.set(!1)},mousemove(i){this.set(n(i))}}});return[r,H.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?kS:null})]}const No="-10000px";class S0{constructor(e,n,r,i){this.facet=n,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(n),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,n){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=n?[]: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]=n[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 n&&(a.forEach((l,c)=>n[c]=l),n.length=a.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function CS(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Cl=U.define({combine:t=>{var e,n,r;return{position:W.ios?"absolute":((e=t.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(i=>i.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||CS}}}),hf=new WeakMap,Wh=Fe.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Cl);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new S0(t,Uh,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(Cl);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",n.dom.appendChild(i)}return n.dom.style.position=this.position,n.dom.style.top=No,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(W.safari){let o=s.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(t=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=Vh(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(Cl).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:s}=t,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=t.pos[a],f=t.size[a];if(!u||l.clip!==!1&&(u.bottom<=Math.max(n.top,r.top)||u.top>=Math.min(n.bottom,r.bottom)||u.right<Math.max(n.left,r.left)-.1||u.left>Math.min(n.right,r.right)+.1)){d.style.top=No;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,m=p?7:0,b=f.right-f.left,x=(e=hf.get(c))!==null&&e!==void 0?e:f.bottom-f.top,w=c.offset||OS,v=this.view.textDirection==Ne.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),C=this.above[a];!l.strictSide&&(C?u.top-x-m-w.y<r.top:u.bottom+x+m+w.y>r.bottom)&&C==r.bottom-u.bottom>u.top-r.top&&(C=this.above[a]=!C);let k=(C?u.top-r.top:r.bottom-u.bottom)-m;if(k<x&&c.resize!==!1){if(k<this.view.defaultLineHeight){d.style.top=No;continue}hf.set(c,x),d.style.height=(x=k)/s+"px"}else d.style.height&&(d.style.height="");let O=C?u.top-x-m-w.y:u.bottom+m+w.y,y=S+b;if(c.overlap!==!0)for(let M of o)M.left<y&&M.right>S&&M.top<O+x&&M.bottom>O&&(O=C?M.top-x-2-m:M.bottom+m+2);if(this.position=="absolute"?(d.style.top=(O-t.parent.top)/s+"px",df(d,(S-t.parent.left)/i)):(d.style.top=O/s+"px",df(d,S/i)),p){let M=u.left+(v?w.x:-w.x)-(S+14-7);p.style.left=M/i+"px"}c.overlap!==!0&&o.push({left:S,top:O,right:y,bottom:O+x}),d.classList.toggle("cm-tooltip-above",C),d.classList.toggle("cm-tooltip-below",!C),c.positioned&&c.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=No}},{eventObservers:{scroll(){this.maybeMeasure()}}});function df(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const jS=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"}}}),OS={x:0,y:0},Uh=U.define({enables:[Wh,jS]}),ma=U.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class za{static create(e){return new za(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new S0(e,ma,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let i=r[e];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const PS=Uh.compute([ma],t=>{let e=t.facet(ma);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:za.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class NS{constructor(e,n,r,i,s){this.view=e,this.source=n,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:n}=this,r=e.docView.tile.nearest(n.target);if(!r)return;let i,s=1;if(r.isWidget())i=r.posAtStart;else{if(i=e.posAtCoords(n),i==null)return;let a=e.coordsAtPos(i);if(!a||n.y<a.top||n.y>a.bottom||n.x<a.left-e.defaultCharacterWidth||n.x>a.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(i)).find(d=>d.from<=i&&d.to>=i),c=l&&l.dir==Ne.RTL?-1:1;s=n.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(Wh),n=e?e.manager.tooltips.findIndex(r=>r.create==za.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:s}=this;if(i.length&&s&&!AS(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,a=(r=(n=i[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!MS(this.view,o,a,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Ao=4;function AS(t,e){let{left:n,right:r,top:i,bottom:s}=t.getBoundingClientRect(),o;if(o=t.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();i=Math.min(a.top,i),s=Math.max(a.bottom,s)}return e.clientX>=n-Ao&&e.clientX<=r+Ao&&e.clientY>=i-Ao&&e.clientY<=s+Ao}function MS(t,e,n,r,i,s){let o=t.scrollDOM.getBoundingClientRect(),a=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,a)<i)return!1;let l=t.posAtCoords({x:r,y:i},!1);return l>=e&&l<=n}function DS(t,e={}){let n=ce.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(n)&&(i=o.value),o.is(TS)&&(i=[]);return i},provide:i=>ma.from(i)});return{active:r,extension:[r,Fe.define(i=>new NS(i,t,r,n,e.hoverTime||300)),PS]}}function C0(t,e){let n=t.plugin(Wh);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const TS=ce.define(),uf=U.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function qi(t,e){let n=t.plugin(j0),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const j0=Fe.fromClass(class{constructor(t){this.input=t.state.facet(Ji),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(uf);this.top=new Mo(t,!0,e.topContainer),this.bottom=new Mo(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(uf);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Mo(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Mo(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Ji);if(n!=this.input){let r=n.filter(l=>l),i=[],s=[],o=[],a=[];for(let l of r){let c=this.specs.indexOf(l),d;c<0?(d=l(t.view),a.push(d)):(d=this.panels[c],d.update&&d.update(t)),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(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>H.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Mo{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=ff(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=ff(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 ff(t){let e=t.nextSibling;return t.remove(),e}const Ji=U.define({enables:j0});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 Zo=U.define(),ES=U.define(),RS={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>ge.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Di=U.define();function LS(t){return[O0(),Di.of({...RS,...t})]}const pf=U.define({combine:t=>t.some(e=>e)});function O0(t){return[IS]}const IS=Fe.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(Di).map(e=>new gf(t,e)),this.fixed=!t.state.facet(pf);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(pf)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=ge.iter(this.view.state.facet(Zo),this.view.viewport.from),r=[],i=this.gutters.map(s=>new $S(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){Xc(n,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){Xc(n,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();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(Di),n=t.state.facet(Di),r=t.docChanged||t.heightChanged||t.viewportChanged||!ge.eq(t.startState.facet(Zo),t.state.facet(Zo),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let i of this.gutters)i.update(t)&&(r=!0);else{r=!0;let i=[];for(let s of n){let o=e.indexOf(s);o<0?i.push(new gf(this.view,s)):(this.gutters[o].update(t),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 t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>H.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,i=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Ne.LTR?{left:r,right:i}:{right:r,left:i}})});function mf(t){return Array.isArray(t)?t:[t]}function Xc(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class $S{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=ge.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:i}=this,s=(n.top-this.height)/e.scaleY,o=n.height/e.scaleY;if(this.i==i.elements.length){let a=new P0(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=n.bottom,this.i++}line(e,n,r){let i=[];Xc(this.cursor,i,n.from),r.length&&(i=i.concat(r));let s=this.gutter.config.lineMarker(e,n,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,n,i)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),i=r?[r]:null;for(let s of e.state.facet(ES)){let o=s(e,n.widget,n);o&&(i||(i=[])).push(o)}i&&this.addElement(e,n,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class gf{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,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);n.domEventHandlers[r](e,a,i)&&i.preventDefault()});this.markers=mf(n.markers(e)),n.initialSpacer&&(this.spacer=new P0(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=mf(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!ge.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class P0{constructor(e,n,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,i)}update(e,n,r,i){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),BS(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,n){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let a=o,l=s<n.length?n[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=n}destroy(){this.setMarkers(null,[])}}function BS(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].compare(e[n]))return!1;return!0}const FS=U.define(),VS=U.define(),Sr=U.define({combine(t){return cn(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,n){let r=Object.assign({},e);for(let i in n){let s=r[i],o=n[i];r[i]=s?(a,l,c)=>s(a,l,c)||o(a,l,c):o}return r}})}});class jl extends vn{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Ol(t,e){return t.state.facet(Sr).formatNumber(e,t.state)}const zS=Di.compute([Sr],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(FS)},lineMarker(e,n,r){return r.some(i=>i.toDOM)?null:new jl(Ol(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let i of e.state.facet(VS)){let s=i(e,n,r);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(Sr)!=e.state.facet(Sr),initialSpacer(e){return new jl(Ol(e,bf(e.state.doc.lines)))},updateSpacer(e,n){let r=Ol(n.view,bf(n.view.state.doc.lines));return r==e.number?e:new jl(r)},domEventHandlers:t.facet(Sr).domEventHandlers,side:"before"}));function HS(t={}){return[Sr.of(t),O0(),zS]}function bf(t){let e=9;for(;e<t;)e=e*10+9;return e}const _S=new class extends vn{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},WS=Zo.compute(["selection"],t=>{let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.head).from;i>n&&(n=i,e.push(_S.range(i)))}return ge.of(e)});function US(){return WS}var Pl;const Cr=new pe;function KS(t){return U.define({combine:t?e=>e.concat(t):void 0})}const GS=new pe;class Vt{constructor(e,n,r=[],i=""){this.data=e,this.name=i,be.prototype.hasOwnProperty("tree")||Object.defineProperty(be.prototype,"tree",{get(){return nt(this)}}),this.parser=n,this.extension=[Fn.of(this),be.languageData.of((s,o,a)=>{let l=xf(s,o,a),c=l.type.prop(Cr);if(!c)return[];let d=s.facet(c),u=l.type.prop(GS);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,n,r=-1){return xf(e,n,r).type.prop(Cr)==this.data}findRegions(e){let n=e.facet(Fn);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(Cr)==this.data){r.push({from:o,to:o+s.length});return}let a=s.prop(pe.mounted);if(a){if(a.tree.prop(Cr)==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=ce.define();function xf(t,e,n){let r=t.facet(Fn),i=nt(t).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(e,n,Le.ExcludeBuffers|Le.EnterBracketed))s.type.isTop&&(i=s);return i}class ga extends Vt{constructor(e,n,r){super(e,n,[],r),this.parser=n}static define(e){let n=KS(e.languageData);return new ga(n,e.parser.configure({props:[Cr.add(r=>r.isTop?n:void 0)]}),e.name)}configure(e,n){return new ga(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function nt(t){let e=t.field(Vt.state,!1);return e?e.tree:Be.empty}class qS{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e<r||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let ui=null;class ba{constructor(e,n,r=[],i,s,o,a,l){this.parser=e,this.state=n,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,n,r){return new ba(e,n,[],Be.empty,0,r,[],null)}startParse(){return this.parser.startParse(new qS(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Be.empty&&this.isDone(n??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()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(sr.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<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(sr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=ui;ui=this;try{return e()}finally{ui=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=yf(e,n.from,n.to);return e}changes(e,n){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=sr.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 ba(this.parser,n,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 n=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=yf(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends ng{createParse(n,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let l=ui;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 n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return ui}}function yf(t,e,n){return sr.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class zr{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new zr(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=ba.create(e.facet(Fn).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new zr(r)}}Vt.state=Ye.define({create:zr.init,update(t,e){for(let n of e.effects)if(n.is(Vt.setState))return n.value;return e.startState.facet(Fn)!=e.state.facet(Fn)?zr.init(e.state):t.apply(e)}});let N0=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(N0=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Nl=typeof navigator<"u"&&(!((Pl=navigator.scheduling)===null||Pl===void 0)&&Pl.isInputPending)?()=>navigator.scheduling.isInputPending():null,JS=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 n=this.view.state.field(Vt.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(Vt.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=N0(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to: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&&!Nl?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<i&&r.doc.length>i+1e3,l=s.context.work(()=>Nl&&Nl()||Date.now()>o,i+(a?0:1e5));this.chunkBudget-=Date.now()-n,(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(n=>ut(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Fn=U.define({combine(t){return t.length?t[0]:null},enables:t=>[Vt.state,JS,H.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class YS{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const QS=U.define(),Ha=U.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function xa(t){let e=t.facet(Ha);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Yi(t,e){let n="",r=t.tabSize,i=t.facet(Ha)[0];if(i==" "){for(;e>=r;)n+=" ",e-=r;i=" "}for(let s=0;s<e;s++)n+=i;return n}function Kh(t,e){t instanceof be&&(t=new _a(t));for(let r of t.state.facet(QS)){let i=r(t,e);if(i!==void 0)return i}let n=nt(t.state);return n.length>=e?XS(t,n,e):null}class _a{constructor(e,n={}){this.state=e,this.options=n,this.unit=xa(e)}lineAt(e,n=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}:(n<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,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:i}=this.lineAt(e,n);return r.slice(e-i,Math.min(r.length,e+100-i))}column(e,n=1){let{text:r,from:i}=this.lineAt(e,n),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,n=e.length){return Ur(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:i}=this.lineAt(e,n),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 A0=new pe;function XS(t,e,n){let r=e.resolveStack(n),i=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);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 M0(r,t,n)}function M0(t,e,n){for(let r=t;r;r=r.next){let i=e3(r.node);if(i)return i(Gh.create(e,n,r))}return 0}function ZS(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function e3(t){let e=t.type.prop(A0);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(pe.closedBy))){let i=t.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>i3(o,!0,1,void 0,s&&!ZS(o)?i.from:void 0)}return t.parent==null?t3:null}function t3(){return 0}class Gh extends _a{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new Gh(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(n3(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return M0(this.context.next,this.base,this.pos)}}function n3(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function r3(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let i=t.options.simulateBreak,s=t.state.doc.lineAt(n.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let a=n.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let c=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+c}}a=l.to}}function i3(t,e,n,r,i){let s=t.textAfter,o=s.match(/^\s*/)[0].length,a=r&&s.slice(o,o+r.length)==r||i==t.pos+o,l=r3(t);return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*n)}function vf({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const s3=200;function o3(){return be.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,i=n.lineAt(r);if(r>i.from+s3)return t;let s=n.sliceString(i.from,r);if(!e.some(c=>c.test(s)))return t;let{state:o}=t,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=Kh(o,d.from);if(u==null)continue;let f=/^\s*/.exec(d.text)[0],p=Yi(o,u);f!=p&&l.push({from:d.from,to:d.from+f.length,insert:p})}return l.length?[t,{changes:l,sequential:!0}]:t})}const a3=U.define(),D0=new pe;function l3(t){let e=t.firstChild,n=t.lastChild;return e&&e.to<n.from?{from:e.to,to:n.type.isError?t.to:n.from}:null}function c3(t,e,n){let r=nt(t);if(r.length<n)return null;let i=r.resolveStack(n,1),s=null;for(let o=i;o;o=o.next){let a=o.node;if(a.to<=n||a.from>n)continue;if(s&&a.from<e)break;let l=a.type.prop(D0);if(l&&(a.to<r.length-50||r.length==t.doc.length||!h3(a))){let c=l(a,t);c&&c.from<=n&&c.from>=e&&c.to>n&&(s=c)}}return s}function h3(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function ya(t,e,n){for(let r of t.facet(a3)){let i=r(t,e,n);if(i)return i}return c3(t,e,n)}function T0(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const Wa=ce.define({map:T0}),Ks=ce.define({map:T0});function E0(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const cr=Ye.define({create(){return re.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=wf(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(Wa)&&!d3(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(I0),i=r?re.replace({widget:new x3(r(e.state,n.value))}):kf;t=t.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(Ks)&&(t=t.update({filter:(r,i)=>n.value.from!=r||n.value.to!=i,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=wf(t,e.selection.main.head)),t},provide:t=>H.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,i)=>{n.push(r,i)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n<t.length;){let r=t[n++],i=t[n++];if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(kf.range(r,i))}return re.set(e,!0)}});function wf(t,e,n=e){let r=!1;return t.between(e,n,(i,s)=>{i<n&&s>e&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(i,s)=>i>=n||s<=e}):t}function va(t,e,n){var r;let i=null;return(r=t.field(cr,!1))===null||r===void 0||r.between(e,n,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function d3(t,e,n){let r=!1;return t.between(e,e,(i,s)=>{i==e&&s==n&&(r=!0)}),r}function R0(t,e){return t.field(cr,!1)?e:e.concat(ce.appendConfig.of($0()))}const u3=t=>{for(let e of E0(t)){let n=ya(t.state,e.from,e.to);if(n)return t.dispatch({effects:R0(t.state,[Wa.of(n),L0(t,n)])}),!0}return!1},f3=t=>{if(!t.state.field(cr,!1))return!1;let e=[];for(let n of E0(t)){let r=va(t.state,n.from,n.to);r&&e.push(Ks.of(r),L0(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function L0(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,i=t.state.doc.lineAt(e.to).number;return H.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${i}.`)}const p3=t=>{let{state:e}=t,n=[];for(let r=0;r<e.doc.length;){let i=t.lineBlockAt(r),s=ya(e,i.from,i.to);s&&n.push(Wa.of(s)),r=(s?t.lineBlockAt(s.to):i).to+1}return n.length&&t.dispatch({effects:R0(t.state,n)}),!!n.length},m3=t=>{let e=t.state.field(cr,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,i)=>{n.push(Ks.of({from:r,to:i}))}),t.dispatch({effects:n}),!0},g3=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:u3},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:f3},{key:"Ctrl-Alt-[",run:p3},{key:"Ctrl-Alt-]",run:m3}],b3={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},I0=U.define({combine(t){return cn(t,b3)}});function $0(t){return[cr,w3]}function B0(t,e){let{state:n}=t,r=n.facet(I0),i=o=>{let a=t.lineBlockAt(t.posAtDOM(o.target)),l=va(t.state,a.from,a.to);l&&t.dispatch({effects:Ks.of(l)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,i,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const kf=re.replace({widget:new class extends hn{toDOM(t){return B0(t,null)}}});class x3 extends hn{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return B0(e,this.value)}}const y3={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Al extends vn{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function v3(t={}){let e={...y3,...t},n=new Al(e,!0),r=new Al(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(cr,!1)!=o.state.field(cr,!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=va(o.state,l.from,l.to)?r:ya(o.state,l.from,l.to)?n:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:s}=e;return[i,LS({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(i))===null||a===void 0?void 0:a.markers)||ge.empty},initialSpacer(){return new Al(e,!1)},domEventHandlers:{...s,click:(o,a,l)=>{if(s.click&&s.click(o,a,l))return!0;let c=va(o.state,a.from,a.to);if(c)return o.dispatch({effects:Ks.of(c)}),!0;let d=ya(o.state,a.from,a.to);return d?(o.dispatch({effects:Wa.of(d)}),!0):!1}}}),$0()]}const w3=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,n){this.specs=e;let r;function i(a){let l=In.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const s=typeof n.all=="string"?n.all:n.all?i(n.all):void 0,o=n.scope;this.scope=o instanceof Vt?a=>a.prop(Cr)==o.data:o?a=>a==o:void 0,this.style=sg(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=n.themeType}static define(e,n){return new Kr(e,n||{})}}const Zc=U.define(),F0=U.define({combine(t){return t.length?[t[0]]:null}});function Ml(t){let e=t.facet(Zc);return e.length?e:t.facet(F0)}function qh(t,e){let n=[S3],r;return t instanceof Kr&&(t.module&&n.push(H.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(F0.of(t)):r?n.push(Zc.computeN([H.darkTheme],i=>i.facet(H.darkTheme)==(r=="dark")?[t]:[])):n.push(Zc.of(t)),n}class k3{constructor(e){this.markCache=Object.create(null),this.tree=nt(e.state),this.decorations=this.buildDeco(e,Ml(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=nt(e.state),r=Ml(e.state),i=r!=Ml(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);n.length<s.to&&!i&&n.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(n!=this.tree||e.viewportChanged||i)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,n){if(!n||!this.tree.length)return re.none;let r=new xn;for(let{from:i,to:s}of e.visibleRanges)T2(this.tree,n,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=re.mark({class:l})))},i,s);return r.finish()}}const S3=ur.high(Fe.fromClass(k3,{decorations:t=>t.decorations})),C3=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"}]),j3=H.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),V0=1e4,z0="()[]{}",H0=U.define({combine(t){return cn(t,{afterCursor:!0,brackets:z0,maxScanDistance:V0,renderMatch:N3})}}),O3=re.mark({class:"cm-matchingBracket"}),P3=re.mark({class:"cm-nonmatchingBracket"});function N3(t){let e=[],n=t.matched?O3:P3;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const A3=Ye.define({create(){return re.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(H0);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&&(n=n.concat(r.renderMatch(s,e.state)))}return re.set(n,!0)},provide:t=>H.decorations.from(t)}),M3=[A3,j3];function D3(t={}){return[H0.of(t),M3]}const T3=new pe;function eh(t,e,n){let r=t.prop(e<0?pe.openedBy:pe.closedBy);if(r)return r;if(t.name.length==1){let i=n.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[n[i+e]]}return null}function th(t){let e=t.type.prop(T3);return e?e(t.node):t}function tn(t,e,n,r={}){let i=r.maxScanDistance||V0,s=r.brackets||z0,o=nt(t),a=o.resolveInner(e,n);for(let l=a;l;l=l.parent){let c=eh(l.type,n,s);if(c&&l.from<l.to){let d=th(l);if(d&&(n>0?e>=d.from&&e<d.to:e>d.from&&e<=d.to))return E3(t,e,n,l,d,c,s)}}return R3(t,e,n,o,a.type,i,s)}function E3(t,e,n,r,i,s,o){let a=r.parent,l={from:i.from,to:i.to},c=0,d=a?.cursor();if(d&&(n<0?d.childBefore(r.from):d.childAfter(r.to)))do if(n<0?d.to<=r.from:d.from>=r.to){if(c==0&&s.indexOf(d.type.name)>-1&&d.from<d.to){let u=th(d);return{start:l,end:u?{from:u.from,to:u.to}:void 0,matched:!0}}else if(eh(d.type,n,o))c++;else if(eh(d.type,-n,o)){if(c==0){let u=th(d);return{start:l,end:u&&u.from<u.to?{from:u.from,to:u.to}:void 0,matched:!1}}c--}}while(n<0?d.prevSibling():d.nextSibling());return{start:l,matched:!1}}function R3(t,e,n,r,i,s,o){let a=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?e-1:e,to:n>0?e+1:e},d=t.doc.iterRange(e,n>0?t.doc.length:0),u=0;for(let f=0;!d.next().done&&f<=s;){let p=d.value;n<0&&(f+=p.length);let m=e+f*n;for(let b=n>0?0:p.length-1,x=n>0?p.length:-1;b!=x;b+=n){let w=o.indexOf(p[b]);if(!(w<0||r.resolveInner(m+b,1).type!=i))if(w%2==0==n>0)u++;else{if(u==1)return{start:c,end:{from:m+b,to:m+b+1},matched:w>>1==l>>1};u--}}n>0&&(f+=p.length)}return d.done?{start:c,matched:!1}:null}const L3=Object.create(null),Sf=[pt.none],Cf=[],jf=Object.create(null),I3=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])I3[t]=$3(L3,e);function Dl(t,e){Cf.indexOf(t)>-1||(Cf.push(t),console.warn(e))}function $3(t,e){let n=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let d=t[c]||T[c];d?typeof d=="function"?l.length?l=l.map(d):Dl(c,`Modifier ${c} used at start of tag`):l.length?Dl(c,`Tag ${c} used as modifier`):l=Array.isArray(d)?d:[d]:Dl(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+n.map(a=>a.id),s=jf[i];if(s)return s.id;let o=jf[i]=pt.define({id:Sf.length,name:r,props:[rg({[r]:n})]});return Sf.push(o),o.id}Ne.RTL,Ne.LTR;const B3=ga.define({name:"json",parser:I2.configure({props:[A0.add({Object:vf({except:/^\s*\}/}),Array:vf({except:/^\s*\]/})}),D0.add({"Object Array":l3})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function F3(){return new YS(B3)}function nh(){return nh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},nh.apply(null,arguments)}function V3(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}const z3=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Yh(t.state,n.from);return r.line?H3(t):r.block?W3(t):!1};function Jh(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=t(e,n);return i?(r(n.update(i)),!0):!1}}const H3=Jh(G3,0),_3=Jh(_0,0),W3=Jh((t,e)=>_0(t,e,K3(e)),0);function Yh(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const fi=50;function U3(t,{open:e,close:n},r,i){let s=t.sliceDoc(r-fi,r),o=t.sliceDoc(i,i+fi),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+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:i+l,margin:l&&1}};let d,u;i-r<=2*fi?d=u=t.sliceDoc(r,i):(d=t.sliceDoc(r,r+fi),u=t.sliceDoc(i-fi,i));let f=/^\s*/.exec(d)[0].length,p=/\s*$/.exec(u)[0].length,m=u.length-p-n.length;return d.slice(f,f+e.length)==e&&u.slice(m,m+n.length)==n?{open:{pos:r+f+e.length,margin:/\s/.test(d.charAt(f+e.length))?1:0},close:{pos:i-p-n.length,margin:/\s/.test(u.charAt(m-1))?1:0}}:null}function K3(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),i=n.to<=r.to?r:t.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:t.doc.lineAt(n.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 _0(t,e,n=e.selection.ranges){let r=n.map(s=>Yh(e,s.from).block);if(!r.every(s=>s))return null;let i=n.map((s,o)=>U3(e,r[o],s.from,s.to));if(t!=2&&!i.every(s=>s))return{changes:e.changes(n.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(t!=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 G3(t,e,n=e.selection.ranges){let r=[],i=-1;for(let{from:s,to:o}of n){let a=r.length,l=1e9,c=Yh(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(t!=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(t!=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 rh=ln.define(),q3=ln.define(),J3=U.define(),W0=U.define({combine(t){return cn(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,i)=>e(r,i)||n(r,i)})}}),U0=Ye.define({create(){return nn.empty},update(t,e){let n=e.state.facet(W0),r=e.annotation(rh);if(r){let l=ft.fromTransaction(e,r.selection),c=r.side,d=c==0?t.undone:t.done;return l?d=wa(d,d.length,n.minDepth,l):d=q0(d,e.startState.selection),new nn(c==0?r.rest:d,c==0?d:r.rest)}let i=e.annotation(q3);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(_e.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let s=ft.fromTransaction(e),o=e.annotation(_e.time),a=e.annotation(_e.userEvent);return s?t=t.addChanges(s,o,a,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,n.newGroupDelay)),(i=="full"||i=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new nn(t.done.map(ft.fromJSON),t.undone.map(ft.fromJSON))}});function Y3(t={}){return[U0,W0.of(t),H.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?K0:e.inputType=="historyRedo"?ih:null;return r?(e.preventDefault(),r(n)):!1}})]}function Ua(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let i=n.field(U0,!1);if(!i)return!1;let s=i.pop(t,n,e);return s?(r(s),!0):!1}}const K0=Ua(0,!1),ih=Ua(1,!1),Q3=Ua(0,!0),X3=Ua(1,!0);class ft{constructor(e,n,r,i,s){this.changes=e,this.effects=n,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,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(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,n){let r=Dt;for(let i of e.startState.facet(J3)){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,n||e.startState.selection,Dt)}static selection(e){return new ft(void 0,Dt,void 0,void 0,e)}}function wa(t,e,n,r){let i=e+1>n+20?e-n-1:0,s=t.slice(i,e);return s.push(r),s}function Z3(t,e){let n=[],r=!1;return t.iterChangedRanges((i,s)=>n.push(i,s)),e.iterChangedRanges((i,s,o,a)=>{for(let l=0;l<n.length;){let c=n[l++],d=n[l++];a>=c&&o<=d&&(r=!0)}}),r}function e4(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function G0(t,e){return t.length?e.length?t.concat(e):t:e}const Dt=[],t4=200;function q0(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-t4));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),wa(t,t.length-1,1e9,n.setSelAfter(r)))}else return[ft.selection([e])]}function n4(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Tl(t,e){if(!t.length)return t;let n=t.length,r=Dt;for(;n;){let i=r4(t[n-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=t.slice(0,n);return s[n-1]=i,s}else e=i.mapped,n--,r=i.selectionsAfter}return r.length?[ft.selection(r)]:Dt}function r4(t,e,n){let r=G0(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):Dt,n);if(!t.changes)return ft.selection(r);let i=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new ft(i,ce.mapEffects(t.effects,e),o,t.startSelection.map(s),r)}const i4=/^(input\.type|delete)($|\.)/;class nn{constructor(e,n,r=0,i=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new nn(this.done,this.undone):this}addChanges(e,n,r,i,s){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||i4.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,Z3(a.changes,e.changes))||r=="input.type.compose")?o=wa(o,o.length-1,i.minDepth,new ft(e.changes.compose(a.changes),G0(ce.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,Dt)):o=wa(o,o.length,i.minDepth,e),new nn(o,Dt,n,r)}addSelection(e,n,r,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Dt;return s.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&e4(s[s.length-1],e)?this:new nn(q0(this.done,e),this.undone,n,r)}addMapping(e){return new nn(Tl(this.done,e),Tl(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,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]||n.selection;if(r&&s.selectionsAfter.length)return n.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:rh.of({side:e,rest:n4(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=Tl(a,s.mapped)),n.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:rh.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 s4=[{key:"Mod-z",run:K0,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:ih,preventDefault:!0},{linux:"Ctrl-Shift-z",run:ih,preventDefault:!0},{key:"Mod-u",run:Q3,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:X3,preventDefault:!0}];function Gr(t,e){return E.create(t.ranges.map(e),t.mainIndex)}function _t(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Wt({state:t,dispatch:e},n){let r=Gr(t.selection,n);return r.eq(t.selection,!0)?!1:(e(_t(t,r)),!0)}function Ka(t,e){return E.cursor(e?t.to:t.from)}function J0(t,e){return Wt(t,n=>n.empty?t.moveByChar(n,e):Ka(n,e))}function rt(t){return t.textDirectionAt(t.state.selection.main.head)==Ne.LTR}const Y0=t=>J0(t,!rt(t)),Q0=t=>J0(t,rt(t));function X0(t,e){return Wt(t,n=>n.empty?t.moveByGroup(n,e):Ka(n,e))}const o4=t=>X0(t,!rt(t)),a4=t=>X0(t,rt(t));function l4(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Ga(t,e,n){let r=nt(t).resolveInner(e.head),i=n?pe.closedBy:pe.openedBy;for(let l=e.head;;){let c=n?r.childAfter(l):r.childBefore(l);if(!c)break;l4(t,c,i)?r=c:l=n?c.to:c.from}let s=r.type.prop(i),o,a;return s&&(o=n?tn(t,r.from,1):tn(t,r.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?r.to:r.from,E.cursor(a,n?-1:1)}const c4=t=>Wt(t,e=>Ga(t.state,e,!rt(t))),h4=t=>Wt(t,e=>Ga(t.state,e,rt(t)));function Z0(t,e){return Wt(t,n=>{if(!n.empty)return Ka(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const eb=t=>Z0(t,!1),tb=t=>Z0(t,!0);function nb(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,i;if(e){for(let s of t.state.facet(H.scrollMargins)){let o=s(t);o?.top&&(n=Math.max(o?.top,n)),o?.bottom&&(r=Math.max(o?.bottom,r))}i=t.scrollDOM.clientHeight-n-r}else i=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,i-5)}}function rb(t,e){let n=nb(t),{state:r}=t,i=Gr(r.selection,o=>o.empty?t.moveVertically(o,e,n.height):Ka(o,e));if(i.eq(r.selection))return!1;let s;if(n.selfScroll){let o=t.coordsAtPos(r.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+n.marginTop,c=a.bottom-n.marginBottom;o&&o.top>l&&o.bottom<c&&(s=H.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-l}))}return t.dispatch(_t(r,i),{effects:s}),!0}const Of=t=>rb(t,!1),sh=t=>rb(t,!0);function zn(t,e,n){let r=t.lineBlockAt(e.head),i=t.moveToLineBoundary(e,n);if(i.head==e.head&&i.head!=(n?r.to:r.from)&&(i=t.moveToLineBoundary(e,n,!1)),!n&&i.head==r.from&&r.length){let s=/^\s*/.exec(t.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 d4=t=>Wt(t,e=>zn(t,e,!0)),u4=t=>Wt(t,e=>zn(t,e,!1)),f4=t=>Wt(t,e=>zn(t,e,!rt(t))),p4=t=>Wt(t,e=>zn(t,e,rt(t))),m4=t=>Wt(t,e=>E.cursor(t.lineBlockAt(e.head).from,1)),g4=t=>Wt(t,e=>E.cursor(t.lineBlockAt(e.head).to,-1));function b4(t,e,n){let r=!1,i=Gr(t.selection,s=>{let o=tn(t,s.head,-1)||tn(t,s.head,1)||s.head>0&&tn(t,s.head-1,1)||s.head<t.doc.length&&tn(t,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(_t(t,i)),!0):!1}const x4=({state:t,dispatch:e})=>b4(t,e);function $t(t,e){let n=Gr(t.state.selection,r=>{let i=e(r);return E.range(r.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(_t(t.state,n)),!0)}function ib(t,e){return $t(t,n=>t.moveByChar(n,e))}const sb=t=>ib(t,!rt(t)),ob=t=>ib(t,rt(t));function ab(t,e){return $t(t,n=>t.moveByGroup(n,e))}const y4=t=>ab(t,!rt(t)),v4=t=>ab(t,rt(t)),w4=t=>$t(t,e=>Ga(t.state,e,!rt(t))),k4=t=>$t(t,e=>Ga(t.state,e,rt(t)));function lb(t,e){return $t(t,n=>t.moveVertically(n,e))}const cb=t=>lb(t,!1),hb=t=>lb(t,!0);function db(t,e){return $t(t,n=>t.moveVertically(n,e,nb(t).height))}const Pf=t=>db(t,!1),Nf=t=>db(t,!0),S4=t=>$t(t,e=>zn(t,e,!0)),C4=t=>$t(t,e=>zn(t,e,!1)),j4=t=>$t(t,e=>zn(t,e,!rt(t))),O4=t=>$t(t,e=>zn(t,e,rt(t))),P4=t=>$t(t,e=>E.cursor(t.lineBlockAt(e.head).from)),N4=t=>$t(t,e=>E.cursor(t.lineBlockAt(e.head).to)),Af=({state:t,dispatch:e})=>(e(_t(t,{anchor:0})),!0),Mf=({state:t,dispatch:e})=>(e(_t(t,{anchor:t.doc.length})),!0),Df=({state:t,dispatch:e})=>(e(_t(t,{anchor:t.selection.main.anchor,head:0})),!0),Tf=({state:t,dispatch:e})=>(e(_t(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),A4=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),M4=({state:t,dispatch:e})=>{let n=qa(t).map(({from:r,to:i})=>E.range(r,Math.min(i+1,t.doc.length)));return e(t.update({selection:E.create(n),userEvent:"select"})),!0},D4=({state:t,dispatch:e})=>{let n=Gr(t.selection,r=>{let i=nt(t),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 n.eq(t.selection)?!1:(e(_t(t,n)),!0)};function ub(t,e){let{state:n}=t,r=n.selection,i=n.selection.ranges.slice();for(let s of n.selection.ranges){let o=n.doc.lineAt(s.head);if(e?o.to<t.state.doc.length:o.from>0)for(let a=s;;){let l=t.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:(t.dispatch(_t(n,E.create(i,i.length-1))),!0)}const T4=t=>ub(t,!1),E4=t=>ub(t,!0),R4=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=E.create([n.main]):n.main.empty||(r=E.create([E.cursor(n.main.head)])),r?(e(_t(t,r)),!0):!1};function Gs(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,i=r.changeByRange(s=>{let{from:o,to:a}=s;if(o==a){let l=e(s);l<o?(n="delete.backward",l=Do(t,l,!1)):l>o&&(n="delete.forward",l=Do(t,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=Do(t,o,!1),a=Do(t,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:(t.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?H.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Do(t,e,n){if(t instanceof H)for(let r of t.state.facet(H.atomicRanges).map(i=>i(t)))r.between(e,e,(i,s)=>{i<e&&s>e&&(e=n?s:i)});return e}const fb=(t,e,n)=>Gs(t,r=>{let i=r.from,{state:s}=t,o=s.doc.lineAt(i),a,l;if(n&&!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%xa(s)||xa(s);for(let u=0;u<d&&a[a.length-1-u]==" ";u++)i--;l=i}else l=He(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=He(o.text,l-o.from,!1,!1)+o.from);return l}),oh=t=>fb(t,!1,!0),pb=t=>fb(t,!0,!1),mb=(t,e)=>Gs(t,n=>{let r=n.head,{state:i}=t,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let a=null;;){if(r==(e?s.to:s.from)){r==n.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let l=He(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!=n.head)&&(a=d),r=l}return r}),gb=t=>mb(t,!1),L4=t=>mb(t,!0),I4=t=>Gs(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),$4=t=>Gs(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),B4=t=>Gs(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),F4=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:we.of(["",""])},range:E.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},V4=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let i=r.from,s=t.doc.lineAt(i),o=i==s.from?i-1:He(s.text,i-s.from,!1)+s.from,a=i==s.to?i+1:He(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:a,insert:t.doc.slice(i,a).append(t.doc.slice(o,i))},range:E.cursor(a)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function qa(t){let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.from),s=t.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=t.doc.lineAt(r.to-1)),n>=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]});n=s.number+1}return e}function bb(t,e,n){if(t.readOnly)return!1;let r=[],i=[];for(let s of qa(t)){if(n?s.to==t.doc.length:s.from==0)continue;let o=t.doc.lineAt(n?s.to+1:s.from-1),a=o.length+1;if(n){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+t.lineBreak});for(let l of s.ranges)i.push(E.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:t.lineBreak+o.text});for(let l of s.ranges)i.push(E.range(l.anchor-a,l.head-a))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:E.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const z4=({state:t,dispatch:e})=>bb(t,e,!1),H4=({state:t,dispatch:e})=>bb(t,e,!0);function xb(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of qa(t))n?r.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):r.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});let i=t.changes(r);return e(t.update({changes:i,selection:t.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const _4=({state:t,dispatch:e})=>xb(t,e,!1),W4=({state:t,dispatch:e})=>xb(t,e,!0),U4=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(qa(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(t.lineWrapping){let o=t.lineBlockAt(i.head),a=t.coordsAtPos(i.head,i.assoc||1);a&&(s=o.bottom+t.documentTop-a.bottom+t.defaultLineHeight/2)}return t.moveVertically(i,!0,s)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function K4(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=nt(t).resolveInner(e),r=n.childBefore(e),i=n.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(pe.closedBy))&&s.indexOf(i.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(i.from).from&&!/\S/.test(t.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const Ef=yb(!1),G4=yb(!0);function yb(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,a=e.doc.lineAt(s),l=!t&&s==o&&K4(e,s);t&&(s=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new _a(e,{simulateBreak:s,simulateDoubleBreak:!!l}),d=Kh(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=["",Yi(e,d)];return l&&u.push(Yi(e,c.lineIndent(a.from,-1))),{changes:{from:s,to:o,insert:we.of(u)},range:E.cursor(s+1+u[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Qh(t,e){let n=-1;return t.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let a=t.doc.lineAt(o);a.number>n&&(r.empty||r.to>a.from)&&(e(a,i,r),n=a.number),o=a.to+1}let s=t.changes(i);return{changes:i,range:E.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const q4=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new _a(t,{overrideIndentation:s=>{let o=n[s];return o??-1}}),i=Qh(t,(s,o,a)=>{let l=Kh(r,s.from);if(l==null)return;/\S/.test(s.text)||(l=0);let c=/^\s*/.exec(s.text)[0],d=Yi(t,l);(c!=d||a.from<s.from+c.length)&&(n[s.from]=l,o.push({from:s.from,to:s.from+c.length,insert:d}))});return i.changes.empty||e(t.update(i,{userEvent:"indent"})),!0},vb=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Qh(t,(n,r)=>{r.push({from:n.from,insert:t.facet(Ha)})}),{userEvent:"input.indent"})),!0),wb=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Qh(t,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let s=Ur(i,t.tabSize),o=0,a=Yi(t,Math.max(0,s-xa(t)));for(;o<i.length&&o<a.length&&i.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+i.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),J4=t=>(t.setTabFocusMode(),!0),Y4=[{key:"Ctrl-b",run:Y0,shift:sb,preventDefault:!0},{key:"Ctrl-f",run:Q0,shift:ob},{key:"Ctrl-p",run:eb,shift:cb},{key:"Ctrl-n",run:tb,shift:hb},{key:"Ctrl-a",run:m4,shift:P4},{key:"Ctrl-e",run:g4,shift:N4},{key:"Ctrl-d",run:pb},{key:"Ctrl-h",run:oh},{key:"Ctrl-k",run:I4},{key:"Ctrl-Alt-h",run:gb},{key:"Ctrl-o",run:F4},{key:"Ctrl-t",run:V4},{key:"Ctrl-v",run:sh}],Q4=[{key:"ArrowLeft",run:Y0,shift:sb,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:o4,shift:y4,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:f4,shift:j4,preventDefault:!0},{key:"ArrowRight",run:Q0,shift:ob,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:a4,shift:v4,preventDefault:!0},{mac:"Cmd-ArrowRight",run:p4,shift:O4,preventDefault:!0},{key:"ArrowUp",run:eb,shift:cb,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Af,shift:Df},{mac:"Ctrl-ArrowUp",run:Of,shift:Pf},{key:"ArrowDown",run:tb,shift:hb,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Mf,shift:Tf},{mac:"Ctrl-ArrowDown",run:sh,shift:Nf},{key:"PageUp",run:Of,shift:Pf},{key:"PageDown",run:sh,shift:Nf},{key:"Home",run:u4,shift:C4,preventDefault:!0},{key:"Mod-Home",run:Af,shift:Df},{key:"End",run:d4,shift:S4,preventDefault:!0},{key:"Mod-End",run:Mf,shift:Tf},{key:"Enter",run:Ef,shift:Ef},{key:"Mod-a",run:A4},{key:"Backspace",run:oh,shift:oh,preventDefault:!0},{key:"Delete",run:pb,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:gb,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:L4,preventDefault:!0},{mac:"Mod-Backspace",run:$4,preventDefault:!0},{mac:"Mod-Delete",run:B4,preventDefault:!0}].concat(Y4.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),X4=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:c4,shift:w4},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:h4,shift:k4},{key:"Alt-ArrowUp",run:z4},{key:"Shift-Alt-ArrowUp",run:_4},{key:"Alt-ArrowDown",run:H4},{key:"Shift-Alt-ArrowDown",run:W4},{key:"Mod-Alt-ArrowUp",run:T4},{key:"Mod-Alt-ArrowDown",run:E4},{key:"Escape",run:R4},{key:"Mod-Enter",run:G4},{key:"Alt-l",mac:"Ctrl-l",run:M4},{key:"Mod-i",run:D4,preventDefault:!0},{key:"Mod-[",run:wb},{key:"Mod-]",run:vb},{key:"Mod-Alt-\\",run:q4},{key:"Shift-Mod-k",run:U4},{key:"Shift-Mod-\\",run:x4},{key:"Mod-/",run:z3},{key:"Alt-A",run:_3},{key:"Ctrl-m",mac:"Shift-Alt-m",run:J4}].concat(Q4),Z4={key:"Tab",run:vb,shift:wb},Rf=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class Hr{constructor(e,n,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(Rf(a)):Rf,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return 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 n=Ah(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Zt(e);let i=this.normalize(n);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<n.length&&n.charCodeAt(s)==a&&o++}}}match(e,n,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:n,to:r}:this.matches.push(1,n)),i&&this.test&&!this.test(i.from,i.to,this.buffer,this.bufferStart)&&(i=null),i}}typeof Symbol<"u"&&(Hr.prototype[Symbol.iterator]=function(){return this});const kb={from:-1,to:-1,match:/.*/.exec("")},Xh="gm"+(/x/.unicode==null?"":"u");class Sb{constructor(e,n,r,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=kb,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new Cb(e,n,r,i,s);this.re=new RegExp(n,Xh+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=ka(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 n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,i=r+n[0].length;if(this.matchPos=ka(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,n)))return this.value={from:r,to:i,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const El=new WeakMap;class Er{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let i=El.get(e);if(!i||i.from>=r||i.to<=n){let a=new Er(n,e.sliceString(n,r));return El.set(e,a),a}if(i.from==n&&i.to==r)return i;let{text:s,from:o}=i;return o>n&&(s=e.sliceString(n,o)+s,o=n),i.to<r&&(s+=e.sliceString(i.to,r)),El.set(e,new Er(o,s)),new Er(n,s.slice(n-o,r-o))}}class Cb{constructor(e,n,r,i,s){this.text=e,this.to=s,this.done=!1,this.value=kb,this.matchPos=ka(e,i),this.re=new RegExp(n,Xh+(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,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,i=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,match:n},this.matchPos=ka(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"&&(Sb.prototype[Symbol.iterator]=Cb.prototype[Symbol.iterator]=function(){return this});function e5(t){try{return new RegExp(t,Xh),!0}catch{return!1}}function ka(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e<n.to&&(r=n.text.charCodeAt(e-n.from))>=56320&&r<57344;)e++;return e}function ah(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=Oe("input",{class:"cm-textfield",name:"line",value:e}),r=Oe("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),t.dispatch({effects:Ti.of(!1)}),t.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},Oe("label",t.state.phrase("Go to line"),": ",n)," ",Oe("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),Oe("button",{name:"close",onclick:()=>{t.dispatch({effects:Ti.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!s)return;let{state:o}=t,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)));t.dispatch({effects:[Ti.of(!1),H.scrollIntoView(b.from,{y:"center"})],selection:b}),t.focus()}return{dom:r}}const Ti=ce.define(),Lf=Ye.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(Ti)&&(t=n.value);return t},provide:t=>Ji.from(t,e=>e?ah:null)}),t5=t=>{let e=qi(t,ah);if(!e){let n=[Ti.of(!0)];t.state.field(Lf,!1)==null&&n.push(ce.appendConfig.of([Lf,n5])),t.dispatch({effects:n}),e=qi(t,ah)}return e&&e.dom.querySelector("input").select(),!0},n5=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"}}}),r5={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},i5=U.define({combine(t){return cn(t,r5,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function s5(t){return[h5,c5]}const o5=re.mark({class:"cm-selectionMatch"}),a5=re.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function If(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Te.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Te.Word)}function l5(t,e,n,r){return t(e.sliceDoc(n,n+1))==Te.Word&&t(e.sliceDoc(r-1,r))==Te.Word}const c5=Fe.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(i5),{state:n}=t,r=n.selection;if(r.ranges.length>1)return re.none;let i=r.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return re.none;let l=n.wordAt(i.head);if(!l)return re.none;o=n.charCategorizer(i.head),s=n.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l<e.minSelectionLength||l>200)return re.none;if(e.wholeWords){if(s=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(If(o,n,i.from,i.to)&&l5(o,n,i.from,i.to)))return re.none}else if(s=n.sliceDoc(i.from,i.to),!s)return re.none}let a=[];for(let l of t.visibleRanges){let c=new Hr(n.doc,s,l.from,l.to);for(;!c.next().done;){let{from:d,to:u}=c.value;if((!o||If(o,n,d,u))&&(i.empty&&d<=i.from&&u>=i.to?a.push(a5.range(d,u)):(d>=i.to||u<=i.from)&&a.push(o5.range(d,u)),a.length>e.maxMatches))return re.none}}return re.set(a)}},{decorations:t=>t.decorations}),h5=H.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),d5=({state:t,dispatch:e})=>{let{selection:n}=t,r=E.create(n.ranges.map(i=>t.wordAt(i.head)||E.cursor(i.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function u5(t,e){let{main:n,ranges:r}=t.selection,i=t.wordAt(n.head),s=i&&i.from==n.from&&i.to==n.to;for(let o=!1,a=new Hr(t.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new Hr(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(l=>l.from==a.value.from))continue;if(s){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const f5=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(s=>s.from===s.to))return d5({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(s=>t.sliceDoc(s.from,s.to)!=r))return!1;let i=u5(t,r);return i?(e(t.update({selection:t.selection.addRange(E.range(i.from,i.to),!1),effects:H.scrollIntoView(i.to)})),!0):!1},qr=U.define({combine(t){return cn(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new j5(e),scrollToMatch:e=>H.scrollIntoView(e)})}});class jb{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||e5(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?`
235
+ `: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 b5(this):new m5(this)}getCursor(e,n=0,r){let i=e.doc?e:be.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?vr(this,i,n,r):yr(this,i,n,r)}}class Ob{constructor(e){this.spec=e}}function yr(t,e,n,r){return new Hr(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:i=>i.toLowerCase(),t.wholeWord?p5(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function p5(t,e){return(n,r,i,s)=>((s>n||s+i.length<r)&&(s=Math.max(0,n-2),i=t.sliceString(s,Math.min(t.length,r+2))),(e(Sa(i,n-s))!=Te.Word||e(Ca(i,n-s))!=Te.Word)&&(e(Ca(i,r-s))!=Te.Word||e(Sa(i,r-s))!=Te.Word))}class m5 extends Ob{constructor(e){super(e)}nextMatch(e,n,r){let i=yr(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let s=Math.min(e.doc.length,n+this.spec.unquoted.length);i=yr(this.spec,e,0,s).nextOverlapping()}return i.done||i.value.from==n&&i.value.to==r?null:i.value}prevMatchInRange(e,n,r){for(let i=r;;){let s=Math.max(n,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==n)return null;i-=1e4}}prevMatch(e,n,r){let i=this.prevMatchInRange(e,0,n);return i||(i=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=n||i.to!=r)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let r=yr(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let s=yr(this.spec,e,Math.max(0,n-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 vr(t,e,n,r){return new Sb(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?g5(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function Sa(t,e){return t.slice(He(t,e,!1),e)}function Ca(t,e){return t.slice(e,He(t,e))}function g5(t){return(e,n,r)=>!r[0].length||(t(Sa(r.input,r.index))!=Te.Word||t(Ca(r.input,r.index))!=Te.Word)&&(t(Ca(r.input,r.index+r[0].length))!=Te.Word||t(Sa(r.input,r.index+r[0].length))!=Te.Word)}class b5 extends Ob{nextMatch(e,n,r){let i=vr(this.spec,e,r,e.doc.length).next();return i.done&&(i=vr(this.spec,e,0,n).next()),i.done?null:i.value}prevMatchInRange(e,n,r){for(let i=1;;i++){let s=Math.max(n,r-i*1e4),o=vr(this.spec,e,s,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==n||a.from>s+10))return a;if(s==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let 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 n})}matchAll(e,n){let r=vr(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let s=vr(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const Qi=ce.define(),Zh=ce.define(),En=Ye.define({create(t){return new Rl(lh(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Qi)?t=new Rl(n.value.create(),t.panel):n.is(Zh)&&(t=new Rl(t.query,n.value?ed:null));return t},provide:t=>Ji.from(t,e=>e.panel)});class Rl{constructor(e,n){this.query=e,this.panel=n}}const x5=re.mark({class:"cm-searchMatch"}),y5=re.mark({class:"cm-searchMatch cm-searchMatch-selected"}),v5=Fe.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(En))}update(t){let e=t.state.field(En);(e!=t.startState.field(En)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return re.none;let{view:n}=this,r=new xn;for(let i=0,s=n.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;t.highlight(n.state,a,l,(c,d)=>{let u=n.state.selection.ranges.some(f=>f.from==c&&f.to==d);r.add(c,d,u?y5:x5)})}return r.finish()}},{decorations:t=>t.decorations});function qs(t){return e=>{let n=e.state.field(En,!1);return n&&n.query.spec.valid?t(e,n):Ab(e)}}const ja=qs((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let i=E.single(r.from,r.to),s=t.state.facet(qr);return t.dispatch({selection:i,effects:[td(t,r),s.scrollToMatch(i.main,t)],userEvent:"select.search"}),Nb(t),!0}),Oa=qs((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,i=e.prevMatch(n,r,r);if(!i)return!1;let s=E.single(i.from,i.to),o=t.state.facet(qr);return t.dispatch({selection:s,effects:[td(t,i),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),Nb(t),!0}),w5=qs((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:E.create(n.map(r=>E.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),k5=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,s=[],o=0;for(let a=new Hr(t.doc,t.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(t.update({selection:E.create(s,o),userEvent:"select.search.matches"})),!0},$f=qs((t,{query:e})=>{let{state:n}=t,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let s=e.nextMatch(n,r,r);if(!s)return!1;let o=s,a=[],l,c,d=[];o.from==r&&o.to==i&&(c=n.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:c}),o=e.nextMatch(n,o.from,o.to),d.push(H.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let u=t.state.changes(a);return o&&(l=E.single(o.from,o.to).map(u),d.push(td(t,o)),d.push(n.facet(qr).scrollToMatch(l.main,t))),t.dispatch({changes:u,selection:l,effects:d,userEvent:"input.replace"}),!0}),S5=qs((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(i=>{let{from:s,to:o}=i;return{from:s,to:o,insert:e.getReplacement(i)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:H.announce.of(r),userEvent:"input.replace.all"}),!0});function ed(t){return t.state.facet(qr).createPanel(t)}function lh(t,e){var n,r,i,s,o;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=t.facet(qr);return new jb({search:((n=e?.literal)!==null&&n!==void 0?n: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 Pb(t){let e=qi(t,ed);return e&&e.dom.querySelector("[main-field]")}function Nb(t){let e=Pb(t);e&&e==t.root.activeElement&&e.select()}const Ab=t=>{let e=t.state.field(En,!1);if(e&&e.panel){let n=Pb(t);if(n&&n!=t.root.activeElement){let r=lh(t.state,e.query.spec);r.valid&&t.dispatch({effects:Qi.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[Zh.of(!0),e?Qi.of(lh(t.state,e.query.spec)):ce.appendConfig.of(P5)]});return!0},Mb=t=>{let e=t.state.field(En,!1);if(!e||!e.panel)return!1;let n=qi(t,ed);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Zh.of(!1)}),!0},C5=[{key:"Mod-f",run:Ab,scope:"editor search-panel"},{key:"F3",run:ja,shift:Oa,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ja,shift:Oa,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Mb,scope:"editor search-panel"},{key:"Mod-Shift-l",run:k5},{key:"Mod-Alt-g",run:t5},{key:"Mod-d",run:f5,preventDefault:!0}];class j5{constructor(e){this.view=e;let n=this.query=e.state.field(En).query.spec;this.commit=this.commit.bind(this),this.searchField=Oe("input",{value:n.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=Oe("input",{value:n.replace,placeholder:xt(e,"Replace"),"aria-label":xt(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Oe("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Oe("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Oe("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(i,s,o){return Oe("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=Oe("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>ja(e),[xt(e,"next")]),r("prev",()=>Oa(e),[xt(e,"previous")]),r("select",()=>w5(e),[xt(e,"all")]),Oe("label",null,[this.caseField,xt(e,"match case")]),Oe("label",null,[this.reField,xt(e,"regexp")]),Oe("label",null,[this.wordField,xt(e,"by word")]),...e.state.readOnly?[]:[Oe("br"),this.replaceField,r("replace",()=>$f(e),[xt(e,"replace")]),r("replaceAll",()=>S5(e),[xt(e,"replace all")])],Oe("button",{name:"close",onclick:()=>Mb(e),"aria-label":xt(e,"close"),type:"button"},["×"])])}commit(){let e=new jb({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:Qi.of(e)}))}keydown(e){_k(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Oa:ja)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),$f(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Qi)&&!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(t,e){return t.state.phrase(e)}const To=30,Eo=/[\s\.,:;?!]/;function td(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),i=t.state.doc.lineAt(n).to,s=Math.max(r.from,e-To),o=Math.min(i,n+To),a=t.state.sliceDoc(s,o);if(s!=r.from){for(let l=0;l<To;l++)if(!Eo.test(a[l+1])&&Eo.test(a[l])){a=a.slice(l);break}}if(o!=i){for(let l=a.length-1;l>a.length-To;l--)if(!Eo.test(a[l-1])&&Eo.test(a[l])){a=a.slice(0,l);break}}return H.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${r.number}.`)}const O5=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"}}),P5=[En,ur.low(v5),O5];class Db{constructor(e,n,r,i){this.state=e,this.pos=n,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=nt(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),i=n.text.slice(r-n.from,this.pos-n.from),s=i.search(Tb(e,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function Bf(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function N5(t){let e=Object.create(null),n=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let s=1;s<i.length;s++)n[i[s]]=!0}let r=Bf(e)+Bf(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function A5(t){let e=t.map(i=>typeof i=="string"?{label:i}:i),[n,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:N5(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:n}:null}}class Ff{constructor(e,n,r,i){this.completion=e,this.source=n,this.match=r,this.score=i}}function or(t){return t.selection.main.from}function Tb(t,e){var n;let{source:r}=t,i=e&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?t:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const Eb=ln.define();function M5(t,e,n,r){let{main:i}=t.selection,s=n-i.from,o=r-i.from;return{...t.changeByRange(a=>{if(a!=i&&n!=r&&t.sliceDoc(a.from+s,a.from+o)!=t.sliceDoc(n,r))return{range:a};let l=t.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 Vf=new WeakMap;function D5(t){if(!Array.isArray(t))return t;let e=Vf.get(t);return e||Vf.set(t,e=A5(t)),e}const Pa=ce.define(),Xi=ce.define();class T5{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let r=ct(e,n),i=Zt(r);this.chars.push(r);let s=e.slice(n,n+i),o=s.toUpperCase();this.folded.push(ct(o==s?s.toLowerCase():o,0)),n+=i}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:i,precise:s,byWord:o}=this;if(n.length==1){let v=ct(e,0),S=Zt(v),C=S==e.length?0:-100;if(v!=n[0])if(v==r[0])C+=-200;else return null;return this.ret(C,[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=n.length,c=0;if(a<0){for(let v=0,S=Math.min(e.length,200);v<S&&c<l;){let C=ct(e,v);(C==n[c]||C==r[c])&&(i[c++]=v),v+=Zt(C)}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),C=0;v<S&&u<l;){let k=ct(e,v);a<0&&(d<l&&k==n[d]&&(s[d++]=v),p<l&&(k==n[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=Ah(k))!=O.toLowerCase()?1:O!=O.toUpperCase()?2:0;(!v||y==1&&x||C==0&&y!=0)&&(n[u]==k||r[u]==k&&(f=!0)?o[u++]=v:o.length&&(w=!1)),C=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):n.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,n,r){let i=[],s=0;for(let o of n){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 E5{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.slice(0,this.pattern.length),r=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,n.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const Ue=U.define({combine(t){return cn(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:R5,filterStrict:!1,compareCompletions:(e,n)=>(e.sortText||e.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>zf(e(r),n(r)),optionClass:(e,n)=>r=>zf(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function zf(t,e){return t?e?t+" "+e:t:e}function R5(t,e,n,r,i,s){let o=t.textDirection==Ne.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(n.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=n.bottom-e.top:(c="bottom",d=e.bottom-n.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 L5(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,i,s){let o=document.createElement("span");o.className="cm-completionLabel";let a=n.displayLabel||n.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(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),e.sort((n,r)=>n.position-r.position).map(n=>n.render)}function Ll(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let i=Math.floor(e/n);return{from:i*n,to:(i+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class I5{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=e.state.field(n),{options:s,selected:o}=i.open,a=e.state.facet(Ue);this.optionContent=L5(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=Ll(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(n).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:Xi.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),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=Ll(s.length,o,e.state.facet(Ue).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),a!=((n=i.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=Ll(n.options.length,n.selected,this.view.state.facet(Ue).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:i}=n.options[n.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,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;r.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=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"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&B5(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),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,n.bottom)-10||i.bottom<Math.max(s.top,n.top)+10?null:this.view.state.facet(Ue).positionInfo(this.view,n,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,n,r){const i=document.createElement("ul");i.id=n,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=n+"-"+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 $5(t,e){return n=>new I5(n,t,e)}function B5(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=n.height/t.offsetHeight;r.top<n.top?t.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/i)}function Hf(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function F5(t,e){let n=[],r=null,i=null,s=d=>{n.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 t)if(d.hasResult()){let u=d.result.getMatch;if(d.result.filter===!1)for(let f of d.result.options)s(new Ff(f,d.source,u?u(f):[],1e9-n.length));else{let f=e.sliceDoc(d.from,d.to),p,m=o.filterStrict?new E5(f):new T5(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 Ff(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 n){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 n.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):Hf(d.completion)>Hf(l)&&(a[a.length-1]=d),l=d.completion}return a}class jr{constructor(e,n,r,i,s,o){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new jr(this.options,_f(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,i,s,o){if(i&&!o&&e.some(c=>c.isPending))return i.setDisabled();let a=F5(e,n);if(!a.length)return i&&e.some(c=>c.isPending)?i.setDisabled():null;let l=n.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 jr(a,_f(r,l),{pos:e.reduce((c,d)=>d.hasResult()?Math.min(c,d.from):c,1e8),create:U5,above:s.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new jr(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new jr(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Na{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new Na(_5,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(Ue),s=(r.override||n.languageDataAt("autocomplete",or(n)).map(D5)).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(nd));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!V5(s,this.active)||a?o=jr.build(s,n,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(Lb)&&(o=o&&o.setSelected(l.value,this.id));return s==this.active&&o==this.open?this:new Na(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?z5:H5}}function V5(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;r<e.length&&!e[r].hasResult();)r++;let i=n==t.length,s=r==e.length;if(i||s)return i==s;if(t[n++].result!=e[r++].result)return!1}}const z5={"aria-autocomplete":"list"},H5={};function _f(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const _5=[];function Rb(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(Eb);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Tt{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=Rb(e,n),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(Pa))i=new Tt(i.source,1,s.value);else if(s.is(Xi))i=new Tt(i.source,0);else if(s.is(nd))for(let o of s.value)o.source==i.source&&(i=o);return i}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(or(e.state))}}class Rr extends Tt{constructor(e,n,r,i,s,o){super(e,3,n),this.limit=r,this.result=i,this.from=s,this.to=o}hasResult(){return!0}updateFor(e,n){var r;if(!(n&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=or(e.state);if(a>o||!i||n&2&&(or(e.startState)==this.from||a<this.limit))return new Tt(this.source,n&4?1:0);let l=e.changes.mapPos(this.limit);return W5(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 Db(e.state,a,!1)))?new Rr(this.source,this.explicit,l,i,i.from,(r=i.to)!==null&&r!==void 0?r:or(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 W5(t,e,n,r){if(!t)return!1;let i=e.sliceDoc(n,r);return typeof t=="function"?t(i,n,r,e):Tb(t,!0).test(i)}const nd=ce.define({map(t,e){return t.map(n=>n.map(e))}}),Lb=ce.define(),ht=Ye.define({create(){return Na.start()},update(t,e){return t.update(e)},provide:t=>[Uh.from(t,e=>e.tooltip),H.contentAttributes.from(t,e=>e.attrs)]});function rd(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(ht).active.find(i=>i.source==e.source);return r instanceof Rr?(typeof n=="string"?t.dispatch({...M5(t.state,n,r.from,r.to),annotations:Eb.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const U5=$5(ht,rd);function Ro(t,e="option"){return n=>{let r=n.state.field(ht,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(Ue).interactionDelay)return!1;let i=1,s;e=="page"&&(s=C0(n,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*(t?1:-1):t?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),n.dispatch({effects:Lb.of(a)}),!0}}const K5=t=>{let e=t.state.field(ht,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(Ue).interactionDelay?!1:rd(t,e.open.options[e.open.selected])},Il=t=>t.state.field(ht,!1)?(t.dispatch({effects:Pa.of(!0)}),!0):!1,G5=t=>{let e=t.state.field(ht,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Xi.of(null)}),!0)};class q5{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const J5=50,Y5=1e3,Q5=Fe.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(ht).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(ht),n=t.state.facet(Ue);if(!t.selectionSet&&!t.docChanged&&t.startState.field(ht)==e)return;let r=t.transactions.some(s=>{let o=Rb(s,n);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&&t.docChanged||o.updates.length+t.transactions.length>J5&&Date.now()-o.time>Y5){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(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(s=>s.effects.some(o=>o.is(Pa)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.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 t.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:t}=this.view,e=t.field(ht);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ue).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=or(e),r=new Db(e,n,t.explicit,this.view),i=new q5(t,r);this.running.push(i),Promise.resolve(t.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:Xi.of(null)}),ut(this.view.state,s)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ue).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=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=or(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,(t=s.done.to)!==null&&t!==void 0?t:a);for(let d of s.updates)c=c.update(d,n);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,n);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:nd.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(ht,!1);if(e&&e.tooltip&&this.view.state.facet(Ue).closeOnBlur){let n=e.open&&C0(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Xi.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Pa.of(!1)}),20),this.composing=0}}}),X5=typeof navigator=="object"&&/Win/.test(navigator.platform),Z5=ur.highest(H.domEventHandlers({keydown(t,e){let n=e.state.field(ht,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(X5&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(o=>o.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(t.key)>-1&&rd(e,r),!1}})),eC=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"}}}),Zi={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},ir=ce.define({map(t,e){let n=e.mapPos(t,-1,ot.TrackAfter);return n??void 0}}),id=new class extends Ln{};id.startSide=1;id.endSide=-1;const Ib=Ye.define({create(){return ge.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(ir)&&(t=t.update({add:[id.range(n.value,n.value+1)]}));return t}});function tC(){return[rC,Ib]}const $l="()[]{}<>«»»«[]{}";function $b(t){for(let e=0;e<$l.length;e+=2)if($l.charCodeAt(e)==t)return $l.charAt(e+1);return Ah(t<128?t:t+1)}function Bb(t,e){return t.languageDataAt("closeBrackets",e)[0]||Zi}const nC=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),rC=H.inputHandler.of((t,e,n,r)=>{if((nC?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(r.length>2||r.length==2&&Zt(ct(r,0))==1||e!=i.from||n!=i.to)return!1;let s=oC(t.state,r);return s?(t.dispatch(s),!0):!1}),iC=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=Bb(t,t.selection.main.head).brackets||Zi.brackets,i=null,s=t.changeByRange(o=>{if(o.empty){let a=aC(t.doc,o.head);for(let l of r)if(l==a&&Ja(t.doc,o.head)==$b(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(t.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},sC=[{key:"Backspace",run:iC}];function oC(t,e){let n=Bb(t,t.selection.main.head),r=n.brackets||Zi.brackets;for(let i of r){let s=$b(ct(i,0));if(e==i)return s==i?hC(t,i,r.indexOf(i+i+i)>-1,n):lC(t,i,s,n.before||Zi.before);if(e==s&&Fb(t,t.selection.main.from))return cC(t,i,s)}return null}function Fb(t,e){let n=!1;return t.field(Ib).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function Ja(t,e){let n=t.sliceString(e,e+2);return n.slice(0,Zt(ct(n,0)))}function aC(t,e){let n=t.sliceString(e-2,e);return Zt(ct(n,0))==n.length?n:n.slice(1)}function lC(t,e,n,r){let i=null,s=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:n,from:o.to}],effects:ir.of(o.to+e.length),range:E.range(o.anchor+e.length,o.head+e.length)};let a=Ja(t.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+n,from:o.head},effects:ir.of(o.head+e.length),range:E.cursor(o.head+e.length)}:{range:i=o}});return i?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function cC(t,e,n){let r=null,i=t.changeByRange(s=>s.empty&&Ja(t.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:E.cursor(s.head+n.length)}:r={range:s});return r?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function hC(t,e,n,r){let i=r.stringPrefixes||Zi.stringPrefixes,s=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:ir.of(a.to+e.length),range:E.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=Ja(t.doc,l),d;if(c==e){if(Wf(t,l))return{changes:{insert:e+e,from:l},effects:ir.of(l+e.length),range:E.cursor(l+e.length)};if(Fb(t,l)){let f=n&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+f.length,insert:f},range:E.cursor(l+f.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(d=Uf(t,l-2*e.length,i))>-1&&Wf(t,d))return{changes:{insert:e+e+e+e,from:l},effects:ir.of(l+e.length),range:E.cursor(l+e.length)};if(t.charCategorizer(l)(c)!=Te.Word&&Uf(t,l,i)>-1&&!dC(t,l,e,i))return{changes:{insert:e+e,from:l},effects:ir.of(l+e.length),range:E.cursor(l+e.length)}}return{range:s=a}});return s?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Wf(t,e){let n=nt(t).resolveInner(e+1);return n.parent&&n.from==e}function dC(t,e,n,r){let i=nt(t).resolveInner(e,-1),s=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=t.sliceDoc(i.from,Math.min(i.to,i.from+n.length+s)),l=a.indexOf(n);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>n.length+l;){if(t.sliceDoc(d.to-n.length,d.to)==n)return!1;d=d.firstChild}return!0}let c=i.to==e&&i.parent;if(!c)break;i=c}return!1}function Uf(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Te.Word)return e;for(let i of n){let s=e-i.length;if(t.sliceDoc(s,e)==i&&r(t.sliceDoc(s-1,s))!=Te.Word)return s}return-1}function uC(t={}){return[Z5,ht,Ue.of(t),Q5,fC,eC]}const Vb=[{key:"Ctrl-Space",run:Il},{mac:"Alt-`",run:Il},{mac:"Alt-i",run:Il},{key:"Escape",run:G5},{key:"ArrowDown",run:Ro(!0)},{key:"ArrowUp",run:Ro(!1)},{key:"PageDown",run:Ro(!0,"page")},{key:"PageUp",run:Ro(!1,"page")},{key:"Enter",run:K5}],fC=ur.highest(Va.computeN([Ue],t=>t.facet(Ue).defaultKeymap?[Vb]:[]));class Kf{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class Qn{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let i=r.facet(es).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,C)=>Math.min(S,C.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 C=b;;){if(C>=x){w=!0;break}if(!c.lineBreak&&d+c.value.length>C)break;C=d+c.value.length,d+=c.value.length,c.next()}}let v=OC(a);if(w)o.add(b,b,re.widget({widget:new kC(v),diagnostics:a.slice()}));else{let S=a.reduce((C,k)=>k.markClass?C+" "+k.markClass:C,"");o.add(b,x,re.mark({class:"cm-lintRange cm-lintRange-"+v+S,diagnostics:a.slice(),inclusiveEnd:a.some(C=>C.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,n,_r(f))}}function _r(t,e=null,n=0){let r=null;return t.between(n,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new Kf(i,s,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new Kf(r.from,s,r.diagnostic)}}),r}function pC(t,e){let n=e.pos,r=e.end||n,i=t.state.facet(es).hideOn(t,n,r);if(i!=null)return i;let s=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(o=>o.is(zb))||t.changes.touchesRange(s.from,Math.max(s.to,r)))}function mC(t,e){return t.field(wt,!1)?e:e.concat(ce.appendConfig.of(PC))}const zb=ce.define(),sd=ce.define(),Hb=ce.define(),wt=Ye.define({create(){return new Qn(re.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,i=t.panel;if(t.selected){let s=e.changes.mapPos(t.selected.from,1);r=_r(n,t.selected.diagnostic,s)||_r(n,null,s)}!n.size&&i&&e.state.facet(es).autoPanel&&(i=null),t=new Qn(n,i,r)}for(let n of e.effects)if(n.is(zb)){let r=e.state.facet(es).autoPanel?n.value.length?ts.open:null:t.panel;t=Qn.init(n.value,r,e.state)}else n.is(sd)?t=new Qn(t.diagnostics,n.value?ts.open:null,t.selected):n.is(Hb)&&(t=new Qn(t.diagnostics,t.panel,n.value));return t},provide:t=>[Ji.from(t,e=>e.panel),H.decorations.from(t,e=>e.diagnostics)]}),gC=re.mark({class:"cm-lintRange cm-lintRange-active"});function bC(t,e,n){let{diagnostics:r}=t.state.field(wt),i,s=-1,o=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(l,c,{spec:d})=>{if(e>=l&&e<=c&&(l==c||(e>l||n>0)&&(e<c||n<0)))return i=d.diagnostics,s=l,o=c,!1});let a=t.state.facet(es).tooltipFilter;return i&&a&&(i=a(i,t.state)),i?{pos:s,end:o,above:t.state.doc.lineAt(s).to<o,create(){return{dom:xC(t,i)}}}:null}function xC(t,e){return Oe("ul",{class:"cm-tooltip-lint"},e.map(n=>Wb(t,n,!1)))}const yC=t=>{let e=t.state.field(wt,!1);(!e||!e.panel)&&t.dispatch({effects:mC(t.state,[sd.of(!0)])});let n=qi(t,ts.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},Gf=t=>{let e=t.state.field(wt,!1);return!e||!e.panel?!1:(t.dispatch({effects:sd.of(!1)}),!0)},vC=t=>{let e=t.state.field(wt,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},wC=[{key:"Mod-Shift-m",run:yC,preventDefault:!0},{key:"F8",run:vC}],es=U.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...cn(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:qf,tooltipFilter:qf,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,i,s)=>e(r,i,s)||n(r,i,s):e:n,autoPanel:(e,n)=>e||n})}}});function qf(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function _b(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;r<n.length;r++){let i=n[r];if(/[a-zA-Z]/.test(i)&&!e.some(s=>s.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function Wb(t,e,n){var r;let i=n?_b(e.actions):[];return Oe("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Oe("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):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=_r(t.state.field(wt).diagnostics,e);m&&s.apply(t,m.from,m.to)},{name:c}=s,d=i[o]?c.indexOf(i[o]):-1,u=d<0?c:[c.slice(0,d),Oe("u",c.slice(d,d+1)),c.slice(d+1)],f=s.markClass?" "+s.markClass:"";return Oe("button",{type:"button",class:"cm-diagnosticAction"+f,onclick:l,onmousedown:l,"aria-label":` Action: ${c}${d<0?"":` (access key "${i[o]})"`}.`},u)}),e.source&&Oe("div",{class:"cm-diagnosticSource"},e.source))}class kC extends hn{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Oe("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Jf{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Wb(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class ts{constructor(e){this.view=e,this.items=[];let n=i=>{if(i.keyCode==27)Gf(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=_b(s.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==i.keyCode){let l=_r(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=Oe("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=Oe("div",{class:"cm-panel-lint"},this.list,Oe("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Gf(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(wt).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(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 Jf(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)),n&&f.diagnostic==n.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 Jf(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 n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(wt),r=_r(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Hb.of(r)})}static open(e){return new ts(e)}}function SC(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function Lo(t){return SC(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const CC=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:Lo("#d11")},".cm-lintRange-warning":{backgroundImage:Lo("orange")},".cm-lintRange-info":{backgroundImage:Lo("#999")},".cm-lintRange-hint":{backgroundImage:Lo("#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 jC(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function OC(t){let e="hint",n=1;for(let r of t){let i=jC(r.severity);i>n&&(n=i,e=r.severity)}return e}const PC=[wt,H.decorations.compute([wt],t=>{let{selected:e,panel:n}=t.field(wt);return!e||!n||e.from==e.to?re.none:re.set([gC.range(e.from,e.to)])}),DS(bC,{hideOn:pC}),CC];var Yf=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(sC)),e.defaultKeymap!==!1&&(r=r.concat(X4)),e.searchKeymap!==!1&&(r=r.concat(C5)),e.historyKeymap!==!1&&(r=r.concat(s4)),e.foldKeymap!==!1&&(r=r.concat(g3)),e.completionKeymap!==!1&&(r=r.concat(Vb)),e.lintKeymap!==!1&&(r=r.concat(wC));var i=[];return e.lineNumbers!==!1&&i.push(HS()),e.highlightActiveLineGutter!==!1&&i.push(US()),e.highlightSpecialChars!==!1&&i.push(oS()),e.history!==!1&&i.push(Y3()),e.foldGutter!==!1&&i.push(v3()),e.drawSelection!==!1&&i.push(Jk()),e.dropCursor!==!1&&i.push(eS()),e.allowMultipleSelections!==!1&&i.push(be.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&i.push(o3()),e.syntaxHighlighting!==!1&&i.push(qh(C3,{fallback:!0})),e.bracketMatching!==!1&&i.push(D3()),e.closeBrackets!==!1&&i.push(tC()),e.autocompletion!==!1&&i.push(uC()),e.rectangularSelection!==!1&&i.push(vS()),n!==!1&&i.push(SS()),e.highlightActiveLine!==!1&&i.push(uS()),e.highlightSelectionMatches!==!1&&i.push(s5()),e.tabSize&&typeof e.tabSize=="number"&&i.push(Ha.of(" ".repeat(e.tabSize))),i.concat([Va.of(r.flat())]).filter(Boolean)};const NC="#e5c07b",Qf="#e06c75",AC="#56b6c2",MC="#ffffff",ea="#abb2bf",ch="#7d8799",DC="#61afef",TC="#98c379",Xf="#d19a66",EC="#c678dd",RC="#21252b",Zf="#2c313a",ep="#282c34",Bl="#353a42",LC="#3E4451",tp="#528bff",IC=H.theme({"&":{color:ea,backgroundColor:ep},".cm-content":{caretColor:tp},".cm-cursor, .cm-dropCursor":{borderLeftColor:tp},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:LC},".cm-panels":{backgroundColor:RC,color:ea},".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:ep,color:ch,border:"none"},".cm-activeLineGutter":{backgroundColor:Zf},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Bl},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Bl,borderBottomColor:Bl},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Zf,color:ea}}},{dark:!0}),$C=Kr.define([{tag:T.keyword,color:EC},{tag:[T.name,T.deleted,T.character,T.propertyName,T.macroName],color:Qf},{tag:[T.function(T.variableName),T.labelName],color:DC},{tag:[T.color,T.constant(T.name),T.standard(T.name)],color:Xf},{tag:[T.definition(T.name),T.separator],color:ea},{tag:[T.typeName,T.className,T.number,T.changed,T.annotation,T.modifier,T.self,T.namespace],color:NC},{tag:[T.operator,T.operatorKeyword,T.url,T.escape,T.regexp,T.link,T.special(T.string)],color:AC},{tag:[T.meta,T.comment],color:ch},{tag:T.strong,fontWeight:"bold"},{tag:T.emphasis,fontStyle:"italic"},{tag:T.strikethrough,textDecoration:"line-through"},{tag:T.link,color:ch,textDecoration:"underline"},{tag:T.heading,fontWeight:"bold",color:Qf},{tag:[T.atom,T.bool,T.special(T.variableName)],color:Xf},{tag:[T.processingInstruction,T.string,T.inserted],color:TC},{tag:T.invalid,color:MC}]),BC=[IC,qh($C)];var FC=H.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),VC=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:i=!1,theme:s="light",placeholder:o="",basicSetup:a=!0}=e,l=[];switch(n&&l.unshift(Va.of([Z4])),a&&(typeof a=="boolean"?l.unshift(Yf()):l.unshift(Yf(a))),o&&l.unshift(gS(o)),s){case"light":l.push(FC);break;case"dark":l.push(BC);break;case"none":break;default:l.push(s);break}return r===!1&&l.push(H.editable.of(!1)),i&&l.push(be.readOnly.of(!0)),[...l]},zC=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class HC{constructor(e,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class np{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 Fl=null,_C=()=>typeof window>"u"?new np:(Fl||(Fl=new np),Fl),rp=ln.define(),WC=200,UC=[];function KC(t){var{value:e,selection:n,onChange:r,onStatistics:i,onCreateEditor:s,onUpdate:o,extensions:a=UC,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:C=!0,root:k,initialState:O}=t,[y,M]=g.useState(),[A,R]=g.useState(),[N,L]=g.useState(),_=g.useState(()=>({current:null}))[0],$=g.useState(()=>({current:null}))[0],F=H.theme({"&":{height:d,minHeight:u,maxHeight:f,width:p,minWidth:m,maxWidth:b},"& .cm-scroller":{height:"100% !important"}}),G=H.updateListener.of(te=>{if(te.docChanged&&typeof r=="function"&&!te.transactions.some(Y=>Y.annotation(rp))){_.current?_.current.reset():(_.current=new HC(()=>{if($.current){var Y=$.current;$.current=null,Y()}_.current=null},WC),_C().add(_.current));var oe=te.state.doc,me=oe.toString();r(me,te)}i&&i(zC(te))}),fe=VC({theme:c,editable:w,readOnly:v,placeholder:x,indentWithTab:S,basicSetup:C}),X=[G,F,...fe];return o&&typeof o=="function"&&X.push(H.updateListener.of(o)),X=X.concat(a),g.useLayoutEffect(()=>{if(y&&!N){var te={doc:e,selection:n,extensions:X},oe=O?be.fromJSON(O.json,te,O.fields):be.create(te);if(L(oe),!A){var me=new H({state:oe,parent:y,root:k});R(me),s&&s(me,oe)}}return()=>{A&&(L(void 0),R(void 0))}},[y,N]),g.useEffect(()=>{t.container&&M(t.container)},[t.container]),g.useEffect(()=>()=>{A&&(A.destroy(),R(void 0)),_.current&&(_.current.cancel(),_.current=null)},[A]),g.useEffect(()=>{l&&A&&A.focus()},[l,A]),g.useEffect(()=>{A&&A.dispatch({effects:ce.reconfigure.of(X)})},[c,a,d,u,f,p,m,b,x,w,v,S,C,r,o]),g.useEffect(()=>{if(e!==void 0){var te=A?A.state.doc.toString():"";if(A&&e!==te){var oe=_.current&&!_.current.isDone,me=()=>{A&&e!==A.state.doc.toString()&&A.dispatch({changes:{from:0,to:A.state.doc.toString().length,insert:e||""},annotations:[rp.of(!0)]})};oe?$.current=me:me()}}},[e,A]),{state:N,setState:L,view:A,setView:R,container:y,setContainer:M}}var GC=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Ub=g.forwardRef((t,e)=>{var{className:n,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:C,editable:k,readOnly:O,root:y,initialState:M}=t,A=V3(t,GC),R=g.useRef(null),{state:N,view:L,container:_,setContainer:$}=KC({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:C,editable:k,readOnly:O,selection:i,onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:c,extensions:s,initialState:M});g.useImperativeHandle(e,()=>({editor:R.current,state:N,view:L}),[R,_,N,L]);var F=g.useCallback(fe=>{R.current=fe,$(fe)},[$]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var G=typeof u=="string"?"cm-theme-"+u:"cm-theme";return h.jsx("div",nh({ref:F,className:""+G+(n?" "+n:"")},A))});Ub.displayName="CodeMirror";const qC=()=>{const t=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[t,qh(e)]},JC=({value:t,onChange:e,onCursorLineChange:n,onEditorFocus:r,height:i="100%",readOnly:s=!1,className:o})=>{const a=g.useMemo(()=>[F3(),H.lineWrapping,...qC()],[]),l=g.useMemo(()=>{if(n)return c=>{const d=c.state.selection.main.head,u=c.view.state.doc.lineAt(d).number-1;n(u)}},[n]);return h.jsx("div",{className:`h-full [&_.cm-editor]:h-full [&_.cm-editor]:outline-none [&_.cm-focused]:outline-none ${o??""}`.trim(),children:h.jsx(Ub,{value:t,height:i,extensions:a,onChange:e,onFocus:r,onUpdate:l,theme:"none",readOnly:s,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}})})},od=({width:t,isLoading:e,jsonText:n,cursorLine:r,syntaxError:i,onChange:s,onEditorFocus:o,onCursorLineChange:a,readOnly:l=!1,headerTitle:c,headerPath:d,headerActions:u})=>{const{t:f}=he(),p=m=>{if(l||!m.target.closest(".cm-editor"))return;const x=m.currentTarget;x.scrollHeight<=x.clientHeight||(x.scrollTop+=m.deltaY)};return h.jsxs("div",{style:{width:`${t}%`},className:"bg-dash-surface border border-dash-border rounded-xl overflow-hidden flex flex-col shadow-sm min-w-0 h-full",children:[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:c??f("jsonTab")}),d&&h.jsx("p",{className:"mt-1 mono text-[11px] text-dash-text-muted truncate",children:d})]}),u&&h.jsx("div",{className:"flex items-center gap-2 shrink-0",children:u})]})}),h.jsx("div",{className:"flex-1 min-h-0 overflow-auto",onWheelCapture:p,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:f("loading")})}):l?h.jsx("pre",{className:"h-full overflow-auto p-4 font-mono text-xs leading-4 text-dash-text whitespace-pre m-0",children:n}):h.jsx(JC,{value:n,onChange:s,onEditorFocus:o,onCursorLineChange:a,readOnly:l,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:[l&&h.jsx("span",{children:f("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"}),f("syntaxValid")]})]})]})]})},ip=({label:t,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:[t,":"]}),h.jsx("span",{className:"text-[10px] mono font-bold text-dash-text-secondary",children:e})]}),Kb=({width:t,fieldDoc:e,activeFieldPath:n,extraContent:r,overrideBadge:i})=>{const{t:s,lang:o}=he(),a=e??(n?qm[n]??{path:n,type:"unknown",default:"n/a",description:"Help is being resolved for this field. Try editing the value or switching to the JSON view for schema-based details.",descriptionVi:"Đang tải trợ giúp cho trường này. Hãy thử chỉnh sửa giá trị hoặc chuyển sang chế độ JSON để xem mô tả suy ra từ schema."}:null);return h.jsxs("div",{style:{width:`${t}%`},className:"bg-dash-surface border border-dash-border rounded-xl flex flex-col shadow-sm overflow-hidden min-w-0",children:[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:a?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:a.path}),i]}),h.jsxs("div",{className:"flex flex-wrap gap-2 mt-2",children:[h.jsx(ip,{label:s("type"),value:a.type}),h.jsx(ip,{label:s("default"),value:a.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"?a.descriptionVi:a.description})]}),a.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:a.validValues.map(l=>h.jsx("span",{className:"px-2 py-0.5 bg-dash-bg border border-dash-border rounded text-[11px] mono text-dash-text",children:l},l))})]}),a.effect&&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"&&a.effectVi?a.effectVi:a.effect})]}),a.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:a.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")})]})]})}),a&&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")]})})]})},YC=({variant:t="development"})=>{const{t:e}=he(),n={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:n[t]})},sp={codex:{heavy:{model:"gpt-5.4",effort:"xhigh"},balanced:{model:"gpt-5.4",effort:"high"},light:{model:"gpt-5.4-mini",effort:"medium"}},"gemini-cli":{heavy:{model:"gemini-3.1-pro-preview"},balanced:{model:"gemini-3.1-pro-preview"},light:{model:"gemini-3-flash-preview"}}},QC={codex:"Codex","gemini-cli":"Gemini CLI"},op=["heavy","balanced","light"];function ap(t,e){return e.split(".").reduce((n,r)=>{if(n!=null&&typeof n=="object"&&r in n)return n[r]},t)}const lp="bg-transparent border border-dash-border rounded px-2 py-1 text-sm text-dash-text placeholder:text-dash-text-muted focus:border-dash-accent focus:outline-none w-full",XC=({config:t,onChange:e,isCollapsed:n,onCollapsedChange:r})=>{const{t:i}=he(),[s,o]=g.useState(!1),a=n??s,l=f=>{r?.(f),n===void 0&&o(f)},c=(f,p,m,b)=>{const x=`modelTaxonomy.${f}.${p}.${m}`;e(x,b===""?void 0:b)},d=f=>{for(const p of op)e(`modelTaxonomy.${f}.${p}.model`,void 0),sp[f]?.[p]?.effort!==void 0&&e(`modelTaxonomy.${f}.${p}.effort`,void 0)},u=f=>i(f==="heavy"?"taxonomyTierHeavy":f==="balanced"?"taxonomyTierBalanced":"taxonomyTierLight");return h.jsxs("div",{"data-model-taxonomy":!0,className:`bg-dash-surface border border-dash-border rounded-lg overflow-hidden ${a?"shrink-0":"h-full min-h-0 flex flex-col"}`,children:[h.jsxs("button",{type:"button",onClick:()=>l(!a),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":!a,"aria-controls":"section-model-taxonomy",children:[h.jsx("h3",{className:"text-sm font-bold text-dash-text uppercase tracking-wider",children:i("sectionModelTaxonomy")}),h.jsx("svg",{className:`w-4 h-4 text-dash-text-muted transition-transform duration-200 ${a?"":"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"})})]}),!a&&h.jsx("div",{id:"section-model-taxonomy","data-model-taxonomy-content":!0,className:"flex-1 min-h-0 overflow-y-auto",children:h.jsxs("div",{className:"px-4 py-3 space-y-4 h-full",children:[h.jsx("p",{className:"text-xs text-dash-text-secondary",children:i("taxonomyDescription")}),Object.entries(sp).map(([f,p])=>{const m=Object.values(p).some(b=>b.effort!==void 0);return h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-xs font-semibold text-dash-text uppercase tracking-wider",children:QC[f]??f}),h.jsx("button",{type:"button",onClick:()=>d(f),className:"text-xs text-dash-text-muted hover:text-dash-text px-2 py-0.5 rounded border border-dash-border hover:border-dash-accent transition-colors",children:i("taxonomyResetProvider")})]}),h.jsx("div",{className:"overflow-hidden rounded border border-dash-border",children:h.jsxs("table",{className:"w-full text-xs",children:[h.jsx("thead",{children:h.jsxs("tr",{className:"bg-dash-surface-hover/40 border-b border-dash-border",children:[h.jsx("th",{className:"text-left px-3 py-2 text-dash-text-secondary font-medium w-1/4",children:i("taxonomyTier")}),h.jsx("th",{className:"text-left px-3 py-2 text-dash-text-secondary font-medium",children:i("taxonomyModel")}),m&&h.jsx("th",{className:"text-left px-3 py-2 text-dash-text-secondary font-medium w-1/4",children:i("taxonomyEffort")})]})}),h.jsx("tbody",{children:op.map(b=>{const x=p[b],w=ap(t,`modelTaxonomy.${f}.${b}.model`),v=ap(t,`modelTaxonomy.${f}.${b}.effort`);return h.jsxs("tr",{className:"border-b border-dash-border last:border-0",children:[h.jsx("td",{className:"px-3 py-2 text-dash-text-secondary",children:u(b)}),h.jsx("td",{className:"px-3 py-2",children:h.jsx("input",{type:"text",className:lp,placeholder:x?.model??"",value:w??"",onChange:S=>c(f,b,"model",S.target.value)})}),m&&h.jsx("td",{className:"px-3 py-2",children:x?.effort!==void 0?h.jsx("input",{type:"text",className:lp,placeholder:x.effort,value:v??"",onChange:S=>c(f,b,"effort",S.target.value)}):null})]},b)})})]})})]},f)})]})})]})},ZC=({components:t,isChecking:e,isUpdating:n,onCheckAll:r,onUpdateAll:i,className:s})=>{const{t:o}=he(),a=t.filter(d=>d.status==="update-available").length,l=t.length>0&&t.every(d=>d.status==="up-to-date"||d.status==="idle"),c=t.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||n,className:"dash-focus-ring px-3 py-2 rounded-lg text-xs font-semibold border border-dash-border bg-dash-surface text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:o("checkAll")}),a>0&&h.jsx("button",{type:"button",onClick:i,disabled:n,className:"dash-focus-ring px-3 py-2 rounded-lg text-xs font-semibold bg-dash-accent text-dash-bg hover:bg-dash-accent-hover disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:o("updateAll")})]})},ej=({value:t,onChange:e,disabled:n=!1})=>{const{t:r}=he();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 ${t==="stable"?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover"} ${n?"opacity-50 cursor-not-allowed":""}`,children:[h.jsx("input",{type:"radio",name:"channel",value:"stable",checked:t==="stable",onChange:()=>e("stable"),disabled:n,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 ${t==="beta"?"bg-amber-500/15 text-amber-500":"text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover"} ${n?"opacity-50 cursor-not-allowed":""}`,children:[h.jsx("input",{type:"radio",name:"channel",value:"beta",checked:t==="beta",onChange:()=>e("beta"),disabled:n,className:"sr-only"}),r("channelBeta")]})]})},tj={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}},Gb=({status:t,ariaLabel:e,size:n="sm"})=>{const r=tj[t],i=n==="sm"?"w-2 h-2":"w-2.5 h-2.5";return h.jsx("span",{className:`
234
236
  inline-block rounded-full ${i} ${r.color}
235
237
  ${r.pulse?"animate-pulse motion-reduce:animate-none":""}
236
- `,role:"status","aria-label":e})},ad=({isOpen:t,onClose:e,target:n,kitName:r,targetVersion:i,onComplete:s,mode:o="single",components:a=[]})=>{const{t:l}=he(),[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),C=g.useRef(null);g.useEffect(()=>{b&&C.current&&C.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 M=a[y];try{const A=M.id==="cli",R=new URLSearchParams({target:A?"cli":"kit"});A||R.set("kit",M.id);const N=new EventSource(`/api/system/update?${R}`);S.current=N,await new Promise((L,H)=>{N.onmessage=$=>{try{const F=JSON.parse($.data);F.type==="phase"&&F.name&&f(G=>[...G,`[${M.name}] ${F.name}`]),F.type==="output"&&F.text&&m(G=>[...G,F.text]),F.type==="error"&&(d("error"),m(G=>[...G,`[ERROR ${M.name}] ${F.message||"Unknown error"}`]),N.close(),H()),F.type==="complete"&&(F.code===0?(N.close(),L()):(d("error"),N.close(),H()))}catch(F){console.error("Failed to parse SSE message:",F),N.close(),H(F)}},N.onerror=()=>{d("error"),m($=>[...$,`[ERROR ${M.name}] Connection lost`]),N.close(),H()}})}catch(A){console.error(`Failed to update ${M.name}:`,A)}}d("success"),s()},[a,s]);g.useEffect(()=>{if(t)if(o==="batch")k();else{const y=new URLSearchParams({target:n});r&&y.set("kit",r),i&&y.set("version",i);const M=new EventSource(`/api/system/update?${y}`);return S.current=M,M.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"),M.close(),R.code===0&&s())}catch(R){console.error("Failed to parse SSE message:",R)}},M.onerror=()=>{d("error"),m(A=>[...A,"[ERROR] Connection lost"]),M.close()},()=>{M.close()}}},[t,n,r,i,s,o,k]);const O=()=>{c!=="running"&&(d("running"),f([]),m([]),x(!1),v(0),e())};return t?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,M)=>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}-${M}`))}),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(`
238
+ `,role:"status","aria-label":e})},ad=({isOpen:t,onClose:e,target:n,kitName:r,targetVersion:i,onComplete:s,mode:o="single",components:a=[]})=>{const{t:l}=he(),[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),C=g.useRef(null);g.useEffect(()=>{b&&C.current&&C.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 M=a[y];try{const A=M.id==="cli",R=new URLSearchParams({target:A?"cli":"kit"});A||R.set("kit",M.id);const N=new EventSource(`/api/system/update?${R}`);S.current=N,await new Promise((L,_)=>{N.onmessage=$=>{try{const F=JSON.parse($.data);F.type==="phase"&&F.name&&f(G=>[...G,`[${M.name}] ${F.name}`]),F.type==="output"&&F.text&&m(G=>[...G,F.text]),F.type==="error"&&(d("error"),m(G=>[...G,`[ERROR ${M.name}] ${F.message||"Unknown error"}`]),N.close(),_()),F.type==="complete"&&(F.code===0?(N.close(),L()):(d("error"),N.close(),_()))}catch(F){console.error("Failed to parse SSE message:",F),N.close(),_(F)}},N.onerror=()=>{d("error"),m($=>[...$,`[ERROR ${M.name}] Connection lost`]),N.close(),_()}})}catch(A){console.error(`Failed to update ${M.name}:`,A)}}d("success"),s()},[a,s]);g.useEffect(()=>{if(t)if(o==="batch")k();else{const y=new URLSearchParams({target:n});r&&y.set("kit",r),i&&y.set("version",i);const M=new EventSource(`/api/system/update?${y}`);return S.current=M,M.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"),M.close(),R.code===0&&s())}catch(R){console.error("Failed to parse SSE message:",R)}},M.onerror=()=>{d("error"),m(A=>[...A,"[ERROR] Connection lost"]),M.close()},()=>{M.close()}}},[t,n,r,i,s,o,k]);const O=()=>{c!=="running"&&(d("running"),f([]),m([]),x(!1),v(0),e())};return t?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,M)=>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}-${M}`))}),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(`
237
239
  `)}),h.jsx("div",{ref:C})]})]})]}),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},qb=({target:t,kitName:e,currentVersion:n,latestVersion:r,onVersionSelect:i})=>{const{t:s}=he(),[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:t});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)}})()},[t,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
238
240
  bg-transparent border border-amber-500/30 rounded px-2 py-1
239
241
  focus:outline-none focus:ring-2 focus:ring-amber-500/50
240
- cursor-pointer appearance-none`,title:s("selectVersion"),children:o.map(p=>{const m=p.version===r,b=p.version===n,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)})})},nj=({version:t,installedAt:e,channel:n="stable",externalStatus:r,externalLatestVersion:i,onStatusChange:s,disabled:o})=>{const{t:a}=he(),[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 C=O=>{s||c(O)},k=O=>{s||u(O)};C("checking"),s&&s("checking",null);try{const y=await(await fetch(`/api/system/check-updates?target=cli&channel=${n}`)).json();y.updateAvailable?(C("update-available"),k(y.latest),s&&s("update-available",y.latest)):(C("up-to-date"),s&&s("up-to-date",null))}catch{C("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(Gb,{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")}),n==="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",t.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",t.replace(/^v/,"")," ","->"," v",w.replace(/^v/,"")]})]}),h.jsx(rj,{status:x,currentVersion:t,latestVersion:w,onCheck:v,onUpdate:()=>p(!0),onVersionSelect:b,disabled:o})]})}),h.jsx(ad,{isOpen:f,onClose:()=>p(!1),target:"cli",targetVersion:m??w??void 0,onComplete:S})]})},rj=({status:t,currentVersion:e,latestVersion:n,onCheck:r,onUpdate:i,onVersionSelect:s,disabled:o})=>{const{t:a}=he();return t==="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")]}):t==="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")}):t==="update-available"&&n?h.jsx("div",{className:"flex items-center gap-2",children:h.jsx(qb,{target:"cli",currentVersion:e,latestVersion:n,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")})},ij=({configPath:t,nodeVersion:e,bunVersion:n,os:r})=>{const{t:i}=he();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(Io,{label:i("claudeConfigPath"),value:t,mono:!0}),h.jsx(Io,{label:i("osVersion"),value:r}),h.jsx(Io,{label:i("nodeVersion"),value:e,mono:!0}),n&&h.jsx(Io,{label:i("bunVersion"),value:n,mono:!0})]})]})},Io=({label:t,value:e,mono:n})=>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:t}),h.jsx("p",{className:`text-dash-text-secondary break-all ${n?"mono text-xs":"text-sm"}`,children:e})]}),sj={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 cp(t,e){if(!t)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(t))}catch{return t}}const oj=()=>{const{t}=he(),[e,n]=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 C=new AbortController;f.current=C,l(!0),d(null);try{const k=await Lv(v==="global"?{scope:"global",limit:40,signal:C.signal}:{scope:"project",projectId:v,limit:40,signal:C.signal});if(S!==u.current)return;o(k)}catch(k){if(C.signal.aborted||S!==u.current)return;o(null),d(k instanceof Error?k.message:t("hookDiagnosticsLoadFailed"))}finally{S===u.current&&(l(!1),f.current=null)}},[t]);g.useEffect(()=>{let v=!1;return Ch().then(S=>{v||n(S.map(C=>({id:C.id,name:C.name})))}).catch(()=>{v||n([])}),()=>{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:t("hookDiagnosticsEntries"),value:String(m?.total??0)},{label:t("hookDiagnosticsCrashes"),value:String(b.crash??0)},{label:t("hookDiagnosticsWarnings"),value:String(b.warn??0)},{label:t("hookDiagnosticsBlocks"),value:String(b.block??0)}],[m?.total,b.block,b.crash,b.warn,t]);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:t("hookDiagnosticsTitle")}),h.jsx("p",{className:"text-xs text-dash-text-secondary",children:t("hookDiagnosticsDesc")}),h.jsx("p",{className:"mono text-[11px] text-dash-text-muted break-all",children:s?.path??t("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:t("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:t("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:[t("hookDiagnosticsLastEvent"),":"," ",cp(m.lastEventAt,t("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:t("hookDiagnosticsParseErrorsNotice").replace("{count}",String(m.parseErrors))}),m.truncated&&h.jsx("p",{children:t("hookDiagnosticsTruncatedNotice")})]}),a&&h.jsx("p",{className:"text-sm text-dash-text-muted",children:t("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:t("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:t("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:cp(v.ts,t("hookDiagnosticsUnknown"))}),h.jsx("span",{className:`rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase ${sj[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:[t("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:[t("hookDiagnosticsTargetLabel"),": ",v.target]}),v.error&&h.jsx("p",{className:"text-red-400",children:v.error})]})]},`${v.ts}-${v.hook}-${S}`))})]})};function aj(t){let e=0,n=0,r=0;for(const i of t)i.ownership==="ck"?e++:i.ownership==="user"?n++:i.ownership==="ck-modified"&&r++;return{ck:e,user:n,modified:r}}function lj(t){const e={skills:0,commands:0,rules:0,hooks:0,settings:0,other:0};for(const n of t){const r=n.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 cj=({kitName:t,kit:e,channel:n="stable",externalStatus:r,externalLatestVersion:i,onStatusChange:s,disabled:o})=>{const{t:a}=he(),[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=aj(v),C=lj(v),k=async()=>{const y=A=>{s||c(A)},M=A=>{s||u(A)};y("checking"),s&&s("checking",null);try{const R=await(await fetch(`/api/system/check-updates?target=kit&kit=${t}&channel=${n}`)).json();R.updateAvailable?(y("update-available"),M(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(Gb,{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:[t," Kit"]}),n==="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(hj,{status:x,currentVersion:e.version??"0.0.0",latestVersion:w,kitName:t,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(C).filter(([,y])=>y>0).map(([y,M])=>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:M})]},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(ad,{isOpen:f,onClose:()=>p(!1),target:"kit",kitName:t,targetVersion:m??w??void 0,onComplete:O})]})},hj=({status:t,currentVersion:e,latestVersion:n,kitName:r,onCheck:i,onUpdate:s,onVersionSelect:o,disabled:a})=>{const{t:l}=he();return t==="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")]}):t==="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")}):t==="update-available"&&n?h.jsx("div",{className:"flex items-center gap-2",children:h.jsx(qb,{target:"kit",kitName:r,currentVersion:e,latestVersion:n,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")})},hp="claudekit-update-channel",dp="claudekit-system-filter",dj=t=>/-(alpha|beta|rc|dev|next)/.test(t),uj=t=>t==="all"||t==="updates"||t==="up-to-date"||t==="cli"||t==="kits"?t:"all",up=t=>t==="update-available"?0:t==="checking"?1:t==="idle"?2:3,fj=({metadata:t})=>{const{t:e}=he(),[n,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(()=>uj(localStorage.getItem(dp))),x=g.useRef(!1),w=g.useRef(0),v=g.useMemo(()=>!t.kits||typeof t.kits!="object"?[]:Object.entries(t.kits),[t.kits]),S=v.length>0,C=t.name,k=t.version,O=t.installedAt,y=v.length>0||C;g.useEffect(()=>{if(!n)return;const q=[];if(q.push({id:"cli",type:"cli",status:"idle",currentVersion:n.cliVersion,latestVersion:null}),S&&v.length>0)for(const[Me,Ce]of v){const Ie=Ce;q.push({id:Me,type:"kit",status:"idle",currentVersion:Ie.version??"?",latestVersion:null})}else C&&q.push({id:C,type:"kit",status:"idle",currentVersion:k??"?",latestVersion:null});s(q)},[n,S,v,C,k]),g.useEffect(()=>{fetch("/api/system/info").then(q=>q.json()).then(r).catch(()=>r(null))},[]),g.useEffect(()=>{const q=localStorage.getItem(hp);q==="stable"||q==="beta"?p(q):n?.cliVersion&&p(dj(n.cliVersion)?"beta":"stable")},[n?.cliVersion]);const M=q=>{p(q),localStorage.setItem(hp,q)};g.useEffect(()=>{localStorage.setItem(dp,m)},[m]);const A=(q,Me,Ce)=>{s(Ie=>Ie.map(Se=>Se.id===q?{...Se,status:Me,latestVersion:Ce}:Se))},R=g.useCallback(async()=>{if(i.length===0)return;const q=w.current+1;w.current=q,a(!0),s(Me=>Me.map(Ce=>Ce.status==="checking"&&Ce.latestVersion===null?Ce:{...Ce,status:"checking",latestVersion:null}));try{const Me=i.map(async Ie=>{try{const Se=Ie.type==="cli"?`target=cli&channel=${f}`:`target=kit&kit=${Ie.id}&channel=${f}`,I=await(await fetch(`/api/system/check-updates?${Se}`)).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}}}),Ce=await Promise.all(Me);if(w.current!==q)return;s(Ie=>Ie.map(Se=>{const gt=Ce.find(I=>I.id===Se.id);return gt?{...Se,status:gt.status,latestVersion:gt.latestVersion}:Se}))}finally{w.current===q&&a(!1)}},[f,i]),N=q=>{b(q),(q==="updates"||q==="up-to-date")&&!o&&!l&&i.length>0&&i.every(Ce=>Ce.status==="idle")&&(x.current=!0,R())},L=()=>{u(!0)},H=()=>{window.location.reload()},$=i.filter(q=>q.status==="update-available").length,F=i.filter(q=>q.status==="up-to-date").length,G=i.filter(q=>q.status==="up-to-date"||q.status==="update-available").length,ue=i.some(q=>q.status==="checking"),X=S&&v.length>0?v.length:C?1:0,te=i.find(q=>q.id==="cli")?.status??"idle",oe=g.useMemo(()=>S&&v.length>0?v.map(([q,Me])=>({id:q,kitName:q,kit:Me})):C?[{id:C,kitName:C,kit:{version:k,installedAt:O}}]:[],[S,v,C,k,O]),pe=g.useMemo(()=>{const Me=[...oe.map(Ce=>({...Ce,status:i.find(Ie=>Ie.id===Ce.id)?.status??"idle"}))].sort((Ce,Ie)=>{const Se=up(Ce.status)-up(Ie.status);return Se!==0?Se:Ce.kitName.localeCompare(Ie.kitName)});return m==="updates"?Me.filter(Ce=>Ce.status==="update-available"):m==="up-to-date"?Me.filter(Ce=>Ce.status==="up-to-date"):m==="cli"?[]:Me},[oe,i,m]),Y=m==="all"||m==="cli"||m==="updates"&&te==="update-available"||m==="up-to-date"&&te==="up-to-date",le=(Y?1:0)+pe.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 me=g.useMemo(()=>le!==0?"":(m==="updates"||m==="up-to-date")&&ue?e("checkingAll"):(m==="updates"||m==="up-to-date")&&G===0?e("runCheckAllForFilter"):m==="updates"&&G>0&&$===0?e("noUpdatesFound"):m==="up-to-date"&&G>0&&F===0?e("noUpToDateYet"):e("noComponentsMatchFilter"),[le,m,ue,G,$,F,e]),ke=!y&&m!=="cli",Qe=e("componentFilterUpdatesCount").replace("{count}",$.toString()),mt=e("componentFilterUpToDateCount").replace("{count}",F.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(ej,{value:f,onChange:M,disabled:o||l}),i.length>0&&h.jsx(ZC,{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(pi,{label:e("components"),value:i.length.toString()}),h.jsx(pi,{label:e("kitsLabel"),value:X.toString()}),h.jsx(pi,{label:e("updateAvailable"),value:$.toString(),tone:"accent"}),h.jsx(pi,{label:e("upToDate"),value:F.toString(),tone:"success"}),h.jsx(pi,{label:e("checkedComponents"),value:G.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(mi,{label:e("componentFilterAll"),value:m,activeValue:"all",onClick:()=>N("all")}),h.jsx(mi,{label:Qe,value:m,activeValue:"updates",onClick:()=>N("updates")}),h.jsx(mi,{label:mt,value:m,activeValue:"up-to-date",onClick:()=>N("up-to-date")}),h.jsx(mi,{label:e("componentFilterCli"),value:m,activeValue:"cli",onClick:()=>N("cli")}),h.jsx(mi,{label:e("componentFilterKits"),value:m,activeValue:"kits",onClick:()=>N("kits")})]})]}),Y&&h.jsx(nj,{version:n?.cliVersion??"...",installedAt:void 0,externalStatus:i.find(q=>q.id==="cli")?.status,externalLatestVersion:i.find(q=>q.id==="cli")?.latestVersion??null,onStatusChange:(q,Me)=>A("cli",q,Me),disabled:o||l,channel:f}),pe.map(q=>{const Me=i.find(Ce=>Ce.id===q.id);return h.jsx(cj,{kitName:q.kitName,kit:q.kit,externalStatus:Me?.status,externalLatestVersion:Me?.latestVersion??null,onStatusChange:(Ce,Ie)=>A(q.id,Ce,Ie),disabled:o||l,channel:f},q.id)}),ke&&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")})}),!ke&&le===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:me})})]}),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($o,{label:e("updateAvailable"),value:$.toString(),tone:$>0?"accent":"default"}),h.jsx($o,{label:e("upToDate"),value:F.toString(),tone:"success"}),h.jsx($o,{label:e("checkedComponents"),value:G.toString()}),h.jsx($o,{label:e("activeChannel"),value:e(f==="beta"?"channelBeta":"channelStable")})]})]}),n&&h.jsx(ij,{configPath:n.configPath,nodeVersion:n.nodeVersion,bunVersion:n.bunVersion,os:n.os}),h.jsx(oj,{})]})]})]}),h.jsx(ad,{isOpen:d,onClose:()=>u(!1),target:"cli",mode:"batch",components:i.filter(q=>q.status==="update-available").map(q=>({id:q.id,name:q.id==="cli"?"CLI":`${q.id} Kit`})),onComplete:H})]})},pi=({label:t,value:e,tone:n="default"})=>{const r=n==="accent"?"text-dash-accent":n==="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:t}),h.jsx("p",{className:`mt-1 mono text-xl font-semibold ${r}`,children:e})]})},$o=({label:t,value:e,tone:n="default"})=>{const r=n==="accent"?"text-dash-accent":n==="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:t}),h.jsx("span",{className:`mono text-xs font-semibold ${r}`,children:e})]})},mi=({label:t,value:e,activeValue:n,onClick:r})=>{const i=e===n;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:t})},Vl="~/.claude/settings.json",Bo="{}",pj=()=>{const{t}=he(),[e,n]=g.useState(!0),[r,i]=g.useState(Vl),[s,o]=g.useState(Bo),[a,l]=g.useState(Bo),[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,C]=g.useState(null);g.useEffect(()=>{let A=!1;return(async()=>{n(!0),m(!1);try{const N=await Ev();if(A)return;const L=JSON.stringify(N.settings??{},null,2);i(N.path||Vl),f(!!N.exists),o(L),l(L),v(null)}catch{if(A)return;m(!0),f(!1),i(Vl),o(Bo),l(Bo)}finally{A||n(!1)}})(),()=>{A=!0}},[]);const k=A=>{l(A),C(null);try{JSON.parse(A),v(null)}catch(R){v(R instanceof Error?R.message:"Invalid JSON")}},O=()=>{l(s),v(null),C(null),x("idle")},y=async()=>{if(!(e||w)){x("saving"),C(null);try{const A=JSON.parse(a),R=JSON.stringify(A,null,2),N=await Rv(A);o(R),l(R),f(!0),x("saved"),C(N.backupPath?`${t("settingsBackupSaved")}: ${N.backupPath}`:t("saved")),setTimeout(()=>x("idle"),2e3)}catch(A){x("error"),C(A instanceof Error?A.message:t("saveFailed")),setTimeout(()=>x("idle"),3e3)}}},M=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:t("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||!M||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:t("discard")}),h.jsx("button",{type:"button",onClick:y,disabled:e||b==="saving"||!!w||!M,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:t(b==="saving"?"saving":b==="saved"?"saved":b==="error"?"saveFailed":"saveChanges")})]})]}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(od,{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:t("settingsJsonMissing")}),!e&&p&&h.jsx("p",{className:"mt-2 px-1 text-xs text-red-500",children:t("settingsJsonLoadFailed")})]})},mj=(t,e)=>{const[n,r]=g.useState(null);return g.useEffect(()=>{const i=t.split(`
241
- `),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)},[t,e]),n};function Jb(t){const{scope:e,fetchConfig:n,fetchSchema:r,saveConfig:i,onReset:s}=t,[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({}),[C,k]=g.useState(!0),[O,y]=g.useState("idle"),[M,A]=g.useState(!1),[R,N]=g.useState(null),[L,H]=g.useState(null),$=mj(o,l),F=qv(L,$),G=g.useMemo(()=>Gv(F,f),[F,f]);g.useEffect(()=>{(async()=>{try{const[le,me]=await Promise.all([n(),r()]),ke=le.local??le.config;b(ke),w(le.global??{}),S(le.sources),p(me),a(JSON.stringify(ke,null,2))}catch(le){console.error("Failed to load config data:",le)}finally{k(!1)}})()},[n,r]),g.useEffect(()=>{try{JSON.parse(o),u(null)}catch(Y){u(Y instanceof Error?Y.message:"Invalid JSON")}},[o]),g.useEffect(()=>{if(R==="json")try{const Y=JSON.parse(o);b(Y)}catch{}},[o,R]);const ue=g.useCallback(Y=>{H(null),N("json"),a(Y)},[]),X=g.useCallback(()=>{H(null)},[]),te=g.useCallback((Y,le)=>{H(Y),N("form"),b(me=>{const ke=Uv(me,Y,le);return a(JSON.stringify(ke,null,2)),ke}),S(me=>({...me,[Y]:e}))},[e]),oe=g.useCallback(async()=>{if(!d){y("saving");try{const Y=JSON.parse(o);await i(Y),b(Y),y("saved"),setTimeout(()=>y("idle"),2e3)}catch{y("error"),setTimeout(()=>y("idle"),3e3)}}},[o,d,i]),pe=g.useCallback(async()=>{if(A(!1),s){k(!0);try{const Y=await s(),le=Y.local??Y.config;b(le),S(Y.sources),a(JSON.stringify(le,null,2))}catch(Y){console.error("Failed to reset:",Y)}finally{k(!1)}}else{const Y={};b(Y),a(JSON.stringify(Y,null,2))}},[s]);return{jsonText:o,config:m,globalConfig:x,sources:v,schema:f,isLoading:C,saveStatus:O,syntaxError:d,cursorLine:l,showResetConfirm:M,activeFieldPath:F,fieldDoc:G,handleJsonChange:ue,handleJsonEditorFocus:X,handleFormChange:te,handleSave:oe,handleReset:pe,setCursorLine:c,setFocusedFieldPath:H,setShowResetConfirm:A}}function hh({storageKey:t,defaultSizes:e,minSizes:n}){const[r,i]=g.useState(()=>{if(typeof window>"u")return e;const c=localStorage.getItem(t);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(t,JSON.stringify(r))},[r,t]);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 C=(v.clientX-m)/p*100,k=[...b],O=c,y=c+1;let M=b[O]+C,A=b[y]-C;M<n[O]&&(M=n[O],A=b[O]+b[y]-M),A<n[y]&&(A=n[y],M=b[O]+b[y]-A),k[O]=M,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,n]),l=g.useCallback(()=>{i(e)},[e]);return{sizes:r,isDragging:s,startDrag:a,reset:l}}const Ya="/api";async function fp(t){const e=`${Ya}/ck-config`,n=await fetch(e);if(!n.ok)throw new Error(`Failed to fetch ck-config: ${n.status}`);return n.json()}async function pp(t,e){const n=new URLSearchParams({scope:t});e&&n.set("projectId",e);const r=await fetch(`${Ya}/ck-config?${n}`);if(!r.ok)throw new Error(`Failed to fetch ck-config: ${r.status}`);return r.json()}async function Yb(t){const e=await fetch(`${Ya}/ck-config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!e.ok){const n=await e.json().catch(()=>({error:"Unknown error"}));throw new Error(n.error||`Failed to save ck-config: ${e.status}`)}return e.json()}async function Qb(){const t=await fetch(`${Ya}/ck-config/schema`);if(!t.ok)throw new Error(`Failed to fetch schema: ${t.status}`);return t.json()}const gj=.58,gi=280,dh=240,bj=80;function xj(t,e,n){return Math.min(Math.max(t,e),n)}function yj(t,e){if(typeof window>"u")return e;const n=localStorage.getItem(t);if(!n)return e;const r=Number.parseFloat(n);if(Number.isNaN(r))return e;if(r>0&&r<1)return r;if(r>=1){const i=Math.max(window.innerHeight-220,r+dh);return Math.min(.75,Math.max(.35,r/i))}return e}function vj(t,e,n,r){const[i,s]=g.useState(()=>typeof window>"u"?e:yj(t,e)),[o,a]=g.useState(!1),l=g.useCallback(c=>{c.preventDefault(),a(!0);const d=c.target.closest("[data-vresize-container]");if(!d)return;const u=p=>{const m=d.getBoundingClientRect(),b=m.height||1,x=(p.clientY-m.top)/b,w=n/b,v=Math.max(w,1-r/b);s(Math.max(w,Math.min(v,x)))},f=()=>{a(!1),document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",f),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",u),document.addEventListener("mouseup",f),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[r,n]);return g.useEffect(()=>{localStorage.setItem(t,String(i))},[t,i]),{topRatio:i,isDragging:o,startDrag:l}}function wj(){const[t,e]=g.useState(null),[n,r]=g.useState(0),i=g.useCallback(s=>{e(s)},[]);return g.useEffect(()=>{if(!t)return;const s=()=>{r(t.getBoundingClientRect().height)};if(s(),typeof ResizeObserver>"u")return;const o=new ResizeObserver(()=>{s()});return o.observe(t),()=>o.disconnect()},[t]),{ref:i,height:n}}const kj=()=>{const{t}=he(),e=an(),[n,r]=g.useState("config"),[i,s]=g.useState({}),[o,a]=g.useState(gi),[l,c]=g.useState(!1),{sizes:d,isDragging:u,startDrag:f}=hh({storageKey:"claudekit-global-config-panels",defaultSizes:[35,40,25],minSizes:[20,25,15]}),{sizes:p,isDragging:m,startDrag:b}=hh({storageKey:"claudekit-global-system-panels",defaultSizes:[70,30],minSizes:[45,20]}),x=vj("claudekit-form-taxonomy-px",gj,gi,dh),{ref:w,height:v}=wj(),S=g.useCallback(async()=>{const[$,F]=await Promise.all([fp(),Bv()]);return s(F),$},[]),C=g.useCallback(async $=>{await Yb({scope:"global",config:$})},[]),k=g.useCallback(async()=>await fp(),[]),O=Jb({scope:"global",fetchConfig:S,fetchSchema:Qb,saveConfig:C,onReset:k}),y=g.useMemo(()=>[{id:"general",title:t("sectionGeneral"),fields:[{path:"codingLevel",label:t("fieldCodingLevel"),description:t("fieldCodingLevelDesc")},{path:"statusline",label:t("fieldStatusline"),description:t("fieldStatuslineDesc")},{path:"statuslineColors",label:t("fieldStatuslineColors"),description:t("fieldStatuslineColorsDesc")},{path:"locale.thinkingLanguage",label:t("fieldThinkingLanguage"),description:t("fieldThinkingLanguageDesc")},{path:"locale.responseLanguage",label:t("fieldResponseLanguage"),description:t("fieldResponseLanguageDesc")}]},{id:"paths",title:t("sectionPaths"),fields:[{path:"paths.docs",label:t("fieldDocsPath"),description:t("fieldDocsPathDesc")},{path:"paths.plans",label:t("fieldPlansPath"),description:t("fieldPlansPathDesc")}]},{id:"privacy",title:t("sectionPrivacy"),defaultCollapsed:!0,fields:[{path:"privacyBlock",label:t("fieldPrivacyBlock"),description:t("fieldPrivacyBlockDesc")},{path:"trust.enabled",label:t("fieldTrustEnabled"),description:t("fieldTrustEnabledDesc")},{path:"trust.passphrase",label:t("fieldTrustPassphrase"),description:t("fieldTrustPassphraseDesc")}]},{id:"project",title:t("sectionProject"),defaultCollapsed:!0,fields:[{path:"project.type",label:t("fieldProjectType"),description:t("fieldProjectTypeDesc")},{path:"project.packageManager",label:t("fieldPackageManager"),description:t("fieldPackageManagerDesc")},{path:"project.framework",label:t("fieldFramework"),description:t("fieldFrameworkDesc")}]},{id:"integrations",title:t("sectionIntegrations"),defaultCollapsed:!0,fields:[{path:"gemini.model",label:t("fieldGeminiModel"),description:t("fieldGeminiModelDesc")},{path:"skills.research.useGemini",label:t("fieldResearchUseGemini"),description:t("fieldResearchUseGeminiDesc")}]},{id:"hooks",title:t("sectionHooks"),defaultCollapsed:!0,fields:[{path:"hooks.session-init",label:t("fieldHookSessionInit"),description:t("fieldHookSessionInitDesc")},{path:"hooks.subagent-init",label:t("fieldHookSubagentInit"),description:t("fieldHookSubagentInitDesc")},{path:"hooks.descriptive-name",label:t("fieldHookDescriptiveName"),description:t("fieldHookDescriptiveNameDesc")},{path:"hooks.dev-rules-reminder",label:t("fieldHookDevRulesReminder"),description:t("fieldHookDevRulesReminderDesc")},{path:"hooks.usage-context-awareness",label:t("fieldHookUsageContextAwareness"),description:t("fieldHookUsageContextAwarenessDesc")},{path:"hooks.context-tracking",label:t("fieldHookContextTracking"),description:t("fieldHookContextTrackingDesc")},{path:"hooks.scout-block",label:t("fieldHookScoutBlock"),description:t("fieldHookScoutBlockDesc")},{path:"hooks.privacy-block",label:t("fieldHookPrivacyBlock"),description:t("fieldHookPrivacyBlockDesc")},{path:"hooks.post-edit-simplify-reminder",label:t("fieldHookPostEditSimplify"),description:t("fieldHookPostEditSimplifyDesc")}]},{id:"updatePipeline",title:t("sectionUpdatePipeline"),defaultCollapsed:!0,fields:[{path:"updatePipeline.autoInitAfterUpdate",label:t("fieldAutoInitAfterUpdate"),description:t("fieldAutoInitAfterUpdateDesc")},{path:"updatePipeline.autoMigrateAfterUpdate",label:t("fieldAutoMigrateAfterUpdate"),description:t("fieldAutoMigrateAfterUpdateDesc")},{path:"updatePipeline.migrateProviders",label:t("fieldMigrateProviders"),description:t("fieldMigrateProvidersDesc")}]},{id:"advanced",title:t("sectionAdvanced"),defaultCollapsed:!0,fields:[{path:"docs.maxLoc",label:t("fieldDocsMaxLoc"),description:t("fieldDocsMaxLocDesc")},{path:"plan.namingFormat",label:t("fieldPlanNamingFormat"),description:t("fieldPlanNamingFormatDesc")},{path:"plan.dateFormat",label:t("fieldPlanDateFormat"),description:t("fieldPlanDateFormatDesc")},{path:"plan.validation.mode",label:t("fieldPlanValidationMode"),description:t("fieldPlanValidationModeDesc")},{path:"plan.validation.minQuestions",label:t("fieldPlanMinQuestions"),description:t("fieldPlanMinQuestionsDesc")},{path:"plan.validation.maxQuestions",label:t("fieldPlanMaxQuestions"),description:t("fieldPlanMaxQuestionsDesc")},{path:"assertions",label:t("fieldAssertions"),description:t("fieldAssertionsDesc")}]}],[t]),M=g.useMemo(()=>{if(v<=0)return null;const $=Math.max(gi,v-dh);return xj(x.topRatio*v,gi,$)},[x.topRatio,v]),A=g.useMemo(()=>l||M===null?null:Math.min(M,o),[o,l,M]),R=g.useMemo(()=>{if(!l||v<=0)return null;const $=Math.max(gi,v-bj);return Math.min(o,$)},[o,l,v]),N=l?R:A,L=!O.isLoading&&!l&&A!==null,H=O.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:t("confirmReset")}),h.jsx("button",{type:"button",onClick:O.handleReset,className:"px-2 py-0.5 rounded bg-red-500 text-white text-xs font-bold hover:bg-red-600 transition-colors",children:t("confirm")}),h.jsx("button",{type:"button",onClick:()=>O.setShowResetConfirm(!1),className:"px-2 py-0.5 rounded bg-dash-surface text-dash-text-secondary text-xs font-bold hover:bg-dash-surface-hover transition-colors border border-dash-border",children:t("cancel")})]}):h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button",onClick:()=>O.setShowResetConfirm(!0),className:"px-3 py-1.5 rounded-lg bg-dash-surface text-xs font-bold text-dash-text-secondary hover:bg-dash-surface-hover transition-colors border border-dash-border",children:t("resetToDefault")}),h.jsx("button",{type:"button",onClick:O.handleSave,disabled:!!O.syntaxError||O.saveStatus==="saving",className:`px-3 py-1.5 rounded-lg text-xs font-bold transition-all tracking-widest uppercase ${O.syntaxError?"bg-dash-surface text-dash-text-muted cursor-not-allowed border border-dash-border":O.saveStatus==="saved"?"bg-green-500 text-white shadow-lg shadow-green-500/20":O.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:O.saveStatus==="saving"?t("saving"):O.saveStatus==="saved"?t("saved"):O.saveStatus==="error"?t("saveFailed"):t("saveChanges")})]});return h.jsxs("div",{className:"animate-in fade-in duration-300 w-full h-full flex flex-col transition-colors",children:[h.jsx(Gm,{title:t("globalConfig"),filePath:"~/.claude/.ck.json",onBack:()=>e(-1),onSave:O.handleSave,onReset:O.handleReset,saveStatus:O.saveStatus,syntaxError:O.syntaxError,showResetConfirm:O.showResetConfirm,setShowResetConfirm:O.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":t("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":n==="config",onClick:()=>r("config"),className:`dash-focus-ring px-4 py-2 rounded-lg text-sm font-semibold transition-colors ${n==="config"?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-muted hover:text-dash-text hover:bg-dash-surface-hover"}`,children:t("configTab")}),h.jsx("button",{role:"tab","aria-selected":n==="metadata",onClick:()=>r("metadata"),className:`dash-focus-ring px-4 py-2 rounded-lg text-sm font-semibold transition-colors ${n==="metadata"?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-muted hover:text-dash-text hover:bg-dash-surface-hover"}`,children:t("systemTab")})]}),h.jsx("p",{className:"hidden lg:block text-xs text-dash-text-muted",children:t("configWorkspaceHint")})]}),h.jsxs("div",{className:"flex-1 flex min-h-0",children:[n==="config"&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{ref:w,"data-vresize-container":!0,style:{width:`${d[0]}%`},className:"flex flex-col min-w-0 min-h-0 h-full",children:[h.jsx("div",{style:N!==null?{height:`${N}px`}:void 0,className:`min-h-0 ${N!==null?"shrink-0":"flex-1"}`,children:h.jsx(Qm,{width:100,isLoading:O.isLoading,schema:O.schema,config:O.config,sources:O.sources,sections:y,onChange:O.handleFormChange,onFieldFocus:O.setFocusedFieldPath,onNaturalHeightChange:a})}),!O.isLoading&&h.jsxs(h.Fragment,{children:[l&&N!==null&&h.jsx("div",{className:"flex-1"}),L&&h.jsx(tr,{direction:"vertical",isDragging:x.isDragging,onMouseDown:x.startDrag}),h.jsx("div",{className:l?"shrink-0":"flex-1 min-h-0 overflow-hidden",children:h.jsx(XC,{config:O.config,onChange:O.handleFormChange,isCollapsed:l,onCollapsedChange:c})})]})]}),h.jsx(tr,{direction:"horizontal",isDragging:u,onMouseDown:$=>f(0,$)}),h.jsx(od,{width:d[1],isLoading:O.isLoading,jsonText:O.jsonText,cursorLine:O.cursorLine,syntaxError:O.syntaxError,onChange:O.handleJsonChange,onEditorFocus:O.handleJsonEditorFocus,onCursorLineChange:O.setCursorLine,headerPath:"~/.claude/.ck.json",headerActions:H}),h.jsx(tr,{direction:"horizontal",isDragging:u,onMouseDown:$=>f(1,$)}),h.jsx(Kb,{width:d[2],fieldDoc:O.fieldDoc,activeFieldPath:O.activeFieldPath})]}),n==="metadata"&&h.jsxs("div",{className:"flex-1 min-h-0 flex",children:[h.jsx("div",{style:{width:`${p[0]}%`},className:"min-w-0 h-full overflow-auto pr-1",children:O.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:t("loading")})}):h.jsx(fj,{metadata:i})}),h.jsx(tr,{direction:"horizontal",isDragging:m,onMouseDown:$=>b(0,$)}),h.jsx("div",{style:{width:`${p[1]}%`},className:"min-w-0 h-full overflow-hidden",children:h.jsx(pj,{})})]})]})]})};function Sj({phase:t}){const e=t.status==="completed"?"border-green-500":t.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:t.phaseId}),h.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:t.name})]})})}function zl({title:t,phases:e,borderColor:n}){return h.jsxs("div",{className:"flex flex-1 flex-col gap-3 min-w-0","aria-label":`${t} phases`,children:[h.jsxs("div",{className:`rounded-t border-t-2 ${n} 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:t}),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(Sj,{phase:r},`${r.phaseId}-${i}`))})]})}function Cj({completed:t,total:e}){const{t:n}=he(),r=e===0?0:Math.round(t/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:n("kanbanProgress")}),h.jsxs("span",{children:[t,"/",e," ",n("kanbanPhases")," — ",r,"% ",n("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 jj(){const{t}=he(),[e]=mv(),n=e.get("file")??"",[r,i]=g.useState([]),[s,o]=g.useState(!1),[a,l]=g.useState(null);if(g.useEffect(()=>{n&&(o(!0),l(null),i([]),fetch(`/api/plan/parse?file=${encodeURIComponent(n)}`).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)))},[n]),!n)return h.jsx("div",{className:"flex h-full items-center justify-center text-gray-400 dark:text-gray-500",children:t("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:t("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:t("kanbanTitle")}),h.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 truncate max-w-xs",title:n,children:n.replaceAll("\\","/")})]}),r.length>0&&h.jsx(Cj,{completed:u.length,total:r.length}),s&&h.jsx("div",{className:"flex flex-1 items-center justify-center text-gray-400",children:t("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:[t("error"),":"," ",a in{kanbanError400:"",kanbanError403:"",kanbanError404:""}?t(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:t("kanbanNoPhases")}),!s&&!a&&r.length>0&&h.jsxs("section",{"aria-label":t("kanbanTitle"),className:"flex flex-1 flex-col gap-4 overflow-auto md:flex-row",children:[h.jsx(zl,{title:t("kanbanStatus_pending"),phases:c,borderColor:"border-amber-400"}),h.jsx(zl,{title:t("kanbanStatus_in-progress"),phases:d,borderColor:"border-blue-500"}),h.jsx(zl,{title:t("kanbanStatus_completed"),phases:u,borderColor:"border-green-500"})]})]})}const mp=[{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"}],Oj=new Set([8203,8204,8205,8288,65279,8232,8233,8234,8235,8236,8237,8238,8294,8295,8296,8297]);function Pj(t){return t===9||t===10||t===13?!0:t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159||Oj.has(t)}function Xn(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(Pj(r)||(e+=n))}return e}function gp(t){if(!t)return"-";const e=t.replace(/\\/g,"/"),n=e.match(/.*\/(\.[^/]+\/)/);if(n?.[1]){const i=(n.index??0)+n[0].length-n[1].length;return e.slice(i)}const r=e.split("/");return r.length>3?`.../${r.slice(-3).join("/")}`:e}function Or(t){return t.success?t.skipped?"skipped":"installed":"failed"}function Nj(t){const e={installed:0,skipped:0,failed:0};for(const n of t){const r=Or(n);r==="installed"?e.installed+=1:r==="skipped"?e.skipped+=1:e.failed+=1}return e}function Xb(t){switch(t){case"agent":case"command":case"skill":case"config":case"rules":case"hooks":case"unknown":return t;default:return"unknown"}}function Aj(t,e){switch(t){case"failed":return{label:e("migrateStatusFailed"),className:"border-red-500/30 bg-red-500/10 text-red-400"};case"skipped":return{label:e("migrateStatusSkipped"),className:"border-yellow-500/30 bg-yellow-500/10 text-yellow-400"};default:return{label:e("migrateStatusInstalled"),className:"border-green-500/30 bg-green-500/10 text-green-400"}}}function Mj(t){const e=new Map;for(const n of t){const r=Xb(n.portableType),i=e.get(r)||[];i.push(n),e.set(r,i)}return e}function Dj(t){return[Xb(t.portableType),t.provider,t.providerDisplayName,t.itemName,t.path,t.success,t.skipped,t.overwritten,t.error,t.skipReason].map(n=>n===void 0?"":String(n)).join("|")}function Tj(t){if(t.length===0)return!0;const e=t[0].provider;return t.every(n=>n.provider===e)}const Lr=({label:t,count:e,className:n})=>e<=0?null:h.jsxs("span",{className:`inline-flex items-center gap-1 rounded-md border px-2.5 py-1 text-xs ${n}`,children:[h.jsx("span",{className:"font-semibold",children:e}),h.jsx("span",{children:t})]}),bp=({labelKey:t,badgeClass:e,items:n,isExpanded:r,onToggle:i,singleProvider:s})=>{const{t:o}=he(),a=n.filter(f=>Or(f)==="installed").length,l=n.filter(f=>Or(f)==="skipped").length,c=n.filter(f=>Or(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(t)}),h.jsx("span",{className:`inline-flex items-center rounded-full border px-2 py-0.5 text-[11px] font-semibold ${e}`,children:n.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:n.map(f=>{const p=Dj(f),m=u.get(p)??0;u.set(p,m+1);const b=m===0?p:`${p}#${m}`,x=Or(f),w=Aj(x,o),v=Xn(f.itemName||gp(f.path)),S=Xn(f.providerDisplayName||f.provider||""),C=Xn(f.path||""),k=Xn(gp(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:C,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:C,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)})})]})]})},Ej=({results:t,onReset:e})=>{const{t:n}=he(),[r,i]=g.useState(""),s=g.useDeferredValue(r),[o,a]=g.useState("all"),[l,c]=g.useState(()=>new Set(mp.map(C=>C.key))),d=g.useMemo(()=>{const C=s.trim().toLowerCase();return t.results.filter(k=>{if(o!=="all"&&Or(k)!==o)return!1;if(!C)return!0;const O=(k.itemName||"").toLowerCase(),y=(k.path||"").toLowerCase(),M=(k.providerDisplayName||k.provider||"").toLowerCase();return O.includes(C)||y.includes(C)||M.includes(C)})},[t.results,s,o]),u=g.useMemo(()=>Tj(d),[d]),f=g.useMemo(()=>{if(!u||d.length===0)return"";const C=Array.from(new Set(d.map(k=>k.providerDisplayName?.trim()||"").filter(k=>k.length>0)));return C.length===1?C[0]:d[0]?.provider||""},[d,u]),p=g.useMemo(()=>Mj(d),[d]),m=g.useMemo(()=>Nj(t.results),[t.results]),b=g.useMemo(()=>[...p.keys()],[p]),x=m.installed+m.skipped+m.failed,w=b.length>0&&b.every(C=>l.has(C)),v=C=>{c(k=>{const O=new Set(k);return O.has(C)?O.delete(C):O.add(C),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:[n("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," ",n("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:n("migrateSummaryNewMigration")})]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[h.jsx(Lr,{label:n("migrateStatusInstalled"),count:m.installed,className:"border-green-500/30 bg-green-500/10 text-green-400"}),h.jsx(Lr,{label:n("migrateStatusSkipped"),count:m.skipped,className:"border-yellow-500/30 bg-yellow-500/10 text-yellow-400"}),h.jsx(Lr,{label:n("migrateStatusFailed"),count:m.failed,className:"border-red-500/30 bg-red-500/10 text-red-400"})]}),t.warnings.length>0&&h.jsx("div",{className:"space-y-2",children:t.warnings.map((C,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(C)},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:C=>i(C.target.value),placeholder:n("migrateSummarySearchPlaceholder"),className:"dash-focus-ring w-full pl-9 pr-3 py-2 bg-dash-bg border border-dash-border rounded-lg text-dash-text text-sm focus:border-dash-accent transition-colors"})]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[["all","installed","skipped","failed"].map(C=>{const k=C==="all"?"migrateSummaryFilterAll":C==="installed"?"migrateStatusInstalled":C==="skipped"?"migrateStatusSkipped":"migrateStatusFailed";return h.jsx("button",{type:"button",onClick:()=>a(C),className:`dash-focus-ring px-3 py-1 text-xs font-medium rounded-full border transition-colors ${o===C?"bg-dash-accent/10 border-dash-accent text-dash-accent":"border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text"}`,children:n(k)},C)}),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:n(w?"migrateSummaryCollapseAll":"migrateSummaryExpandAll")})]})]}),d.length===0?h.jsx("div",{className:"text-center py-8 text-sm text-dash-text-muted",children:n("migrateSummaryNoResults")}):h.jsxs("div",{className:"space-y-2.5",children:[mp.map(C=>{const k=p.get(C.key);return!k||k.length===0?null:h.jsx(bp,{labelKey:C.labelKey,badgeClass:C.badgeClass,items:k,isExpanded:l.has(C.key),onToggle:()=>v(C.key),singleProvider:u},C.key)}),(()=>{const C=p.get("unknown");return!C||C.length===0?null:h.jsx(bp,{labelKey:"migrateTypeUnknown",badgeClass:"border-dash-border text-dash-text-muted",items:C,isExpanded:l.has("unknown"),onToggle:()=>v("unknown"),singleProvider:u})})()]})]})},Rj=500;function Lj(t){return t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159}function Ij(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(Lj(r)||(e+=n))}return e}const $j=({diff:t,className:e=""})=>{const n=t.split(`
242
- `),r=n.slice(0,Rj),i=n.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=Ij(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 Bj(t){return t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159}function bi(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(Bj(r)||(e+=n))}return e}const Fj=({action:t,resolution:e,onResolve:n})=>{const{t:r}=he(),[i,s]=g.useState(!1),o=t.ownedSections&&t.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:[bi(t.provider),"/",bi(t.type),"/",bi(t.item)]}),h.jsx("p",{className:"text-xs text-dash-text-muted mt-1",children:bi(t.reason)}),t.targetPath&&h.jsx("p",{className:"text-xs text-dash-text-secondary mt-1 font-mono truncate",children:bi(t.targetPath)})]}),h.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[h.jsx("button",{type:"button",onClick:()=>n({type:"overwrite"}),className:`dash-focus-ring px-3 py-1.5 text-xs font-semibold rounded-md transition-colors ${e?.type==="overwrite"?"bg-dash-accent text-white":"bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover"}`,children:r("migrateConflictUseCK")}),h.jsx("button",{type:"button",onClick:()=>n({type:"keep"}),className:`dash-focus-ring px-3 py-1.5 text-xs font-semibold rounded-md transition-colors ${e?.type==="keep"?"bg-dash-accent text-white":"bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover"}`,children:r("migrateConflictKeepMine")}),o&&h.jsx("button",{type:"button",onClick:()=>n({type:"smart-merge"}),className:`dash-focus-ring px-3 py-1.5 text-xs font-semibold rounded-md transition-colors ${e?.type==="smart-merge"?"bg-dash-accent text-white":"bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover"}`,children:r("migrateConflictSmartMerge")}),t.diff&&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&&t.diff&&h.jsx($j,{diff:t.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"),": ",Vj(e.type,r)]})]})]})};function Vj(t,e){switch(t){case"overwrite":return e("migrateConflictUseCK");case"keep":return e("migrateConflictKeepMine");case"smart-merge":return e("migrateConflictSmartMerge");case"resolved":return e("migrateConflictManual");default:return String(t)}}const zj=[{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"}],xp=["agent","command","skill","config","rules","hooks"],_j={agent:"migrateTypeAgents",command:"migrateTypeCommands",skill:"migrateTypeSkills",config:"migrateTypeConfig",rules:"migrateTypeRules",hooks:"migrateTypeHooks"},Hj={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"},gr=200;function Wj(t){return t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159}function Fo(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(Wj(r)||(e+=n))}return e}function Uj(t){const e={install:[],update:[],skip:[],conflict:[],delete:[]};for(const n of t)e[n.action].push(n);return e}function Kj(t){const e=new Map;for(const n of t){const r=e.get(n.type)||[];r.push(n),e.set(n.type,r)}return e}const Gj=({plan:t,resolutions:e,onResolve:n,actionKey:r})=>{const{t:i}=he(),s=g.useMemo(()=>Uj(t.actions),[t.actions]),o=g.useMemo(()=>zj.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(()=>Kj(c),[c]),u=f=>{for(const p of s.conflict)n(p,{type:f})};return h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[t.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:[t.summary.install," ",i("migrateActionInstall")]}),t.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:[t.summary.update," ",i("migrateActionUpdate")]}),t.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:[t.summary.skip," ",i("migrateActionSkip")]}),t.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:[t.summary.conflict," ",i("migrateActionConflict")]}),t.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:[t.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"?xp.map(f=>{const p=d.get(f);return!p||p.length===0?null:h.jsxs(yp,{type:f,count:p.length,children:[p.slice(0,gr).map(m=>h.jsx(Fj,{action:m,resolution:e.get(r(m))||null,onResolve:b=>n(m,b)},r(m))),p.length>gr&&h.jsxs("div",{className:"text-xs text-dash-text-muted",children:["... ",p.length-gr," more"]})]},`${a}:${f}`)}):xp.map(f=>{const p=d.get(f);return!p||p.length===0?null:h.jsxs(yp,{type:f,count:p.length,defaultExpanded:a!=="skip",children:[p.slice(0,gr).map(m=>h.jsx(qj,{action:m},`${m.provider}:${m.type}:${m.item}:${m.global}:${m.action}`)),p.length>gr&&h.jsxs("div",{className:"text-xs text-dash-text-muted",children:["... ",p.length-gr," more"]})]},`${a}:${f}`)})]})},yp=({type:t,count:e,defaultExpanded:n=!0,children:r})=>{const{t:i}=he(),[s,o]=g.useState(n),a=Hj[t],l=i(_j[t]);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})]})},qj=({action:t})=>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:[Fo(t.provider),"/",Fo(t.item)]}),h.jsx("div",{className:"text-xs text-dash-text-muted mt-1",children:Fo(t.reason)}),t.targetPath&&h.jsx("div",{className:"text-xs text-dash-text-secondary mt-0.5 font-mono truncate",children:Fo(t.targetPath)})]});var Jj=function(e){return typeof window<"u"?matchMedia&&matchMedia("(prefers-color-scheme: ".concat(e,")")):{matches:!1}},_l,Yj=g.createContext({appearance:"light",setAppearance:function(){},isDarkMode:!1,themeMode:"light",setThemeMode:function(){},browserPrefers:(_l=Jj("dark"))!==null&&_l!==void 0&&_l.matches?"dark":"light"}),Qj=function(){return g.useContext(Yj)};const Zb=(t,e)=>{if(e)return"row";switch(t){case"horizontal":return"row";case"horizontal-reverse":return"row-reverse";case"vertical":default:return"column";case"vertical-reverse":return"column-reverse"}},Xj=t=>{if(t)return["space-between","space-around","space-evenly"].includes(t)},Zj=(t,e)=>Zb(t,e)==="row",br=t=>typeof t=="number"?`${t}px`:t,eO=({visible:t,flex:e,gap:n,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,...C})=>{const k=o||a,y=Zj(r,i)&&!c&&Xj(k)?"100%":br(c),M={...e!==void 0?{"--lobe-flex":String(e)}:{},...r||i?{"--lobe-flex-direction":Zb(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":br(l)}:{},...d!==void 0?{"--lobe-flex-padding":br(d)}:{},...u!==void 0?{"--lobe-flex-padding-inline":br(u)}:{},...f!==void 0?{"--lobe-flex-padding-block":br(f)}:{},...n!==void 0?{"--lobe-flex-gap":br(n)}:{},...x},A="lobe-flex",R=[A,t===!1?`${A}--hidden`:void 0,p?`${p}-flex`:void 0,b].filter(Boolean).join(" ");return h.jsx(m,{ref:S,...C,className:R,style:M,children:w})};var ex=g.memo(eO);const tO=({children:t,ref:e,...n})=>h.jsx(ex,{...n,align:"center",justify:"center",ref:e,children:t});var nO=tO;const rO=/\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;function iO(t){return Array.from(t.match(rO)??[])}function sO(t){return iO(t).map(n=>n.toLowerCase()).join("-")}g.createContext(null);var oO=function(e,n){if(n){if(e&&n==="#000")return"0 0 0 1px rgba(255,255,255,0.1) inset";if(!e&&n==="#fff")return"0 0 0 1px rgba(0,0,0,0.05) inset"}};function ns(t){"@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(t)}var aO=["shape","color","background","size","style","iconMultiple","Icon","iconStyle","iconClassName"];function vp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Vo(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?vp(Object(n),!0).forEach(function(r){lO(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function lO(t,e,n){return e=cO(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function cO(t){var e=hO(t,"string");return ns(e)=="symbol"?e:String(e)}function hO(t,e){if(ns(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ns(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dO(t,e){if(t==null)return{};var n=uO(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function uO(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var _n=g.memo(function(t){var e=t.shape,n=e===void 0?"circle":e,r=t.color,i=r===void 0?"#fff":r,s=t.background,o=t.size,a=t.style,l=t.iconMultiple,c=l===void 0?.75:l,d=t.Icon,u=t.iconStyle,f=t.iconClassName,p=dO(t,aO),m=Qj(),b=m.isDarkMode;return h.jsx(nO,Vo(Vo({flex:"none",style:Vo({background:s,borderRadius:n==="circle"?"50%":Math.floor(o*.1),boxShadow:oO(b,s),color:i,height:o,width:o},a)},p),{},{children:d&&h.jsx(d,{className:f,color:i,size:o,style:Vo({transform:"scale(".concat(c,")")},u)})}))});function rs(t){"@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(t)}var fO=["Icon","style","Text","color","size","spaceMultiple","textMultiple","extra","extraStyle","showText","showLogo","extraClassName","iconProps","inverse"];function wp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function kn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?wp(Object(n),!0).forEach(function(r){pO(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function pO(t,e,n){return e=mO(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function mO(t){var e=gO(t,"string");return rs(e)=="symbol"?e:String(e)}function gO(t,e){if(rs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(rs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function bO(t,e){if(t==null)return{};var n=xO(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function xO(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var Hn=g.memo(function(t){var e=t.Icon,n=t.style,r=t.Text,i=t.color,s=t.size,o=s===void 0?24:s,a=t.spaceMultiple,l=a===void 0?1:a,c=t.textMultiple,d=c===void 0?1:c,u=t.extra,f=t.extraStyle,p=t.showText,m=p===void 0?!0:p,b=t.showLogo,x=b===void 0?!0:b,w=t.extraClassName,v=t.iconProps,S=t.inverse,C=bO(t,fO),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(ex,kn(kn({align:"center",flex:"none",horizontal:!0,justify:"flex-start",style:kn({color:i},n)},C),{},{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})]}))}),yO=function(e,n){return g.useMemo(function(){var r=Array.from({length:n},function(i,s){var o="lobe-icons-".concat(sO(e),"-fill-").concat(s);return{fill:"url(#".concat(o,")"),id:o}});return r},[e,n])},Jr="Claude",vO=.8,wO=.1,tx="#D97757",kO=tx,SO="#fff",CO=.75;function is(t){"@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(t)}var jO=["size","style"];function kp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Hl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?kp(Object(n),!0).forEach(function(r){OO(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):kp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function OO(t,e,n){return e=PO(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function PO(t){var e=NO(t,"string");return is(e)=="symbol"?e:String(e)}function NO(t,e){if(is(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(is(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function AO(t,e){if(t==null)return{};var n=MO(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function MO(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var ld=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=AO(t,jO);return h.jsxs("svg",Hl(Hl({fill:"currentColor",fillRule:"evenodd",height:n,style:Hl({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,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 ss(t){"@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(t)}function Sp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function DO(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Sp(Object(n),!0).forEach(function(r){TO(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Sp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function TO(t,e,n){return e=EO(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function EO(t){var e=RO(t,"string");return ss(e)=="symbol"?e:String(e)}function RO(t,e){if(ss(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ss(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function LO(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var IO=g.memo(function(t){var e=Object.assign({},(LO(t),t));return h.jsx(_n,DO({Icon:ld,"aria-label":Jr,background:kO,color:SO,iconMultiple:CO},e))});function os(t){"@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(t)}var $O=["size","style"];function Cp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Wl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Cp(Object(n),!0).forEach(function(r){BO(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Cp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function BO(t,e,n){return e=FO(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function FO(t){var e=VO(t,"string");return os(e)=="symbol"?e:String(e)}function VO(t,e){if(os(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(os(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function zO(t,e){if(t==null)return{};var n=_O(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function _O(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var nx=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=zO(t,$O);return h.jsxs("svg",Wl(Wl({height:n,style:Wl({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,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 as(t){"@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(t)}var HO=["size","style"];function jp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ul(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?jp(Object(n),!0).forEach(function(r){WO(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):jp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function WO(t,e,n){return e=UO(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function UO(t){var e=KO(t,"string");return as(e)=="symbol"?e:String(e)}function KO(t,e){if(as(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(as(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function GO(t,e){if(t==null)return{};var n=qO(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function qO(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var rx=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=GO(t,HO);return h.jsxs("svg",Ul(Ul({fill:"currentColor",fillRule:"nonzero",height:n,style:Ul({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 ls(t){"@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(t)}var JO=["type"];function Op(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function YO(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Op(Object(n),!0).forEach(function(r){QO(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Op(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function QO(t,e,n){return e=XO(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function XO(t){var e=ZO(t,"string");return ls(e)=="symbol"?e:String(e)}function ZO(t,e){if(ls(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ls(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function e6(t,e){if(t==null)return{};var n=t6(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function t6(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var n6=g.memo(function(t){var e=t.type,n=e===void 0?"mono":e,r=e6(t,JO),i=n==="color"?nx:ld;return h.jsx(Hn,YO({Icon:i,Text:rx,"aria-label":Jr,spaceMultiple:wO,textMultiple:vO},r))}),fr=ld;fr.Color=nx;fr.Text=rx;fr.Combine=n6;fr.Avatar=IO;fr.colorPrimary=tx;fr.title=Jr;var Js="OpenAI",r6=.75,i6=.1,ix="#000",sx="#19C37D",ox="#AB68FF",ax="#F86AA4",cd="#F9C322",lx="#0099FF",cx="#0000FE",s6=ix,o6="#fff",a6=.75;function cs(t){"@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(t)}var l6=["size","style"];function Pp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Kl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Pp(Object(n),!0).forEach(function(r){c6(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Pp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function c6(t,e,n){return e=h6(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function h6(t){var e=d6(t,"string");return cs(e)=="symbol"?e:String(e)}function d6(t,e){if(cs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(cs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function u6(t,e){if(t==null)return{};var n=f6(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function f6(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var hd=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=u6(t,l6);return h.jsxs("svg",Kl(Kl({fill:"currentColor",fillRule:"evenodd",height:n,style:Kl({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Js}),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"})]}))}),hr="Gemini",p6=.8,m6=.2,hx="#fff",g6=hx,b6="#fff",x6=.8;function hs(t){"@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(t)}var y6=["size","style"];function Np(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Gl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Np(Object(n),!0).forEach(function(r){v6(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Np(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function v6(t,e,n){return e=w6(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function w6(t){var e=k6(t,"string");return hs(e)=="symbol"?e:String(e)}function k6(t,e){if(hs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(hs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function S6(t,e){return P6(t)||O6(t,e)||j6(t,e)||C6()}function C6(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
243
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function j6(t,e){if(t){if(typeof t=="string")return Ap(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ap(t,e)}}function Ap(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function O6(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function P6(t){if(Array.isArray(t))return t}function N6(t,e){if(t==null)return{};var n=A6(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function A6(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var dd=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=N6(t,y6),s=yO(hr,3),o=S6(s,3),a=o[0],l=o[1],c=o[2];return h.jsxs("svg",Gl(Gl({height:n,style:Gl({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:hr}),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 ds(t){"@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(t)}function Mp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function M6(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Mp(Object(n),!0).forEach(function(r){D6(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Mp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function D6(t,e,n){return e=T6(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function T6(t){var e=E6(t,"string");return ds(e)=="symbol"?e:String(e)}function E6(t,e){if(ds(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ds(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function R6(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var L6=g.memo(function(t){var e=Object.assign({},(R6(t),t));return h.jsx(_n,M6({Icon:dd,"aria-label":hr,background:g6,color:b6,iconMultiple:x6},e))});function us(t){"@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(t)}var I6=["size","style"];function Dp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ql(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Dp(Object(n),!0).forEach(function(r){$6(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Dp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function $6(t,e,n){return e=B6(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function B6(t){var e=F6(t,"string");return us(e)=="symbol"?e:String(e)}function F6(t,e){if(us(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(us(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function V6(t,e){if(t==null)return{};var n=z6(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function z6(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var dx=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=V6(t,I6);return h.jsxs("svg",ql(ql({fill:"currentColor",fillRule:"evenodd",height:n,style:ql({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:hr}),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 fs(t){"@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(t)}var _6=["size","style"];function Tp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Jl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Tp(Object(n),!0).forEach(function(r){H6(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Tp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function H6(t,e,n){return e=W6(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function W6(t){var e=U6(t,"string");return fs(e)=="symbol"?e:String(e)}function U6(t,e){if(fs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(fs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function K6(t,e){if(t==null)return{};var n=G6(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function G6(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var ux=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=K6(t,_6);return h.jsxs("svg",Jl(Jl({fill:"currentColor",fillRule:"evenodd",height:n,style:Jl({flex:"none",lineHeight:1},r),viewBox:"0 0 98 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:hr}),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 ps(t){"@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(t)}var q6=["type"];function Ep(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function J6(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ep(Object(n),!0).forEach(function(r){Y6(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ep(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Y6(t,e,n){return e=Q6(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Q6(t){var e=X6(t,"string");return ps(e)=="symbol"?e:String(e)}function X6(t,e){if(ps(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ps(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Z6(t,e){if(t==null)return{};var n=eP(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function eP(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var tP=g.memo(function(t){var e=t.type,n=e===void 0?"mono":e,r=Z6(t,q6),i=n==="color"?dd:dx;return h.jsx(Hn,J6({Icon:i,Text:ux,"aria-label":hr,spaceMultiple:m6,textMultiple:p6},r))}),pr=dx;pr.Color=dd;pr.Text=ux;pr.Combine=tP;pr.Avatar=L6;pr.colorPrimary=hx;pr.title=hr;function ms(t){"@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(t)}var nP=["type"];function Rp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function rP(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Rp(Object(n),!0).forEach(function(r){iP(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Rp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function iP(t,e,n){return e=sP(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function sP(t){var e=oP(t,"string");return ms(e)=="symbol"?e:String(e)}function oP(t,e){if(ms(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ms(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function aP(t,e){if(t==null)return{};var n=lP(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function lP(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var cP=g.memo(function(t){var e=t.type,n=e===void 0?"normal":e,r=aP(t,nP),i=g.useMemo(function(){switch(n){case"gpt3":return sx;case"gpt4":return ox;case"gpt5":return ax;case"o3":case"o1":return cd;case"oss":return lx;case"platform":return cx;default:return s6}},[n]);return h.jsx(_n,rP({Icon:hd,"aria-label":Js,background:i,color:o6,iconMultiple:a6},r))});function gs(t){"@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(t)}var hP=["size","style"];function Lp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Yl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Lp(Object(n),!0).forEach(function(r){dP(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Lp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function dP(t,e,n){return e=uP(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function uP(t){var e=fP(t,"string");return gs(e)=="symbol"?e:String(e)}function fP(t,e){if(gs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(gs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function pP(t,e){if(t==null)return{};var n=mP(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function mP(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var fx=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=pP(t,hP);return h.jsxs("svg",Yl(Yl({fill:"currentColor",fillRule:"evenodd",height:n,style:Yl({flex:"none",lineHeight:1},r),viewBox:"0 0 84 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Js}),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 bs(t){"@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(t)}var gP=["extraStyle"];function Ip(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function $p(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ip(Object(n),!0).forEach(function(r){bP(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ip(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function bP(t,e,n){return e=xP(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xP(t){var e=yP(t,"string");return bs(e)=="symbol"?e:String(e)}function yP(t,e){if(bs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(bs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function vP(t,e){if(t==null)return{};var n=wP(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function wP(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var kP=g.memo(function(t){var e=t.extraStyle,n=vP(t,gP);return h.jsx(Hn,$p({Icon:hd,Text:fx,"aria-label":Js,extraStyle:$p({fontWeight:600},e),spaceMultiple:i6,textMultiple:r6},n))}),Ct=hd;Ct.Text=fx;Ct.Combine=kP;Ct.Avatar=cP;Ct.colorPrimary=ix;Ct.colorGpt3=sx;Ct.colorGpt4=ox;Ct.colorGpt5=ax;Ct.colorO1=cd;Ct.colorO3=cd;Ct.colorOss=lx;Ct.colorPlatform=cx;Ct.title=Js;var Ys="GithubCopilot",SP=.75,CP=.3,px="#000",jP=px,OP="#fff",PP=.75;function xs(t){"@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(t)}var NP=["size","style"];function Bp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ql(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Bp(Object(n),!0).forEach(function(r){AP(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Bp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function AP(t,e,n){return e=MP(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function MP(t){var e=DP(t,"string");return xs(e)=="symbol"?e:String(e)}function DP(t,e){if(xs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(xs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function TP(t,e){if(t==null)return{};var n=EP(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function EP(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var ud=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=TP(t,NP);return h.jsxs("svg",Ql(Ql({fill:"currentColor",fillRule:"evenodd",height:n,style:Ql({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Ys}),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 ys(t){"@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(t)}function Fp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function RP(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Fp(Object(n),!0).forEach(function(r){LP(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Fp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function LP(t,e,n){return e=IP(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function IP(t){var e=$P(t,"string");return ys(e)=="symbol"?e:String(e)}function $P(t,e){if(ys(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ys(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function BP(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var FP=g.memo(function(t){var e=Object.assign({},(BP(t),t));return h.jsx(_n,RP({Icon:ud,"aria-label":Ys,background:jP,color:OP,iconMultiple:PP},e))});function vs(t){"@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(t)}var VP=["size","style"];function Vp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Xl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Vp(Object(n),!0).forEach(function(r){zP(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Vp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function zP(t,e,n){return e=_P(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _P(t){var e=HP(t,"string");return vs(e)=="symbol"?e:String(e)}function HP(t,e){if(vs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(vs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function WP(t,e){if(t==null)return{};var n=UP(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function UP(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var mx=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=WP(t,VP);return h.jsxs("svg",Xl(Xl({fill:"currentColor",fillRule:"evenodd",height:n,style:Xl({flex:"none",lineHeight:1},r),viewBox:"0 0 154 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Ys}),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 ws(t){"@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(t)}function zp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function KP(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?zp(Object(n),!0).forEach(function(r){GP(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):zp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function GP(t,e,n){return e=qP(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qP(t){var e=JP(t,"string");return ws(e)=="symbol"?e:String(e)}function JP(t,e){if(ws(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ws(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function YP(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var QP=g.memo(function(t){var e=Object.assign({},(YP(t),t));return h.jsx(Hn,KP({Icon:ud,Text:mx,"aria-label":Ys,spaceMultiple:CP,textMultiple:SP},e))}),Yr=ud;Yr.Text=mx;Yr.Combine=QP;Yr.Avatar=FP;Yr.colorPrimary=px;Yr.title=Ys;var Qs="Cline",XP=.7,ZP=.2,gx="#323B43",e7=gx,t7="#fff",n7=.6;function ks(t){"@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(t)}var r7=["size","style"];function _p(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Zl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?_p(Object(n),!0).forEach(function(r){i7(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_p(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function i7(t,e,n){return e=s7(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s7(t){var e=o7(t,"string");return ks(e)=="symbol"?e:String(e)}function o7(t,e){if(ks(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ks(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function a7(t,e){if(t==null)return{};var n=l7(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function l7(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var fd=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=a7(t,r7);return h.jsxs("svg",Zl(Zl({fill:"currentColor",fillRule:"evenodd",height:n,style:Zl({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Qs}),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 Ss(t){"@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(t)}function Hp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function c7(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Hp(Object(n),!0).forEach(function(r){h7(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Hp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function h7(t,e,n){return e=d7(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function d7(t){var e=u7(t,"string");return Ss(e)=="symbol"?e:String(e)}function u7(t,e){if(Ss(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ss(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function f7(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var p7=g.memo(function(t){var e=Object.assign({},(f7(t),t));return h.jsx(_n,c7({Icon:fd,"aria-label":Qs,background:e7,color:t7,iconMultiple:n7},e))});function Cs(t){"@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(t)}var m7=["size","style"];function Wp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ec(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Wp(Object(n),!0).forEach(function(r){g7(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Wp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function g7(t,e,n){return e=b7(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function b7(t){var e=x7(t,"string");return Cs(e)=="symbol"?e:String(e)}function x7(t,e){if(Cs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Cs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function y7(t,e){if(t==null)return{};var n=v7(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function v7(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var bx=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=y7(t,m7);return h.jsxs("svg",ec(ec({fill:"currentColor",fillRule:"evenodd",height:n,style:ec({flex:"none",lineHeight:1},r),viewBox:"0 0 88 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Qs}),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 js(t){"@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(t)}function Up(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function w7(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Up(Object(n),!0).forEach(function(r){k7(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Up(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function k7(t,e,n){return e=S7(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function S7(t){var e=C7(t,"string");return js(e)=="symbol"?e:String(e)}function C7(t,e){if(js(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(js(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function j7(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var O7=g.memo(function(t){var e=Object.assign({},(j7(t),t));return h.jsx(Hn,w7({Icon:fd,Text:bx,"aria-label":Qs,iconProps:{shape:"square"},spaceMultiple:ZP,textMultiple:XP},e))}),Qr=fd;Qr.Text=bx;Qr.Combine=O7;Qr.Avatar=p7;Qr.colorPrimary=gx;Qr.title=Qs;var Xs="Cursor",P7=.7,N7=.1,xx="#000",A7=xx,M7="#fff",D7=.6;function Os(t){"@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(t)}var T7=["size","style"];function Kp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function tc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Kp(Object(n),!0).forEach(function(r){E7(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Kp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function E7(t,e,n){return e=R7(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function R7(t){var e=L7(t,"string");return Os(e)=="symbol"?e:String(e)}function L7(t,e){if(Os(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Os(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function I7(t,e){if(t==null)return{};var n=$7(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function $7(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var pd=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=I7(t,T7);return h.jsxs("svg",tc(tc({fill:"currentColor",fillRule:"evenodd",height:n,style:tc({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Xs}),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 Ps(t){"@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(t)}function Gp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function B7(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Gp(Object(n),!0).forEach(function(r){F7(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Gp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function F7(t,e,n){return e=V7(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function V7(t){var e=z7(t,"string");return Ps(e)=="symbol"?e:String(e)}function z7(t,e){if(Ps(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ps(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function _7(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var H7=g.memo(function(t){var e=Object.assign({},(_7(t),t));return h.jsx(_n,B7({Icon:pd,"aria-label":Xs,background:A7,color:M7,iconMultiple:D7},e))});function Ns(t){"@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(t)}var W7=["size","style"];function qp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function nc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?qp(Object(n),!0).forEach(function(r){U7(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):qp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function U7(t,e,n){return e=K7(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function K7(t){var e=G7(t,"string");return Ns(e)=="symbol"?e:String(e)}function G7(t,e){if(Ns(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ns(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function q7(t,e){if(t==null)return{};var n=J7(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function J7(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var yx=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=q7(t,W7);return h.jsxs("svg",nc(nc({fill:"currentColor",fillRule:"evenodd",height:n,style:nc({flex:"none",lineHeight:1},r),viewBox:"0 0 123 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Xs}),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 As(t){"@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(t)}function Jp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Y7(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Jp(Object(n),!0).forEach(function(r){Q7(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Jp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Q7(t,e,n){return e=X7(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function X7(t){var e=Z7(t,"string");return As(e)=="symbol"?e:String(e)}function Z7(t,e){if(As(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(As(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function e8(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var t8=g.memo(function(t){var e=Object.assign({},(e8(t),t));return h.jsx(Hn,Y7({Icon:pd,Text:yx,"aria-label":Xs,spaceMultiple:N7,textMultiple:P7},e))}),Xr=pd;Xr.Text=yx;Xr.Combine=t8;Xr.Avatar=H7;Xr.colorPrimary=xx;Xr.title=Xs;var Zs="Goose",n8=.7,r8=.2,vx="#fff",i8=vx,s8="#000",o8=.65;function Ms(t){"@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(t)}var a8=["size","style"];function Yp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function rc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Yp(Object(n),!0).forEach(function(r){l8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Yp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function l8(t,e,n){return e=c8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function c8(t){var e=h8(t,"string");return Ms(e)=="symbol"?e:String(e)}function h8(t,e){if(Ms(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ms(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function d8(t,e){if(t==null)return{};var n=u8(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function u8(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var md=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=d8(t,a8);return h.jsxs("svg",rc(rc({fill:"currentColor",fillRule:"evenodd",height:n,style:rc({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Zs}),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 Ds(t){"@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(t)}function Qp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function f8(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Qp(Object(n),!0).forEach(function(r){p8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Qp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function p8(t,e,n){return e=m8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function m8(t){var e=g8(t,"string");return Ds(e)=="symbol"?e:String(e)}function g8(t,e){if(Ds(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ds(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function b8(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var x8=g.memo(function(t){var e=Object.assign({},(b8(t),t));return h.jsx(_n,f8({Icon:md,"aria-label":Zs,background:i8,color:s8,iconMultiple:o8},e))});function Ts(t){"@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(t)}var y8=["size","style"];function Xp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ic(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Xp(Object(n),!0).forEach(function(r){v8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Xp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function v8(t,e,n){return e=w8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function w8(t){var e=k8(t,"string");return Ts(e)=="symbol"?e:String(e)}function k8(t,e){if(Ts(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ts(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function S8(t,e){if(t==null)return{};var n=C8(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function C8(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var wx=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=S8(t,y8);return h.jsxs("svg",ic(ic({fill:"currentColor",fillRule:"evenodd",height:n,style:ic({flex:"none",lineHeight:1},r),viewBox:"0 0 87 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Zs}),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 Es(t){"@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(t)}function Zp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function j8(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Zp(Object(n),!0).forEach(function(r){O8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Zp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function O8(t,e,n){return e=P8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function P8(t){var e=N8(t,"string");return Es(e)=="symbol"?e:String(e)}function N8(t,e){if(Es(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Es(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function A8(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var M8=g.memo(function(t){var e=Object.assign({},(A8(t),t));return h.jsx(Hn,j8({Icon:md,Text:wx,"aria-label":Zs,iconProps:{shape:"square"},spaceMultiple:r8,textMultiple:n8},e))}),Zr=md;Zr.Text=wx;Zr.Combine=M8;Zr.Avatar=x8;Zr.colorPrimary=vx;Zr.title=Zs;var eo="Windsurf",D8=.7,T8=.2,kx="#fff",E8=kx,R8="#000",L8=.75;function Rs(t){"@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(t)}var I8=["size","style"];function em(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function sc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?em(Object(n),!0).forEach(function(r){$8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):em(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function $8(t,e,n){return e=B8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function B8(t){var e=F8(t,"string");return Rs(e)=="symbol"?e:String(e)}function F8(t,e){if(Rs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Rs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function V8(t,e){if(t==null)return{};var n=z8(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function z8(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var gd=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=V8(t,I8);return h.jsxs("svg",sc(sc({fill:"currentColor",fillRule:"evenodd",height:n,style:sc({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:eo}),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 Ls(t){"@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(t)}function tm(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function _8(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?tm(Object(n),!0).forEach(function(r){H8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tm(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function H8(t,e,n){return e=W8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function W8(t){var e=U8(t,"string");return Ls(e)=="symbol"?e:String(e)}function U8(t,e){if(Ls(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ls(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function K8(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var G8=g.memo(function(t){var e=Object.assign({},(K8(t),t));return h.jsx(_n,_8({Icon:gd,"aria-label":eo,background:E8,color:R8,iconMultiple:L8},e))});function Is(t){"@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(t)}var q8=["size","style"];function nm(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function oc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?nm(Object(n),!0).forEach(function(r){J8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):nm(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function J8(t,e,n){return e=Y8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Y8(t){var e=Q8(t,"string");return Is(e)=="symbol"?e:String(e)}function Q8(t,e){if(Is(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Is(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function X8(t,e){if(t==null)return{};var n=Z8(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Z8(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var Sx=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=X8(t,q8);return h.jsxs("svg",oc(oc({fill:"currentColor",fillRule:"evenodd",height:n,style:oc({flex:"none",lineHeight:1},r),viewBox:"0 0 111 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:eo}),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 $s(t){"@babel/helpers - typeof";return $s=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},$s(t)}function rm(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function eN(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?rm(Object(n),!0).forEach(function(r){tN(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):rm(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function tN(t,e,n){return e=nN(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function nN(t){var e=rN(t,"string");return $s(e)=="symbol"?e:String(e)}function rN(t,e){if($s(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if($s(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function iN(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var sN=g.memo(function(t){var e=Object.assign({},(iN(t),t));return h.jsx(Hn,eN({Icon:gd,Text:Sx,"aria-label":eo,iconProps:{shape:"square"},spaceMultiple:T8,textMultiple:D8},e))}),ei=gd;ei.Text=Sx;ei.Combine=sN;ei.Avatar=G8;ei.colorPrimary=kx;ei.title=eo;const oN={"claude-code":fr.Avatar,cursor:Xr.Avatar,codex:Ct.Avatar,"gemini-cli":pr.Avatar,goose:Zr.Avatar,"github-copilot":Yr.Avatar,windsurf:ei.Avatar,cline:Qr.Avatar},aN={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 lN(t){return t.split(/\s+/).map(e=>e[0]).join("").toUpperCase().slice(0,2)}const Cx=({agentName:t,displayName:e,size:n=20})=>{const r=oN[t];if(r)return h.jsx(r,{size:n});const i=aN[t];return i?h.jsx("img",{src:i,alt:e,className:"rounded object-contain",style:{width:n,height:n}}):h.jsx("div",{className:"flex items-center justify-center rounded bg-dash-surface-hover text-dash-text-muted font-semibold",style:{width:n,height:n,fontSize:n*.45},children:lN(e)})};function ac(t){return JSON.stringify([t.provider,t.type,t.item,t.global])}function cN(t){if(typeof t=="string"){const e=t.trim();return e.length>0?e:null}if(typeof t=="object"&&t!==null){const e=t;for(const n of["message","error","detail","details","reason"]){const r=e[n];if(typeof r=="string"&&r.trim().length>0)return r.trim()}}return null}async function im(t,e){const r=(await t.text().catch(()=>"")).trim();if(!r)return e;try{const i=JSON.parse(r);return cN(i)||e}catch{return r}}function hN(){const[t,e]=g.useState("idle"),[n,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 C=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 im(y,"Failed to reconcile migration plan");throw new Error(A)}const M=await y.json();if(C!==d.current)return;r(M.plan),s(new Map),e("reviewing")}catch(O){if(k.signal.aborted||O instanceof DOMException&&O.name==="AbortError"||C!==d.current)return;c(O instanceof Error?O.message:"Failed to reconcile"),e("error")}},[]),b=g.useCallback((S,C)=>{s(k=>{const O=new Map(k);return O.set(ac(S),C),O})},[]),x=g.useCallback(async()=>{if(!n)return c("No plan to execute"),e("error"),!1;e("executing"),c(null),u.current+=1;const S=u.current;p.current?.abort();const C=new AbortController;p.current=C;try{const k=Object.fromEntries(i.entries()),O=await fetch("/api/migrate/execute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:n,resolutions:k}),signal:C.signal});if(S!==u.current)return!1;if(!O.ok){const M=await im(O,"Failed to execute migration");if(O.status===501)return c(M||"Plan execution is not available in this server build"),e("reviewing"),!1;throw new Error(M)}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 C.signal.aborted||k instanceof DOMException&&k.name==="AbortError"||S!==u.current||(c(k instanceof Error?k.message:"Failed to execute migration"),e("error")),!1}},[n,i]),w=g.useCallback(()=>{f.current?.abort(),p.current?.abort(),e("idle"),r(null),s(new Map),a(null),c(null)},[]),v=g.useMemo(()=>n?n.actions.filter(S=>S.action==="conflict").every(S=>i.has(ac(S))):!0,[n,i]);return{phase:t,plan:n,resolutions:i,results:o,error:l,reconcile:m,resolve:b,execute:x,reset:w,allConflictsResolved:v,actionKey:ac}}const dN={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"},sm={detected:"#D4A574","not-detected":"#8B9DC3"},lt=({label:t,value:e,tone:n="default"})=>{const r=n==="accent"?"text-dash-accent":n==="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:t}),h.jsx("p",{className:`mt-1 text-lg font-semibold ${r}`,children:e})]})};function om(t,e){return t.success?t.skipped?{label:e("migrateStatusSkipped"),className:"text-yellow-400"}:{label:e("migrateStatusInstalled"),className:"text-green-400"}:{label:e("migrateStatusFailed"),className:"text-red-400"}}const uN=new Set([8203,8204,8205,8288,65279,8232,8233,8234,8235,8236,8237,8238,8294,8295,8296,8297]);function fN(t){return t===9||t===10||t===13?!0:t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159||uN.has(t)}function am(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(fN(r)||(e+=n))}return e}const pN=({provider:t,include:e,isSelected:n,cardClickToggles:r,onToggleSelect:i,onOpenDetails:s,t:o})=>{const a=Nt.filter(c=>t.capabilities[c]).length,l=Nt.some(c=>e[c]&&!t.capabilities[c]);return h.jsxs("div",{className:`relative rounded-xl border px-4 py-3 cursor-pointer transition-all ${n?"bg-dash-accent-subtle border-dash-accent/30 shadow-sm shadow-dash-accent/10":l?"bg-dash-surface border-yellow-500/25 hover:bg-dash-surface-hover hover:border-yellow-500/40":"bg-dash-surface border-dash-border hover:bg-dash-surface-hover hover:border-dash-accent/25"}`,children:[h.jsx("button",{type:"button",onClick:()=>r?i(t.name):s(t.name),"aria-label":r?`${t.displayName} deselect`:`${t.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(Cx,{agentName:t.name,displayName:t.displayName,size:18}),h.jsx("span",{className:"text-sm font-semibold text-dash-text truncate",children:t.displayName}),t.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")}),t.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:[t.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:t.detected?"text-dash-accent":"text-dash-text-muted",children:t.detected?o("migrateDetectedTag"):o("migrateNotDetectedTag")}),h.jsx("span",{className:"text-dash-text-muted",children:t.recommended?o("migrateFilterRecommended"):"-"})]}),h.jsx("div",{className:"flex flex-wrap gap-1",children:Nt.map(c=>{const d=t.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(t.name)},className:`dash-focus-ring px-4 py-1.5 text-xs font-semibold rounded-md transition-colors ${n?"bg-transparent text-dash-text-secondary border border-dash-border hover:bg-dash-surface-hover":"bg-dash-accent text-white hover:bg-dash-accent/90"}`,children:o(n?"migrateSelectedButton":"migrateSelectButton")})})]})]})},mN=({provider:t,include:e,isSelected:n,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":t.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(Cx,{agentName:t.name,displayName:t.displayName,size:22}),h.jsx("h2",{className:"text-xl font-bold text-dash-text truncate",children:t.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:t.name}),h.jsx("span",{className:`text-[10px] uppercase tracking-wide px-2 py-0.5 rounded border ${t.detected?"border-dash-accent/30 text-dash-accent":"border-dash-border text-dash-text-muted"}`,children:t.detected?o("migrateDetectedTag"):o("migrateNotDetectedTag")}),t.recommended&&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=t.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)})})]}),t.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 ${om(r,o).className}`,children:om(r,o).label})]}),h.jsx("p",{className:"text-xs font-mono text-dash-text break-all",children:am(r.path||"-")}),(r.error||r.skipReason)&&h.jsx("p",{className:"text-xs text-red-400 break-words",children:am(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(t.name),className:`px-4 py-2 text-sm font-semibold rounded-md transition-colors ${n?"bg-transparent text-dash-text-secondary border border-dash-border hover:bg-dash-surface-hover":"bg-dash-accent text-white hover:bg-dash-accent/90"}`,children:o(n?"migrateUnselectProvider":"migrateSelectProviderAction")}),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")})]})]})})},gN=()=>{const{t}=he(),e=hN(),[n,r]=g.useState([]),[i,s]=g.useState(null),[o,a]=g.useState([]),[l,c]=g.useState(dN),[d,u]=g.useState(!0),[f,p]=g.useState(!0),[m,b]=g.useState(!1),[x,w]=g.useState(null),[v,S]=g.useState(""),C=g.useDeferredValue(v),[k,O]=g.useState("all"),[y,M]=g.useState(null),A=g.useRef(0),R=g.useCallback(async(I=!1)=>{A.current+=1;const K=A.current;try{I?b(!0):p(!0),w(null);const[ae,De]=await Promise.all([Fv(),su()]);if(K!==A.current)return;r(ae.providers),s(De),a(Ut=>{if(Ut.length===0)return[];const to=ae.providers.map(ti=>ti.name);return Ut.filter(ti=>to.includes(ti))})}catch(ae){if(K!==A.current)return;w(ae instanceof Error?ae.message:t("migrateDetectFailed"))}finally{K===A.current&&(p(!1),b(!1))}},[t]);g.useEffect(()=>{R()},[R]);const N=g.useMemo(()=>{const I=new Map;for(const K of n)I.set(K.name,K);return I},[n]),L=g.useMemo(()=>y&&N.get(y)||null,[y,N]);g.useEffect(()=>{y&&!N.has(y)&&M(null)},[y,N]);const H=g.useCallback(()=>{M(null)},[]),$=g.useMemo(()=>new Set(o),[o]),F=g.useMemo(()=>n.filter(I=>I.detected).length,[n]),G=o.length,ue=g.useMemo(()=>n.filter(I=>I.recommended).length,[n]),X=g.useMemo(()=>Nt.filter(I=>l[I]).length,[l]),te=g.useMemo(()=>{const I=[];l.commands&&o.includes("codex")&&!d&&N.get("codex")?.commandsGlobalOnly&&I.push(t("migrateGlobalForced"));for(const K of Nt){if(!l[K])continue;const ae=o.filter(De=>!N.get(De)?.capabilities[K]).map(De=>N.get(De)?.displayName||De);ae.length>0&&I.push(`${t("migrateUnsupported")}: ${t(Zn[K])} -> ${ae.join(", ")}`)}return I},[l,d,N,o,t]),oe=g.useCallback(I=>{if(I==="codex"){a(["codex"]);return}if(I==="antigravity"){a(["antigravity"]);return}if(I==="core"){const ae=["codex","antigravity","droid"].filter(De=>n.some(Ut=>Ut.name===De));a(ae);return}const K=n.filter(ae=>ae.detected).map(ae=>ae.name);a(K)},[n]),pe=g.useCallback(I=>{a(K=>K.includes(I)?K.filter(ae=>ae!==I):[...K,I])},[]),Y=g.useCallback(I=>{c(K=>({...K,[I]:!K[I]}))},[]),le=g.useMemo(()=>{const I=[...n];return I.sort((K,ae)=>{const De=$.has(K.name),Ut=$.has(ae.name);return De!==Ut?De?-1:1:K.detected!==ae.detected?K.detected?-1:1:K.recommended!==ae.recommended?K.recommended?-1:1:K.displayName.localeCompare(ae.displayName)}),I},[n,$]),me=g.useMemo(()=>{const I=C.trim().toLowerCase();return le.filter(K=>{if(k==="selected"&&!$.has(K.name)||k==="detected"&&!K.detected||k==="recommended"&&!K.recommended||k==="not-detected"&&K.detected)return!1;if(!I)return!0;const ae=Nt.filter(De=>K.capabilities[De]).map(De=>t(Zn[De]).toLowerCase());return K.displayName.toLowerCase().includes(I)||K.name.toLowerCase().includes(I)||ae.some(De=>De.includes(I))})},[C,k,$,le,t]),ke=g.useMemo(()=>{const I=me.filter(De=>De.detected),K=me.filter(De=>!De.detected),ae=[];return I.length>0&&ae.push({key:"detected",label:t("migrateDetectedTag"),providers:I}),K.length>0&&ae.push({key:"not-detected",label:t("migrateNotDetectedTag"),providers:K}),ae},[me,t]),Qe=g.useMemo(()=>({all:n.length,selected:G,detected:n.filter(I=>I.detected).length,recommended:n.filter(I=>I.recommended).length,"not-detected":n.filter(I=>!I.detected).length}),[n,G]),mt=g.useMemo(()=>me.map(I=>I.name),[me]),q=g.useCallback(()=>{a(I=>{const K=new Set(I);for(const ae of mt)K.add(ae);return Array.from(K)})},[mt]),Me=g.useCallback(()=>{a([])},[]),Ce=g.useCallback(async()=>{if(o.length===0){w(t("migrateSelectProvider"));return}if(X===0){w(t("migrateNoTypesEnabled"));return}await e.reconcile({providers:o,global:d,include:l})},[X,l,d,o,t,e]),Ie=g.useCallback(async()=>{if(w(null),!!await e.execute())try{const K=await su();s(K)}catch(K){console.error("Failed to refresh discovery:",K)}},[e]),Se=g.useMemo(()=>{const I=new Map;if(!e.results)return I;for(const K of e.results.results)I.set(K.provider,K);return I},[e.results]);g.useEffect(()=>{const I=K=>{const ae=K.target,De=!!(ae&&(ae instanceof HTMLInputElement||ae instanceof HTMLTextAreaElement||ae.isContentEditable||ae.closest('[contenteditable="true"], [role="textbox"]'))),Ut=K.metaKey||K.ctrlKey||K.altKey;K.key==="/"&&!De&&!Ut&&(K.preventDefault(),document.getElementById("migrate-search")?.focus())};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[]);const gt=e.phase==="idle"&&o.length>0&&X>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:t("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:t("migrate")}),h.jsx("h1",{className:"text-xl md:text-2xl font-semibold text-dash-text",children:t("migrateTitle")}),h.jsx("p",{className:"text-sm text-dash-text-secondary max-w-3xl",children:t("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:t("migrateInstalled"),value:e.results.counts.installed,tone:"success"}),h.jsx(lt,{label:t("migrateSkipped"),value:e.results.counts.skipped}),h.jsx(lt,{label:t("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:t("migrateTypeAgents"),value:i?.counts.agents??0}),h.jsx(lt,{label:t("migrateDetectedProviders"),value:F,tone:"success"}),h.jsx(lt,{label:t("migrateSelectedProviders"),value:G,tone:"accent"}),h.jsx(lt,{label:t("migrateTypes"),value:X})]})]})}),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:t("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:t("cancel")})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto px-5 pb-4",children:[h.jsx(Gj,{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:t("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:t("migrateExecutePlan")})]})]}),e.phase==="complete"&&e.results&&h.jsx(Ej,{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:t("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"?t("migrateReconciling"):t("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:t("migrateSearchProviders"),className:"dash-focus-ring w-full pl-9 pr-12 py-2 bg-dash-bg border border-dash-border rounded-lg text-dash-text text-sm focus:border-dash-accent transition-colors"}),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:t("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:t(m?"checking":"migrateRefresh")}),h.jsx("button",{type:"button",onClick:q,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:t("migrateSelectVisible")}),h.jsx("button",{type:"button",onClick:Me,disabled:G===0,className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-50 whitespace-nowrap",children:t("migrateClearSelection")})]})]}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{key:"all",label:t("categoryAll")},{key:"selected",label:t("migrateSelectedProviders")},{key:"detected",label:t("migrateDetectedProviders")},{key:"recommended",label:t("migrateFilterRecommended")},{key:"not-detected",label:t("migrateNotDetectedTag")}].map(I=>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:t("migrateTypes")}),h.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Nt.map(I=>h.jsx("button",{type:"button",onClick:()=>Y(I),className:`dash-focus-ring px-2.5 py-1 text-[11px] uppercase tracking-wide rounded-md border transition-colors ${l[I]?"border-dash-accent/45 text-dash-accent bg-dash-accent/5":"border-dash-border text-dash-text-muted hover:bg-dash-surface-hover"}`,children:t(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:t("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:t(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:t("migrateProvidersHeading")}),h.jsxs("p",{className:"text-xs text-dash-text-muted",children:[me.length," ",t("migrateProvidersCountSuffix")]})]}),n.length===0?h.jsx("div",{className:"text-sm text-dash-text-muted",children:t("migrateNoProviders")}):me.length===0?h.jsx("div",{className:"text-sm text-dash-text-muted",children:t("migrateNoProvidersMatch")}):h.jsx("div",{className:"space-y-5",children:ke.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:sm[I.key]}}),h.jsx("h2",{className:"text-[13px] font-semibold uppercase tracking-wide",style:{color:sm[I.key]},children:I.label}),h.jsxs("span",{className:"text-[11px] text-dash-text-muted ml-auto",children:[I.providers.length," ",t("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(K=>h.jsx(pN,{provider:K,include:l,isSelected:$.has(K.name),cardClickToggles:k==="selected",onToggleSelect:pe,onOpenDetails:M,t},K.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:t("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," ",t("migrateSummarySubtitle")]})]}),h.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[h.jsx(lt,{label:t("migrateInstalled"),value:e.results.counts.installed,tone:"success"}),h.jsx(lt,{label:t("migrateSkipped"),value:e.results.counts.skipped}),h.jsx(lt,{label:t("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:t("migrateTypes")}),Nt.map(I=>{const K=e.results?.discovery?.[I]??0;return K===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:t(Zn[I])}),h.jsx("span",{className:"font-semibold text-dash-text",children:K})]},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:t("migrateSummaryProviders")}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:o.map(I=>{const K=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:K?.displayName||I},I)})})]}),h.jsx("div",{className:"text-[10px] px-3 py-1.5 bg-dash-bg rounded-md text-dash-text-muted",children:t(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:t("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:t("migrateActionSummaryTitle")}),h.jsxs("p",{className:"text-xs text-dash-text-muted mt-1",children:[G," ",t("migrateProvidersCountSuffix")," ·"," ",X,"/",Nt.length," ",t("migrateTypes")]})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h.jsx(lt,{label:t("migrateSelectedProviders"),value:G,tone:"accent"}),h.jsx(lt,{label:t("migrateDetectedProviders"),value:F}),h.jsx(lt,{label:t("migrateTypes"),value:X}),h.jsx(lt,{label:t("migrateFilterRecommended"),value:ue,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:t("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:t("migrateScopeGlobal")})]}),h.jsx("button",{type:"button",onClick:Ce,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"?t("migrateRunning"):t("migrateRun")}),te.length>0&&h.jsx("div",{className:"space-y-2",children:te.map((I,K)=>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}-${K}`))})]}),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:t("migrateSelectProviderAction")}),h.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h.jsx("button",{type:"button",onClick:()=>oe("codex"),className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover",children:t("migratePresetCodex")}),h.jsx("button",{type:"button",onClick:()=>oe("antigravity"),className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover",children:t("migratePresetAntigravity")}),h.jsx("button",{type:"button",onClick:()=>oe("core"),className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover",children:t("migratePresetCore")}),h.jsx("button",{type:"button",onClick:()=>oe("detected"),className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover",children:t("migratePresetDetected")})]})]})]})})]})]}),L&&h.jsx(mN,{provider:L,include:l,isSelected:$.has(L.name),latestResult:Se.get(L.name)||null,onToggleSelect:pe,onClose:H,t})]})},bN=({featureId:t,name:e,description:n,included:r})=>{const{t:i}=he();return h.jsxs("div",{"data-testid":`feature-card-${t}`,className:`p-4 rounded-lg border transition-all ${r?"border-[var(--dash-accent)] bg-[var(--dash-surface)] shadow-sm":"border-[var(--dash-border)] bg-[var(--dash-bg)] opacity-50"}`,children:[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(n)})]})},xN=({selectedKit:t,onKitSelect:e,onInstall:n,installing:r})=>{const{t:i}=he(),[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(lc,{number:1,active:s===1,label:i("stepChooseKit")}),h.jsx("div",{className:"flex-1 h-px bg-[var(--dash-border)]"}),h.jsx(lc,{number:2,active:s===2,label:i("stepConfigure")}),h.jsx("div",{className:"flex-1 h-px bg-[var(--dash-border)]"}),h.jsx(lc,{number:3,active:s===3,label:i("stepInstall")})]}),h.jsxs("div",{className:"min-h-[200px]",children:[s===1&&h.jsx(yN,{onSelect:e,selected:t}),s===2&&t&&h.jsx(vN,{kit:t}),s===3&&h.jsx(wN,{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&&t&&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:n,disabled:r,className:"px-4 py-2 text-sm font-medium text-white bg-[var(--dash-accent)] rounded-lg hover:opacity-90 transition-opacity disabled:opacity-50 disabled:cursor-not-allowed","data-testid":"wizard-install",children:i("install")})]})]})},lc=({number:t,active:e,label:n})=>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:t}),h.jsx("span",{className:`text-sm font-medium ${e?"text-[var(--dash-text)]":"text-[var(--dash-text-muted)]"}`,children:n})]}),yN=({onSelect:t,selected:e})=>{const{t:n}=he();return h.jsxs("div",{className:"space-y-4",children:[h.jsx("p",{className:"text-[var(--dash-text-muted)]",children:e?`Selected: ${e===Qt.ENGINEER?n("kitEngineerName"):n("kitMarketingName")}`:"Please select a kit above"}),e&&h.jsxs("button",{type:"button",onClick:()=>t(e===Qt.ENGINEER?Qt.MARKETING:Qt.ENGINEER),className:"text-sm text-[var(--dash-accent)] hover:underline",children:["Switch to ",e===Qt.ENGINEER?n("kitMarketingName"):n("kitEngineerName")]})]})},vN=()=>h.jsx("div",{className:"text-[var(--dash-text-muted)]",children:"Configuration preview placeholder"}),wN=({installing:t})=>h.jsx("div",{className:"text-[var(--dash-text-muted)]",children:t?"Installing...":"Ready to install"}),kN=({kit:t,onGetStarted:e})=>{const{t:n}=he(),r=an(),i=t===Qt.ENGINEER?"kitEngineerName":t===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:n("installSuccess")}),h.jsx("p",{className:"text-[var(--dash-text-muted)] max-w-md mx-auto",children:n("installSuccessDesc").replace("{kit}",n(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:n("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:n("goToDashboard")})]})]})},SN=[{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}],jx={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 CN(t){const e=jx[t];return e?SN.filter(n=>e.features.includes(n.id)):(console.warn(`Unknown kit type: ${t}`),[])}const jN=({kit:t,selected:e,onSelect:n,features:r})=>{const{t:i}=he();return h.jsxs("button",{type:"button",onClick:n,className:`p-6 rounded-lg border-2 text-left transition-all w-full ${e?"border-[var(--dash-accent)] bg-[var(--dash-surface)] shadow-md":"border-[var(--dash-border)] hover:border-[var(--dash-accent)]/50"}`,children:[h.jsx("h3",{className:`text-xl font-bold ${t.primaryColor}`,children:i(t.name)}),h.jsx("p",{className:"text-[var(--dash-text-muted)] mt-1",children:i(t.tagline)}),h.jsx("div",{className:"mt-4 space-y-2",children:r.slice(0,3).map(s=>h.jsx(bN,{featureId:s.id,name:s.name,description:s.description,included:!0},s.id))})]})},ON=()=>{const{t}=he(),e=an(),[n,r]=g.useState(null),[i,s]=g.useState(!1),[o,a]=g.useState(!1),[l,c]=g.useState(null),d=async()=>{if(n){s(!0),c(null);try{const f=await fetch("/api/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kit:n})});if(!f.ok)throw new Error(`Installation failed: ${f.statusText}`);a(!0)}catch(f){const p=f instanceof Error?f.message:"Unknown error occurred";c(p),console.error("Install failed:",f)}finally{s(!1)}}};if(o&&n)return h.jsx(kN,{kit:n,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:t("onboardingTitle")}),h.jsx("p",{className:"mt-2 text-[var(--dash-text-muted)]",children:t("onboardingSubtitle")})]}),h.jsx("section",{className:"grid md:grid-cols-2 gap-6 mb-8",children:Object.values(jx).map(f=>{const p=u(f.id);return h.jsx(jN,{kit:f,selected:n===p,onSelect:()=>r(p),features:CN(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"})]}),n&&h.jsx(xN,{selectedKit:n,onKitSelect:r,onInstall:d,installing:i})]})},PN=()=>{const{t}=he(),e=an(),{projectId:n}=$m(),[r,i]=g.useState(null),{sizes:s,isDragging:o,startDrag:a}=hh({storageKey:"claudekit-project-config-panels",defaultSizes:[35,40,25],minSizes:[20,25,15]}),l=g.useCallback(async()=>{if(!n)throw new Error("No project ID");const[b,x,w]=await Promise.all([pp("project",n),pp("global"),Ch()]),v=w.find(S=>S.id===n);return v&&i(v.path),{...b,global:x.config??{}}},[n]),c=g.useCallback(async b=>{n&&await Yb({scope:"project",projectId:n,config:b})},[n]),d=Jb({scope:"project",fetchConfig:l,fetchSchema:Qb,saveConfig:c}),u=g.useCallback(b=>{const x=mc(d.config,b),w=mc(d.globalConfig,b);return x!==void 0&&w!==void 0&&x!==w},[d.config,d.globalConfig]),f=g.useMemo(()=>[{id:"paths",title:t("sectionPaths"),fields:[{path:"paths.docs",label:t("fieldDocsPath"),description:t("fieldDocsPathDesc")},{path:"paths.plans",label:t("fieldPlansPath"),description:t("fieldPlansPathDesc")}]},{id:"project",title:t("sectionProject"),fields:[{path:"project.type",label:t("fieldProjectType"),description:t("fieldProjectTypeDesc")},{path:"project.packageManager",label:t("fieldPackageManager"),description:t("fieldPackageManagerDesc")},{path:"project.framework",label:t("fieldFramework"),description:t("fieldFrameworkDesc")}]},{id:"privacy",title:t("sectionPrivacy"),defaultCollapsed:!0,fields:[{path:"privacyBlock",label:t("fieldPrivacyBlock"),description:t("fieldPrivacyBlockDesc")}]},{id:"advanced",title:t("sectionAdvanced"),defaultCollapsed:!0,fields:[{path:"docs.maxLoc",label:t("fieldDocsMaxLoc"),description:t("fieldDocsMaxLocDesc")},{path:"plan.namingFormat",label:t("fieldPlanNamingFormat"),description:t("fieldPlanNamingFormatDesc")}]}],[t]),p=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:t("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:t("inheritedFromGlobal")}),h.jsxs("p",{className:"text-[12px] text-dash-text-secondary leading-normal",children:[t("viewGlobalConfig")," ",h.jsx("button",{onClick:()=>e("/config/global"),className:"text-dash-accent hover:underline font-medium",children:t("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(Gm,{title:t("projectConfig"),filePath:r?`${r}/.claude/.ck.json`:".claude/.ck.json",onBack:()=>e(`/project/${n}`),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(Qm,{width:s[0],isLoading:d.isLoading,schema:d.schema,config:d.config,sources:d.sources,sections:f,onChange:d.handleFormChange,onFieldFocus:d.setFocusedFieldPath}),h.jsx(tr,{direction:"horizontal",isDragging:o,onMouseDown:b=>a(0,b)}),h.jsx(od,{width:s[1],isLoading:d.isLoading,jsonText:d.jsonText,cursorLine:d.cursorLine,syntaxError:d.syntaxError,onChange:d.handleJsonChange,onEditorFocus:d.handleJsonEditorFocus,onCursorLineChange:d.setCursorLine}),h.jsx(tr,{direction:"horizontal",isDragging:o,onMouseDown:b=>a(1,b)}),h.jsx(Kb,{width:s[2],fieldDoc:d.fieldDoc,activeFieldPath:d.activeFieldPath,overrideBadge:p,extraContent:m})]})]})},Ot="__global__",NN=({project:t})=>{const{t:e}=he(),n=an(),{skills:r,loading:i}=Vv(),{sessions:s,loading:o}=zv(t.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 Tv(N,t.path,L,t.id)}catch(H){alert(`${e("actionFailed")}: ${H instanceof Error?H.message:N}`)}},v=g.useCallback(()=>{const N=new AbortController;return d(!0),f(null),Dv(t.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},[t.id,e]);g.useEffect(()=>{const N=v();return()=>{N.abort()}},[v]);const S=r.filter(N=>t.skills.includes(N.id)),C=a?.terminals||[],k=a?.editors||[],O=C.find(N=>N.id===a?.defaults.terminalApp)?.label||a?.defaults.terminalApp,y=k.find(N=>N.id===a?.defaults.editorApp)?.label||a?.defaults.editorApp,M=g.useMemo(()=>C.find(N=>p===Ot?N.id===a?.defaults.terminalApp:N.id===p),[C,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(!t.id.startsWith("discovered-"))try{await Km(t.id,{preferences:{[N]:L===Ot?null:L}})}catch(H){const $=H instanceof Error?H.message:"Failed to save preference";alert(`${e("actionFailed")}: ${$}`)}};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:t.name}),h.jsx(AN,{status:t.health}),h.jsx(YC,{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"})}),t.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(lm,{icon:"📟",label:e("terminal"),sub:M?`${M.openMode==="open-app"?e("openAppOnly"):e("openAtPath")} • ${M.label}`:e("terminalSub"),onClick:()=>w("terminal",p===Ot?void 0:p),disabled:c||!M&&C.length>0,options:C,value:p,fallbackLabel:a?`${e("useGlobalFallback")} (${O})`:e("useGlobalFallback"),onChange:async N=>{m(N),await R("terminalApp",N)}}),h.jsx(lm,{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(uh,{icon:"🤖",label:e("launch"),sub:e("launchSub"),highlight:!0,onClick:()=>w("launch")}),h.jsx(uh,{icon:"⚙️",label:e("config"),sub:e("configSub"),onClick:()=>n(`/config/project/${t.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(zo,{label:e("activeKit"),value:t.kitType}),h.jsx(zo,{label:e("aiModel"),value:t.model}),h.jsx(zo,{label:e("hooks"),value:`${t.activeHooks} ${e("active")}`}),h.jsx(zo,{label:e("mcpServers"),value:`${t.mcpServers} ${e("connected")}`})]}),h.jsx("button",{onClick:()=>n(`/config/project/${t.id}`),className:"w-full mt-6 py-2 rounded-lg bg-dash-bg text-xs font-bold text-dash-text-secondary hover:bg-dash-surface-hover transition-colors border border-dash-border",children:e("editProjectConfig")})]}),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")," →"]})})]})]})]})]})},AN=({status:t})=>{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[t]}`,children:t})},lm=({icon:t,label:e,sub:n,disabled:r,options:i,value:s,fallbackLabel:o,onClick:a,onChange:l})=>h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx(uh,{icon:t,label:e,sub:n,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))]})]}),uh=({icon:t,label:e,sub:n,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:t}),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:n})]}),zo=({label:t,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:t}),h.jsx("span",{className:"text-dash-text font-bold mono uppercase text-[10px] tracking-tight",children:e})]}),MN=()=>{const{t}=he(),{project:e}=f1();return e?h.jsx(NN,{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:t("selectProject")})]})},DN=lv([{path:"/",element:h.jsx(Wv,{}),children:[{index:!0,element:h.jsx(ol,{to:"/config/global",replace:!0})},{path:"config/global",element:h.jsx(kj,{})},{path:"config/project/:projectId",element:h.jsx(PN,{})},{path:"project/:projectId",element:h.jsx(MN,{})},{path:"onboarding",element:h.jsx(ON,{})},{path:"migrate",element:h.jsx(gN,{})},{path:"kanban",element:h.jsx(jj,{})},{path:"skills",element:h.jsx(ol,{to:"/migrate",replace:!0})},{path:"*",element:h.jsx(ol,{to:"/",replace:!0})}]}]),Ox=document.getElementById("root");if(!Ox)throw document.body.innerHTML='<div style="padding:20px;color:red;">Fatal: Root element not found</div>',new Error("Root element #root not found");cc.createRoot(Ox).render(h.jsx(zx.StrictMode,{children:h.jsx(Cv,{children:h.jsx(jv,{children:h.jsx(wv,{router:DN})})})}));
242
+ cursor-pointer appearance-none`,title:s("selectVersion"),children:o.map(p=>{const m=p.version===r,b=p.version===n,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)})})},nj=({version:t,installedAt:e,channel:n="stable",externalStatus:r,externalLatestVersion:i,onStatusChange:s,disabled:o})=>{const{t:a}=he(),[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 C=O=>{s||c(O)},k=O=>{s||u(O)};C("checking"),s&&s("checking",null);try{const y=await(await fetch(`/api/system/check-updates?target=cli&channel=${n}`)).json();y.updateAvailable?(C("update-available"),k(y.latest),s&&s("update-available",y.latest)):(C("up-to-date"),s&&s("up-to-date",null))}catch{C("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(Gb,{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")}),n==="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",t.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",t.replace(/^v/,"")," ","->"," v",w.replace(/^v/,"")]})]}),h.jsx(rj,{status:x,currentVersion:t,latestVersion:w,onCheck:v,onUpdate:()=>p(!0),onVersionSelect:b,disabled:o})]})}),h.jsx(ad,{isOpen:f,onClose:()=>p(!1),target:"cli",targetVersion:m??w??void 0,onComplete:S})]})},rj=({status:t,currentVersion:e,latestVersion:n,onCheck:r,onUpdate:i,onVersionSelect:s,disabled:o})=>{const{t:a}=he();return t==="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")]}):t==="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")}):t==="update-available"&&n?h.jsx("div",{className:"flex items-center gap-2",children:h.jsx(qb,{target:"cli",currentVersion:e,latestVersion:n,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")})},ij=({configPath:t,nodeVersion:e,bunVersion:n,os:r})=>{const{t:i}=he();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(Io,{label:i("claudeConfigPath"),value:t,mono:!0}),h.jsx(Io,{label:i("osVersion"),value:r}),h.jsx(Io,{label:i("nodeVersion"),value:e,mono:!0}),n&&h.jsx(Io,{label:i("bunVersion"),value:n,mono:!0})]})]})},Io=({label:t,value:e,mono:n})=>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:t}),h.jsx("p",{className:`text-dash-text-secondary break-all ${n?"mono text-xs":"text-sm"}`,children:e})]}),sj={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 cp(t,e){if(!t)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(t))}catch{return t}}const oj=()=>{const{t}=he(),[e,n]=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 C=new AbortController;f.current=C,l(!0),d(null);try{const k=await Lv(v==="global"?{scope:"global",limit:40,signal:C.signal}:{scope:"project",projectId:v,limit:40,signal:C.signal});if(S!==u.current)return;o(k)}catch(k){if(C.signal.aborted||S!==u.current)return;o(null),d(k instanceof Error?k.message:t("hookDiagnosticsLoadFailed"))}finally{S===u.current&&(l(!1),f.current=null)}},[t]);g.useEffect(()=>{let v=!1;return Ch().then(S=>{v||n(S.map(C=>({id:C.id,name:C.name})))}).catch(()=>{v||n([])}),()=>{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:t("hookDiagnosticsEntries"),value:String(m?.total??0)},{label:t("hookDiagnosticsCrashes"),value:String(b.crash??0)},{label:t("hookDiagnosticsWarnings"),value:String(b.warn??0)},{label:t("hookDiagnosticsBlocks"),value:String(b.block??0)}],[m?.total,b.block,b.crash,b.warn,t]);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:t("hookDiagnosticsTitle")}),h.jsx("p",{className:"text-xs text-dash-text-secondary",children:t("hookDiagnosticsDesc")}),h.jsx("p",{className:"mono text-[11px] text-dash-text-muted break-all",children:s?.path??t("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:t("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:t("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:[t("hookDiagnosticsLastEvent"),":"," ",cp(m.lastEventAt,t("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:t("hookDiagnosticsParseErrorsNotice").replace("{count}",String(m.parseErrors))}),m.truncated&&h.jsx("p",{children:t("hookDiagnosticsTruncatedNotice")})]}),a&&h.jsx("p",{className:"text-sm text-dash-text-muted",children:t("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:t("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:t("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:cp(v.ts,t("hookDiagnosticsUnknown"))}),h.jsx("span",{className:`rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase ${sj[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:[t("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:[t("hookDiagnosticsTargetLabel"),": ",v.target]}),v.error&&h.jsx("p",{className:"text-red-400",children:v.error})]})]},`${v.ts}-${v.hook}-${S}`))})]})};function aj(t){let e=0,n=0,r=0;for(const i of t)i.ownership==="ck"?e++:i.ownership==="user"?n++:i.ownership==="ck-modified"&&r++;return{ck:e,user:n,modified:r}}function lj(t){const e={skills:0,commands:0,rules:0,hooks:0,settings:0,other:0};for(const n of t){const r=n.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 cj=({kitName:t,kit:e,channel:n="stable",externalStatus:r,externalLatestVersion:i,onStatusChange:s,disabled:o})=>{const{t:a}=he(),[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=aj(v),C=lj(v),k=async()=>{const y=A=>{s||c(A)},M=A=>{s||u(A)};y("checking"),s&&s("checking",null);try{const R=await(await fetch(`/api/system/check-updates?target=kit&kit=${t}&channel=${n}`)).json();R.updateAvailable?(y("update-available"),M(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(Gb,{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:[t," Kit"]}),n==="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(hj,{status:x,currentVersion:e.version??"0.0.0",latestVersion:w,kitName:t,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(C).filter(([,y])=>y>0).map(([y,M])=>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:M})]},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(ad,{isOpen:f,onClose:()=>p(!1),target:"kit",kitName:t,targetVersion:m??w??void 0,onComplete:O})]})},hj=({status:t,currentVersion:e,latestVersion:n,kitName:r,onCheck:i,onUpdate:s,onVersionSelect:o,disabled:a})=>{const{t:l}=he();return t==="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")]}):t==="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")}):t==="update-available"&&n?h.jsx("div",{className:"flex items-center gap-2",children:h.jsx(qb,{target:"kit",kitName:r,currentVersion:e,latestVersion:n,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")})},hp="claudekit-update-channel",dp="claudekit-system-filter",dj=t=>/-(alpha|beta|rc|dev|next)/.test(t),uj=t=>t==="all"||t==="updates"||t==="up-to-date"||t==="cli"||t==="kits"?t:"all",up=t=>t==="update-available"?0:t==="checking"?1:t==="idle"?2:3,fj=({metadata:t})=>{const{t:e}=he(),[n,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(()=>uj(localStorage.getItem(dp))),x=g.useRef(!1),w=g.useRef(0),v=g.useMemo(()=>!t.kits||typeof t.kits!="object"?[]:Object.entries(t.kits),[t.kits]),S=v.length>0,C=t.name,k=t.version,O=t.installedAt,y=v.length>0||C;g.useEffect(()=>{if(!n)return;const q=[];if(q.push({id:"cli",type:"cli",status:"idle",currentVersion:n.cliVersion,latestVersion:null}),S&&v.length>0)for(const[Me,Ce]of v){const Ie=Ce;q.push({id:Me,type:"kit",status:"idle",currentVersion:Ie.version??"?",latestVersion:null})}else C&&q.push({id:C,type:"kit",status:"idle",currentVersion:k??"?",latestVersion:null});s(q)},[n,S,v,C,k]),g.useEffect(()=>{fetch("/api/system/info").then(q=>q.json()).then(r).catch(()=>r(null))},[]),g.useEffect(()=>{const q=localStorage.getItem(hp);q==="stable"||q==="beta"?p(q):n?.cliVersion&&p(dj(n.cliVersion)?"beta":"stable")},[n?.cliVersion]);const M=q=>{p(q),localStorage.setItem(hp,q)};g.useEffect(()=>{localStorage.setItem(dp,m)},[m]);const A=(q,Me,Ce)=>{s(Ie=>Ie.map(Se=>Se.id===q?{...Se,status:Me,latestVersion:Ce}:Se))},R=g.useCallback(async()=>{if(i.length===0)return;const q=w.current+1;w.current=q,a(!0),s(Me=>Me.map(Ce=>Ce.status==="checking"&&Ce.latestVersion===null?Ce:{...Ce,status:"checking",latestVersion:null}));try{const Me=i.map(async Ie=>{try{const Se=Ie.type==="cli"?`target=cli&channel=${f}`:`target=kit&kit=${Ie.id}&channel=${f}`,I=await(await fetch(`/api/system/check-updates?${Se}`)).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}}}),Ce=await Promise.all(Me);if(w.current!==q)return;s(Ie=>Ie.map(Se=>{const gt=Ce.find(I=>I.id===Se.id);return gt?{...Se,status:gt.status,latestVersion:gt.latestVersion}:Se}))}finally{w.current===q&&a(!1)}},[f,i]),N=q=>{b(q),(q==="updates"||q==="up-to-date")&&!o&&!l&&i.length>0&&i.every(Ce=>Ce.status==="idle")&&(x.current=!0,R())},L=()=>{u(!0)},_=()=>{window.location.reload()},$=i.filter(q=>q.status==="update-available").length,F=i.filter(q=>q.status==="up-to-date").length,G=i.filter(q=>q.status==="up-to-date"||q.status==="update-available").length,fe=i.some(q=>q.status==="checking"),X=S&&v.length>0?v.length:C?1:0,te=i.find(q=>q.id==="cli")?.status??"idle",oe=g.useMemo(()=>S&&v.length>0?v.map(([q,Me])=>({id:q,kitName:q,kit:Me})):C?[{id:C,kitName:C,kit:{version:k,installedAt:O}}]:[],[S,v,C,k,O]),me=g.useMemo(()=>{const Me=[...oe.map(Ce=>({...Ce,status:i.find(Ie=>Ie.id===Ce.id)?.status??"idle"}))].sort((Ce,Ie)=>{const Se=up(Ce.status)-up(Ie.status);return Se!==0?Se:Ce.kitName.localeCompare(Ie.kitName)});return m==="updates"?Me.filter(Ce=>Ce.status==="update-available"):m==="up-to-date"?Me.filter(Ce=>Ce.status==="up-to-date"):m==="cli"?[]:Me},[oe,i,m]),Y=m==="all"||m==="cli"||m==="updates"&&te==="update-available"||m==="up-to-date"&&te==="up-to-date",ae=(Y?1:0)+me.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 de=g.useMemo(()=>ae!==0?"":(m==="updates"||m==="up-to-date")&&fe?e("checkingAll"):(m==="updates"||m==="up-to-date")&&G===0?e("runCheckAllForFilter"):m==="updates"&&G>0&&$===0?e("noUpdatesFound"):m==="up-to-date"&&G>0&&F===0?e("noUpToDateYet"):e("noComponentsMatchFilter"),[ae,m,fe,G,$,F,e]),ke=!y&&m!=="cli",Qe=e("componentFilterUpdatesCount").replace("{count}",$.toString()),mt=e("componentFilterUpToDateCount").replace("{count}",F.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(ej,{value:f,onChange:M,disabled:o||l}),i.length>0&&h.jsx(ZC,{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(pi,{label:e("components"),value:i.length.toString()}),h.jsx(pi,{label:e("kitsLabel"),value:X.toString()}),h.jsx(pi,{label:e("updateAvailable"),value:$.toString(),tone:"accent"}),h.jsx(pi,{label:e("upToDate"),value:F.toString(),tone:"success"}),h.jsx(pi,{label:e("checkedComponents"),value:G.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(mi,{label:e("componentFilterAll"),value:m,activeValue:"all",onClick:()=>N("all")}),h.jsx(mi,{label:Qe,value:m,activeValue:"updates",onClick:()=>N("updates")}),h.jsx(mi,{label:mt,value:m,activeValue:"up-to-date",onClick:()=>N("up-to-date")}),h.jsx(mi,{label:e("componentFilterCli"),value:m,activeValue:"cli",onClick:()=>N("cli")}),h.jsx(mi,{label:e("componentFilterKits"),value:m,activeValue:"kits",onClick:()=>N("kits")})]})]}),Y&&h.jsx(nj,{version:n?.cliVersion??"...",installedAt:void 0,externalStatus:i.find(q=>q.id==="cli")?.status,externalLatestVersion:i.find(q=>q.id==="cli")?.latestVersion??null,onStatusChange:(q,Me)=>A("cli",q,Me),disabled:o||l,channel:f}),me.map(q=>{const Me=i.find(Ce=>Ce.id===q.id);return h.jsx(cj,{kitName:q.kitName,kit:q.kit,externalStatus:Me?.status,externalLatestVersion:Me?.latestVersion??null,onStatusChange:(Ce,Ie)=>A(q.id,Ce,Ie),disabled:o||l,channel:f},q.id)}),ke&&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")})}),!ke&&ae===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:de})})]}),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($o,{label:e("updateAvailable"),value:$.toString(),tone:$>0?"accent":"default"}),h.jsx($o,{label:e("upToDate"),value:F.toString(),tone:"success"}),h.jsx($o,{label:e("checkedComponents"),value:G.toString()}),h.jsx($o,{label:e("activeChannel"),value:e(f==="beta"?"channelBeta":"channelStable")})]})]}),n&&h.jsx(ij,{configPath:n.configPath,nodeVersion:n.nodeVersion,bunVersion:n.bunVersion,os:n.os}),h.jsx(oj,{})]})]})]}),h.jsx(ad,{isOpen:d,onClose:()=>u(!1),target:"cli",mode:"batch",components:i.filter(q=>q.status==="update-available").map(q=>({id:q.id,name:q.id==="cli"?"CLI":`${q.id} Kit`})),onComplete:_})]})},pi=({label:t,value:e,tone:n="default"})=>{const r=n==="accent"?"text-dash-accent":n==="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:t}),h.jsx("p",{className:`mt-1 mono text-xl font-semibold ${r}`,children:e})]})},$o=({label:t,value:e,tone:n="default"})=>{const r=n==="accent"?"text-dash-accent":n==="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:t}),h.jsx("span",{className:`mono text-xs font-semibold ${r}`,children:e})]})},mi=({label:t,value:e,activeValue:n,onClick:r})=>{const i=e===n;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:t})},Vl="~/.claude/settings.json",Bo="{}",pj=()=>{const{t}=he(),[e,n]=g.useState(!0),[r,i]=g.useState(Vl),[s,o]=g.useState(Bo),[a,l]=g.useState(Bo),[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,C]=g.useState(null);g.useEffect(()=>{let A=!1;return(async()=>{n(!0),m(!1);try{const N=await Ev();if(A)return;const L=JSON.stringify(N.settings??{},null,2);i(N.path||Vl),f(!!N.exists),o(L),l(L),v(null)}catch{if(A)return;m(!0),f(!1),i(Vl),o(Bo),l(Bo)}finally{A||n(!1)}})(),()=>{A=!0}},[]);const k=A=>{l(A),C(null);try{JSON.parse(A),v(null)}catch(R){v(R instanceof Error?R.message:"Invalid JSON")}},O=()=>{l(s),v(null),C(null),x("idle")},y=async()=>{if(!(e||w)){x("saving"),C(null);try{const A=JSON.parse(a),R=JSON.stringify(A,null,2),N=await Rv(A);o(R),l(R),f(!0),x("saved"),C(N.backupPath?`${t("settingsBackupSaved")}: ${N.backupPath}`:t("saved")),setTimeout(()=>x("idle"),2e3)}catch(A){x("error"),C(A instanceof Error?A.message:t("saveFailed")),setTimeout(()=>x("idle"),3e3)}}},M=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:t("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||!M||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:t("discard")}),h.jsx("button",{type:"button",onClick:y,disabled:e||b==="saving"||!!w||!M,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:t(b==="saving"?"saving":b==="saved"?"saved":b==="error"?"saveFailed":"saveChanges")})]})]}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(od,{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:t("settingsJsonMissing")}),!e&&p&&h.jsx("p",{className:"mt-2 px-1 text-xs text-red-500",children:t("settingsJsonLoadFailed")})]})},mj=(t,e)=>{const[n,r]=g.useState(null);return g.useEffect(()=>{const i=t.split(`
243
+ `),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)},[t,e]),n};function Jb(t){const{scope:e,fetchConfig:n,fetchSchema:r,saveConfig:i,onReset:s}=t,[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({}),[C,k]=g.useState(!0),[O,y]=g.useState("idle"),[M,A]=g.useState(!1),[R,N]=g.useState(null),[L,_]=g.useState(null),$=mj(o,l),F=qv(L,$),G=g.useMemo(()=>Gv(F,f),[F,f]);g.useEffect(()=>{(async()=>{try{const[ae,de]=await Promise.all([n(),r()]),ke=ae.local??ae.config;b(ke),w(ae.global??{}),S(ae.sources),p(de),a(JSON.stringify(ke,null,2))}catch(ae){console.error("Failed to load config data:",ae)}finally{k(!1)}})()},[n,r]),g.useEffect(()=>{try{JSON.parse(o),u(null)}catch(Y){u(Y instanceof Error?Y.message:"Invalid JSON")}},[o]),g.useEffect(()=>{if(R==="json")try{const Y=JSON.parse(o);b(Y)}catch{}},[o,R]);const fe=g.useCallback(Y=>{_(null),N("json"),a(Y)},[]),X=g.useCallback(()=>{_(null)},[]),te=g.useCallback((Y,ae)=>{_(Y),N("form"),b(de=>{const ke=Uv(de,Y,ae);return a(JSON.stringify(ke,null,2)),ke}),S(de=>({...de,[Y]:e}))},[e]),oe=g.useCallback(async()=>{if(!d){y("saving");try{const Y=JSON.parse(o),de=await i(Y)??Y;b(de),a(JSON.stringify(de,null,2)),y("saved"),setTimeout(()=>y("idle"),2e3)}catch{y("error"),setTimeout(()=>y("idle"),3e3)}}},[o,d,i]),me=g.useCallback(async()=>{if(A(!1),s){k(!0);try{const Y=await s(),ae=Y.local??Y.config;b(ae),S(Y.sources),a(JSON.stringify(ae,null,2))}catch(Y){console.error("Failed to reset:",Y)}finally{k(!1)}}else{const Y={};b(Y),a(JSON.stringify(Y,null,2))}},[s]);return{jsonText:o,config:m,globalConfig:x,sources:v,schema:f,isLoading:C,saveStatus:O,syntaxError:d,cursorLine:l,showResetConfirm:M,activeFieldPath:F,fieldDoc:G,handleJsonChange:fe,handleJsonEditorFocus:X,handleFormChange:te,handleSave:oe,handleReset:me,setCursorLine:c,setFocusedFieldPath:_,setShowResetConfirm:A}}function hh({storageKey:t,defaultSizes:e,minSizes:n}){const[r,i]=g.useState(()=>{if(typeof window>"u")return e;const c=localStorage.getItem(t);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(t,JSON.stringify(r))},[r,t]);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 C=(v.clientX-m)/p*100,k=[...b],O=c,y=c+1;let M=b[O]+C,A=b[y]-C;M<n[O]&&(M=n[O],A=b[O]+b[y]-M),A<n[y]&&(A=n[y],M=b[O]+b[y]-A),k[O]=M,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,n]),l=g.useCallback(()=>{i(e)},[e]);return{sizes:r,isDragging:s,startDrag:a,reset:l}}const Ya="/api";async function fp(t){const e=`${Ya}/ck-config`,n=await fetch(e);if(!n.ok)throw new Error(`Failed to fetch ck-config: ${n.status}`);return n.json()}async function pp(t,e){const n=new URLSearchParams({scope:t});e&&n.set("projectId",e);const r=await fetch(`${Ya}/ck-config?${n}`);if(!r.ok)throw new Error(`Failed to fetch ck-config: ${r.status}`);return r.json()}async function Yb(t){const e=await fetch(`${Ya}/ck-config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!e.ok){const n=await e.json().catch(()=>({error:"Unknown error"}));throw new Error(n.error||`Failed to save ck-config: ${e.status}`)}return e.json()}async function Qb(){const t=await fetch(`${Ya}/ck-config/schema`);if(!t.ok)throw new Error(`Failed to fetch schema: ${t.status}`);return t.json()}const gj=.58,gi=280,dh=240,bj=80;function xj(t,e,n){return Math.min(Math.max(t,e),n)}function yj(t,e){if(typeof window>"u")return e;const n=localStorage.getItem(t);if(!n)return e;const r=Number.parseFloat(n);if(Number.isNaN(r))return e;if(r>0&&r<1)return r;if(r>=1){const i=Math.max(window.innerHeight-220,r+dh);return Math.min(.75,Math.max(.35,r/i))}return e}function vj(t,e,n,r){const[i,s]=g.useState(()=>typeof window>"u"?e:yj(t,e)),[o,a]=g.useState(!1),l=g.useCallback(c=>{c.preventDefault(),a(!0);const d=c.target.closest("[data-vresize-container]");if(!d)return;const u=p=>{const m=d.getBoundingClientRect(),b=m.height||1,x=(p.clientY-m.top)/b,w=n/b,v=Math.max(w,1-r/b);s(Math.max(w,Math.min(v,x)))},f=()=>{a(!1),document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",f),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",u),document.addEventListener("mouseup",f),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[r,n]);return g.useEffect(()=>{localStorage.setItem(t,String(i))},[t,i]),{topRatio:i,isDragging:o,startDrag:l}}function wj(){const[t,e]=g.useState(null),[n,r]=g.useState(0),i=g.useCallback(s=>{e(s)},[]);return g.useEffect(()=>{if(!t)return;const s=()=>{r(t.getBoundingClientRect().height)};if(s(),typeof ResizeObserver>"u")return;const o=new ResizeObserver(()=>{s()});return o.observe(t),()=>o.disconnect()},[t]),{ref:i,height:n}}const kj=()=>{const{t}=he(),e=an(),[n,r]=g.useState("config"),[i,s]=g.useState({}),[o,a]=g.useState(gi),[l,c]=g.useState(!1),{sizes:d,isDragging:u,startDrag:f}=hh({storageKey:"claudekit-global-config-panels",defaultSizes:[35,40,25],minSizes:[20,25,15]}),{sizes:p,isDragging:m,startDrag:b}=hh({storageKey:"claudekit-global-system-panels",defaultSizes:[70,30],minSizes:[45,20]}),x=vj("claudekit-form-taxonomy-px",gj,gi,dh),{ref:w,height:v}=wj(),S=g.useCallback(async()=>{const[$,F]=await Promise.all([fp(),Bv()]);return s(F),$},[]),C=g.useCallback(async $=>(await Yb({scope:"global",config:$})).config,[]),k=g.useCallback(async()=>await fp(),[]),O=Jb({scope:"global",fetchConfig:S,fetchSchema:Qb,saveConfig:C,onReset:k}),y=g.useMemo(()=>[{id:"general",title:t("sectionGeneral"),fields:[{path:"codingLevel",label:t("fieldCodingLevel"),description:t("fieldCodingLevelDesc")},{path:"statusline",label:t("fieldStatusline"),description:t("fieldStatuslineDesc")},{path:"statuslineColors",label:t("fieldStatuslineColors"),description:t("fieldStatuslineColorsDesc")},{path:"statuslineQuota",label:t("fieldStatuslineQuota"),description:t("fieldStatuslineQuotaDesc")},{path:"locale.thinkingLanguage",label:t("fieldThinkingLanguage"),description:t("fieldThinkingLanguageDesc")},{path:"locale.responseLanguage",label:t("fieldResponseLanguage"),description:t("fieldResponseLanguageDesc")}]},{id:"paths",title:t("sectionPaths"),fields:[{path:"paths.docs",label:t("fieldDocsPath"),description:t("fieldDocsPathDesc")},{path:"paths.plans",label:t("fieldPlansPath"),description:t("fieldPlansPathDesc")}]},{id:"privacy",title:t("sectionPrivacy"),defaultCollapsed:!0,fields:[{path:"privacyBlock",label:t("fieldPrivacyBlock"),description:t("fieldPrivacyBlockDesc")},{path:"trust.enabled",label:t("fieldTrustEnabled"),description:t("fieldTrustEnabledDesc")},{path:"trust.passphrase",label:t("fieldTrustPassphrase"),description:t("fieldTrustPassphraseDesc")}]},{id:"project",title:t("sectionProject"),defaultCollapsed:!0,fields:[{path:"project.type",label:t("fieldProjectType"),description:t("fieldProjectTypeDesc")},{path:"project.packageManager",label:t("fieldPackageManager"),description:t("fieldPackageManagerDesc")},{path:"project.framework",label:t("fieldFramework"),description:t("fieldFrameworkDesc")}]},{id:"integrations",title:t("sectionIntegrations"),defaultCollapsed:!0,fields:[{path:"gemini.model",label:t("fieldGeminiModel"),description:t("fieldGeminiModelDesc")},{path:"skills.research.useGemini",label:t("fieldResearchUseGemini"),description:t("fieldResearchUseGeminiDesc")}]},{id:"hooks",title:t("sectionHooks"),defaultCollapsed:!0,fields:[{path:"hooks.session-init",label:t("fieldHookSessionInit"),description:t("fieldHookSessionInitDesc")},{path:"hooks.subagent-init",label:t("fieldHookSubagentInit"),description:t("fieldHookSubagentInitDesc")},{path:"hooks.descriptive-name",label:t("fieldHookDescriptiveName"),description:t("fieldHookDescriptiveNameDesc")},{path:"hooks.dev-rules-reminder",label:t("fieldHookDevRulesReminder"),description:t("fieldHookDevRulesReminderDesc")},{path:"hooks.usage-context-awareness",label:t("fieldHookUsageContextAwareness"),description:t("fieldHookUsageContextAwarenessDesc")},{path:"hooks.context-tracking",label:t("fieldHookContextTracking"),description:t("fieldHookContextTrackingDesc")},{path:"hooks.scout-block",label:t("fieldHookScoutBlock"),description:t("fieldHookScoutBlockDesc")},{path:"hooks.privacy-block",label:t("fieldHookPrivacyBlock"),description:t("fieldHookPrivacyBlockDesc")},{path:"hooks.post-edit-simplify-reminder",label:t("fieldHookPostEditSimplify"),description:t("fieldHookPostEditSimplifyDesc")}]},{id:"updatePipeline",title:t("sectionUpdatePipeline"),defaultCollapsed:!0,fields:[{path:"updatePipeline.autoInitAfterUpdate",label:t("fieldAutoInitAfterUpdate"),description:t("fieldAutoInitAfterUpdateDesc")},{path:"updatePipeline.autoMigrateAfterUpdate",label:t("fieldAutoMigrateAfterUpdate"),description:t("fieldAutoMigrateAfterUpdateDesc")},{path:"updatePipeline.migrateProviders",label:t("fieldMigrateProviders"),description:t("fieldMigrateProvidersDesc")}]},{id:"advanced",title:t("sectionAdvanced"),defaultCollapsed:!0,fields:[{path:"docs.maxLoc",label:t("fieldDocsMaxLoc"),description:t("fieldDocsMaxLocDesc")},{path:"plan.namingFormat",label:t("fieldPlanNamingFormat"),description:t("fieldPlanNamingFormatDesc")},{path:"plan.dateFormat",label:t("fieldPlanDateFormat"),description:t("fieldPlanDateFormatDesc")},{path:"plan.validation.mode",label:t("fieldPlanValidationMode"),description:t("fieldPlanValidationModeDesc")},{path:"plan.validation.minQuestions",label:t("fieldPlanMinQuestions"),description:t("fieldPlanMinQuestionsDesc")},{path:"plan.validation.maxQuestions",label:t("fieldPlanMaxQuestions"),description:t("fieldPlanMaxQuestionsDesc")},{path:"assertions",label:t("fieldAssertions"),description:t("fieldAssertionsDesc")}]}],[t]),M=g.useMemo(()=>{if(v<=0)return null;const $=Math.max(gi,v-dh);return xj(x.topRatio*v,gi,$)},[x.topRatio,v]),A=g.useMemo(()=>l||M===null?null:Math.min(M,o),[o,l,M]),R=g.useMemo(()=>{if(!l||v<=0)return null;const $=Math.max(gi,v-bj);return Math.min(o,$)},[o,l,v]),N=l?R:A,L=!O.isLoading&&!l&&A!==null,_=O.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:t("confirmReset")}),h.jsx("button",{type:"button",onClick:O.handleReset,className:"px-2 py-0.5 rounded bg-red-500 text-white text-xs font-bold hover:bg-red-600 transition-colors",children:t("confirm")}),h.jsx("button",{type:"button",onClick:()=>O.setShowResetConfirm(!1),className:"px-2 py-0.5 rounded bg-dash-surface text-dash-text-secondary text-xs font-bold hover:bg-dash-surface-hover transition-colors border border-dash-border",children:t("cancel")})]}):h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button",onClick:()=>O.setShowResetConfirm(!0),className:"px-3 py-1.5 rounded-lg bg-dash-surface text-xs font-bold text-dash-text-secondary hover:bg-dash-surface-hover transition-colors border border-dash-border",children:t("resetToDefault")}),h.jsx("button",{type:"button",onClick:O.handleSave,disabled:!!O.syntaxError||O.saveStatus==="saving",className:`px-3 py-1.5 rounded-lg text-xs font-bold transition-all tracking-widest uppercase ${O.syntaxError?"bg-dash-surface text-dash-text-muted cursor-not-allowed border border-dash-border":O.saveStatus==="saved"?"bg-green-500 text-white shadow-lg shadow-green-500/20":O.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:O.saveStatus==="saving"?t("saving"):O.saveStatus==="saved"?t("saved"):O.saveStatus==="error"?t("saveFailed"):t("saveChanges")})]});return h.jsxs("div",{className:"animate-in fade-in duration-300 w-full h-full flex flex-col transition-colors",children:[h.jsx(Gm,{title:t("globalConfig"),filePath:"~/.claude/.ck.json",onBack:()=>e(-1),onSave:O.handleSave,onReset:O.handleReset,saveStatus:O.saveStatus,syntaxError:O.syntaxError,showResetConfirm:O.showResetConfirm,setShowResetConfirm:O.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":t("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":n==="config",onClick:()=>r("config"),className:`dash-focus-ring px-4 py-2 rounded-lg text-sm font-semibold transition-colors ${n==="config"?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-muted hover:text-dash-text hover:bg-dash-surface-hover"}`,children:t("configTab")}),h.jsx("button",{role:"tab","aria-selected":n==="metadata",onClick:()=>r("metadata"),className:`dash-focus-ring px-4 py-2 rounded-lg text-sm font-semibold transition-colors ${n==="metadata"?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-muted hover:text-dash-text hover:bg-dash-surface-hover"}`,children:t("systemTab")})]}),h.jsx("p",{className:"hidden lg:block text-xs text-dash-text-muted",children:t("configWorkspaceHint")})]}),h.jsxs("div",{className:"flex-1 flex min-h-0",children:[n==="config"&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{ref:w,"data-vresize-container":!0,style:{width:`${d[0]}%`},className:"flex flex-col min-w-0 min-h-0 h-full",children:[h.jsx("div",{style:N!==null?{height:`${N}px`}:void 0,className:`min-h-0 ${N!==null?"shrink-0":"flex-1"}`,children:h.jsx(Qm,{width:100,isLoading:O.isLoading,schema:O.schema,config:O.config,sources:O.sources,sections:y,onChange:O.handleFormChange,onFieldFocus:O.setFocusedFieldPath,onNaturalHeightChange:a})}),!O.isLoading&&h.jsxs(h.Fragment,{children:[l&&N!==null&&h.jsx("div",{className:"flex-1"}),L&&h.jsx(tr,{direction:"vertical",isDragging:x.isDragging,onMouseDown:x.startDrag}),h.jsx("div",{className:l?"shrink-0":"flex-1 min-h-0 overflow-hidden",children:h.jsx(XC,{config:O.config,onChange:O.handleFormChange,isCollapsed:l,onCollapsedChange:c})})]})]}),h.jsx(tr,{direction:"horizontal",isDragging:u,onMouseDown:$=>f(0,$)}),h.jsx(od,{width:d[1],isLoading:O.isLoading,jsonText:O.jsonText,cursorLine:O.cursorLine,syntaxError:O.syntaxError,onChange:O.handleJsonChange,onEditorFocus:O.handleJsonEditorFocus,onCursorLineChange:O.setCursorLine,headerPath:"~/.claude/.ck.json",headerActions:_}),h.jsx(tr,{direction:"horizontal",isDragging:u,onMouseDown:$=>f(1,$)}),h.jsx(Kb,{width:d[2],fieldDoc:O.fieldDoc,activeFieldPath:O.activeFieldPath})]}),n==="metadata"&&h.jsxs("div",{className:"flex-1 min-h-0 flex",children:[h.jsx("div",{style:{width:`${p[0]}%`},className:"min-w-0 h-full overflow-auto pr-1",children:O.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:t("loading")})}):h.jsx(fj,{metadata:i})}),h.jsx(tr,{direction:"horizontal",isDragging:m,onMouseDown:$=>b(0,$)}),h.jsx("div",{style:{width:`${p[1]}%`},className:"min-w-0 h-full overflow-hidden",children:h.jsx(pj,{})})]})]})]})};function Sj({phase:t}){const e=t.status==="completed"?"border-green-500":t.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:t.phaseId}),h.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:t.name})]})})}function zl({title:t,phases:e,borderColor:n}){return h.jsxs("div",{className:"flex flex-1 flex-col gap-3 min-w-0","aria-label":`${t} phases`,children:[h.jsxs("div",{className:`rounded-t border-t-2 ${n} 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:t}),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(Sj,{phase:r},`${r.phaseId}-${i}`))})]})}function Cj({completed:t,total:e}){const{t:n}=he(),r=e===0?0:Math.round(t/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:n("kanbanProgress")}),h.jsxs("span",{children:[t,"/",e," ",n("kanbanPhases")," — ",r,"% ",n("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 jj(){const{t}=he(),[e]=mv(),n=e.get("file")??"",[r,i]=g.useState([]),[s,o]=g.useState(!1),[a,l]=g.useState(null);if(g.useEffect(()=>{n&&(o(!0),l(null),i([]),fetch(`/api/plan/parse?file=${encodeURIComponent(n)}`).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)))},[n]),!n)return h.jsx("div",{className:"flex h-full items-center justify-center text-gray-400 dark:text-gray-500",children:t("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:t("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:t("kanbanTitle")}),h.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 truncate max-w-xs",title:n,children:n.replaceAll("\\","/")})]}),r.length>0&&h.jsx(Cj,{completed:u.length,total:r.length}),s&&h.jsx("div",{className:"flex flex-1 items-center justify-center text-gray-400",children:t("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:[t("error"),":"," ",a in{kanbanError400:"",kanbanError403:"",kanbanError404:""}?t(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:t("kanbanNoPhases")}),!s&&!a&&r.length>0&&h.jsxs("section",{"aria-label":t("kanbanTitle"),className:"flex flex-1 flex-col gap-4 overflow-auto md:flex-row",children:[h.jsx(zl,{title:t("kanbanStatus_pending"),phases:c,borderColor:"border-amber-400"}),h.jsx(zl,{title:t("kanbanStatus_in-progress"),phases:d,borderColor:"border-blue-500"}),h.jsx(zl,{title:t("kanbanStatus_completed"),phases:u,borderColor:"border-green-500"})]})]})}const mp=[{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"}],Oj=new Set([8203,8204,8205,8288,65279,8232,8233,8234,8235,8236,8237,8238,8294,8295,8296,8297]);function Pj(t){return t===9||t===10||t===13?!0:t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159||Oj.has(t)}function Xn(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(Pj(r)||(e+=n))}return e}function gp(t){if(!t)return"-";const e=t.replace(/\\/g,"/"),n=e.match(/.*\/(\.[^/]+\/)/);if(n?.[1]){const i=(n.index??0)+n[0].length-n[1].length;return e.slice(i)}const r=e.split("/");return r.length>3?`.../${r.slice(-3).join("/")}`:e}function Or(t){return t.success?t.skipped?"skipped":"installed":"failed"}function Nj(t){const e={installed:0,skipped:0,failed:0};for(const n of t){const r=Or(n);r==="installed"?e.installed+=1:r==="skipped"?e.skipped+=1:e.failed+=1}return e}function Xb(t){switch(t){case"agent":case"command":case"skill":case"config":case"rules":case"hooks":case"unknown":return t;default:return"unknown"}}function Aj(t,e){switch(t){case"failed":return{label:e("migrateStatusFailed"),className:"border-red-500/30 bg-red-500/10 text-red-400"};case"skipped":return{label:e("migrateStatusSkipped"),className:"border-yellow-500/30 bg-yellow-500/10 text-yellow-400"};default:return{label:e("migrateStatusInstalled"),className:"border-green-500/30 bg-green-500/10 text-green-400"}}}function Mj(t){const e=new Map;for(const n of t){const r=Xb(n.portableType),i=e.get(r)||[];i.push(n),e.set(r,i)}return e}function Dj(t){return[Xb(t.portableType),t.provider,t.providerDisplayName,t.itemName,t.path,t.success,t.skipped,t.overwritten,t.error,t.skipReason].map(n=>n===void 0?"":String(n)).join("|")}function Tj(t){if(t.length===0)return!0;const e=t[0].provider;return t.every(n=>n.provider===e)}const Lr=({label:t,count:e,className:n})=>e<=0?null:h.jsxs("span",{className:`inline-flex items-center gap-1 rounded-md border px-2.5 py-1 text-xs ${n}`,children:[h.jsx("span",{className:"font-semibold",children:e}),h.jsx("span",{children:t})]}),bp=({labelKey:t,badgeClass:e,items:n,isExpanded:r,onToggle:i,singleProvider:s})=>{const{t:o}=he(),a=n.filter(f=>Or(f)==="installed").length,l=n.filter(f=>Or(f)==="skipped").length,c=n.filter(f=>Or(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(t)}),h.jsx("span",{className:`inline-flex items-center rounded-full border px-2 py-0.5 text-[11px] font-semibold ${e}`,children:n.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:n.map(f=>{const p=Dj(f),m=u.get(p)??0;u.set(p,m+1);const b=m===0?p:`${p}#${m}`,x=Or(f),w=Aj(x,o),v=Xn(f.itemName||gp(f.path)),S=Xn(f.providerDisplayName||f.provider||""),C=Xn(f.path||""),k=Xn(gp(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:C,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:C,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)})})]})]})},Ej=({results:t,onReset:e})=>{const{t:n}=he(),[r,i]=g.useState(""),s=g.useDeferredValue(r),[o,a]=g.useState("all"),[l,c]=g.useState(()=>new Set(mp.map(C=>C.key))),d=g.useMemo(()=>{const C=s.trim().toLowerCase();return t.results.filter(k=>{if(o!=="all"&&Or(k)!==o)return!1;if(!C)return!0;const O=(k.itemName||"").toLowerCase(),y=(k.path||"").toLowerCase(),M=(k.providerDisplayName||k.provider||"").toLowerCase();return O.includes(C)||y.includes(C)||M.includes(C)})},[t.results,s,o]),u=g.useMemo(()=>Tj(d),[d]),f=g.useMemo(()=>{if(!u||d.length===0)return"";const C=Array.from(new Set(d.map(k=>k.providerDisplayName?.trim()||"").filter(k=>k.length>0)));return C.length===1?C[0]:d[0]?.provider||""},[d,u]),p=g.useMemo(()=>Mj(d),[d]),m=g.useMemo(()=>Nj(t.results),[t.results]),b=g.useMemo(()=>[...p.keys()],[p]),x=m.installed+m.skipped+m.failed,w=b.length>0&&b.every(C=>l.has(C)),v=C=>{c(k=>{const O=new Set(k);return O.has(C)?O.delete(C):O.add(C),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:[n("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," ",n("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:n("migrateSummaryNewMigration")})]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[h.jsx(Lr,{label:n("migrateStatusInstalled"),count:m.installed,className:"border-green-500/30 bg-green-500/10 text-green-400"}),h.jsx(Lr,{label:n("migrateStatusSkipped"),count:m.skipped,className:"border-yellow-500/30 bg-yellow-500/10 text-yellow-400"}),h.jsx(Lr,{label:n("migrateStatusFailed"),count:m.failed,className:"border-red-500/30 bg-red-500/10 text-red-400"})]}),t.warnings.length>0&&h.jsx("div",{className:"space-y-2",children:t.warnings.map((C,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(C)},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:C=>i(C.target.value),placeholder:n("migrateSummarySearchPlaceholder"),className:"dash-focus-ring w-full pl-9 pr-3 py-2 bg-dash-bg border border-dash-border rounded-lg text-dash-text text-sm focus:border-dash-accent transition-colors"})]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[["all","installed","skipped","failed"].map(C=>{const k=C==="all"?"migrateSummaryFilterAll":C==="installed"?"migrateStatusInstalled":C==="skipped"?"migrateStatusSkipped":"migrateStatusFailed";return h.jsx("button",{type:"button",onClick:()=>a(C),className:`dash-focus-ring px-3 py-1 text-xs font-medium rounded-full border transition-colors ${o===C?"bg-dash-accent/10 border-dash-accent text-dash-accent":"border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text"}`,children:n(k)},C)}),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:n(w?"migrateSummaryCollapseAll":"migrateSummaryExpandAll")})]})]}),d.length===0?h.jsx("div",{className:"text-center py-8 text-sm text-dash-text-muted",children:n("migrateSummaryNoResults")}):h.jsxs("div",{className:"space-y-2.5",children:[mp.map(C=>{const k=p.get(C.key);return!k||k.length===0?null:h.jsx(bp,{labelKey:C.labelKey,badgeClass:C.badgeClass,items:k,isExpanded:l.has(C.key),onToggle:()=>v(C.key),singleProvider:u},C.key)}),(()=>{const C=p.get("unknown");return!C||C.length===0?null:h.jsx(bp,{labelKey:"migrateTypeUnknown",badgeClass:"border-dash-border text-dash-text-muted",items:C,isExpanded:l.has("unknown"),onToggle:()=>v("unknown"),singleProvider:u})})()]})]})},Rj=500;function Lj(t){return t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159}function Ij(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(Lj(r)||(e+=n))}return e}const $j=({diff:t,className:e=""})=>{const n=t.split(`
244
+ `),r=n.slice(0,Rj),i=n.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=Ij(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 Bj(t){return t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159}function bi(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(Bj(r)||(e+=n))}return e}const Fj=({action:t,resolution:e,onResolve:n})=>{const{t:r}=he(),[i,s]=g.useState(!1),o=t.ownedSections&&t.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:[bi(t.provider),"/",bi(t.type),"/",bi(t.item)]}),h.jsx("p",{className:"text-xs text-dash-text-muted mt-1",children:bi(t.reason)}),t.targetPath&&h.jsx("p",{className:"text-xs text-dash-text-secondary mt-1 font-mono truncate",children:bi(t.targetPath)})]}),h.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[h.jsx("button",{type:"button",onClick:()=>n({type:"overwrite"}),className:`dash-focus-ring px-3 py-1.5 text-xs font-semibold rounded-md transition-colors ${e?.type==="overwrite"?"bg-dash-accent text-white":"bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover"}`,children:r("migrateConflictUseCK")}),h.jsx("button",{type:"button",onClick:()=>n({type:"keep"}),className:`dash-focus-ring px-3 py-1.5 text-xs font-semibold rounded-md transition-colors ${e?.type==="keep"?"bg-dash-accent text-white":"bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover"}`,children:r("migrateConflictKeepMine")}),o&&h.jsx("button",{type:"button",onClick:()=>n({type:"smart-merge"}),className:`dash-focus-ring px-3 py-1.5 text-xs font-semibold rounded-md transition-colors ${e?.type==="smart-merge"?"bg-dash-accent text-white":"bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover"}`,children:r("migrateConflictSmartMerge")}),t.diff&&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&&t.diff&&h.jsx($j,{diff:t.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"),": ",Vj(e.type,r)]})]})]})};function Vj(t,e){switch(t){case"overwrite":return e("migrateConflictUseCK");case"keep":return e("migrateConflictKeepMine");case"smart-merge":return e("migrateConflictSmartMerge");case"resolved":return e("migrateConflictManual");default:return String(t)}}const zj=[{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"}],xp=["agent","command","skill","config","rules","hooks"],Hj={agent:"migrateTypeAgents",command:"migrateTypeCommands",skill:"migrateTypeSkills",config:"migrateTypeConfig",rules:"migrateTypeRules",hooks:"migrateTypeHooks"},_j={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"},gr=200;function Wj(t){return t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159}function Fo(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(Wj(r)||(e+=n))}return e}function Uj(t){const e={install:[],update:[],skip:[],conflict:[],delete:[]};for(const n of t)e[n.action].push(n);return e}function Kj(t){const e=new Map;for(const n of t){const r=e.get(n.type)||[];r.push(n),e.set(n.type,r)}return e}const Gj=({plan:t,resolutions:e,onResolve:n,actionKey:r})=>{const{t:i}=he(),s=g.useMemo(()=>Uj(t.actions),[t.actions]),o=g.useMemo(()=>zj.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(()=>Kj(c),[c]),u=f=>{for(const p of s.conflict)n(p,{type:f})};return h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[t.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:[t.summary.install," ",i("migrateActionInstall")]}),t.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:[t.summary.update," ",i("migrateActionUpdate")]}),t.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:[t.summary.skip," ",i("migrateActionSkip")]}),t.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:[t.summary.conflict," ",i("migrateActionConflict")]}),t.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:[t.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"?xp.map(f=>{const p=d.get(f);return!p||p.length===0?null:h.jsxs(yp,{type:f,count:p.length,children:[p.slice(0,gr).map(m=>h.jsx(Fj,{action:m,resolution:e.get(r(m))||null,onResolve:b=>n(m,b)},r(m))),p.length>gr&&h.jsxs("div",{className:"text-xs text-dash-text-muted",children:["... ",p.length-gr," more"]})]},`${a}:${f}`)}):xp.map(f=>{const p=d.get(f);return!p||p.length===0?null:h.jsxs(yp,{type:f,count:p.length,defaultExpanded:a!=="skip",children:[p.slice(0,gr).map(m=>h.jsx(qj,{action:m},`${m.provider}:${m.type}:${m.item}:${m.global}:${m.action}`)),p.length>gr&&h.jsxs("div",{className:"text-xs text-dash-text-muted",children:["... ",p.length-gr," more"]})]},`${a}:${f}`)})]})},yp=({type:t,count:e,defaultExpanded:n=!0,children:r})=>{const{t:i}=he(),[s,o]=g.useState(n),a=_j[t],l=i(Hj[t]);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})]})},qj=({action:t})=>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:[Fo(t.provider),"/",Fo(t.item)]}),h.jsx("div",{className:"text-xs text-dash-text-muted mt-1",children:Fo(t.reason)}),t.targetPath&&h.jsx("div",{className:"text-xs text-dash-text-secondary mt-0.5 font-mono truncate",children:Fo(t.targetPath)})]});var Jj=function(e){return typeof window<"u"?matchMedia&&matchMedia("(prefers-color-scheme: ".concat(e,")")):{matches:!1}},Hl,Yj=g.createContext({appearance:"light",setAppearance:function(){},isDarkMode:!1,themeMode:"light",setThemeMode:function(){},browserPrefers:(Hl=Jj("dark"))!==null&&Hl!==void 0&&Hl.matches?"dark":"light"}),Qj=function(){return g.useContext(Yj)};const Zb=(t,e)=>{if(e)return"row";switch(t){case"horizontal":return"row";case"horizontal-reverse":return"row-reverse";case"vertical":default:return"column";case"vertical-reverse":return"column-reverse"}},Xj=t=>{if(t)return["space-between","space-around","space-evenly"].includes(t)},Zj=(t,e)=>Zb(t,e)==="row",br=t=>typeof t=="number"?`${t}px`:t,eO=({visible:t,flex:e,gap:n,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,...C})=>{const k=o||a,y=Zj(r,i)&&!c&&Xj(k)?"100%":br(c),M={...e!==void 0?{"--lobe-flex":String(e)}:{},...r||i?{"--lobe-flex-direction":Zb(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":br(l)}:{},...d!==void 0?{"--lobe-flex-padding":br(d)}:{},...u!==void 0?{"--lobe-flex-padding-inline":br(u)}:{},...f!==void 0?{"--lobe-flex-padding-block":br(f)}:{},...n!==void 0?{"--lobe-flex-gap":br(n)}:{},...x},A="lobe-flex",R=[A,t===!1?`${A}--hidden`:void 0,p?`${p}-flex`:void 0,b].filter(Boolean).join(" ");return h.jsx(m,{ref:S,...C,className:R,style:M,children:w})};var ex=g.memo(eO);const tO=({children:t,ref:e,...n})=>h.jsx(ex,{...n,align:"center",justify:"center",ref:e,children:t});var nO=tO;const rO=/\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;function iO(t){return Array.from(t.match(rO)??[])}function sO(t){return iO(t).map(n=>n.toLowerCase()).join("-")}g.createContext(null);var oO=function(e,n){if(n){if(e&&n==="#000")return"0 0 0 1px rgba(255,255,255,0.1) inset";if(!e&&n==="#fff")return"0 0 0 1px rgba(0,0,0,0.05) inset"}};function ns(t){"@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(t)}var aO=["shape","color","background","size","style","iconMultiple","Icon","iconStyle","iconClassName"];function vp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Vo(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?vp(Object(n),!0).forEach(function(r){lO(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function lO(t,e,n){return e=cO(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function cO(t){var e=hO(t,"string");return ns(e)=="symbol"?e:String(e)}function hO(t,e){if(ns(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ns(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dO(t,e){if(t==null)return{};var n=uO(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function uO(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var Hn=g.memo(function(t){var e=t.shape,n=e===void 0?"circle":e,r=t.color,i=r===void 0?"#fff":r,s=t.background,o=t.size,a=t.style,l=t.iconMultiple,c=l===void 0?.75:l,d=t.Icon,u=t.iconStyle,f=t.iconClassName,p=dO(t,aO),m=Qj(),b=m.isDarkMode;return h.jsx(nO,Vo(Vo({flex:"none",style:Vo({background:s,borderRadius:n==="circle"?"50%":Math.floor(o*.1),boxShadow:oO(b,s),color:i,height:o,width:o},a)},p),{},{children:d&&h.jsx(d,{className:f,color:i,size:o,style:Vo({transform:"scale(".concat(c,")")},u)})}))});function rs(t){"@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(t)}var fO=["Icon","style","Text","color","size","spaceMultiple","textMultiple","extra","extraStyle","showText","showLogo","extraClassName","iconProps","inverse"];function wp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function kn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?wp(Object(n),!0).forEach(function(r){pO(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function pO(t,e,n){return e=mO(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function mO(t){var e=gO(t,"string");return rs(e)=="symbol"?e:String(e)}function gO(t,e){if(rs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(rs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function bO(t,e){if(t==null)return{};var n=xO(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function xO(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var _n=g.memo(function(t){var e=t.Icon,n=t.style,r=t.Text,i=t.color,s=t.size,o=s===void 0?24:s,a=t.spaceMultiple,l=a===void 0?1:a,c=t.textMultiple,d=c===void 0?1:c,u=t.extra,f=t.extraStyle,p=t.showText,m=p===void 0?!0:p,b=t.showLogo,x=b===void 0?!0:b,w=t.extraClassName,v=t.iconProps,S=t.inverse,C=bO(t,fO),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(ex,kn(kn({align:"center",flex:"none",horizontal:!0,justify:"flex-start",style:kn({color:i},n)},C),{},{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})]}))}),yO=function(e,n){return g.useMemo(function(){var r=Array.from({length:n},function(i,s){var o="lobe-icons-".concat(sO(e),"-fill-").concat(s);return{fill:"url(#".concat(o,")"),id:o}});return r},[e,n])},Jr="Claude",vO=.8,wO=.1,tx="#D97757",kO=tx,SO="#fff",CO=.75;function is(t){"@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(t)}var jO=["size","style"];function kp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function _l(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?kp(Object(n),!0).forEach(function(r){OO(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):kp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function OO(t,e,n){return e=PO(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function PO(t){var e=NO(t,"string");return is(e)=="symbol"?e:String(e)}function NO(t,e){if(is(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(is(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function AO(t,e){if(t==null)return{};var n=MO(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function MO(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var ld=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=AO(t,jO);return h.jsxs("svg",_l(_l({fill:"currentColor",fillRule:"evenodd",height:n,style:_l({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,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 ss(t){"@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(t)}function Sp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function DO(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Sp(Object(n),!0).forEach(function(r){TO(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Sp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function TO(t,e,n){return e=EO(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function EO(t){var e=RO(t,"string");return ss(e)=="symbol"?e:String(e)}function RO(t,e){if(ss(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ss(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function LO(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var IO=g.memo(function(t){var e=Object.assign({},(LO(t),t));return h.jsx(Hn,DO({Icon:ld,"aria-label":Jr,background:kO,color:SO,iconMultiple:CO},e))});function os(t){"@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(t)}var $O=["size","style"];function Cp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Wl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Cp(Object(n),!0).forEach(function(r){BO(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Cp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function BO(t,e,n){return e=FO(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function FO(t){var e=VO(t,"string");return os(e)=="symbol"?e:String(e)}function VO(t,e){if(os(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(os(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function zO(t,e){if(t==null)return{};var n=HO(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function HO(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var nx=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=zO(t,$O);return h.jsxs("svg",Wl(Wl({height:n,style:Wl({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,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 as(t){"@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(t)}var _O=["size","style"];function jp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ul(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?jp(Object(n),!0).forEach(function(r){WO(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):jp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function WO(t,e,n){return e=UO(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function UO(t){var e=KO(t,"string");return as(e)=="symbol"?e:String(e)}function KO(t,e){if(as(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(as(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function GO(t,e){if(t==null)return{};var n=qO(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function qO(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var rx=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=GO(t,_O);return h.jsxs("svg",Ul(Ul({fill:"currentColor",fillRule:"nonzero",height:n,style:Ul({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 ls(t){"@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(t)}var JO=["type"];function Op(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function YO(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Op(Object(n),!0).forEach(function(r){QO(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Op(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function QO(t,e,n){return e=XO(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function XO(t){var e=ZO(t,"string");return ls(e)=="symbol"?e:String(e)}function ZO(t,e){if(ls(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ls(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function e6(t,e){if(t==null)return{};var n=t6(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function t6(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var n6=g.memo(function(t){var e=t.type,n=e===void 0?"mono":e,r=e6(t,JO),i=n==="color"?nx:ld;return h.jsx(_n,YO({Icon:i,Text:rx,"aria-label":Jr,spaceMultiple:wO,textMultiple:vO},r))}),fr=ld;fr.Color=nx;fr.Text=rx;fr.Combine=n6;fr.Avatar=IO;fr.colorPrimary=tx;fr.title=Jr;var Js="OpenAI",r6=.75,i6=.1,ix="#000",sx="#19C37D",ox="#AB68FF",ax="#F86AA4",cd="#F9C322",lx="#0099FF",cx="#0000FE",s6=ix,o6="#fff",a6=.75;function cs(t){"@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(t)}var l6=["size","style"];function Pp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Kl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Pp(Object(n),!0).forEach(function(r){c6(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Pp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function c6(t,e,n){return e=h6(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function h6(t){var e=d6(t,"string");return cs(e)=="symbol"?e:String(e)}function d6(t,e){if(cs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(cs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function u6(t,e){if(t==null)return{};var n=f6(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function f6(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var hd=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=u6(t,l6);return h.jsxs("svg",Kl(Kl({fill:"currentColor",fillRule:"evenodd",height:n,style:Kl({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Js}),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"})]}))}),hr="Gemini",p6=.8,m6=.2,hx="#fff",g6=hx,b6="#fff",x6=.8;function hs(t){"@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(t)}var y6=["size","style"];function Np(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Gl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Np(Object(n),!0).forEach(function(r){v6(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Np(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function v6(t,e,n){return e=w6(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function w6(t){var e=k6(t,"string");return hs(e)=="symbol"?e:String(e)}function k6(t,e){if(hs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(hs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function S6(t,e){return P6(t)||O6(t,e)||j6(t,e)||C6()}function C6(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
245
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function j6(t,e){if(t){if(typeof t=="string")return Ap(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ap(t,e)}}function Ap(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function O6(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function P6(t){if(Array.isArray(t))return t}function N6(t,e){if(t==null)return{};var n=A6(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function A6(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var dd=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=N6(t,y6),s=yO(hr,3),o=S6(s,3),a=o[0],l=o[1],c=o[2];return h.jsxs("svg",Gl(Gl({height:n,style:Gl({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:hr}),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 ds(t){"@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(t)}function Mp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function M6(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Mp(Object(n),!0).forEach(function(r){D6(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Mp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function D6(t,e,n){return e=T6(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function T6(t){var e=E6(t,"string");return ds(e)=="symbol"?e:String(e)}function E6(t,e){if(ds(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ds(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function R6(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var L6=g.memo(function(t){var e=Object.assign({},(R6(t),t));return h.jsx(Hn,M6({Icon:dd,"aria-label":hr,background:g6,color:b6,iconMultiple:x6},e))});function us(t){"@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(t)}var I6=["size","style"];function Dp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ql(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Dp(Object(n),!0).forEach(function(r){$6(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Dp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function $6(t,e,n){return e=B6(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function B6(t){var e=F6(t,"string");return us(e)=="symbol"?e:String(e)}function F6(t,e){if(us(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(us(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function V6(t,e){if(t==null)return{};var n=z6(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function z6(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var dx=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=V6(t,I6);return h.jsxs("svg",ql(ql({fill:"currentColor",fillRule:"evenodd",height:n,style:ql({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:hr}),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 fs(t){"@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(t)}var H6=["size","style"];function Tp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Jl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Tp(Object(n),!0).forEach(function(r){_6(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Tp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function _6(t,e,n){return e=W6(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function W6(t){var e=U6(t,"string");return fs(e)=="symbol"?e:String(e)}function U6(t,e){if(fs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(fs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function K6(t,e){if(t==null)return{};var n=G6(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function G6(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var ux=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=K6(t,H6);return h.jsxs("svg",Jl(Jl({fill:"currentColor",fillRule:"evenodd",height:n,style:Jl({flex:"none",lineHeight:1},r),viewBox:"0 0 98 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:hr}),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 ps(t){"@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(t)}var q6=["type"];function Ep(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function J6(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ep(Object(n),!0).forEach(function(r){Y6(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ep(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Y6(t,e,n){return e=Q6(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Q6(t){var e=X6(t,"string");return ps(e)=="symbol"?e:String(e)}function X6(t,e){if(ps(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ps(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Z6(t,e){if(t==null)return{};var n=eP(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function eP(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var tP=g.memo(function(t){var e=t.type,n=e===void 0?"mono":e,r=Z6(t,q6),i=n==="color"?dd:dx;return h.jsx(_n,J6({Icon:i,Text:ux,"aria-label":hr,spaceMultiple:m6,textMultiple:p6},r))}),pr=dx;pr.Color=dd;pr.Text=ux;pr.Combine=tP;pr.Avatar=L6;pr.colorPrimary=hx;pr.title=hr;function ms(t){"@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(t)}var nP=["type"];function Rp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function rP(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Rp(Object(n),!0).forEach(function(r){iP(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Rp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function iP(t,e,n){return e=sP(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function sP(t){var e=oP(t,"string");return ms(e)=="symbol"?e:String(e)}function oP(t,e){if(ms(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ms(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function aP(t,e){if(t==null)return{};var n=lP(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function lP(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var cP=g.memo(function(t){var e=t.type,n=e===void 0?"normal":e,r=aP(t,nP),i=g.useMemo(function(){switch(n){case"gpt3":return sx;case"gpt4":return ox;case"gpt5":return ax;case"o3":case"o1":return cd;case"oss":return lx;case"platform":return cx;default:return s6}},[n]);return h.jsx(Hn,rP({Icon:hd,"aria-label":Js,background:i,color:o6,iconMultiple:a6},r))});function gs(t){"@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(t)}var hP=["size","style"];function Lp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Yl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Lp(Object(n),!0).forEach(function(r){dP(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Lp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function dP(t,e,n){return e=uP(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function uP(t){var e=fP(t,"string");return gs(e)=="symbol"?e:String(e)}function fP(t,e){if(gs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(gs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function pP(t,e){if(t==null)return{};var n=mP(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function mP(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var fx=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=pP(t,hP);return h.jsxs("svg",Yl(Yl({fill:"currentColor",fillRule:"evenodd",height:n,style:Yl({flex:"none",lineHeight:1},r),viewBox:"0 0 84 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Js}),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 bs(t){"@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(t)}var gP=["extraStyle"];function Ip(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function $p(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ip(Object(n),!0).forEach(function(r){bP(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ip(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function bP(t,e,n){return e=xP(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xP(t){var e=yP(t,"string");return bs(e)=="symbol"?e:String(e)}function yP(t,e){if(bs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(bs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function vP(t,e){if(t==null)return{};var n=wP(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function wP(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var kP=g.memo(function(t){var e=t.extraStyle,n=vP(t,gP);return h.jsx(_n,$p({Icon:hd,Text:fx,"aria-label":Js,extraStyle:$p({fontWeight:600},e),spaceMultiple:i6,textMultiple:r6},n))}),Ct=hd;Ct.Text=fx;Ct.Combine=kP;Ct.Avatar=cP;Ct.colorPrimary=ix;Ct.colorGpt3=sx;Ct.colorGpt4=ox;Ct.colorGpt5=ax;Ct.colorO1=cd;Ct.colorO3=cd;Ct.colorOss=lx;Ct.colorPlatform=cx;Ct.title=Js;var Ys="GithubCopilot",SP=.75,CP=.3,px="#000",jP=px,OP="#fff",PP=.75;function xs(t){"@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(t)}var NP=["size","style"];function Bp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ql(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Bp(Object(n),!0).forEach(function(r){AP(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Bp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function AP(t,e,n){return e=MP(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function MP(t){var e=DP(t,"string");return xs(e)=="symbol"?e:String(e)}function DP(t,e){if(xs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(xs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function TP(t,e){if(t==null)return{};var n=EP(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function EP(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var ud=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=TP(t,NP);return h.jsxs("svg",Ql(Ql({fill:"currentColor",fillRule:"evenodd",height:n,style:Ql({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Ys}),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 ys(t){"@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(t)}function Fp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function RP(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Fp(Object(n),!0).forEach(function(r){LP(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Fp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function LP(t,e,n){return e=IP(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function IP(t){var e=$P(t,"string");return ys(e)=="symbol"?e:String(e)}function $P(t,e){if(ys(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ys(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function BP(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var FP=g.memo(function(t){var e=Object.assign({},(BP(t),t));return h.jsx(Hn,RP({Icon:ud,"aria-label":Ys,background:jP,color:OP,iconMultiple:PP},e))});function vs(t){"@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(t)}var VP=["size","style"];function Vp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Xl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Vp(Object(n),!0).forEach(function(r){zP(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Vp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function zP(t,e,n){return e=HP(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function HP(t){var e=_P(t,"string");return vs(e)=="symbol"?e:String(e)}function _P(t,e){if(vs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(vs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function WP(t,e){if(t==null)return{};var n=UP(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function UP(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var mx=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=WP(t,VP);return h.jsxs("svg",Xl(Xl({fill:"currentColor",fillRule:"evenodd",height:n,style:Xl({flex:"none",lineHeight:1},r),viewBox:"0 0 154 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Ys}),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 ws(t){"@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(t)}function zp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function KP(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?zp(Object(n),!0).forEach(function(r){GP(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):zp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function GP(t,e,n){return e=qP(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qP(t){var e=JP(t,"string");return ws(e)=="symbol"?e:String(e)}function JP(t,e){if(ws(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ws(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function YP(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var QP=g.memo(function(t){var e=Object.assign({},(YP(t),t));return h.jsx(_n,KP({Icon:ud,Text:mx,"aria-label":Ys,spaceMultiple:CP,textMultiple:SP},e))}),Yr=ud;Yr.Text=mx;Yr.Combine=QP;Yr.Avatar=FP;Yr.colorPrimary=px;Yr.title=Ys;var Qs="Cline",XP=.7,ZP=.2,gx="#323B43",e7=gx,t7="#fff",n7=.6;function ks(t){"@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(t)}var r7=["size","style"];function Hp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Zl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Hp(Object(n),!0).forEach(function(r){i7(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Hp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function i7(t,e,n){return e=s7(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s7(t){var e=o7(t,"string");return ks(e)=="symbol"?e:String(e)}function o7(t,e){if(ks(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ks(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function a7(t,e){if(t==null)return{};var n=l7(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function l7(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var fd=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=a7(t,r7);return h.jsxs("svg",Zl(Zl({fill:"currentColor",fillRule:"evenodd",height:n,style:Zl({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Qs}),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 Ss(t){"@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(t)}function _p(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function c7(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?_p(Object(n),!0).forEach(function(r){h7(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_p(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function h7(t,e,n){return e=d7(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function d7(t){var e=u7(t,"string");return Ss(e)=="symbol"?e:String(e)}function u7(t,e){if(Ss(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ss(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function f7(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var p7=g.memo(function(t){var e=Object.assign({},(f7(t),t));return h.jsx(Hn,c7({Icon:fd,"aria-label":Qs,background:e7,color:t7,iconMultiple:n7},e))});function Cs(t){"@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(t)}var m7=["size","style"];function Wp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ec(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Wp(Object(n),!0).forEach(function(r){g7(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Wp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function g7(t,e,n){return e=b7(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function b7(t){var e=x7(t,"string");return Cs(e)=="symbol"?e:String(e)}function x7(t,e){if(Cs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Cs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function y7(t,e){if(t==null)return{};var n=v7(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function v7(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var bx=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=y7(t,m7);return h.jsxs("svg",ec(ec({fill:"currentColor",fillRule:"evenodd",height:n,style:ec({flex:"none",lineHeight:1},r),viewBox:"0 0 88 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Qs}),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 js(t){"@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(t)}function Up(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function w7(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Up(Object(n),!0).forEach(function(r){k7(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Up(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function k7(t,e,n){return e=S7(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function S7(t){var e=C7(t,"string");return js(e)=="symbol"?e:String(e)}function C7(t,e){if(js(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(js(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function j7(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var O7=g.memo(function(t){var e=Object.assign({},(j7(t),t));return h.jsx(_n,w7({Icon:fd,Text:bx,"aria-label":Qs,iconProps:{shape:"square"},spaceMultiple:ZP,textMultiple:XP},e))}),Qr=fd;Qr.Text=bx;Qr.Combine=O7;Qr.Avatar=p7;Qr.colorPrimary=gx;Qr.title=Qs;var Xs="Cursor",P7=.7,N7=.1,xx="#000",A7=xx,M7="#fff",D7=.6;function Os(t){"@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(t)}var T7=["size","style"];function Kp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function tc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Kp(Object(n),!0).forEach(function(r){E7(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Kp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function E7(t,e,n){return e=R7(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function R7(t){var e=L7(t,"string");return Os(e)=="symbol"?e:String(e)}function L7(t,e){if(Os(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Os(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function I7(t,e){if(t==null)return{};var n=$7(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function $7(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var pd=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=I7(t,T7);return h.jsxs("svg",tc(tc({fill:"currentColor",fillRule:"evenodd",height:n,style:tc({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Xs}),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 Ps(t){"@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(t)}function Gp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function B7(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Gp(Object(n),!0).forEach(function(r){F7(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Gp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function F7(t,e,n){return e=V7(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function V7(t){var e=z7(t,"string");return Ps(e)=="symbol"?e:String(e)}function z7(t,e){if(Ps(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ps(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function H7(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var _7=g.memo(function(t){var e=Object.assign({},(H7(t),t));return h.jsx(Hn,B7({Icon:pd,"aria-label":Xs,background:A7,color:M7,iconMultiple:D7},e))});function Ns(t){"@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(t)}var W7=["size","style"];function qp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function nc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?qp(Object(n),!0).forEach(function(r){U7(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):qp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function U7(t,e,n){return e=K7(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function K7(t){var e=G7(t,"string");return Ns(e)=="symbol"?e:String(e)}function G7(t,e){if(Ns(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ns(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function q7(t,e){if(t==null)return{};var n=J7(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function J7(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var yx=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=q7(t,W7);return h.jsxs("svg",nc(nc({fill:"currentColor",fillRule:"evenodd",height:n,style:nc({flex:"none",lineHeight:1},r),viewBox:"0 0 123 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Xs}),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 As(t){"@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(t)}function Jp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Y7(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Jp(Object(n),!0).forEach(function(r){Q7(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Jp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Q7(t,e,n){return e=X7(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function X7(t){var e=Z7(t,"string");return As(e)=="symbol"?e:String(e)}function Z7(t,e){if(As(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(As(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function e8(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var t8=g.memo(function(t){var e=Object.assign({},(e8(t),t));return h.jsx(_n,Y7({Icon:pd,Text:yx,"aria-label":Xs,spaceMultiple:N7,textMultiple:P7},e))}),Xr=pd;Xr.Text=yx;Xr.Combine=t8;Xr.Avatar=_7;Xr.colorPrimary=xx;Xr.title=Xs;var Zs="Goose",n8=.7,r8=.2,vx="#fff",i8=vx,s8="#000",o8=.65;function Ms(t){"@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(t)}var a8=["size","style"];function Yp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function rc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Yp(Object(n),!0).forEach(function(r){l8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Yp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function l8(t,e,n){return e=c8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function c8(t){var e=h8(t,"string");return Ms(e)=="symbol"?e:String(e)}function h8(t,e){if(Ms(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ms(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function d8(t,e){if(t==null)return{};var n=u8(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function u8(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var md=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=d8(t,a8);return h.jsxs("svg",rc(rc({fill:"currentColor",fillRule:"evenodd",height:n,style:rc({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Zs}),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 Ds(t){"@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(t)}function Qp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function f8(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Qp(Object(n),!0).forEach(function(r){p8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Qp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function p8(t,e,n){return e=m8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function m8(t){var e=g8(t,"string");return Ds(e)=="symbol"?e:String(e)}function g8(t,e){if(Ds(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ds(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function b8(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var x8=g.memo(function(t){var e=Object.assign({},(b8(t),t));return h.jsx(Hn,f8({Icon:md,"aria-label":Zs,background:i8,color:s8,iconMultiple:o8},e))});function Ts(t){"@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(t)}var y8=["size","style"];function Xp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ic(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Xp(Object(n),!0).forEach(function(r){v8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Xp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function v8(t,e,n){return e=w8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function w8(t){var e=k8(t,"string");return Ts(e)=="symbol"?e:String(e)}function k8(t,e){if(Ts(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ts(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function S8(t,e){if(t==null)return{};var n=C8(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function C8(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var wx=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=S8(t,y8);return h.jsxs("svg",ic(ic({fill:"currentColor",fillRule:"evenodd",height:n,style:ic({flex:"none",lineHeight:1},r),viewBox:"0 0 87 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:Zs}),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 Es(t){"@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(t)}function Zp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function j8(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Zp(Object(n),!0).forEach(function(r){O8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Zp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function O8(t,e,n){return e=P8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function P8(t){var e=N8(t,"string");return Es(e)=="symbol"?e:String(e)}function N8(t,e){if(Es(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Es(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function A8(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var M8=g.memo(function(t){var e=Object.assign({},(A8(t),t));return h.jsx(_n,j8({Icon:md,Text:wx,"aria-label":Zs,iconProps:{shape:"square"},spaceMultiple:r8,textMultiple:n8},e))}),Zr=md;Zr.Text=wx;Zr.Combine=M8;Zr.Avatar=x8;Zr.colorPrimary=vx;Zr.title=Zs;var eo="Windsurf",D8=.7,T8=.2,kx="#fff",E8=kx,R8="#000",L8=.75;function Rs(t){"@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(t)}var I8=["size","style"];function em(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function sc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?em(Object(n),!0).forEach(function(r){$8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):em(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function $8(t,e,n){return e=B8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function B8(t){var e=F8(t,"string");return Rs(e)=="symbol"?e:String(e)}function F8(t,e){if(Rs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Rs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function V8(t,e){if(t==null)return{};var n=z8(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function z8(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var gd=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=V8(t,I8);return h.jsxs("svg",sc(sc({fill:"currentColor",fillRule:"evenodd",height:n,style:sc({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:eo}),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 Ls(t){"@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(t)}function tm(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function H8(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?tm(Object(n),!0).forEach(function(r){_8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tm(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function _8(t,e,n){return e=W8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function W8(t){var e=U8(t,"string");return Ls(e)=="symbol"?e:String(e)}function U8(t,e){if(Ls(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ls(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function K8(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var G8=g.memo(function(t){var e=Object.assign({},(K8(t),t));return h.jsx(Hn,H8({Icon:gd,"aria-label":eo,background:E8,color:R8,iconMultiple:L8},e))});function Is(t){"@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(t)}var q8=["size","style"];function nm(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function oc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?nm(Object(n),!0).forEach(function(r){J8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):nm(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function J8(t,e,n){return e=Y8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Y8(t){var e=Q8(t,"string");return Is(e)=="symbol"?e:String(e)}function Q8(t,e){if(Is(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Is(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function X8(t,e){if(t==null)return{};var n=Z8(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Z8(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var Sx=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=X8(t,q8);return h.jsxs("svg",oc(oc({fill:"currentColor",fillRule:"evenodd",height:n,style:oc({flex:"none",lineHeight:1},r),viewBox:"0 0 111 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[h.jsx("title",{children:eo}),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 $s(t){"@babel/helpers - typeof";return $s=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},$s(t)}function rm(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function eN(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?rm(Object(n),!0).forEach(function(r){tN(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):rm(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function tN(t,e,n){return e=nN(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function nN(t){var e=rN(t,"string");return $s(e)=="symbol"?e:String(e)}function rN(t,e){if($s(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if($s(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function iN(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var sN=g.memo(function(t){var e=Object.assign({},(iN(t),t));return h.jsx(_n,eN({Icon:gd,Text:Sx,"aria-label":eo,iconProps:{shape:"square"},spaceMultiple:T8,textMultiple:D8},e))}),ei=gd;ei.Text=Sx;ei.Combine=sN;ei.Avatar=G8;ei.colorPrimary=kx;ei.title=eo;const oN={"claude-code":fr.Avatar,cursor:Xr.Avatar,codex:Ct.Avatar,"gemini-cli":pr.Avatar,goose:Zr.Avatar,"github-copilot":Yr.Avatar,windsurf:ei.Avatar,cline:Qr.Avatar},aN={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 lN(t){return t.split(/\s+/).map(e=>e[0]).join("").toUpperCase().slice(0,2)}const Cx=({agentName:t,displayName:e,size:n=20})=>{const r=oN[t];if(r)return h.jsx(r,{size:n});const i=aN[t];return i?h.jsx("img",{src:i,alt:e,className:"rounded object-contain",style:{width:n,height:n}}):h.jsx("div",{className:"flex items-center justify-center rounded bg-dash-surface-hover text-dash-text-muted font-semibold",style:{width:n,height:n,fontSize:n*.45},children:lN(e)})};function ac(t){return JSON.stringify([t.provider,t.type,t.item,t.global])}function cN(t){if(typeof t=="string"){const e=t.trim();return e.length>0?e:null}if(typeof t=="object"&&t!==null){const e=t;for(const n of["message","error","detail","details","reason"]){const r=e[n];if(typeof r=="string"&&r.trim().length>0)return r.trim()}}return null}async function im(t,e){const r=(await t.text().catch(()=>"")).trim();if(!r)return e;try{const i=JSON.parse(r);return cN(i)||e}catch{return r}}function hN(){const[t,e]=g.useState("idle"),[n,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 C=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 im(y,"Failed to reconcile migration plan");throw new Error(A)}const M=await y.json();if(C!==d.current)return;r(M.plan),s(new Map),e("reviewing")}catch(O){if(k.signal.aborted||O instanceof DOMException&&O.name==="AbortError"||C!==d.current)return;c(O instanceof Error?O.message:"Failed to reconcile"),e("error")}},[]),b=g.useCallback((S,C)=>{s(k=>{const O=new Map(k);return O.set(ac(S),C),O})},[]),x=g.useCallback(async()=>{if(!n)return c("No plan to execute"),e("error"),!1;e("executing"),c(null),u.current+=1;const S=u.current;p.current?.abort();const C=new AbortController;p.current=C;try{const k=Object.fromEntries(i.entries()),O=await fetch("/api/migrate/execute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:n,resolutions:k}),signal:C.signal});if(S!==u.current)return!1;if(!O.ok){const M=await im(O,"Failed to execute migration");if(O.status===501)return c(M||"Plan execution is not available in this server build"),e("reviewing"),!1;throw new Error(M)}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 C.signal.aborted||k instanceof DOMException&&k.name==="AbortError"||S!==u.current||(c(k instanceof Error?k.message:"Failed to execute migration"),e("error")),!1}},[n,i]),w=g.useCallback(()=>{f.current?.abort(),p.current?.abort(),e("idle"),r(null),s(new Map),a(null),c(null)},[]),v=g.useMemo(()=>n?n.actions.filter(S=>S.action==="conflict").every(S=>i.has(ac(S))):!0,[n,i]);return{phase:t,plan:n,resolutions:i,results:o,error:l,reconcile:m,resolve:b,execute:x,reset:w,allConflictsResolved:v,actionKey:ac}}const dN={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"},sm={detected:"#D4A574","not-detected":"#8B9DC3"},lt=({label:t,value:e,tone:n="default"})=>{const r=n==="accent"?"text-dash-accent":n==="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:t}),h.jsx("p",{className:`mt-1 text-lg font-semibold ${r}`,children:e})]})};function om(t,e){return t.success?t.skipped?{label:e("migrateStatusSkipped"),className:"text-yellow-400"}:{label:e("migrateStatusInstalled"),className:"text-green-400"}:{label:e("migrateStatusFailed"),className:"text-red-400"}}const uN=new Set([8203,8204,8205,8288,65279,8232,8233,8234,8235,8236,8237,8238,8294,8295,8296,8297]);function fN(t){return t===9||t===10||t===13?!0:t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159||uN.has(t)}function am(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(fN(r)||(e+=n))}return e}const pN=({provider:t,include:e,isSelected:n,cardClickToggles:r,onToggleSelect:i,onOpenDetails:s,t:o})=>{const a=Nt.filter(c=>t.capabilities[c]).length,l=Nt.some(c=>e[c]&&!t.capabilities[c]);return h.jsxs("div",{className:`relative rounded-xl border px-4 py-3 cursor-pointer transition-all ${n?"bg-dash-accent-subtle border-dash-accent/30 shadow-sm shadow-dash-accent/10":l?"bg-dash-surface border-yellow-500/25 hover:bg-dash-surface-hover hover:border-yellow-500/40":"bg-dash-surface border-dash-border hover:bg-dash-surface-hover hover:border-dash-accent/25"}`,children:[h.jsx("button",{type:"button",onClick:()=>r?i(t.name):s(t.name),"aria-label":r?`${t.displayName} deselect`:`${t.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(Cx,{agentName:t.name,displayName:t.displayName,size:18}),h.jsx("span",{className:"text-sm font-semibold text-dash-text truncate",children:t.displayName}),t.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")}),t.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:[t.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:t.detected?"text-dash-accent":"text-dash-text-muted",children:t.detected?o("migrateDetectedTag"):o("migrateNotDetectedTag")}),h.jsx("span",{className:"text-dash-text-muted",children:t.recommended?o("migrateFilterRecommended"):"-"})]}),h.jsx("div",{className:"flex flex-wrap gap-1",children:Nt.map(c=>{const d=t.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(t.name)},className:`dash-focus-ring px-4 py-1.5 text-xs font-semibold rounded-md transition-colors ${n?"bg-transparent text-dash-text-secondary border border-dash-border hover:bg-dash-surface-hover":"bg-dash-accent text-white hover:bg-dash-accent/90"}`,children:o(n?"migrateSelectedButton":"migrateSelectButton")})})]})]})},mN=({provider:t,include:e,isSelected:n,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":t.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(Cx,{agentName:t.name,displayName:t.displayName,size:22}),h.jsx("h2",{className:"text-xl font-bold text-dash-text truncate",children:t.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:t.name}),h.jsx("span",{className:`text-[10px] uppercase tracking-wide px-2 py-0.5 rounded border ${t.detected?"border-dash-accent/30 text-dash-accent":"border-dash-border text-dash-text-muted"}`,children:t.detected?o("migrateDetectedTag"):o("migrateNotDetectedTag")}),t.recommended&&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=t.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)})})]}),t.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 ${om(r,o).className}`,children:om(r,o).label})]}),h.jsx("p",{className:"text-xs font-mono text-dash-text break-all",children:am(r.path||"-")}),(r.error||r.skipReason)&&h.jsx("p",{className:"text-xs text-red-400 break-words",children:am(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(t.name),className:`px-4 py-2 text-sm font-semibold rounded-md transition-colors ${n?"bg-transparent text-dash-text-secondary border border-dash-border hover:bg-dash-surface-hover":"bg-dash-accent text-white hover:bg-dash-accent/90"}`,children:o(n?"migrateUnselectProvider":"migrateSelectProviderAction")}),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")})]})]})})},gN=()=>{const{t}=he(),e=hN(),[n,r]=g.useState([]),[i,s]=g.useState(null),[o,a]=g.useState([]),[l,c]=g.useState(dN),[d,u]=g.useState(!0),[f,p]=g.useState(!0),[m,b]=g.useState(!1),[x,w]=g.useState(null),[v,S]=g.useState(""),C=g.useDeferredValue(v),[k,O]=g.useState("all"),[y,M]=g.useState(null),A=g.useRef(0),R=g.useCallback(async(I=!1)=>{A.current+=1;const K=A.current;try{I?b(!0):p(!0),w(null);const[le,De]=await Promise.all([Fv(),su()]);if(K!==A.current)return;r(le.providers),s(De),a(Ut=>{if(Ut.length===0)return[];const to=le.providers.map(ti=>ti.name);return Ut.filter(ti=>to.includes(ti))})}catch(le){if(K!==A.current)return;w(le instanceof Error?le.message:t("migrateDetectFailed"))}finally{K===A.current&&(p(!1),b(!1))}},[t]);g.useEffect(()=>{R()},[R]);const N=g.useMemo(()=>{const I=new Map;for(const K of n)I.set(K.name,K);return I},[n]),L=g.useMemo(()=>y&&N.get(y)||null,[y,N]);g.useEffect(()=>{y&&!N.has(y)&&M(null)},[y,N]);const _=g.useCallback(()=>{M(null)},[]),$=g.useMemo(()=>new Set(o),[o]),F=g.useMemo(()=>n.filter(I=>I.detected).length,[n]),G=o.length,fe=g.useMemo(()=>n.filter(I=>I.recommended).length,[n]),X=g.useMemo(()=>Nt.filter(I=>l[I]).length,[l]),te=g.useMemo(()=>{const I=[];l.commands&&o.includes("codex")&&!d&&N.get("codex")?.commandsGlobalOnly&&I.push(t("migrateGlobalForced"));for(const K of Nt){if(!l[K])continue;const le=o.filter(De=>!N.get(De)?.capabilities[K]).map(De=>N.get(De)?.displayName||De);le.length>0&&I.push(`${t("migrateUnsupported")}: ${t(Zn[K])} -> ${le.join(", ")}`)}return I},[l,d,N,o,t]),oe=g.useCallback(I=>{if(I==="codex"){a(["codex"]);return}if(I==="antigravity"){a(["antigravity"]);return}if(I==="core"){const le=["codex","antigravity","droid"].filter(De=>n.some(Ut=>Ut.name===De));a(le);return}const K=n.filter(le=>le.detected).map(le=>le.name);a(K)},[n]),me=g.useCallback(I=>{a(K=>K.includes(I)?K.filter(le=>le!==I):[...K,I])},[]),Y=g.useCallback(I=>{c(K=>({...K,[I]:!K[I]}))},[]),ae=g.useMemo(()=>{const I=[...n];return I.sort((K,le)=>{const De=$.has(K.name),Ut=$.has(le.name);return De!==Ut?De?-1:1:K.detected!==le.detected?K.detected?-1:1:K.recommended!==le.recommended?K.recommended?-1:1:K.displayName.localeCompare(le.displayName)}),I},[n,$]),de=g.useMemo(()=>{const I=C.trim().toLowerCase();return ae.filter(K=>{if(k==="selected"&&!$.has(K.name)||k==="detected"&&!K.detected||k==="recommended"&&!K.recommended||k==="not-detected"&&K.detected)return!1;if(!I)return!0;const le=Nt.filter(De=>K.capabilities[De]).map(De=>t(Zn[De]).toLowerCase());return K.displayName.toLowerCase().includes(I)||K.name.toLowerCase().includes(I)||le.some(De=>De.includes(I))})},[C,k,$,ae,t]),ke=g.useMemo(()=>{const I=de.filter(De=>De.detected),K=de.filter(De=>!De.detected),le=[];return I.length>0&&le.push({key:"detected",label:t("migrateDetectedTag"),providers:I}),K.length>0&&le.push({key:"not-detected",label:t("migrateNotDetectedTag"),providers:K}),le},[de,t]),Qe=g.useMemo(()=>({all:n.length,selected:G,detected:n.filter(I=>I.detected).length,recommended:n.filter(I=>I.recommended).length,"not-detected":n.filter(I=>!I.detected).length}),[n,G]),mt=g.useMemo(()=>de.map(I=>I.name),[de]),q=g.useCallback(()=>{a(I=>{const K=new Set(I);for(const le of mt)K.add(le);return Array.from(K)})},[mt]),Me=g.useCallback(()=>{a([])},[]),Ce=g.useCallback(async()=>{if(o.length===0){w(t("migrateSelectProvider"));return}if(X===0){w(t("migrateNoTypesEnabled"));return}await e.reconcile({providers:o,global:d,include:l})},[X,l,d,o,t,e]),Ie=g.useCallback(async()=>{if(w(null),!!await e.execute())try{const K=await su();s(K)}catch(K){console.error("Failed to refresh discovery:",K)}},[e]),Se=g.useMemo(()=>{const I=new Map;if(!e.results)return I;for(const K of e.results.results)I.set(K.provider,K);return I},[e.results]);g.useEffect(()=>{const I=K=>{const le=K.target,De=!!(le&&(le instanceof HTMLInputElement||le instanceof HTMLTextAreaElement||le.isContentEditable||le.closest('[contenteditable="true"], [role="textbox"]'))),Ut=K.metaKey||K.ctrlKey||K.altKey;K.key==="/"&&!De&&!Ut&&(K.preventDefault(),document.getElementById("migrate-search")?.focus())};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[]);const gt=e.phase==="idle"&&o.length>0&&X>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:t("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:t("migrate")}),h.jsx("h1",{className:"text-xl md:text-2xl font-semibold text-dash-text",children:t("migrateTitle")}),h.jsx("p",{className:"text-sm text-dash-text-secondary max-w-3xl",children:t("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:t("migrateInstalled"),value:e.results.counts.installed,tone:"success"}),h.jsx(lt,{label:t("migrateSkipped"),value:e.results.counts.skipped}),h.jsx(lt,{label:t("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:t("migrateTypeAgents"),value:i?.counts.agents??0}),h.jsx(lt,{label:t("migrateDetectedProviders"),value:F,tone:"success"}),h.jsx(lt,{label:t("migrateSelectedProviders"),value:G,tone:"accent"}),h.jsx(lt,{label:t("migrateTypes"),value:X})]})]})}),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:t("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:t("cancel")})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto px-5 pb-4",children:[h.jsx(Gj,{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:t("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:t("migrateExecutePlan")})]})]}),e.phase==="complete"&&e.results&&h.jsx(Ej,{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:t("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"?t("migrateReconciling"):t("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:t("migrateSearchProviders"),className:"dash-focus-ring w-full pl-9 pr-12 py-2 bg-dash-bg border border-dash-border rounded-lg text-dash-text text-sm focus:border-dash-accent transition-colors"}),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:t("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:t(m?"checking":"migrateRefresh")}),h.jsx("button",{type:"button",onClick:q,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:t("migrateSelectVisible")}),h.jsx("button",{type:"button",onClick:Me,disabled:G===0,className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-50 whitespace-nowrap",children:t("migrateClearSelection")})]})]}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{key:"all",label:t("categoryAll")},{key:"selected",label:t("migrateSelectedProviders")},{key:"detected",label:t("migrateDetectedProviders")},{key:"recommended",label:t("migrateFilterRecommended")},{key:"not-detected",label:t("migrateNotDetectedTag")}].map(I=>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:t("migrateTypes")}),h.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Nt.map(I=>h.jsx("button",{type:"button",onClick:()=>Y(I),className:`dash-focus-ring px-2.5 py-1 text-[11px] uppercase tracking-wide rounded-md border transition-colors ${l[I]?"border-dash-accent/45 text-dash-accent bg-dash-accent/5":"border-dash-border text-dash-text-muted hover:bg-dash-surface-hover"}`,children:t(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:t("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:t(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:t("migrateProvidersHeading")}),h.jsxs("p",{className:"text-xs text-dash-text-muted",children:[de.length," ",t("migrateProvidersCountSuffix")]})]}),n.length===0?h.jsx("div",{className:"text-sm text-dash-text-muted",children:t("migrateNoProviders")}):de.length===0?h.jsx("div",{className:"text-sm text-dash-text-muted",children:t("migrateNoProvidersMatch")}):h.jsx("div",{className:"space-y-5",children:ke.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:sm[I.key]}}),h.jsx("h2",{className:"text-[13px] font-semibold uppercase tracking-wide",style:{color:sm[I.key]},children:I.label}),h.jsxs("span",{className:"text-[11px] text-dash-text-muted ml-auto",children:[I.providers.length," ",t("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(K=>h.jsx(pN,{provider:K,include:l,isSelected:$.has(K.name),cardClickToggles:k==="selected",onToggleSelect:me,onOpenDetails:M,t},K.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:t("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," ",t("migrateSummarySubtitle")]})]}),h.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[h.jsx(lt,{label:t("migrateInstalled"),value:e.results.counts.installed,tone:"success"}),h.jsx(lt,{label:t("migrateSkipped"),value:e.results.counts.skipped}),h.jsx(lt,{label:t("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:t("migrateTypes")}),Nt.map(I=>{const K=e.results?.discovery?.[I]??0;return K===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:t(Zn[I])}),h.jsx("span",{className:"font-semibold text-dash-text",children:K})]},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:t("migrateSummaryProviders")}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:o.map(I=>{const K=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:K?.displayName||I},I)})})]}),h.jsx("div",{className:"text-[10px] px-3 py-1.5 bg-dash-bg rounded-md text-dash-text-muted",children:t(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:t("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:t("migrateActionSummaryTitle")}),h.jsxs("p",{className:"text-xs text-dash-text-muted mt-1",children:[G," ",t("migrateProvidersCountSuffix")," ·"," ",X,"/",Nt.length," ",t("migrateTypes")]})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h.jsx(lt,{label:t("migrateSelectedProviders"),value:G,tone:"accent"}),h.jsx(lt,{label:t("migrateDetectedProviders"),value:F}),h.jsx(lt,{label:t("migrateTypes"),value:X}),h.jsx(lt,{label:t("migrateFilterRecommended"),value:fe,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:t("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:t("migrateScopeGlobal")})]}),h.jsx("button",{type:"button",onClick:Ce,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"?t("migrateRunning"):t("migrateRun")}),te.length>0&&h.jsx("div",{className:"space-y-2",children:te.map((I,K)=>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}-${K}`))})]}),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:t("migrateSelectProviderAction")}),h.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h.jsx("button",{type:"button",onClick:()=>oe("codex"),className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover",children:t("migratePresetCodex")}),h.jsx("button",{type:"button",onClick:()=>oe("antigravity"),className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover",children:t("migratePresetAntigravity")}),h.jsx("button",{type:"button",onClick:()=>oe("core"),className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover",children:t("migratePresetCore")}),h.jsx("button",{type:"button",onClick:()=>oe("detected"),className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover",children:t("migratePresetDetected")})]})]})]})})]})]}),L&&h.jsx(mN,{provider:L,include:l,isSelected:$.has(L.name),latestResult:Se.get(L.name)||null,onToggleSelect:me,onClose:_,t})]})},bN=({featureId:t,name:e,description:n,included:r})=>{const{t:i}=he();return h.jsxs("div",{"data-testid":`feature-card-${t}`,className:`p-4 rounded-lg border transition-all ${r?"border-[var(--dash-accent)] bg-[var(--dash-surface)] shadow-sm":"border-[var(--dash-border)] bg-[var(--dash-bg)] opacity-50"}`,children:[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(n)})]})},xN=({selectedKit:t,onKitSelect:e,onInstall:n,installing:r})=>{const{t:i}=he(),[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(lc,{number:1,active:s===1,label:i("stepChooseKit")}),h.jsx("div",{className:"flex-1 h-px bg-[var(--dash-border)]"}),h.jsx(lc,{number:2,active:s===2,label:i("stepConfigure")}),h.jsx("div",{className:"flex-1 h-px bg-[var(--dash-border)]"}),h.jsx(lc,{number:3,active:s===3,label:i("stepInstall")})]}),h.jsxs("div",{className:"min-h-[200px]",children:[s===1&&h.jsx(yN,{onSelect:e,selected:t}),s===2&&t&&h.jsx(vN,{kit:t}),s===3&&h.jsx(wN,{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&&t&&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:n,disabled:r,className:"px-4 py-2 text-sm font-medium text-white bg-[var(--dash-accent)] rounded-lg hover:opacity-90 transition-opacity disabled:opacity-50 disabled:cursor-not-allowed","data-testid":"wizard-install",children:i("install")})]})]})},lc=({number:t,active:e,label:n})=>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:t}),h.jsx("span",{className:`text-sm font-medium ${e?"text-[var(--dash-text)]":"text-[var(--dash-text-muted)]"}`,children:n})]}),yN=({onSelect:t,selected:e})=>{const{t:n}=he();return h.jsxs("div",{className:"space-y-4",children:[h.jsx("p",{className:"text-[var(--dash-text-muted)]",children:e?`Selected: ${e===Qt.ENGINEER?n("kitEngineerName"):n("kitMarketingName")}`:"Please select a kit above"}),e&&h.jsxs("button",{type:"button",onClick:()=>t(e===Qt.ENGINEER?Qt.MARKETING:Qt.ENGINEER),className:"text-sm text-[var(--dash-accent)] hover:underline",children:["Switch to ",e===Qt.ENGINEER?n("kitMarketingName"):n("kitEngineerName")]})]})},vN=()=>h.jsx("div",{className:"text-[var(--dash-text-muted)]",children:"Configuration preview placeholder"}),wN=({installing:t})=>h.jsx("div",{className:"text-[var(--dash-text-muted)]",children:t?"Installing...":"Ready to install"}),kN=({kit:t,onGetStarted:e})=>{const{t:n}=he(),r=an(),i=t===Qt.ENGINEER?"kitEngineerName":t===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:n("installSuccess")}),h.jsx("p",{className:"text-[var(--dash-text-muted)] max-w-md mx-auto",children:n("installSuccessDesc").replace("{kit}",n(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:n("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:n("goToDashboard")})]})]})},SN=[{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}],jx={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 CN(t){const e=jx[t];return e?SN.filter(n=>e.features.includes(n.id)):(console.warn(`Unknown kit type: ${t}`),[])}const jN=({kit:t,selected:e,onSelect:n,features:r})=>{const{t:i}=he();return h.jsxs("button",{type:"button",onClick:n,className:`p-6 rounded-lg border-2 text-left transition-all w-full ${e?"border-[var(--dash-accent)] bg-[var(--dash-surface)] shadow-md":"border-[var(--dash-border)] hover:border-[var(--dash-accent)]/50"}`,children:[h.jsx("h3",{className:`text-xl font-bold ${t.primaryColor}`,children:i(t.name)}),h.jsx("p",{className:"text-[var(--dash-text-muted)] mt-1",children:i(t.tagline)}),h.jsx("div",{className:"mt-4 space-y-2",children:r.slice(0,3).map(s=>h.jsx(bN,{featureId:s.id,name:s.name,description:s.description,included:!0},s.id))})]})},ON=()=>{const{t}=he(),e=an(),[n,r]=g.useState(null),[i,s]=g.useState(!1),[o,a]=g.useState(!1),[l,c]=g.useState(null),d=async()=>{if(n){s(!0),c(null);try{const f=await fetch("/api/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kit:n})});if(!f.ok)throw new Error(`Installation failed: ${f.statusText}`);a(!0)}catch(f){const p=f instanceof Error?f.message:"Unknown error occurred";c(p),console.error("Install failed:",f)}finally{s(!1)}}};if(o&&n)return h.jsx(kN,{kit:n,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:t("onboardingTitle")}),h.jsx("p",{className:"mt-2 text-[var(--dash-text-muted)]",children:t("onboardingSubtitle")})]}),h.jsx("section",{className:"grid md:grid-cols-2 gap-6 mb-8",children:Object.values(jx).map(f=>{const p=u(f.id);return h.jsx(jN,{kit:f,selected:n===p,onSelect:()=>r(p),features:CN(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"})]}),n&&h.jsx(xN,{selectedKit:n,onKitSelect:r,onInstall:d,installing:i})]})},PN=()=>{const{t}=he(),e=an(),{projectId:n}=$m(),[r,i]=g.useState(null),{sizes:s,isDragging:o,startDrag:a}=hh({storageKey:"claudekit-project-config-panels",defaultSizes:[35,40,25],minSizes:[20,25,15]}),l=g.useCallback(async()=>{if(!n)throw new Error("No project ID");const[b,x,w]=await Promise.all([pp("project",n),pp("global"),Ch()]),v=w.find(S=>S.id===n);return v&&i(v.path),{...b,global:x.config??{}}},[n]),c=g.useCallback(async b=>n?(await Yb({scope:"project",projectId:n,config:b})).config:void 0,[n]),d=Jb({scope:"project",fetchConfig:l,fetchSchema:Qb,saveConfig:c}),u=g.useCallback(b=>{const x=mc(d.config,b),w=mc(d.globalConfig,b);return x!==void 0&&w!==void 0&&x!==w},[d.config,d.globalConfig]),f=g.useMemo(()=>[{id:"paths",title:t("sectionPaths"),fields:[{path:"paths.docs",label:t("fieldDocsPath"),description:t("fieldDocsPathDesc")},{path:"paths.plans",label:t("fieldPlansPath"),description:t("fieldPlansPathDesc")}]},{id:"project",title:t("sectionProject"),fields:[{path:"project.type",label:t("fieldProjectType"),description:t("fieldProjectTypeDesc")},{path:"project.packageManager",label:t("fieldPackageManager"),description:t("fieldPackageManagerDesc")},{path:"project.framework",label:t("fieldFramework"),description:t("fieldFrameworkDesc")}]},{id:"privacy",title:t("sectionPrivacy"),defaultCollapsed:!0,fields:[{path:"privacyBlock",label:t("fieldPrivacyBlock"),description:t("fieldPrivacyBlockDesc")}]},{id:"advanced",title:t("sectionAdvanced"),defaultCollapsed:!0,fields:[{path:"docs.maxLoc",label:t("fieldDocsMaxLoc"),description:t("fieldDocsMaxLocDesc")},{path:"plan.namingFormat",label:t("fieldPlanNamingFormat"),description:t("fieldPlanNamingFormatDesc")}]}],[t]),p=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:t("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:t("inheritedFromGlobal")}),h.jsxs("p",{className:"text-[12px] text-dash-text-secondary leading-normal",children:[t("viewGlobalConfig")," ",h.jsx("button",{onClick:()=>e("/config/global"),className:"text-dash-accent hover:underline font-medium",children:t("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(Gm,{title:t("projectConfig"),filePath:r?`${r}/.claude/.ck.json`:".claude/.ck.json",onBack:()=>e(`/project/${n}`),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(Qm,{width:s[0],isLoading:d.isLoading,schema:d.schema,config:d.config,sources:d.sources,sections:f,onChange:d.handleFormChange,onFieldFocus:d.setFocusedFieldPath}),h.jsx(tr,{direction:"horizontal",isDragging:o,onMouseDown:b=>a(0,b)}),h.jsx(od,{width:s[1],isLoading:d.isLoading,jsonText:d.jsonText,cursorLine:d.cursorLine,syntaxError:d.syntaxError,onChange:d.handleJsonChange,onEditorFocus:d.handleJsonEditorFocus,onCursorLineChange:d.setCursorLine}),h.jsx(tr,{direction:"horizontal",isDragging:o,onMouseDown:b=>a(1,b)}),h.jsx(Kb,{width:s[2],fieldDoc:d.fieldDoc,activeFieldPath:d.activeFieldPath,overrideBadge:p,extraContent:m})]})]})},Ot="__global__",NN=({project:t})=>{const{t:e}=he(),n=an(),{skills:r,loading:i}=Vv(),{sessions:s,loading:o}=zv(t.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 Tv(N,t.path,L,t.id)}catch(_){alert(`${e("actionFailed")}: ${_ instanceof Error?_.message:N}`)}},v=g.useCallback(()=>{const N=new AbortController;return d(!0),f(null),Dv(t.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},[t.id,e]);g.useEffect(()=>{const N=v();return()=>{N.abort()}},[v]);const S=r.filter(N=>t.skills.includes(N.id)),C=a?.terminals||[],k=a?.editors||[],O=C.find(N=>N.id===a?.defaults.terminalApp)?.label||a?.defaults.terminalApp,y=k.find(N=>N.id===a?.defaults.editorApp)?.label||a?.defaults.editorApp,M=g.useMemo(()=>C.find(N=>p===Ot?N.id===a?.defaults.terminalApp:N.id===p),[C,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(!t.id.startsWith("discovered-"))try{await Km(t.id,{preferences:{[N]:L===Ot?null:L}})}catch(_){const $=_ instanceof Error?_.message:"Failed to save preference";alert(`${e("actionFailed")}: ${$}`)}};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:t.name}),h.jsx(AN,{status:t.health}),h.jsx(YC,{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"})}),t.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(lm,{icon:"📟",label:e("terminal"),sub:M?`${M.openMode==="open-app"?e("openAppOnly"):e("openAtPath")} • ${M.label}`:e("terminalSub"),onClick:()=>w("terminal",p===Ot?void 0:p),disabled:c||!M&&C.length>0,options:C,value:p,fallbackLabel:a?`${e("useGlobalFallback")} (${O})`:e("useGlobalFallback"),onChange:async N=>{m(N),await R("terminalApp",N)}}),h.jsx(lm,{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(uh,{icon:"🤖",label:e("launch"),sub:e("launchSub"),highlight:!0,onClick:()=>w("launch")}),h.jsx(uh,{icon:"⚙️",label:e("config"),sub:e("configSub"),onClick:()=>n(`/config/project/${t.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(zo,{label:e("activeKit"),value:t.kitType}),h.jsx(zo,{label:e("aiModel"),value:t.model}),h.jsx(zo,{label:e("hooks"),value:`${t.activeHooks} ${e("active")}`}),h.jsx(zo,{label:e("mcpServers"),value:`${t.mcpServers} ${e("connected")}`})]}),h.jsx("button",{onClick:()=>n(`/config/project/${t.id}`),className:"w-full mt-6 py-2 rounded-lg bg-dash-bg text-xs font-bold text-dash-text-secondary hover:bg-dash-surface-hover transition-colors border border-dash-border",children:e("editProjectConfig")})]}),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")," →"]})})]})]})]})]})},AN=({status:t})=>{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[t]}`,children:t})},lm=({icon:t,label:e,sub:n,disabled:r,options:i,value:s,fallbackLabel:o,onClick:a,onChange:l})=>h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx(uh,{icon:t,label:e,sub:n,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))]})]}),uh=({icon:t,label:e,sub:n,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:t}),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:n})]}),zo=({label:t,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:t}),h.jsx("span",{className:"text-dash-text font-bold mono uppercase text-[10px] tracking-tight",children:e})]}),MN=()=>{const{t}=he(),{project:e}=f1();return e?h.jsx(NN,{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:t("selectProject")})]})},DN=lv([{path:"/",element:h.jsx(Wv,{}),children:[{index:!0,element:h.jsx(ol,{to:"/config/global",replace:!0})},{path:"config/global",element:h.jsx(kj,{})},{path:"config/project/:projectId",element:h.jsx(PN,{})},{path:"project/:projectId",element:h.jsx(MN,{})},{path:"onboarding",element:h.jsx(ON,{})},{path:"migrate",element:h.jsx(gN,{})},{path:"kanban",element:h.jsx(jj,{})},{path:"skills",element:h.jsx(ol,{to:"/migrate",replace:!0})},{path:"*",element:h.jsx(ol,{to:"/",replace:!0})}]}]),Ox=document.getElementById("root");if(!Ox)throw document.body.innerHTML='<div style="padding:20px;color:red;">Fatal: Root element not found</div>',new Error("Root element #root not found");cc.createRoot(Ox).render(h.jsx(zx.StrictMode,{children:h.jsx(Cv,{children:h.jsx(jv,{children:h.jsx(wv,{router:DN})})})}));