claudekit-cli 3.41.4 → 3.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -1
- package/cli-manifest.json +2155 -0
- package/dist/index.js +31668 -22093
- package/dist/ui/assets/index-CRtJwrzd.css +1 -0
- package/dist/ui/assets/index-vFxwRWqA.js +311 -0
- package/dist/ui/assets/{vendor-DNUgy55u.js → vendor-BkC4CYzM.js} +1 -1
- package/dist/ui/images/logo-512.png +0 -0
- package/dist/ui/index.html +3 -3
- package/package.json +25 -4
- package/dist/ui/assets/index-BzNW50gy.js +0 -249
- package/dist/ui/assets/index-QUag--Eo.css +0 -1
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
var l3=Object.defineProperty;var c3=(t,e,n)=>e in t?l3(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var g0=(t,e,n)=>c3(t,typeof e!="symbol"?e+"":e,n);import{r as g,a as Us,R as d3,g as u3,b as Qe}from"./vendor-BkC4CYzM.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var F1={exports:{}},Eu={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var h3=g,f3=Symbol.for("react.element"),p3=Symbol.for("react.fragment"),m3=Object.prototype.hasOwnProperty,g3=h3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,x3={key:!0,ref:!0,__self:!0,__source:!0};function z1(t,e,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)m3.call(e,r)&&!x3.hasOwnProperty(r)&&(s[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)s[r]===void 0&&(s[r]=e[r]);return{$$typeof:f3,type:t,key:i,ref:o,props:s,_owner:g3.current}}Eu.Fragment=p3;Eu.jsx=z1;Eu.jsxs=z1;F1.exports=Eu;var c=F1.exports,Kf={},x0=Us;Kf.createRoot=x0.createRoot,Kf.hydrateRoot=x0.hydrateRoot;/**
|
|
10
|
+
* react-router v7.11.0
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) Remix Software Inc.
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the MIT license found in the
|
|
15
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
16
|
+
*
|
|
17
|
+
* @license MIT
|
|
18
|
+
*/var V1=t=>{throw TypeError(t)},b3=(t,e,n)=>e.has(t)||V1("Cannot "+n),vh=(t,e,n)=>(b3(t,e,"read from private field"),n?n.call(t):e.get(t)),y3=(t,e,n)=>e.has(t)?V1("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),b0="popstate";function v3(t={}){function e(r,s){let{pathname:i,search:o,hash:a}=r.location;return ba("",{pathname:i,search:o,hash:a},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function n(r,s){return typeof s=="string"?s:jr(s)}return k3(e,n,null,t)}function Re(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function at(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function w3(){return Math.random().toString(36).substring(2,10)}function y0(t,e){return{usr:t.state,key:t.key,idx:e}}function ba(t,e,n=null,r){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?Os(e):e,state:n,key:e&&e.key||r||w3()}}function jr({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 Os(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 k3(t,e,n,r={}){let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,a="POP",l=null,d=u();d==null&&(d=0,o.replaceState({...o.state,idx:d},""));function u(){return(o.state||{idx:null}).idx}function h(){a="POP";let b=u(),y=b==null?null:b-d;d=b,l&&l({action:a,location:x.location,delta:y})}function f(b,y){a="PUSH";let k=ba(x.location,b,y);d=u()+1;let v=y0(k,d),w=x.createHref(k);try{o.pushState(v,"",w)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;s.location.assign(w)}i&&l&&l({action:a,location:x.location,delta:1})}function p(b,y){a="REPLACE";let k=ba(x.location,b,y);d=u();let v=y0(k,d),w=x.createHref(k);o.replaceState(v,"",w),i&&l&&l({action:a,location:x.location,delta:0})}function m(b){return H1(b)}let x={get action(){return a},get location(){return t(s,o)},listen(b){if(l)throw new Error("A history only accepts one active listener");return s.addEventListener(b0,h),l=b,()=>{s.removeEventListener(b0,h),l=null}},createHref(b){return e(s,b)},createURL:m,encodeLocation(b){let y=m(b);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:f,replace:p,go(b){return o.go(b)}};return x}function H1(t,e=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Re(n,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:jr(t);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=n+r),new URL(r,n)}var Yo,v0=class{constructor(t){if(y3(this,Yo,new Map),t)for(let[e,n]of t)this.set(e,n)}get(t){if(vh(this,Yo).has(t))return vh(this,Yo).get(t);if(t.defaultValue!==void 0)return t.defaultValue;throw new Error("No value found for context")}set(t,e){vh(this,Yo).set(t,e)}};Yo=new WeakMap;var S3=new Set(["lazy","caseSensitive","path","id","index","children"]);function C3(t){return S3.has(t)}var j3=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function N3(t){return j3.has(t)}function P3(t){return t.index===!0}function ya(t,e,n=[],r={},s=!1){return t.map((i,o)=>{let a=[...n,String(o)],l=typeof i.id=="string"?i.id:a.join("-");if(Re(i.index!==!0||!i.children,"Cannot specify children on an index route"),Re(s||!r[l],`Found a route id collision on id "${l}". Route id's must be globally unique within Data Router usages`),P3(i)){let d={...i,id:l};return r[l]=w0(d,e(d)),d}else{let d={...i,id:l,children:void 0};return r[l]=w0(d,e(d)),i.children&&(d.children=ya(i.children,e,a,r,s)),d}})}function w0(t,e){return Object.assign(t,{...e,...typeof e.lazy=="object"&&e.lazy!=null?{lazy:{...t.lazy,...e.lazy}}:{}})}function ls(t,e,n="/"){return Xo(t,e,n,!1)}function Xo(t,e,n,r){let s=typeof e=="string"?Os(e):e,i=$n(s.pathname||"/",n);if(i==null)return null;let o=W1(t);E3(o);let a=null;for(let l=0;a==null&&l<o.length;++l){let d=F3(i);a=$3(o[l],d,r)}return a}function O3(t,e){let{route:n,pathname:r,params:s}=t;return{id:n.id,pathname:r,params:s,data:e[n.id],loaderData:e[n.id],handle:n.handle}}function W1(t,e=[],n=[],r="",s=!1){let i=(o,a,l=s,d)=>{let u={relativePath:d===void 0?o.path||"":d,caseSensitive:o.caseSensitive===!0,childrenIndex:a,route:o};if(u.relativePath.startsWith("/")){if(!u.relativePath.startsWith(r)&&l)return;Re(u.relativePath.startsWith(r),`Absolute route path "${u.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),u.relativePath=u.relativePath.slice(r.length)}let h=wr([r,u.relativePath]),f=n.concat(u);o.children&&o.children.length>0&&(Re(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),W1(o.children,e,f,h,l)),!(o.path==null&&!o.index)&&e.push({path:h,score:_3(h,o.index),routesMeta:f})};return t.forEach((o,a)=>{if(o.path===""||!o.path?.includes("?"))i(o,a);else for(let l of U1(o.path))i(o,a,!0,l)}),e}function U1(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=U1(r.join("/")),a=[];return a.push(...o.map(l=>l===""?i:[i,l].join("/"))),s&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function E3(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:I3(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var D3=/^:[\w-]+$/,M3=3,A3=2,T3=1,L3=10,R3=-2,k0=t=>t==="*";function _3(t,e){let n=t.split("/"),r=n.length;return n.some(k0)&&(r+=R3),e&&(r+=A3),n.filter(s=>!k0(s)).reduce((s,i)=>s+(D3.test(i)?M3:i===""?T3:L3),r)}function I3(t,e){return t.length===e.length&&t.slice(0,-1).every((r,s)=>r===e[s])?t[t.length-1]-e[e.length-1]:0}function $3(t,e,n=!1){let{routesMeta:r}=t,s={},i="/",o=[];for(let a=0;a<r.length;++a){let l=r[a],d=a===r.length-1,u=i==="/"?e:e.slice(i.length)||"/",h=jd({path:l.relativePath,caseSensitive:l.caseSensitive,end:d},u),f=l.route;if(!h&&d&&n&&!r[r.length-1].route.index&&(h=jd({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},u)),!h)return null;Object.assign(s,h.params),o.push({params:s,pathname:wr([i,h.pathname]),pathnameBase:H3(wr([i,h.pathnameBase])),route:f}),h.pathnameBase!=="/"&&(i=wr([i,h.pathnameBase]))}return o}function jd(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=B3(t.path,t.caseSensitive,t.end),s=e.match(n);if(!s)return null;let i=s[0],o=i.replace(/(.)\/+$/,"$1"),a=s.slice(1);return{params:r.reduce((d,{paramName:u,isOptional:h},f)=>{if(u==="*"){let m=a[f]||"";o=i.slice(0,i.length-m.length).replace(/(.)\/+$/,"$1")}const p=a[f];return h&&!p?d[u]=void 0:d[u]=(p||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:o,pattern:t}}function B3(t,e=!1,n=!0){at(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let r=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),r]}function F3(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return at(!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 $n(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 z3({basename:t,pathname:e}){return e==="/"?t:wr([t,e])}var K1=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Du=t=>K1.test(t);function V3(t,e="/"){let{pathname:n,search:r="",hash:s=""}=typeof t=="string"?Os(t):t,i;if(n)if(Du(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),at(!1,`Pathnames cannot have embedded double slashes - normalizing ${o} -> ${n}`)}n.startsWith("/")?i=S0(n.substring(1),"/"):i=S0(n,e)}else i=e;return{pathname:i,search:W3(r),hash:U3(s)}}function S0(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function wh(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 G1(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Mu(t){let e=G1(t);return e.map((n,r)=>r===e.length-1?n.pathname:n.pathnameBase)}function Au(t,e,n,r=!1){let s;typeof t=="string"?s=Os(t):(s={...t},Re(!s.pathname||!s.pathname.includes("?"),wh("?","pathname","search",s)),Re(!s.pathname||!s.pathname.includes("#"),wh("#","pathname","hash",s)),Re(!s.search||!s.search.includes("#"),wh("#","search","hash",s)));let i=t===""||s.pathname==="",o=i?"/":s.pathname,a;if(o==null)a=n;else{let h=e.length-1;if(!r&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),h-=1;s.pathname=f.join("/")}a=h>=0?e[h]:"/"}let l=V3(s,a),d=o&&o!=="/"&&o.endsWith("/"),u=(i||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(d||u)&&(l.pathname+="/"),l}var wr=t=>t.join("/").replace(/\/\/+/g,"/"),H3=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),W3=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,U3=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,$l=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 va(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Bl(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var q1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Y1(t,e){let n=t;if(typeof n!="string"||!K1.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(q1)try{let i=new URL(window.location.href),o=n.startsWith("//")?new URL(i.protocol+n):new URL(n),a=$n(o.pathname,e);o.origin===i.origin&&a!=null?n=a+o.search+o.hash:s=!0}catch{at(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:s,to:n}}var hs=Symbol("Uninstrumented");function K3(t,e){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};t.forEach(s=>s({id:e.id,index:e.index,path:e.path,instrument(i){let o=Object.keys(n);for(let a of o)i[a]&&n[a].push(i[a])}}));let r={};if(typeof e.lazy=="function"&&n.lazy.length>0){let s=Pi(n.lazy,e.lazy,()=>{});s&&(r.lazy=s)}if(typeof e.lazy=="object"){let s=e.lazy;["middleware","loader","action"].forEach(i=>{let o=s[i],a=n[`lazy.${i}`];if(typeof o=="function"&&a.length>0){let l=Pi(a,o,()=>{});l&&(r.lazy=Object.assign(r.lazy||{},{[i]:l}))}})}return["loader","action"].forEach(s=>{let i=e[s];if(typeof i=="function"&&n[s].length>0){let o=i[hs]??i,a=Pi(n[s],o,(...l)=>C0(l[0]));a&&(a[hs]=o,r[s]=a)}}),e.middleware&&e.middleware.length>0&&n.middleware.length>0&&(r.middleware=e.middleware.map(s=>{let i=s[hs]??s,o=Pi(n.middleware,i,(...a)=>C0(a[0]));return o?(o[hs]=i,o):s})),r}function G3(t,e){let n={navigate:[],fetch:[]};if(e.forEach(r=>r({instrument(s){let i=Object.keys(s);for(let o of i)s[o]&&n[o].push(s[o])}})),n.navigate.length>0){let r=t.navigate[hs]??t.navigate,s=Pi(n.navigate,r,(...i)=>{let[o,a]=i;return{to:typeof o=="number"||typeof o=="string"?o:o?jr(o):".",...j0(t,a??{})}});s&&(s[hs]=r,t.navigate=s)}if(n.fetch.length>0){let r=t.fetch[hs]??t.fetch,s=Pi(n.fetch,r,(...i)=>{let[o,,a,l]=i;return{href:a??".",fetcherKey:o,...j0(t,l??{})}});s&&(s[hs]=r,t.fetch=s)}return t}function Pi(t,e,n){return t.length===0?null:async(...r)=>{let s=await X1(t,n(...r),()=>e(...r),t.length-1);if(s.type==="error")throw s.value;return s.value}}async function X1(t,e,n,r){let s=t[r],i;if(s){let o,a=async()=>(o?console.error("You cannot call instrumented handlers more than once"):o=X1(t,e,n,r-1),i=await o,Re(i,"Expected a result"),i.type==="error"&&i.value instanceof Error?{status:"error",error:i.value}:{status:"success",error:void 0});try{await s(a,e)}catch(l){console.error("An instrumentation function threw an error:",l)}o||await a(),await o}else try{i={type:"success",value:await n()}}catch(o){i={type:"error",value:o}}return i||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function C0(t){let{request:e,context:n,params:r,unstable_pattern:s}=t;return{request:q3(e),params:{...r},unstable_pattern:s,context:Y3(n)}}function j0(t,e){return{currentUrl:jr(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 q3(t){return{method:t.method,url:t.url,headers:{get:(...e)=>t.headers.get(...e)}}}function Y3(t){if(Z3(t)){let e={...t};return Object.freeze(e),e}else return{get:e=>t.get(e)}}var X3=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Z3(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")===X3}var Z1=["POST","PUT","PATCH","DELETE"],Q3=new Set(Z1),J3=["GET",...Z1],e4=new Set(J3),Q1=new Set([301,302,303,307,308]),t4=new Set([307,308]),kh={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},n4={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Ro={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},r4=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),J1="remix-router-transitions",ew=Symbol("ResetLoaderData");function s4(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";Re(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=t.hydrationRouteProperties||[],s=t.mapRouteProperties||r4,i=s;if(t.unstable_instrumentations){let L=t.unstable_instrumentations;i=B=>({...s(B),...K3(L.map(H=>H.route).filter(Boolean),B)})}let o={},a=ya(t.routes,i,void 0,o),l,d=t.basename||"/";d.startsWith("/")||(d=`/${d}`);let u=t.dataStrategy||c4,h={...t.future},f=null,p=new Set,m=null,x=null,b=null,y=t.hydrationData!=null,k=ls(a,t.history.location,d),v=!1,w=null,C;if(k==null&&!t.patchRoutesOnNavigation){let L=En(404,{pathname:t.history.location.pathname}),{matches:B,route:H}=gc(a);C=!0,k=B,w={[H.id]:L}}else if(k&&!t.hydrationData&>(k,a,t.history.location.pathname).active&&(k=null),k)if(k.some(L=>L.route.lazy))C=!1;else if(!k.some(L=>Om(L.route)))C=!0;else{let L=t.hydrationData?t.hydrationData.loaderData:null,B=t.hydrationData?t.hydrationData.errors:null;if(B){let H=k.findIndex(Y=>B[Y.route.id]!==void 0);C=k.slice(0,H+1).every(Y=>!qf(Y.route,L,B))}else C=k.every(H=>!qf(H.route,L,B))}else{C=!1,k=[];let L=gt(null,a,t.history.location.pathname);L.active&&L.matches&&(v=!0,k=L.matches)}let j,S={historyAction:t.history.action,location:t.history.location,matches:k,initialized:C,navigation:kh,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||w,fetchers:new Map,blockers:new Map},P="POP",D=null,A=!1,N,T=!1,I=new Map,O=null,E=!1,M=!1,R=new Set,_=new Map,$=0,F=-1,z=new Map,V=new Set,Z=new Map,U=new Map,Q=new Set,se=new Map,ce,X=null;function K(){if(f=t.history.listen(({action:L,location:B,delta:H})=>{if(ce){ce(),ce=void 0;return}at(se.size===0||H!=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 Y=bi({currentLocation:S.location,nextLocation:B,historyAction:L});if(Y&&H!=null){let ne=new Promise(me=>{ce=me});t.history.go(H*-1),Qr(Y,{state:"blocked",location:B,proceed(){Qr(Y,{state:"proceeding",proceed:void 0,reset:void 0,location:B}),ne.then(()=>t.history.go(H))},reset(){let me=new Map(S.blockers);me.set(Y,Ro),J({blockers:me})}}),D?.resolve(),D=null;return}return De(L,B)}),n){P4(e,I);let L=()=>O4(e,I);e.addEventListener("pagehide",L),O=()=>e.removeEventListener("pagehide",L)}return S.initialized||De("POP",S.location,{initialHydration:!0}),j}function te(){f&&f(),O&&O(),p.clear(),N&&N.abort(),S.fetchers.forEach((L,B)=>Xr(B)),S.blockers.forEach((L,B)=>xi(B))}function le(L){return p.add(L),()=>p.delete(L)}function J(L,B={}){L.matches&&(L.matches=L.matches.map(ne=>{let me=o[ne.route.id],he=ne.route;return he.element!==me.element||he.errorElement!==me.errorElement||he.hydrateFallbackElement!==me.hydrateFallbackElement?{...ne,route:me}:ne})),S={...S,...L};let H=[],Y=[];S.fetchers.forEach((ne,me)=>{ne.state==="idle"&&(Q.has(me)?H.push(me):Y.push(me))}),Q.forEach(ne=>{!S.fetchers.has(ne)&&!_.has(ne)&&H.push(ne)}),[...p].forEach(ne=>ne(S,{deletedFetchers:H,newErrors:L.errors??null,viewTransitionOpts:B.viewTransitionOpts,flushSync:B.flushSync===!0})),H.forEach(ne=>Xr(ne)),Y.forEach(ne=>S.fetchers.delete(ne))}function de(L,B,{flushSync:H}={}){let Y=S.actionData!=null&&S.navigation.formMethod!=null&&Wt(S.navigation.formMethod)&&S.navigation.state==="loading"&&L.state?._isRedirect!==!0,ne;B.actionData?Object.keys(B.actionData).length>0?ne=B.actionData:ne=null:Y?ne=S.actionData:ne=null;let me=B.loaderData?R0(S.loaderData,B.loaderData,B.matches||[],B.errors):S.loaderData,he=S.blockers;he.size>0&&(he=new Map(he),he.forEach((Ne,ve)=>he.set(ve,Ro)));let xe=E?!1:Tt(L,B.matches||S.matches),ye=A===!0||S.navigation.formMethod!=null&&Wt(S.navigation.formMethod)&&L.state?._isRedirect!==!0;l&&(a=l,l=void 0),E||P==="POP"||(P==="PUSH"?t.history.push(L,L.state):P==="REPLACE"&&t.history.replace(L,L.state));let we;if(P==="POP"){let Ne=I.get(S.location.pathname);Ne&&Ne.has(L.pathname)?we={currentLocation:S.location,nextLocation:L}:I.has(L.pathname)&&(we={currentLocation:L,nextLocation:S.location})}else if(T){let Ne=I.get(S.location.pathname);Ne?Ne.add(L.pathname):(Ne=new Set([L.pathname]),I.set(S.location.pathname,Ne)),we={currentLocation:S.location,nextLocation:L}}J({...B,actionData:ne,loaderData:me,historyAction:P,location:L,initialized:!0,navigation:kh,revalidation:"idle",restoreScrollPosition:xe,preventScrollReset:ye,blockers:he},{viewTransitionOpts:we,flushSync:H===!0}),P="POP",A=!1,T=!1,E=!1,M=!1,D?.resolve(),D=null,X?.resolve(),X=null}async function Ce(L,B){if(D?.resolve(),D=null,typeof L=="number"){D||(D=B0());let We=D.promise;return t.history.go(L),We}let H=Gf(S.location,S.matches,d,L,B?.fromRouteId,B?.relative),{path:Y,submission:ne,error:me}=N0(!1,H,B),he=S.location,xe=ba(S.location,Y,B&&B.state);xe={...xe,...t.history.encodeLocation(xe)};let ye=B&&B.replace!=null?B.replace:void 0,we="PUSH";ye===!0?we="REPLACE":ye===!1||ne!=null&&Wt(ne.formMethod)&&ne.formAction===S.location.pathname+S.location.search&&(we="REPLACE");let Ne=B&&"preventScrollReset"in B?B.preventScrollReset===!0:void 0,ve=(B&&B.flushSync)===!0,He=bi({currentLocation:he,nextLocation:xe,historyAction:we});if(He){Qr(He,{state:"blocked",location:xe,proceed(){Qr(He,{state:"proceeding",proceed:void 0,reset:void 0,location:xe}),Ce(L,B)},reset(){let We=new Map(S.blockers);We.set(He,Ro),J({blockers:We})}});return}await De(we,xe,{submission:ne,pendingError:me,preventScrollReset:Ne,replace:B&&B.replace,enableViewTransition:B&&B.viewTransition,flushSync:ve,callSiteDefaultShouldRevalidate:B&&B.unstable_defaultShouldRevalidate})}function Te(){X||(X=B0()),Se(),J({revalidation:"loading"});let L=X.promise;return S.navigation.state==="submitting"?L:S.navigation.state==="idle"?(De(S.historyAction,S.location,{startUninterruptedRevalidation:!0}),L):(De(P||S.historyAction,S.navigation.location,{overrideNavigation:S.navigation,enableViewTransition:T===!0}),L)}async function De(L,B,H){N&&N.abort(),N=null,P=L,E=(H&&H.startUninterruptedRevalidation)===!0,Nn(S.location,S.matches),A=(H&&H.preventScrollReset)===!0,T=(H&&H.enableViewTransition)===!0;let Y=l||a,ne=H&&H.overrideNavigation,me=H?.initialHydration&&S.matches&&S.matches.length>0&&!v?S.matches:ls(Y,B,d),he=(H&&H.flushSync)===!0;if(me&&S.initialized&&!M&&x4(S.location,B)&&!(H&&H.submission&&Wt(H.submission.formMethod))){de(B,{matches:me},{flushSync:he});return}let xe=gt(me,Y,B.pathname);if(xe.active&&xe.matches&&(me=xe.matches),!me){let{error:xt,notFoundMatches:Rt,route:qe}=ct(B.pathname);de(B,{matches:Rt,loaderData:{},errors:{[qe.id]:xt}},{flushSync:he});return}N=new AbortController;let ye=Si(t.history,B,N.signal,H&&H.submission),we=t.getContext?await t.getContext():new v0,Ne;if(H&&H.pendingError)Ne=[cs(me).route.id,{type:"error",error:H.pendingError}];else if(H&&H.submission&&Wt(H.submission.formMethod)){let xt=await tt(ye,B,H.submission,me,we,xe.active,H&&H.initialHydration===!0,{replace:H.replace,flushSync:he});if(xt.shortCircuited)return;if(xt.pendingActionResult){let[Rt,qe]=xt.pendingActionResult;if(yn(qe)&&va(qe.error)&&qe.error.status===404){N=null,de(B,{matches:xt.matches,loaderData:{},errors:{[Rt]:qe.error}});return}}me=xt.matches||me,Ne=xt.pendingActionResult,ne=Sh(B,H.submission),he=!1,xe.active=!1,ye=Si(t.history,ye.url,ye.signal)}let{shortCircuited:ve,matches:He,loaderData:We,errors:wt}=await qt(ye,B,me,we,xe.active,ne,H&&H.submission,H&&H.fetcherSubmission,H&&H.replace,H&&H.initialHydration===!0,he,Ne,H&&H.callSiteDefaultShouldRevalidate);ve||(N=null,de(B,{matches:He||me,..._0(Ne),loaderData:We,errors:wt}))}async function tt(L,B,H,Y,ne,me,he,xe={}){Se();let ye=j4(B,H);if(J({navigation:ye},{flushSync:xe.flushSync===!0}),me){let ve=await Lt(Y,B.pathname,L.signal);if(ve.type==="aborted")return{shortCircuited:!0};if(ve.type==="error"){if(ve.partialMatches.length===0){let{matches:We,route:wt}=gc(a);return{matches:We,pendingActionResult:[wt.id,{type:"error",error:ve.error}]}}let He=cs(ve.partialMatches).route.id;return{matches:ve.partialMatches,pendingActionResult:[He,{type:"error",error:ve.error}]}}else if(ve.matches)Y=ve.matches;else{let{notFoundMatches:He,error:We,route:wt}=ct(B.pathname);return{matches:He,pendingActionResult:[wt.id,{type:"error",error:We}]}}}let we,Ne=sd(Y,B);if(!Ne.route.action&&!Ne.route.lazy)we={type:"error",error:En(405,{method:L.method,pathname:B.pathname,routeId:Ne.route.id})};else{let ve=Ri(i,o,L,Y,Ne,he?[]:r,ne),He=await G(L,ve,ne,null);if(we=He[Ne.route.id],!we){for(let We of Y)if(He[We.route.id]){we=He[We.route.id];break}}if(L.signal.aborted)return{shortCircuited:!0}}if(Ks(we)){let ve;return xe&&xe.replace!=null?ve=xe.replace:ve=A0(we.response.headers.get("Location"),new URL(L.url),d)===S.location.pathname+S.location.search,await Vt(L,we,!0,{submission:H,replace:ve}),{shortCircuited:!0}}if(yn(we)){let ve=cs(Y,Ne.route.id);return(xe&&xe.replace)!==!0&&(P="PUSH"),{matches:Y,pendingActionResult:[ve.route.id,we,Ne.route.id]}}return{matches:Y,pendingActionResult:[Ne.route.id,we]}}async function qt(L,B,H,Y,ne,me,he,xe,ye,we,Ne,ve,He){let We=me||Sh(B,he),wt=he||xe||$0(We),xt=!E&&!we;if(ne){if(xt){let Ot=Nt(ve);J({navigation:We,...Ot!==void 0?{actionData:Ot}:{}},{flushSync:Ne})}let $e=await Lt(H,B.pathname,L.signal);if($e.type==="aborted")return{shortCircuited:!0};if($e.type==="error"){if($e.partialMatches.length===0){let{matches:Jr,route:Lr}=gc(a);return{matches:Jr,loaderData:{},errors:{[Lr.id]:$e.error}}}let Ot=cs($e.partialMatches).route.id;return{matches:$e.partialMatches,loaderData:{},errors:{[Ot]:$e.error}}}else if($e.matches)H=$e.matches;else{let{error:Ot,notFoundMatches:Jr,route:Lr}=ct(B.pathname);return{matches:Jr,loaderData:{},errors:{[Lr.id]:Ot}}}}let Rt=l||a,{dsMatches:qe,revalidatingFetchers:Yt}=P0(L,Y,i,o,t.history,S,H,wt,B,we?[]:r,we===!0,M,R,Q,Z,V,Rt,d,t.patchRoutesOnNavigation!=null,ve,He);if(F=++$,!t.dataStrategy&&!qe.some($e=>$e.shouldLoad)&&!qe.some($e=>$e.route.middleware&&$e.route.middleware.length>0)&&Yt.length===0){let $e=Ts();return de(B,{matches:H,loaderData:{},errors:ve&&yn(ve[1])?{[ve[0]]:ve[1].error}:null,..._0(ve),...$e?{fetchers:new Map(S.fetchers)}:{}},{flushSync:Ne}),{shortCircuited:!0}}if(xt){let $e={};if(!ne){$e.navigation=We;let Ot=Nt(ve);Ot!==void 0&&($e.actionData=Ot)}Yt.length>0&&($e.fetchers=mt(Yt)),J($e,{flushSync:Ne})}Yt.forEach($e=>{pn($e.key),$e.controller&&_.set($e.key,$e.controller)});let Ar=()=>Yt.forEach($e=>pn($e.key));N&&N.signal.addEventListener("abort",Ar);let{loaderResults:Ls,fetcherResults:lr}=await ie(qe,Yt,L,Y);if(L.signal.aborted)return{shortCircuited:!0};N&&N.signal.removeEventListener("abort",Ar),Yt.forEach($e=>_.delete($e.key));let On=xc(Ls);if(On)return await Vt(L,On.result,!0,{replace:ye}),{shortCircuited:!0};if(On=xc(lr),On)return V.add(On.key),await Vt(L,On.result,!0,{replace:ye}),{shortCircuited:!0};let{loaderData:Lo,errors:Rs}=L0(S,H,Ls,ve,Yt,lr);we&&S.errors&&(Rs={...S.errors,...Rs});let Tr=Ts(),_s=mi(F),yi=Tr||_s||Yt.length>0;return{matches:H,loaderData:Lo,errors:Rs,...yi?{fetchers:new Map(S.fetchers)}:{}}}function Nt(L){if(L&&!yn(L[1]))return{[L[0]]:L[1].data};if(S.actionData)return Object.keys(S.actionData).length===0?null:S.actionData}function mt(L){return L.forEach(B=>{let H=S.fetchers.get(B.key),Y=_o(void 0,H?H.data:void 0);S.fetchers.set(B.key,Y)}),new Map(S.fetchers)}async function nn(L,B,H,Y){pn(L);let ne=(Y&&Y.flushSync)===!0,me=l||a,he=Gf(S.location,S.matches,d,H,B,Y?.relative),xe=ls(me,he,d),ye=gt(xe,me,he);if(ye.active&&ye.matches&&(xe=ye.matches),!xe){Ye(L,B,En(404,{pathname:he}),{flushSync:ne});return}let{path:we,submission:Ne,error:ve}=N0(!0,he,Y);if(ve){Ye(L,B,ve,{flushSync:ne});return}let He=t.getContext?await t.getContext():new v0,We=(Y&&Y.preventScrollReset)===!0;if(Ne&&Wt(Ne.formMethod)){await rn(L,B,we,xe,He,ye.active,ne,We,Ne,Y&&Y.unstable_defaultShouldRevalidate);return}Z.set(L,{routeId:B,path:we}),await jn(L,B,we,xe,He,ye.active,ne,We,Ne)}async function rn(L,B,H,Y,ne,me,he,xe,ye,we){Se(),Z.delete(L);let Ne=S.fetchers.get(L);Pe(L,N4(ye,Ne),{flushSync:he});let ve=new AbortController,He=Si(t.history,H,ve.signal,ye);if(me){let rt=await Lt(Y,new URL(He.url).pathname,He.signal,L);if(rt.type==="aborted")return;if(rt.type==="error"){Ye(L,B,rt.error,{flushSync:he});return}else if(rt.matches)Y=rt.matches;else{Ye(L,B,En(404,{pathname:H}),{flushSync:he});return}}let We=sd(Y,H);if(!We.route.action&&!We.route.lazy){let rt=En(405,{method:ye.formMethod,pathname:H,routeId:B});Ye(L,B,rt,{flushSync:he});return}_.set(L,ve);let wt=$,xt=Ri(i,o,He,Y,We,r,ne),Rt=await G(He,xt,ne,L),qe=Rt[We.route.id];if(!qe){for(let rt of xt)if(Rt[rt.route.id]){qe=Rt[rt.route.id];break}}if(He.signal.aborted){_.get(L)===ve&&_.delete(L);return}if(Q.has(L)){if(Ks(qe)||yn(qe)){Pe(L,$r(void 0));return}}else{if(Ks(qe))if(_.delete(L),F>wt){Pe(L,$r(void 0));return}else return V.add(L),Pe(L,_o(ye)),Vt(He,qe,!1,{fetcherSubmission:ye,preventScrollReset:xe});if(yn(qe)){Ye(L,B,qe.error);return}}let Yt=S.navigation.location||S.location,Ar=Si(t.history,Yt,ve.signal),Ls=l||a,lr=S.navigation.state!=="idle"?ls(Ls,S.navigation.location,d):S.matches;Re(lr,"Didn't find any matches after fetcher action");let On=++$;z.set(L,On);let Lo=_o(ye,qe.data);S.fetchers.set(L,Lo);let{dsMatches:Rs,revalidatingFetchers:Tr}=P0(Ar,ne,i,o,t.history,S,lr,ye,Yt,r,!1,M,R,Q,Z,V,Ls,d,t.patchRoutesOnNavigation!=null,[We.route.id,qe],we);Tr.filter(rt=>rt.key!==L).forEach(rt=>{let vi=rt.key,pc=S.fetchers.get(vi),mc=_o(void 0,pc?pc.data:void 0);S.fetchers.set(vi,mc),pn(vi),rt.controller&&_.set(vi,rt.controller)}),J({fetchers:new Map(S.fetchers)});let _s=()=>Tr.forEach(rt=>pn(rt.key));ve.signal.addEventListener("abort",_s);let{loaderResults:yi,fetcherResults:$e}=await ie(Rs,Tr,Ar,ne);if(ve.signal.aborted)return;if(ve.signal.removeEventListener("abort",_s),z.delete(L),_.delete(L),Tr.forEach(rt=>_.delete(rt.key)),S.fetchers.has(L)){let rt=$r(qe.data);S.fetchers.set(L,rt)}let Ot=xc(yi);if(Ot)return Vt(Ar,Ot.result,!1,{preventScrollReset:xe});if(Ot=xc($e),Ot)return V.add(Ot.key),Vt(Ar,Ot.result,!1,{preventScrollReset:xe});let{loaderData:Jr,errors:Lr}=L0(S,lr,yi,void 0,Tr,$e);mi(On),S.navigation.state==="loading"&&On>F?(Re(P,"Expected pending action"),N&&N.abort(),de(S.navigation.location,{matches:lr,loaderData:Jr,errors:Lr,fetchers:new Map(S.fetchers)})):(J({errors:Lr,loaderData:R0(S.loaderData,Jr,lr,Lr),fetchers:new Map(S.fetchers)}),M=!1)}async function jn(L,B,H,Y,ne,me,he,xe,ye){let we=S.fetchers.get(L);Pe(L,_o(ye,we?we.data:void 0),{flushSync:he});let Ne=new AbortController,ve=Si(t.history,H,Ne.signal);if(me){let qe=await Lt(Y,new URL(ve.url).pathname,ve.signal,L);if(qe.type==="aborted")return;if(qe.type==="error"){Ye(L,B,qe.error,{flushSync:he});return}else if(qe.matches)Y=qe.matches;else{Ye(L,B,En(404,{pathname:H}),{flushSync:he});return}}let He=sd(Y,H);_.set(L,Ne);let We=$,wt=Ri(i,o,ve,Y,He,r,ne),Rt=(await G(ve,wt,ne,L))[He.route.id];if(_.get(L)===Ne&&_.delete(L),!ve.signal.aborted){if(Q.has(L)){Pe(L,$r(void 0));return}if(Ks(Rt))if(F>We){Pe(L,$r(void 0));return}else{V.add(L),await Vt(ve,Rt,!1,{preventScrollReset:xe});return}if(yn(Rt)){Ye(L,B,Rt.error);return}Pe(L,$r(Rt.data))}}async function Vt(L,B,H,{submission:Y,fetcherSubmission:ne,preventScrollReset:me,replace:he}={}){H||(D?.resolve(),D=null),B.response.headers.has("X-Remix-Revalidate")&&(M=!0);let xe=B.response.headers.get("Location");Re(xe,"Expected a Location header on the redirect Response"),xe=A0(xe,new URL(L.url),d);let ye=ba(S.location,xe,{_isRedirect:!0});if(n){let wt=!1;if(B.response.headers.has("X-Remix-Reload-Document"))wt=!0;else if(Du(xe)){const xt=H1(xe,!0);wt=xt.origin!==e.location.origin||$n(xt.pathname,d)==null}if(wt){he?e.location.replace(xe):e.location.assign(xe);return}}N=null;let we=he===!0||B.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:Ne,formAction:ve,formEncType:He}=S.navigation;!Y&&!ne&&Ne&&ve&&He&&(Y=$0(S.navigation));let We=Y||ne;if(t4.has(B.response.status)&&We&&Wt(We.formMethod))await De(we,ye,{submission:{...We,formAction:xe},preventScrollReset:me||A,enableViewTransition:H?T:void 0});else{let wt=Sh(ye,Y);await De(we,ye,{overrideNavigation:wt,fetcherSubmission:ne,preventScrollReset:me||A,enableViewTransition:H?T:void 0})}}async function G(L,B,H,Y){let ne,me={};try{ne=await u4(u,L,B,Y,H,!1)}catch(he){return B.filter(xe=>xe.shouldLoad).forEach(xe=>{me[xe.route.id]={type:"error",error:he}}),me}if(L.signal.aborted)return me;if(!Wt(L.method))for(let he of B){if(ne[he.route.id]?.type==="error")break;!ne.hasOwnProperty(he.route.id)&&!S.loaderData.hasOwnProperty(he.route.id)&&(!S.errors||!S.errors.hasOwnProperty(he.route.id))&&he.shouldCallHandler()&&(ne[he.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${he.route.id}`)})}for(let[he,xe]of Object.entries(ne))if(w4(xe)){let ye=xe.result;me[he]={type:"redirect",response:m4(ye,L,he,B,d)}}else me[he]=await p4(xe);return me}async function ie(L,B,H,Y){let ne=G(H,L,Y,null),me=Promise.all(B.map(async ye=>{if(ye.matches&&ye.match&&ye.request&&ye.controller){let Ne=(await G(ye.request,ye.matches,Y,ye.key))[ye.match.route.id];return{[ye.key]:Ne}}else return Promise.resolve({[ye.key]:{type:"error",error:En(404,{pathname:ye.path})}})})),he=await ne,xe=(await me).reduce((ye,we)=>Object.assign(ye,we),{});return{loaderResults:he,fetcherResults:xe}}function Se(){M=!0,Z.forEach((L,B)=>{_.has(B)&&R.add(B),pn(B)})}function Pe(L,B,H={}){S.fetchers.set(L,B),J({fetchers:new Map(S.fetchers)},{flushSync:(H&&H.flushSync)===!0})}function Ye(L,B,H,Y={}){let ne=cs(S.matches,B);Xr(L),J({errors:{[ne.route.id]:H},fetchers:new Map(S.fetchers)},{flushSync:(Y&&Y.flushSync)===!0})}function Wn(L){return U.set(L,(U.get(L)||0)+1),Q.has(L)&&Q.delete(L),S.fetchers.get(L)||n4}function Ht(L,B){pn(L,B?.reason),Pe(L,$r(null))}function Xr(L){let B=S.fetchers.get(L);_.has(L)&&!(B&&B.state==="loading"&&z.has(L))&&pn(L),Z.delete(L),z.delete(L),V.delete(L),Q.delete(L),R.delete(L),S.fetchers.delete(L)}function To(L){let B=(U.get(L)||0)-1;B<=0?(U.delete(L),Q.add(L)):U.set(L,B),J({fetchers:new Map(S.fetchers)})}function pn(L,B){let H=_.get(L);H&&(H.abort(B),_.delete(L))}function Zr(L){for(let B of L){let H=Wn(B),Y=$r(H.data);S.fetchers.set(B,Y)}}function Ts(){let L=[],B=!1;for(let H of V){let Y=S.fetchers.get(H);Re(Y,`Expected fetcher: ${H}`),Y.state==="loading"&&(V.delete(H),L.push(H),B=!0)}return Zr(L),B}function mi(L){let B=[];for(let[H,Y]of z)if(Y<L){let ne=S.fetchers.get(H);Re(ne,`Expected fetcher: ${H}`),ne.state==="loading"&&(pn(H),z.delete(H),B.push(H))}return Zr(B),B.length>0}function gi(L,B){let H=S.blockers.get(L)||Ro;return se.get(L)!==B&&se.set(L,B),H}function xi(L){S.blockers.delete(L),se.delete(L)}function Qr(L,B){let H=S.blockers.get(L)||Ro;Re(H.state==="unblocked"&&B.state==="blocked"||H.state==="blocked"&&B.state==="blocked"||H.state==="blocked"&&B.state==="proceeding"||H.state==="blocked"&&B.state==="unblocked"||H.state==="proceeding"&&B.state==="unblocked",`Invalid blocker state transition: ${H.state} -> ${B.state}`);let Y=new Map(S.blockers);Y.set(L,B),J({blockers:Y})}function bi({currentLocation:L,nextLocation:B,historyAction:H}){if(se.size===0)return;se.size>1&&at(!1,"A router only supports one blocker at a time");let Y=Array.from(se.entries()),[ne,me]=Y[Y.length-1],he=S.blockers.get(ne);if(!(he&&he.state==="proceeding")&&me({currentLocation:L,nextLocation:B,historyAction:H}))return ne}function ct(L){let B=En(404,{pathname:L}),H=l||a,{matches:Y,route:ne}=gc(H);return{notFoundMatches:Y,route:ne,error:B}}function At(L,B,H){if(m=L,b=B,x=H||null,!y&&S.navigation===kh){y=!0;let Y=Tt(S.location,S.matches);Y!=null&&J({restoreScrollPosition:Y})}return()=>{m=null,b=null,x=null}}function Pt(L,B){return x&&x(L,B.map(Y=>O3(Y,S.loaderData)))||L.key}function Nn(L,B){if(m&&b){let H=Pt(L,B);m[H]=b()}}function Tt(L,B){if(m){let H=Pt(L,B),Y=m[H];if(typeof Y=="number")return Y}return null}function gt(L,B,H){if(t.patchRoutesOnNavigation)if(L){if(Object.keys(L[0].params).length>0)return{active:!0,matches:Xo(B,H,d,!0)}}else return{active:!0,matches:Xo(B,H,d,!0)||[]};return{active:!1,matches:null}}async function Lt(L,B,H,Y){if(!t.patchRoutesOnNavigation)return{type:"success",matches:L};let ne=L;for(;;){let me=l==null,he=l||a,xe=o;try{await t.patchRoutesOnNavigation({signal:H,path:B,matches:ne,fetcherKey:Y,patch:(Ne,ve)=>{H.aborted||O0(Ne,ve,he,xe,i,!1)}})}catch(Ne){return{type:"error",error:Ne,partialMatches:ne}}finally{me&&!H.aborted&&(a=[...a])}if(H.aborted)return{type:"aborted"};let ye=ls(he,B,d),we=null;if(ye){if(Object.keys(ye[0].params).length===0)return{type:"success",matches:ye};if(we=Xo(he,B,d,!0),!(we&&ne.length<we.length&&Un(ne,we.slice(0,ne.length))))return{type:"success",matches:ye}}if(we||(we=Xo(he,B,d,!0)),!we||Un(ne,we))return{type:"success",matches:null};ne=we}}function Un(L,B){return L.length===B.length&&L.every((H,Y)=>H.route.id===B[Y].route.id)}function ut(L){o={},l=ya(L,i,void 0,o)}function Pn(L,B,H=!1){let Y=l==null;O0(L,B,l||a,o,i,H),Y&&(a=[...a],J({}))}return j={get basename(){return d},get future(){return h},get state(){return S},get routes(){return a},get window(){return e},initialize:K,subscribe:le,enableScrollRestoration:At,navigate:Ce,fetch:nn,revalidate:Te,createHref:L=>t.history.createHref(L),encodeLocation:L=>t.history.encodeLocation(L),getFetcher:Wn,resetFetcher:Ht,deleteFetcher:To,dispose:te,getBlocker:gi,deleteBlocker:xi,patchRoutes:Pn,_internalFetchControllers:_,_internalSetRoutes:ut,_internalSetStateDoNotUseOrYouWillBreakYourApp(L){J(L)}},t.unstable_instrumentations&&(j=G3(j,t.unstable_instrumentations.map(L=>L.router).filter(Boolean))),j}function i4(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function Gf(t,e,n,r,s,i){let o,a;if(s){o=[];for(let d of e)if(o.push(d),d.route.id===s){a=d;break}}else o=e,a=e[e.length-1];let l=Au(r||".",Mu(o),$n(t.pathname,n)||t.pathname,i==="path");if(r==null&&(l.search=t.search,l.hash=t.hash),(r==null||r===""||r===".")&&a){let d=Dm(l.search);if(a.route.index&&!d)l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index";else if(!a.route.index&&d){let u=new URLSearchParams(l.search),h=u.getAll("index");u.delete("index"),h.filter(p=>p).forEach(p=>u.append("index",p));let f=u.toString();l.search=f?`?${f}`:""}}return n!=="/"&&(l.pathname=z3({basename:n,pathname:l.pathname})),jr(l)}function N0(t,e,n){if(!n||!i4(n))return{path:e};if(n.formMethod&&!C4(n.formMethod))return{path:e,error:En(405,{method:n.formMethod})};let r=()=>({path:e,error:En(400,{type:"invalid-body"})}),i=(n.formMethod||"get").toUpperCase(),o=ow(e);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Wt(i))return r();let h=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:i,formAction:o,formEncType:n.formEncType,formData:void 0,json:void 0,text:h}}}else if(n.formEncType==="application/json"){if(!Wt(i))return r();try{let h=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:e,submission:{formMethod:i,formAction:o,formEncType:n.formEncType,formData:void 0,json:h,text:void 0}}}catch{return r()}}}Re(typeof FormData=="function","FormData is not available in this environment");let a,l;if(n.formData)a=Xf(n.formData),l=n.formData;else if(n.body instanceof FormData)a=Xf(n.body),l=n.body;else if(n.body instanceof URLSearchParams)a=n.body,l=T0(a);else if(n.body==null)a=new URLSearchParams,l=new FormData;else try{a=new URLSearchParams(n.body),l=T0(a)}catch{return r()}let d={formMethod:i,formAction:o,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:l,json:void 0,text:void 0};if(Wt(d.formMethod))return{path:e,submission:d};let u=Os(e);return t&&u.search&&Dm(u.search)&&a.append("index",""),u.search=`?${a}`,{path:jr(u),submission:d}}function P0(t,e,n,r,s,i,o,a,l,d,u,h,f,p,m,x,b,y,k,v,w){let C=v?yn(v[1])?v[1].error:v[1].data:void 0,j=s.createURL(i.location),S=s.createURL(l),P;if(u&&i.errors){let E=Object.keys(i.errors)[0];P=o.findIndex(M=>M.route.id===E)}else if(v&&yn(v[1])){let E=v[0];P=o.findIndex(M=>M.route.id===E)-1}let D=v?v[1].statusCode:void 0,A=D&&D>=400,N={currentUrl:j,currentParams:i.matches[0]?.params||{},nextUrl:S,nextParams:o[0].params,...a,actionResult:C,actionStatus:D},T=Bl(o),I=o.map((E,M)=>{let{route:R}=E,_=null;if(P!=null&&M>P?_=!1:R.lazy?_=!0:Om(R)?u?_=qf(R,i.loaderData,i.errors):o4(i.loaderData,i.matches[M],E)&&(_=!0):_=!1,_!==null)return Yf(n,r,t,T,E,d,e,_);let $=!1;typeof w=="boolean"?$=w:A?$=!1:(h||j.pathname+j.search===S.pathname+S.search||j.search!==S.search||a4(i.matches[M],E))&&($=!0);let F={...N,defaultShouldRevalidate:$},z=sa(E,F);return Yf(n,r,t,T,E,d,e,z,F,w)}),O=[];return m.forEach((E,M)=>{if(u||!o.some(U=>U.route.id===E.routeId)||p.has(M))return;let R=i.fetchers.get(M),_=R&&R.state!=="idle"&&R.data===void 0,$=ls(b,E.path,y);if(!$){if(k&&_)return;O.push({key:M,routeId:E.routeId,path:E.path,matches:null,match:null,request:null,controller:null});return}if(x.has(M))return;let F=sd($,E.path),z=new AbortController,V=Si(s,E.path,z.signal),Z=null;if(f.has(M))f.delete(M),Z=Ri(n,r,V,$,F,d,e);else if(_)h&&(Z=Ri(n,r,V,$,F,d,e));else{let U;typeof w=="boolean"?U=w:A?U=!1:U=h;let Q={...N,defaultShouldRevalidate:U};sa(F,Q)&&(Z=Ri(n,r,V,$,F,d,e,Q))}Z&&O.push({key:M,routeId:E.routeId,path:E.path,matches:Z,match:F,request:V,controller:z})}),{dsMatches:I,revalidatingFetchers:O}}function Om(t){return t.loader!=null||t.middleware!=null&&t.middleware.length>0}function qf(t,e,n){if(t.lazy)return!0;if(!Om(t))return!1;let r=e!=null&&t.id in e,s=n!=null&&n[t.id]!==void 0;return!r&&s?!1:typeof t.loader=="function"&&t.loader.hydrate===!0?!0:!r&&!s}function o4(t,e,n){let r=!e||n.route.id!==e.route.id,s=!t.hasOwnProperty(n.route.id);return r||s}function a4(t,e){let n=t.route.path;return t.pathname!==e.pathname||n!=null&&n.endsWith("*")&&t.params["*"]!==e.params["*"]}function sa(t,e){if(t.route.shouldRevalidate){let n=t.route.shouldRevalidate(e);if(typeof n=="boolean")return n}return e.defaultShouldRevalidate}function O0(t,e,n,r,s,i){let o;if(t){let d=r[t];Re(d,`No route found to patch children into: routeId = ${t}`),d.children||(d.children=[]),o=d.children}else o=n;let a=[],l=[];if(e.forEach(d=>{let u=o.find(h=>tw(d,h));u?l.push({existingRoute:u,newRoute:d}):a.push(d)}),a.length>0){let d=ya(a,s,[t||"_","patch",String(o?.length||"0")],r);o.push(...d)}if(i&&l.length>0)for(let d=0;d<l.length;d++){let{existingRoute:u,newRoute:h}=l[d],f=u,[p]=ya([h],s,[],{},!0);Object.assign(f,{element:p.element?p.element:f.element,errorElement:p.errorElement?p.errorElement:f.errorElement,hydrateFallbackElement:p.hydrateFallbackElement?p.hydrateFallbackElement:f.hydrateFallbackElement})}}function tw(t,e){return"id"in t&&"id"in e&&t.id===e.id?!0:t.index===e.index&&t.path===e.path&&t.caseSensitive===e.caseSensitive?(!t.children||t.children.length===0)&&(!e.children||e.children.length===0)?!0:t.children.every((n,r)=>e.children?.some(s=>tw(n,s))):!1}var E0=new WeakMap,nw=({key:t,route:e,manifest:n,mapRouteProperties:r})=>{let s=n[e.id];if(Re(s,"No route found in manifest"),!s.lazy||typeof s.lazy!="object")return;let i=s.lazy[t];if(!i)return;let o=E0.get(s);o||(o={},E0.set(s,o));let a=o[t];if(a)return a;let l=(async()=>{let d=C3(t),h=s[t]!==void 0&&t!=="hasErrorBoundary";if(d)at(!d,"Route property "+t+" is not a supported lazy route property. This property will be ignored."),o[t]=Promise.resolve();else if(h)at(!1,`Route "${s.id}" has a static property "${t}" defined. The lazy property will be ignored.`);else{let f=await i();f!=null&&(Object.assign(s,{[t]:f}),Object.assign(s,r(s)))}typeof s.lazy=="object"&&(s.lazy[t]=void 0,Object.values(s.lazy).every(f=>f===void 0)&&(s.lazy=void 0))})();return o[t]=l,l},D0=new WeakMap;function l4(t,e,n,r,s){let i=n[t.id];if(Re(i,"No route found in manifest"),!t.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof t.lazy=="function"){let u=D0.get(i);if(u)return{lazyRoutePromise:u,lazyHandlerPromise:u};let h=(async()=>{Re(typeof t.lazy=="function","No lazy route function found");let f=await t.lazy(),p={};for(let m in f){let x=f[m];if(x===void 0)continue;let b=N3(m),k=i[m]!==void 0&&m!=="hasErrorBoundary";b?at(!b,"Route property "+m+" is not a supported property to be returned from a lazy route function. This property will be ignored."):k?at(!k,`Route "${i.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]=x}Object.assign(i,p),Object.assign(i,{...r(i),lazy:void 0})})();return D0.set(i,h),h.catch(()=>{}),{lazyRoutePromise:h,lazyHandlerPromise:h}}let o=Object.keys(t.lazy),a=[],l;for(let u of o){if(s&&s.includes(u))continue;let h=nw({key:u,route:t,manifest:n,mapRouteProperties:r});h&&(a.push(h),u===e&&(l=h))}let d=a.length>0?Promise.all(a).then(()=>{}):void 0;return d?.catch(()=>{}),l?.catch(()=>{}),{lazyRoutePromise:d,lazyHandlerPromise:l}}async function M0(t){let e=t.matches.filter(s=>s.shouldLoad),n={};return(await Promise.all(e.map(s=>s.resolve()))).forEach((s,i)=>{n[e[i].route.id]=s}),n}async function c4(t){return t.matches.some(e=>e.route.middleware)?rw(t,()=>M0(t)):M0(t)}function rw(t,e){return d4(t,e,r=>{if(S4(r))throw r;return r},y4,n);function n(r,s,i){if(i)return Promise.resolve(Object.assign(i.value,{[s]:{type:"error",result:r}}));{let{matches:o}=t,a=Math.min(Math.max(o.findIndex(d=>d.route.id===s),0),Math.max(o.findIndex(d=>d.shouldCallHandler()),0)),l=cs(o,o[a].route.id).route.id;return Promise.resolve({[l]:{type:"error",result:r}})}}}async function d4(t,e,n,r,s){let{matches:i,request:o,params:a,context:l,unstable_pattern:d}=t,u=i.flatMap(f=>f.route.middleware?f.route.middleware.map(p=>[f.route.id,p]):[]);return await sw({request:o,params:a,context:l,unstable_pattern:d},u,e,n,r,s)}async function sw(t,e,n,r,s,i,o=0){let{request:a}=t;if(a.signal.aborted)throw a.signal.reason??new Error(`Request aborted: ${a.method} ${a.url}`);let l=e[o];if(!l)return await n();let[d,u]=l,h,f=async()=>{if(h)throw new Error("You may only call `next()` once per middleware");try{return h={value:await sw(t,e,n,r,s,i,o+1)},h.value}catch(p){return h={value:await i(p,d,h)},h.value}};try{let p=await u(t,f),m=p!=null?r(p):void 0;return s(m)?m:h?m??h.value:(h={value:await f()},h.value)}catch(p){return await i(p,d,h)}}function iw(t,e,n,r,s){let i=nw({key:"middleware",route:r.route,manifest:e,mapRouteProperties:t}),o=l4(r.route,Wt(n.method)?"action":"loader",e,t,s);return{middleware:i,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function Yf(t,e,n,r,s,i,o,a,l=null,d){let u=!1,h=iw(t,e,n,s,i);return{...s,_lazyPromises:h,shouldLoad:a,shouldRevalidateArgs:l,shouldCallHandler(f){return u=!0,l?typeof d=="boolean"?sa(s,{...l,defaultShouldRevalidate:d}):typeof f=="boolean"?sa(s,{...l,defaultShouldRevalidate:f}):sa(s,l):a},resolve(f){let{lazy:p,loader:m,middleware:x}=s.route,b=u||a||f&&!Wt(n.method)&&(p||m),y=x&&x.length>0&&!m&&!p;return b&&(Wt(n.method)||!y)?h4({request:n,unstable_pattern:r,match:s,lazyHandlerPromise:h?.handler,lazyRoutePromise:h?.route,handlerOverride:f,scopedContext:o}):Promise.resolve({type:"data",result:void 0})}}}function Ri(t,e,n,r,s,i,o,a=null){return r.map(l=>l.route.id!==s.route.id?{...l,shouldLoad:!1,shouldRevalidateArgs:a,shouldCallHandler:()=>!1,_lazyPromises:iw(t,e,n,l,i),resolve:()=>Promise.resolve({type:"data",result:void 0})}:Yf(t,e,n,Bl(r),l,i,o,!0,a))}async function u4(t,e,n,r,s,i){n.some(d=>d._lazyPromises?.middleware)&&await Promise.all(n.map(d=>d._lazyPromises?.middleware));let o={request:e,unstable_pattern:Bl(n),params:n[0].params,context:s,matches:n},l=await t({...o,fetcherKey:r,runClientMiddleware:d=>{let u=o;return rw(u,()=>d({...u,fetcherKey:r,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(n.flatMap(d=>[d._lazyPromises?.handler,d._lazyPromises?.route]))}catch{}return l}async function h4({request:t,unstable_pattern:e,match:n,lazyHandlerPromise:r,lazyRoutePromise:s,handlerOverride:i,scopedContext:o}){let a,l,d=Wt(t.method),u=d?"action":"loader",h=f=>{let p,m=new Promise((y,k)=>p=k);l=()=>p(),t.signal.addEventListener("abort",l);let x=y=>typeof f!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${u}" [routeId: ${n.route.id}]`)):f({request:t,unstable_pattern:e,params:n.params,context:o},...y!==void 0?[y]:[]),b=(async()=>{try{return{type:"data",result:await(i?i(k=>x(k)):x())}}catch(y){return{type:"error",result:y}}})();return Promise.race([b,m])};try{let f=d?n.route.action:n.route.loader;if(r||s)if(f){let p,[m]=await Promise.all([h(f).catch(x=>{p=x}),r,s]);if(p!==void 0)throw p;a=m}else{await r;let p=d?n.route.action:n.route.loader;if(p)[a]=await Promise.all([h(p),s]);else if(u==="action"){let m=new URL(t.url),x=m.pathname+m.search;throw En(405,{method:t.method,pathname:x,routeId:n.route.id})}else return{type:"data",result:void 0}}else if(f)a=await h(f);else{let p=new URL(t.url),m=p.pathname+p.search;throw En(404,{pathname:m})}}catch(f){return{type:"error",result:f}}finally{l&&t.signal.removeEventListener("abort",l)}return a}async function f4(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 p4(t){let{result:e,type:n}=t;if(Em(e)){let r;try{r=await f4(e)}catch(s){return{type:"error",error:s}}return n==="error"?{type:"error",error:new $l(e.status,e.statusText,r),statusCode:e.status,headers:e.headers}:{type:"data",data:r,statusCode:e.status,headers:e.headers}}return n==="error"?I0(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:b4(e),statusCode:va(e)?e.status:void 0,headers:e.init?.headers?new Headers(e.init.headers):void 0}:{type:"error",error:e,statusCode:va(e)?e.status:void 0}:I0(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 m4(t,e,n,r,s){let i=t.headers.get("Location");if(Re(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!Du(i)){let o=r.slice(0,r.findIndex(a=>a.route.id===n)+1);i=Gf(new URL(e.url),o,s,i),t.headers.set("Location",i)}return t}function A0(t,e,n){if(Du(t)){let r=t,s=r.startsWith("//")?new URL(e.protocol+r):new URL(r),i=$n(s.pathname,n)!=null;if(s.origin===e.origin&&i)return s.pathname+s.search+s.hash}return t}function Si(t,e,n,r){let s=t.createURL(ow(e)).toString(),i={signal:n};if(r&&Wt(r.formMethod)){let{formMethod:o,formEncType:a}=r;i.method=o.toUpperCase(),a==="application/json"?(i.headers=new Headers({"Content-Type":a}),i.body=JSON.stringify(r.json)):a==="text/plain"?i.body=r.text:a==="application/x-www-form-urlencoded"&&r.formData?i.body=Xf(r.formData):i.body=r.formData}return new Request(s,i)}function Xf(t){let e=new URLSearchParams;for(let[n,r]of t.entries())e.append(n,typeof r=="string"?r:r.name);return e}function T0(t){let e=new FormData;for(let[n,r]of t.entries())e.append(n,r);return e}function g4(t,e,n,r=!1,s=!1){let i={},o=null,a,l=!1,d={},u=n&&yn(n[1])?n[1].error:void 0;return t.forEach(h=>{if(!(h.route.id in e))return;let f=h.route.id,p=e[f];if(Re(!Ks(p),"Cannot handle redirect results in processLoaderData"),yn(p)){let m=p.error;if(u!==void 0&&(m=u,u=void 0),o=o||{},s)o[f]=m;else{let x=cs(t,f);o[x.route.id]==null&&(o[x.route.id]=m)}r||(i[f]=ew),l||(l=!0,a=va(p.error)?p.error.status:500),p.headers&&(d[f]=p.headers)}else i[f]=p.data,p.statusCode&&p.statusCode!==200&&!l&&(a=p.statusCode),p.headers&&(d[f]=p.headers)}),u!==void 0&&n&&(o={[n[0]]:u},n[2]&&(i[n[2]]=void 0)),{loaderData:i,errors:o,statusCode:a||200,loaderHeaders:d}}function L0(t,e,n,r,s,i){let{loaderData:o,errors:a}=g4(e,n,r);return s.filter(l=>!l.matches||l.matches.some(d=>d.shouldLoad)).forEach(l=>{let{key:d,match:u,controller:h}=l;if(h&&h.signal.aborted)return;let f=i[d];if(Re(f,"Did not find corresponding fetcher result"),yn(f)){let p=cs(t.matches,u?.route.id);a&&a[p.route.id]||(a={...a,[p.route.id]:f.error}),t.fetchers.delete(d)}else if(Ks(f))Re(!1,"Unhandled fetcher revalidation redirect");else{let p=$r(f.data);t.fetchers.set(d,p)}}),{loaderData:o,errors:a}}function R0(t,e,n,r){let s=Object.entries(e).filter(([,i])=>i!==ew).reduce((i,[o,a])=>(i[o]=a,i),{});for(let i of n){let o=i.route.id;if(!e.hasOwnProperty(o)&&t.hasOwnProperty(o)&&i.route.loader&&(s[o]=t[o]),r&&r.hasOwnProperty(o))break}return s}function _0(t){return t?yn(t[1])?{actionData:{}}:{actionData:{[t[0]]:t[1].data}}:{}}function cs(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 gc(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 En(t,{pathname:e,routeId:n,method:r,type:s,message:i}={}){let o="Unknown Server Error",a="Unknown @remix-run/router error";return t===400?(o="Bad Request",r&&e&&n?a=`You made a ${r} request to "${e}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:s==="invalid-body"&&(a="Unable to encode submission body")):t===403?(o="Forbidden",a=`Route "${n}" does not match URL "${e}"`):t===404?(o="Not Found",a=`No route matches URL "${e}"`):t===405&&(o="Method Not Allowed",r&&e&&n?a=`You made a ${r.toUpperCase()} request to "${e}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(a=`Invalid request method "${r.toUpperCase()}"`)),new $l(t||500,o,new Error(a),!0)}function xc(t){let e=Object.entries(t);for(let n=e.length-1;n>=0;n--){let[r,s]=e[n];if(Ks(s))return{key:r,result:s}}}function ow(t){let e=typeof t=="string"?Os(t):t;return jr({...e,hash:""})}function x4(t,e){return t.pathname!==e.pathname||t.search!==e.search?!1:t.hash===""?e.hash!=="":t.hash===e.hash?!0:e.hash!==""}function b4(t){return new $l(t.init?.status??500,t.init?.statusText??"Internal Server Error",t.data)}function y4(t){return t!=null&&typeof t=="object"&&Object.entries(t).every(([e,n])=>typeof e=="string"&&v4(n))}function v4(t){return t!=null&&typeof t=="object"&&"type"in t&&"result"in t&&(t.type==="data"||t.type==="error")}function w4(t){return Em(t.result)&&Q1.has(t.result.status)}function yn(t){return t.type==="error"}function Ks(t){return(t&&t.type)==="redirect"}function I0(t){return typeof t=="object"&&t!=null&&"type"in t&&"data"in t&&"init"in t&&t.type==="DataWithResponseInit"}function Em(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.headers=="object"&&typeof t.body<"u"}function k4(t){return Q1.has(t)}function S4(t){return Em(t)&&k4(t.status)&&t.headers.has("Location")}function C4(t){return e4.has(t.toUpperCase())}function Wt(t){return Q3.has(t.toUpperCase())}function Dm(t){return new URLSearchParams(t).getAll("index").some(e=>e==="")}function sd(t,e){let n=typeof e=="string"?Os(e).search:e.search;if(t[t.length-1].route.index&&Dm(n||""))return t[t.length-1];let r=G1(t);return r[r.length-1]}function $0(t){let{formMethod:e,formAction:n,formEncType:r,text:s,formData:i,json:o}=t;if(!(!e||!n||!r)){if(s!=null)return{formMethod:e,formAction:n,formEncType:r,formData:void 0,json:void 0,text:s};if(i!=null)return{formMethod:e,formAction:n,formEncType:r,formData:i,json:void 0,text:void 0};if(o!==void 0)return{formMethod:e,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function Sh(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 j4(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 _o(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 N4(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 $r(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 P4(t,e){try{let n=t.sessionStorage.getItem(J1);if(n){let r=JSON.parse(n);for(let[s,i]of Object.entries(r||{}))i&&Array.isArray(i)&&e.set(s,new Set(i||[]))}}catch{}}function O4(t,e){if(e.size>0){let n={};for(let[r,s]of e)n[r]=[...s];try{t.sessionStorage.setItem(J1,JSON.stringify(n))}catch(r){at(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function B0(){let t,e,n=new Promise((r,s)=>{t=async i=>{r(i);try{await n}catch{}},e=async i=>{s(i);try{await n}catch{}}});return{promise:n,resolve:t,reject:e}}var di=g.createContext(null);di.displayName="DataRouter";var Fl=g.createContext(null);Fl.displayName="DataRouterState";var aw=g.createContext(!1);function E4(){return g.useContext(aw)}var Mm=g.createContext({isTransitioning:!1});Mm.displayName="ViewTransition";var lw=g.createContext(new Map);lw.displayName="Fetchers";var D4=g.createContext(null);D4.displayName="Await";var Sn=g.createContext(null);Sn.displayName="Navigation";var Tu=g.createContext(null);Tu.displayName="Location";var Fn=g.createContext({outlet:null,matches:[],isDataRoute:!1});Fn.displayName="Route";var Am=g.createContext(null);Am.displayName="RouteError";var cw="REACT_ROUTER_ERROR",M4="REDIRECT",A4="ROUTE_ERROR_RESPONSE";function T4(t){if(t.startsWith(`${cw}:${M4}:{`))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 L4(t){if(t.startsWith(`${cw}:${A4}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new $l(e.status,e.statusText,e.data)}catch{}}function R4(t,{relative:e}={}){Re(bo(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=g.useContext(Sn),{hash:s,pathname:i,search:o}=Vl(t,{relative:e}),a=i;return n!=="/"&&(a=i==="/"?n:wr([n,i])),r.createHref({pathname:a,search:o,hash:s})}function bo(){return g.useContext(Tu)!=null}function sr(){return Re(bo(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(Tu).location}var dw="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function uw(t){g.useContext(Sn).static||g.useLayoutEffect(t)}function Ft(){let{isDataRoute:t}=g.useContext(Fn);return t?Y4():_4()}function _4(){Re(bo(),"useNavigate() may be used only in the context of a <Router> component.");let t=g.useContext(di),{basename:e,navigator:n}=g.useContext(Sn),{matches:r}=g.useContext(Fn),{pathname:s}=sr(),i=JSON.stringify(Mu(r)),o=g.useRef(!1);return uw(()=>{o.current=!0}),g.useCallback((l,d={})=>{if(at(o.current,dw),!o.current)return;if(typeof l=="number"){n.go(l);return}let u=Au(l,JSON.parse(i),s,d.relative==="path");t==null&&e!=="/"&&(u.pathname=u.pathname==="/"?e:wr([e,u.pathname])),(d.replace?n.replace:n.push)(u,d.state,d)},[e,n,i,s,t])}var hw=g.createContext(null);function fw(){return g.useContext(hw)}function I4(t){let e=g.useContext(Fn).outlet;return g.useMemo(()=>e&&g.createElement(hw.Provider,{value:t},e),[e,t])}function zl(){let{matches:t}=g.useContext(Fn),e=t[t.length-1];return e?e.params:{}}function Vl(t,{relative:e}={}){let{matches:n}=g.useContext(Fn),{pathname:r}=sr(),s=JSON.stringify(Mu(n));return g.useMemo(()=>Au(t,JSON.parse(s),r,e==="path"),[t,s,r,e])}function $4(t,e,n,r,s){Re(bo(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=g.useContext(Sn),{matches:o}=g.useContext(Fn),a=o[o.length-1],l=a?a.params:{},d=a?a.pathname:"/",u=a?a.pathnameBase:"/",h=a&&a.route;{let k=h&&h.path||"";mw(d,!h||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${k}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
20
|
+
|
|
21
|
+
Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let f=sr(),p;p=f;let m=p.pathname||"/",x=m;if(u!=="/"){let k=u.replace(/^\//,"").split("/");x="/"+m.replace(/^\//,"").split("/").slice(k.length).join("/")}let b=ls(t,{pathname:x});return at(h||b!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),at(b==null||b[b.length-1].route.element!==void 0||b[b.length-1].route.Component!==void 0||b[b.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),H4(b&&b.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:wr([u,i.encodeLocation?i.encodeLocation(k.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?u:wr([u,i.encodeLocation?i.encodeLocation(k.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),o,n,r,s)}function B4(){let t=q4(),e=va(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",t),o=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:i},"ErrorBoundary")," or"," ",g.createElement("code",{style:i},"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:s},n):null,o)}var F4=g.createElement(B4,null),pw=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=L4(t.digest);n&&(t=n)}let e=t!==void 0?g.createElement(Fn.Provider,{value:this.props.routeContext},g.createElement(Am.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?g.createElement(z4,{error:t},e):e}};pw.contextType=aw;var Ch=new WeakMap;function z4({children:t,error:e}){let{basename:n}=g.useContext(Sn);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=T4(e.digest);if(r){let s=Ch.get(e);if(s)throw s;let i=Y1(r.location,n);if(q1&&!Ch.get(e))if(i.isExternal||r.reloadDocument)window.location.href=i.absoluteURL||i.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:r.replace}));throw Ch.set(e,o),o}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return t}function V4({routeContext:t,match:e,children:n}){let r=g.useContext(di);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),g.createElement(Fn.Provider,{value:t},n)}function H4(t,e=[],n=null,r=null,s=null){if(t==null){if(!n)return null;if(n.errors)t=n.matches;else if(e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let i=t,o=n?.errors;if(o!=null){let u=i.findIndex(h=>h.route.id&&o?.[h.route.id]!==void 0);Re(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),i=i.slice(0,Math.min(i.length,u+1))}let a=!1,l=-1;if(n)for(let u=0;u<i.length;u++){let h=i[u];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(l=u),h.route.id){let{loaderData:f,errors:p}=n,m=h.route.loader&&!f.hasOwnProperty(h.route.id)&&(!p||p[h.route.id]===void 0);if(h.route.lazy||m){a=!0,l>=0?i=i.slice(0,l+1):i=[i[0]];break}}}let d=n&&r?(u,h)=>{r(u,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:Bl(n.matches),errorInfo:h})}:void 0;return i.reduceRight((u,h,f)=>{let p,m=!1,x=null,b=null;n&&(p=o&&h.route.id?o[h.route.id]:void 0,x=h.route.errorElement||F4,a&&(l<0&&f===0?(mw("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),m=!0,b=null):l===f&&(m=!0,b=h.route.hydrateFallbackElement||null)));let y=e.concat(i.slice(0,f+1)),k=()=>{let v;return p?v=x:m?v=b:h.route.Component?v=g.createElement(h.route.Component,null):h.route.element?v=h.route.element:v=u,g.createElement(V4,{match:h,routeContext:{outlet:u,matches:y,isDataRoute:n!=null},children:v})};return n&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?g.createElement(pw,{location:n.location,revalidation:n.revalidation,component:x,error:p,children:k(),routeContext:{outlet:null,matches:y,isDataRoute:!0},onError:d}):k()},null)}function Tm(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function W4(t){let e=g.useContext(di);return Re(e,Tm(t)),e}function U4(t){let e=g.useContext(Fl);return Re(e,Tm(t)),e}function K4(t){let e=g.useContext(Fn);return Re(e,Tm(t)),e}function Lm(t){let e=K4(t),n=e.matches[e.matches.length-1];return Re(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function G4(){return Lm("useRouteId")}function q4(){let t=g.useContext(Am),e=U4("useRouteError"),n=Lm("useRouteError");return t!==void 0?t:e.errors?.[n]}function Y4(){let{router:t}=W4("useNavigate"),e=Lm("useNavigate"),n=g.useRef(!1);return uw(()=>{n.current=!0}),g.useCallback(async(s,i={})=>{at(n.current,dw),n.current&&(typeof s=="number"?await t.navigate(s):await t.navigate(s,{fromRouteId:e,...i}))},[t,e])}var F0={};function mw(t,e,n){!e&&!F0[t]&&(F0[t]=!0,at(!1,n))}var z0={};function V0(t,e){!t&&!z0[e]&&(z0[e]=!0,console.warn(e))}var X4="useOptimistic",H0=d3[X4],Z4=()=>{};function Q4(t){return H0?H0(t):[t,Z4]}function J4(t){let e={hasErrorBoundary:t.hasErrorBoundary||t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&(t.element&&at(!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&&at(!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&&at(!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 eN=["HydrateFallback","hydrateFallbackElement"],tN=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 nN({router:t,flushSync:e,onError:n,unstable_useTransitions:r}){r=E4()||r;let[i,o]=g.useState(t.state),[a,l]=Q4(i),[d,u]=g.useState(),[h,f]=g.useState({isTransitioning:!1}),[p,m]=g.useState(),[x,b]=g.useState(),[y,k]=g.useState(),v=g.useRef(new Map),w=g.useCallback((P,{deletedFetchers:D,newErrors:A,flushSync:N,viewTransitionOpts:T})=>{A&&n&&Object.values(A).forEach(O=>n(O,{location:P.location,params:P.matches[0]?.params??{},unstable_pattern:Bl(P.matches)})),P.fetchers.forEach((O,E)=>{O.data!==void 0&&v.current.set(E,O.data)}),D.forEach(O=>v.current.delete(O)),V0(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 I=t.window!=null&&t.window.document!=null&&typeof t.window.document.startViewTransition=="function";if(V0(T==null||I,"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."),!T||!I){e&&N?e(()=>o(P)):r===!1?o(P):g.startTransition(()=>{r===!0&&l(O=>W0(O,P)),o(P)});return}if(e&&N){e(()=>{x&&(p?.resolve(),x.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:T.currentLocation,nextLocation:T.nextLocation})});let O=t.window.document.startViewTransition(()=>{e(()=>o(P))});O.finished.finally(()=>{e(()=>{m(void 0),b(void 0),u(void 0),f({isTransitioning:!1})})}),e(()=>b(O));return}x?(p?.resolve(),x.skipTransition(),k({state:P,currentLocation:T.currentLocation,nextLocation:T.nextLocation})):(u(P),f({isTransitioning:!0,flushSync:!1,currentLocation:T.currentLocation,nextLocation:T.nextLocation}))},[t.window,e,x,p,r,l,n]);g.useLayoutEffect(()=>t.subscribe(w),[t,w]),g.useEffect(()=>{h.isTransitioning&&!h.flushSync&&m(new tN)},[h]),g.useEffect(()=>{if(p&&d&&t.window){let P=d,D=p.promise,A=t.window.document.startViewTransition(async()=>{r===!1?o(P):g.startTransition(()=>{r===!0&&l(N=>W0(N,P)),o(P)}),await D});A.finished.finally(()=>{m(void 0),b(void 0),u(void 0),f({isTransitioning:!1})}),b(A)}},[d,p,t.window,r,l]),g.useEffect(()=>{p&&d&&a.location.key===d.location.key&&p.resolve()},[p,x,a.location,d]),g.useEffect(()=>{!h.isTransitioning&&y&&(u(y.state),f({isTransitioning:!0,flushSync:!1,currentLocation:y.currentLocation,nextLocation:y.nextLocation}),k(void 0))},[h.isTransitioning,y]);let C=g.useMemo(()=>({createHref:t.createHref,encodeLocation:t.encodeLocation,go:P=>t.navigate(P),push:(P,D,A)=>t.navigate(P,{state:D,preventScrollReset:A?.preventScrollReset}),replace:(P,D,A)=>t.navigate(P,{replace:!0,state:D,preventScrollReset:A?.preventScrollReset})}),[t]),j=t.basename||"/",S=g.useMemo(()=>({router:t,navigator:C,static:!1,basename:j,onError:n}),[t,C,j,n]);return g.createElement(g.Fragment,null,g.createElement(di.Provider,{value:S},g.createElement(Fl.Provider,{value:a},g.createElement(lw.Provider,{value:v.current},g.createElement(Mm.Provider,{value:h},g.createElement(iN,{basename:j,location:a.location,navigationType:a.historyAction,navigator:C,unstable_useTransitions:r},g.createElement(rN,{routes:t.routes,future:t.future,state:a,onError:n})))))),null)}function W0(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 rN=g.memo(sN);function sN({routes:t,future:e,state:n,onError:r}){return $4(t,void 0,n,r,e)}function gw({to:t,replace:e,state:n,relative:r}){Re(bo(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=g.useContext(Sn);at(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=g.useContext(Fn),{pathname:o}=sr(),a=Ft(),l=Au(t,Mu(i),o,r==="path"),d=JSON.stringify(l);return g.useEffect(()=>{a(JSON.parse(d),{replace:e,state:n,relative:r})},[a,d,r,e,n]),null}function U0(t){return I4(t.context)}function iN({basename:t="/",children:e=null,location:n,navigationType:r="POP",navigator:s,static:i=!1,unstable_useTransitions:o}){Re(!bo(),"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:s,static:i,unstable_useTransitions:o,future:{}}),[a,s,i,o]);typeof n=="string"&&(n=Os(n));let{pathname:d="/",search:u="",hash:h="",state:f=null,key:p="default"}=n,m=g.useMemo(()=>{let x=$n(d,a);return x==null?null:{location:{pathname:x,search:u,hash:h,state:f,key:p},navigationType:r}},[a,d,u,h,f,p,r]);return at(m!=null,`<Router basename="${a}"> is not able to match the URL "${d}${u}${h}" because it does not start with the basename, so the <Router> won't render anything.`),m==null?null:g.createElement(Sn.Provider,{value:l},g.createElement(Tu.Provider,{children:e,value:m}))}var id="get",od="application/x-www-form-urlencoded";function Lu(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function oN(t){return Lu(t)&&t.tagName.toLowerCase()==="button"}function aN(t){return Lu(t)&&t.tagName.toLowerCase()==="form"}function lN(t){return Lu(t)&&t.tagName.toLowerCase()==="input"}function cN(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function dN(t,e){return t.button===0&&(!e||e==="_self")&&!cN(t)}function Zf(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function uN(t,e){let n=Zf(t);return e&&e.forEach((r,s)=>{n.has(s)||e.getAll(s).forEach(i=>{n.append(s,i)})}),n}var bc=null;function hN(){if(bc===null)try{new FormData(document.createElement("form"),0),bc=!1}catch{bc=!0}return bc}var fN=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function jh(t){return t!=null&&!fN.has(t)?(at(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${od}"`),null):t}function pN(t,e){let n,r,s,i,o;if(aN(t)){let a=t.getAttribute("action");r=a?$n(a,e):null,n=t.getAttribute("method")||id,s=jh(t.getAttribute("enctype"))||od,i=new FormData(t)}else if(oN(t)||lN(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?$n(l,e):null,n=t.getAttribute("formmethod")||a.getAttribute("method")||id,s=jh(t.getAttribute("formenctype"))||jh(a.getAttribute("enctype"))||od,i=new FormData(a,t),!hN()){let{name:d,type:u,value:h}=t;if(u==="image"){let f=d?`${d}.`:"";i.append(`${f}x`,"0"),i.append(`${f}y`,"0")}else d&&i.append(d,h)}}else{if(Lu(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=id,r=null,s=od,o=t}return i&&s==="text/plain"&&(o=i,i=void 0),{action:r,method:n.toLowerCase(),encType:s,formData:i,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Rm(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function mN(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&&$n(r.pathname,e)==="/"?r.pathname=`${e.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function gN(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 xN(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 bN(t,e,n){let r=await Promise.all(t.map(async s=>{let i=e.routes[s.route.id];if(i){let o=await gN(i,n);return o.links?o.links():[]}return[]}));return kN(r.flat(1).filter(xN).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function K0(t,e,n,r,s,i){let o=(l,d)=>n[d]?l.route.id!==n[d].route.id:!0,a=(l,d)=>n[d].pathname!==l.pathname||n[d].route.path?.endsWith("*")&&n[d].params["*"]!==l.params["*"];return i==="assets"?e.filter((l,d)=>o(l,d)||a(l,d)):i==="data"?e.filter((l,d)=>{let u=r.routes[l.route.id];if(!u||!u.hasLoader)return!1;if(o(l,d)||a(l,d))return!0;if(l.route.shouldRevalidate){let h=l.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(t,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof h=="boolean")return h}return!0}):[]}function yN(t,e,{includeHydrateFallback:n}={}){return vN(t.map(r=>{let s=e.routes[r.route.id];if(!s)return[];let i=[s.module];return s.clientActionModule&&(i=i.concat(s.clientActionModule)),s.clientLoaderModule&&(i=i.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(i=i.concat(s.hydrateFallbackModule)),s.imports&&(i=i.concat(s.imports)),i}).flat(1))}function vN(t){return[...new Set(t)]}function wN(t){let e={},n=Object.keys(t).sort();for(let r of n)e[r]=t[r];return e}function kN(t,e){let n=new Set;return new Set(e),t.reduce((r,s)=>{let i=JSON.stringify(wN(s));return n.has(i)||(n.add(i),r.push({key:i,link:s})),r},[])}function xw(){let t=g.useContext(di);return Rm(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function SN(){let t=g.useContext(Fl);return Rm(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var _m=g.createContext(void 0);_m.displayName="FrameworkContext";function bw(){let t=g.useContext(_m);return Rm(t,"You must render this element inside a <HydratedRouter> element"),t}function CN(t,e){let n=g.useContext(_m),[r,s]=g.useState(!1),[i,o]=g.useState(!1),{onFocus:a,onBlur:l,onMouseEnter:d,onMouseLeave:u,onTouchStart:h}=e,f=g.useRef(null);g.useEffect(()=>{if(t==="render"&&o(!0),t==="viewport"){let x=y=>{y.forEach(k=>{o(k.isIntersecting)})},b=new IntersectionObserver(x,{threshold:.5});return f.current&&b.observe(f.current),()=>{b.disconnect()}}},[t]),g.useEffect(()=>{if(r){let x=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(x)}}},[r]);let p=()=>{s(!0)},m=()=>{s(!1),o(!1)};return n?t!=="intent"?[i,f,{}]:[i,f,{onFocus:Io(a,p),onBlur:Io(l,m),onMouseEnter:Io(d,p),onMouseLeave:Io(u,m),onTouchStart:Io(h,p)}]:[!1,f,{}]}function Io(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function jN({page:t,...e}){let{router:n}=xw(),r=g.useMemo(()=>ls(n.routes,t,n.basename),[n.routes,t,n.basename]);return r?g.createElement(PN,{page:t,matches:r,...e}):null}function NN(t){let{manifest:e,routeModules:n}=bw(),[r,s]=g.useState([]);return g.useEffect(()=>{let i=!1;return bN(t,e,n).then(o=>{i||s(o)}),()=>{i=!0}},[t,e,n]),r}function PN({page:t,matches:e,...n}){let r=sr(),{manifest:s,routeModules:i}=bw(),{basename:o}=xw(),{loaderData:a,matches:l}=SN(),d=g.useMemo(()=>K0(t,e,l,s,r,"data"),[t,e,l,s,r]),u=g.useMemo(()=>K0(t,e,l,s,r,"assets"),[t,e,l,s,r]),h=g.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let m=new Set,x=!1;if(e.forEach(y=>{let k=s.routes[y.route.id];!k||!k.hasLoader||(!d.some(v=>v.route.id===y.route.id)&&y.route.id in a&&i[y.route.id]?.shouldRevalidate||k.hasClientLoader?x=!0:m.add(y.route.id))}),m.size===0)return[];let b=mN(t,o,"data");return x&&m.size>0&&b.searchParams.set("_routes",e.filter(y=>m.has(y.route.id)).map(y=>y.route.id).join(",")),[b.pathname+b.search]},[o,a,r,s,d,e,t,i]),f=g.useMemo(()=>yN(u,s),[u,s]),p=NN(u);return g.createElement(g.Fragment,null,h.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:x})=>g.createElement("link",{key:m,nonce:n.nonce,...x})))}function ON(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var EN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{EN&&(window.__reactRouterVersion="7.11.0")}catch{}function DN(t,e){return s4({basename:e?.basename,getContext:e?.getContext,future:e?.future,history:v3({window:e?.window}),hydrationData:MN(),routes:t,mapRouteProperties:J4,hydrationRouteProperties:eN,dataStrategy:e?.dataStrategy,patchRoutesOnNavigation:e?.patchRoutesOnNavigation,window:e?.window,unstable_instrumentations:e?.unstable_instrumentations}).initialize()}function MN(){let t=window?.__staticRouterHydrationData;return t&&t.errors&&(t={...t,errors:AN(t.errors)}),t}function AN(t){if(!t)return null;let e=Object.entries(t),n={};for(let[r,s]of e)if(s&&s.__type==="RouteErrorResponse")n[r]=new $l(s.status,s.statusText,s.data,s.internal===!0);else if(s&&s.__type==="Error"){if(s.__subType){let i=window[s.__subType];if(typeof i=="function")try{let o=new i(s.message);o.stack="",n[r]=o}catch{}}if(n[r]==null){let i=new Error(s.message);i.stack="",n[r]=i}}else n[r]=s;return n}var yw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,vw=g.forwardRef(function({onClick:e,discover:n="render",prefetch:r="none",relative:s,reloadDocument:i,replace:o,state:a,target:l,to:d,preventScrollReset:u,viewTransition:h,unstable_defaultShouldRevalidate:f,...p},m){let{basename:x,unstable_useTransitions:b}=g.useContext(Sn),y=typeof d=="string"&&yw.test(d),k=Y1(d,x);d=k.to;let v=R4(d,{relative:s}),[w,C,j]=CN(r,p),S=_N(d,{replace:o,state:a,target:l,preventScrollReset:u,relative:s,viewTransition:h,unstable_defaultShouldRevalidate:f,unstable_useTransitions:b});function P(A){e&&e(A),A.defaultPrevented||S(A)}let D=g.createElement("a",{...p,...j,href:k.absoluteURL||v,onClick:k.isExternal||i?e:P,ref:ON(m,C),target:l,"data-discover":!y&&n==="render"?"true":void 0});return w&&!y?g.createElement(g.Fragment,null,D,g.createElement(jN,{page:v})):D});vw.displayName="Link";var TN=g.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:r="",end:s=!1,style:i,to:o,viewTransition:a,children:l,...d},u){let h=Vl(o,{relative:d.relative}),f=sr(),p=g.useContext(Fl),{navigator:m,basename:x}=g.useContext(Sn),b=p!=null&&zN(h)&&a===!0,y=m.encodeLocation?m.encodeLocation(h).pathname:h.pathname,k=f.pathname,v=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;n||(k=k.toLowerCase(),v=v?v.toLowerCase():null,y=y.toLowerCase()),v&&x&&(v=$n(v,x)||v);const w=y!=="/"&&y.endsWith("/")?y.length-1:y.length;let C=k===y||!s&&k.startsWith(y)&&k.charAt(w)==="/",j=v!=null&&(v===y||!s&&v.startsWith(y)&&v.charAt(y.length)==="/"),S={isActive:C,isPending:j,isTransitioning:b},P=C?e:void 0,D;typeof r=="function"?D=r(S):D=[r,C?"active":null,j?"pending":null,b?"transitioning":null].filter(Boolean).join(" ");let A=typeof i=="function"?i(S):i;return g.createElement(vw,{...d,"aria-current":P,className:D,ref:u,style:A,to:o,viewTransition:a},typeof l=="function"?l(S):l)});TN.displayName="NavLink";var LN=g.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:r,replace:s,state:i,method:o=id,action:a,onSubmit:l,relative:d,preventScrollReset:u,viewTransition:h,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:x}=g.useContext(Sn),b=BN(),y=FN(a,{relative:d}),k=o.toLowerCase()==="get"?"get":"post",v=typeof a=="string"&&yw.test(a),w=C=>{if(l&&l(C),C.defaultPrevented)return;C.preventDefault();let j=C.nativeEvent.submitter,S=j?.getAttribute("formmethod")||o,P=()=>b(j||C.currentTarget,{fetcherKey:e,method:S,navigate:n,replace:s,state:i,relative:d,preventScrollReset:u,viewTransition:h,unstable_defaultShouldRevalidate:f});x&&n!==!1?g.startTransition(()=>P()):P()};return g.createElement("form",{ref:m,method:k,action:y,onSubmit:r?l:w,...p,"data-discover":!v&&t==="render"?"true":void 0})});LN.displayName="Form";function RN(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ww(t){let e=g.useContext(di);return Re(e,RN(t)),e}function _N(t,{target:e,replace:n,state:r,preventScrollReset:s,relative:i,viewTransition:o,unstable_defaultShouldRevalidate:a,unstable_useTransitions:l}={}){let d=Ft(),u=sr(),h=Vl(t,{relative:i});return g.useCallback(f=>{if(dN(f,e)){f.preventDefault();let p=n!==void 0?n:jr(u)===jr(h),m=()=>d(t,{replace:p,state:r,preventScrollReset:s,relative:i,viewTransition:o,unstable_defaultShouldRevalidate:a});l?g.startTransition(()=>m()):m()}},[u,d,h,n,r,e,t,s,i,o,a,l])}function Hl(t){at(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(Zf(t)),n=g.useRef(!1),r=sr(),s=g.useMemo(()=>uN(r.search,n.current?null:e.current),[r.search]),i=Ft(),o=g.useCallback((a,l)=>{const d=Zf(typeof a=="function"?a(new URLSearchParams(s)):a);n.current=!0,i("?"+d,l)},[i,s]);return[s,o]}var IN=0,$N=()=>`__${String(++IN)}__`;function BN(){let{router:t}=ww("useSubmit"),{basename:e}=g.useContext(Sn),n=G4(),r=t.fetch,s=t.navigate;return g.useCallback(async(i,o={})=>{let{action:a,method:l,encType:d,formData:u,body:h}=pN(i,e);if(o.navigate===!1){let f=o.fetcherKey||$N();await r(f,n,o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:u,body:h,formMethod:o.method||l,formEncType:o.encType||d,flushSync:o.flushSync})}else await s(o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:u,body:h,formMethod:o.method||l,formEncType:o.encType||d,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[r,s,e,n])}function FN(t,{relative:e}={}){let{basename:n}=g.useContext(Sn),r=g.useContext(Fn);Re(r,"useFormAction must be used inside a RouteContext");let[s]=r.matches.slice(-1),i={...Vl(t||".",{relative:e})},o=sr();if(t==null){i.search=o.search;let a=new URLSearchParams(i.search),l=a.getAll("index");if(l.some(u=>u==="")){a.delete("index"),l.filter(h=>h).forEach(h=>a.append("index",h));let u=a.toString();i.search=u?`?${u}`:""}}return(!t||t===".")&&s.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:wr([n,i.pathname])),jr(i)}function zN(t,{relative:e}={}){let n=g.useContext(Mm);Re(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=ww("useViewTransitionState"),s=Vl(t,{relative:e});if(!n.isTransitioning)return!1;let i=$n(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=$n(n.nextLocation.pathname,r)||n.nextLocation.pathname;return jd(s.pathname,o)!=null||jd(s.pathname,i)!=null}function VN(t){return g.createElement(nN,{flushSync:Us.flushSync,...t})}const HN={en:{loading:"Loading...",error:"Error",selectProject:"Select a project to view dashboard",controlCenter:"Control Center",settings:"Settings",sync:"Sync",offline:"Offline",switchToLight:"Switch to light mode",switchToDark:"Switch to dark mode",settingsSection:"Settings",overviewSection:"Overview",entitiesSection:"Entities",toolsSection:"Tools",configEditor:"Config Editor",projects:"Projects",addProject:"Add Project",global:"Global",skills:"Skills",skillsNav:"Skills",health:"Health",collapse:"Collapse",expand:"Expand",installing:"Installing...",manage:"Manage",uninstall:"Uninstall",installGlobally:"Install Globally",installGloballyDesc:"Available to all projects instead of current project only",selectAtLeastOneAgent:"Please select at least one agent",installationFailed:"Installation failed",allSkills:"All Skills",refresh:"Refresh",browseAndManageSkills:"Browse and manage skills for your agents",detected:"Detected",notDetected:"Not detected",sessions:"sessions",noSessions:"No sessions",terminal:"Terminal",terminalSub:"Open bash at path",editor:"Editor",editorSub:"Open in VS Code",useGlobalFallback:"Use global fallback",openAtPath:"Open at project path",openAppOnly:"Open app only",actionOptionsLoadFailed:"Could not load editor/terminal options",launch:"Launch",launchSub:"Start Claude Code",config:"Config",configSub:"Manage project settings",recentSessions:"Recent Sessions",viewAllHistory:"View All History",showLess:"Show Less",actionFailed:"Action failed",loadingSessions:"Loading sessions...",noSessionsFound:"No sessions found",configuration:"Claude Settings",planSettingsTitle:"Plan Settings",activeKit:"Active Kit",aiModel:"Model",hooks:"Hooks",active:"active",mcpServers:"MCP Servers",connected:"connected",plansDirectory:"Plans Directory",validationMode:"Validation Mode",planScopeLabel:"Scope",planScopeProject:"project",planScopeGlobal:"global",activePlansLabel:"Active Plans",activePlansTitle:"Active Plans",noActivePlansFound:"No active plans found",openPlan:"Open Plan",openKanban:"Open Kanban",blockedByLabel:"Blocked by",progressLabel:"Progress",editProjectConfig:"Edit Project Config",projectPreferenceSaveFailed:"Failed to save preference",globalSettings:"(Global)",globalSkills:"Global Skills",loadingSkills:"Loading skills...",noDescription:"No description",browseSkillsMarketplace:"Browse Skills Marketplace",desktopModeLabel:"Desktop Mode",desktopModeActionsMessage:"Project quick actions stay in the CLI or web dashboard in desktop mode.",desktopModePlansMessage:"Plan dashboards still run in the web workflow in desktop mode.",desktopModeQuickActionsHint:"Desktop mode keeps project quick actions in the CLI for now. Use ck config, ck migrate, or your terminal/editor directly for server-backed actions.",desktopModeMigrateTitle:"Migration stays in the CLI for now",desktopModeMigrateDescription:"The desktop app no longer runs the Express migration backend in Phase 5A. Migration planning and execution still belong to the CLI workflow.",desktopModeMigrateHint:"Run ck migrate in a terminal for migration work.",desktopModeOnboardingTitle:"Desktop onboarding ships in the next phase",desktopModeOnboardingDescription:"The current onboarding flow installs kits through the web backend, which is intentionally not part of desktop mode anymore.",desktopModeOnboardingHint:"Use ck init or ck config in the terminal or web dashboard for onboarding today.",desktopOnboardingEyebrow:"First Run",desktopOnboardingTitle:"Welcome to ClaudeKit Control Center",desktopOnboardingDescription:"Let's get your desktop app ready by finding the Claude projects you want to manage here.",desktopOnboardingWelcomeBody:"We'll scan your home, projects, code, and dev folders for Claude-ready workspaces, then let you choose what to register.",desktopOnboardingStart:"Find My Projects",desktopOnboardingScanning:"Scanning common development folders...",desktopOnboardingScanningHint:"This checks your home, ~/projects, ~/code, and ~/dev directories for Claude workspaces.",desktopOnboardingScanFailed:"Failed to scan for Claude projects",desktopOnboardingScanPartialWarning:"{count} scan target(s) could not be read. Showing the projects that were discovered successfully.",desktopOnboardingSelectTitle:"Choose projects to add",desktopOnboardingSelectDescription:"Pick the projects you want ClaudeKit Control Center to register now.",desktopOnboardingNoProjects:"No Claude projects were found in the common development folders. You can continue to the dashboard and add one manually later.",desktopOnboardingSelectedCount:"{count} selected",desktopOnboardingContinue:"Continue",desktopOnboardingSkip:"Skip for now",desktopOnboardingSaving:"Saving...",desktopOnboardingAddFailed:"Failed to add the selected projects",desktopOnboardingDoneTitle:"You're ready to go",desktopOnboardingDoneDescription:"Your onboarding preferences are saved. ClaudeKit Control Center will open the dashboard from here on out.",desktopOnboardingOpenDashboard:"Open Dashboard",desktopOnboardingKitDetected:"ClaudeKit detected",desktopOnboardingPartialAddWarning:"{failed} of {total} selected projects could not be added. You can register them manually later.",desktopModePlansTitle:"Plans dashboard stays in the web workflow for now",desktopModePlansDescription:"Phase 5A removes the Express runtime from desktop mode. The rich plans dashboard still depends on backend-only plan analytics and actions that are being handled in later work.",desktopModePlansHint:"Use ck config for the plans dashboard, or open plans directly from the CLI workflow.",desktopModePlanDetailTitle:"Detailed plan analytics stay in the web dashboard for now",desktopModePlanDetailDescription:"Timeline, heatmap, and plan action flows still depend on backend-only plan APIs. Phase 5A keeps desktop mode honest by disabling those surfaces instead of leaving dead network requests behind.",desktopModePlanDetailHint:"Use ck config for detailed plan dashboards and plan actions.",desktopModePlanReaderTitle:"Plan reader stays in the web dashboard for now",desktopModePlanReaderDescription:"Phase 5A removes the Express runtime, but the current markdown reader still depends on backend-only plan file routes.",desktopModePlanReaderHint:"Use ck config when you need the full plan reader experience.",backToDashboard:"Back to Dashboard",educationalConfigEditor:"Educational Config Editor",discard:"Discard",saveChanges:"Save Changes",mergedView:"Merged View",localConfig:"Local (.ck.json)",globalConfig:"Global",syntaxValid:"Syntax Valid",configurationHelp:"Configuration Help",field:"Field",type:"Type",default:"Default",description:"Description",validValues:"Valid Values",systemEffect:"System Effect",exampleUsage:"Example Usage",knowledgeBase:"Knowledge Base",clickToSeeHelp:"Click on any configuration field to see detailed documentation and usage examples.",extractedFrom:"Extracted from ClaudeKit v2.x Specification",resetToDefault:"Reset",saving:"Saving...",saved:"Saved",confirmReset:"Reset to Default?",confirmResetMessage:"All changes will be lost and replaced with default values.",confirm:"Confirm",saveFailed:"Save failed",configTab:"Config",systemTab:"System",formTab:"Form",jsonTab:"JSON",readOnly:"Read-only",installedKit:"Installed Kit",kitVersion:"Kit Version",installedOn:"Installed On",noKitInstalled:"No kit installed",components:"Components",agents:"Agents",commands:"Commands",workflows:"Workflows",kitSkills:"Skills",fileOwnership:"File Ownership",ownershipCk:"kit-managed",ownershipUser:"user-owned",ownershipModified:"modified",componentInventory:"Component Inventory",installedHooks:"Installed Hooks",installedMcpServers:"MCP Servers",lastChecked:"Last update check",staleIndicator:"Stale",skippedVersion:"Skipped",filesModifiedFromDefaults:"files modified from kit defaults",cliCard:"ClaudeKit CLI",checkForUpdates:"Check for Updates",checking:"Checking...",upToDate:"Up to date",updateAvailable:"Update available",updateNow:"Update Now",updating:"Updating...",updateSuccess:"Update Complete!",updateFailed:"Update Failed",closeModal:"Close",showDetails:"Show Details",hideDetails:"Hide Details",environment:"Environment",claudeConfigPath:"Claude config",nodeVersion:"Node",bunVersion:"Bun",osVersion:"OS",envShell:"Shell",envHomeDir:"Home",envCpuCores:"CPU Cores",envTotalMemory:"Memory",cliPackageManager:"Package Manager",cliInstallLocation:"Install Location",cliGitVersion:"Git",cliGhVersion:"GitHub CLI",channelStable:"Stable",channelBeta:"Beta",betaBadge:"Beta",latestVersion:"Latest",selectVersion:"Select version",loadingVersions:"Loading versions...",prereleaseLabel:"Pre",currentVersionLabel:"Current",checkAll:"Check All",checkingAll:"Checking...",updateAll:"Update All",updatesAvailable:"{count} updates available",allUpToDate:"All up to date",systemControlTower:"System Control Tower",systemOverviewTitle:"Update & Runtime Overview",systemOverviewDesc:"Track CLI and kit health, then run upgrades from one place.",installedComponentsHeading:"Installed Components",updateReadiness:"Update Readiness",checkedComponents:"Checked",activeChannel:"Channel",readyToScan:"Ready to scan",noTrackedFiles:"No tracked files detected",kitsLabel:"Kits",componentFilterAll:"All",componentFilterUpdates:"Updates",componentFilterUpdatesCount:"Updates ({count})",componentFilterUpToDate:"Up to date",componentFilterUpToDateCount:"Up to date ({count})",componentFilterCli:"CLI",componentFilterKits:"Kits",noComponentsMatchFilter:"No components match the current filter.",runCheckAllForFilter:"Run Check All to populate this filter.",noUpdatesFound:"No updates found. Checked components are up to date.",noUpToDateYet:"No components are up to date yet.",configWorkspaceHint:"Edit configuration or manage system updates from one workspace.",settingsJsonHeading:"Claude Settings JSON",settingsJsonMissing:"No settings file found at ~/.claude/settings.json.",settingsJsonLoadFailed:"Failed to load ~/.claude/settings.json.",settingsLoadFailedDetail:"Error detail:",configLoadFailed:"Failed to load configuration.",configLoadFailedDetail:"Error detail:",settingsBackupSaved:"Backup saved",hookDiagnosticsTitle:"Hook Diagnostics",hookDiagnosticsDesc:"Inspect recent hook activity and failures without opening JSONL files manually.",hookDiagnosticsPathPending:"Resolving log path...",hookDiagnosticsScopeGlobal:"Global hooks",hookDiagnosticsEntries:"Entries",hookDiagnosticsCrashes:"Crashes",hookDiagnosticsWarnings:"Warnings",hookDiagnosticsBlocks:"Blocks",hookDiagnosticsLastEvent:"Last event",hookDiagnosticsLoading:"Loading hook diagnostics...",hookDiagnosticsLoadFailed:"Failed to load hook diagnostics",hookDiagnosticsMissing:"No hook log file found for this scope yet.",hookDiagnosticsEmpty:"Hook log is present but contains no readable entries.",hookDiagnosticsParseErrorsNotice:"Skipped {count} malformed log line(s) while loading diagnostics.",hookDiagnosticsTruncatedNotice:"Showing a bounded recent window to keep diagnostics responsive on large logs.",hookDiagnosticsToolLabel:"tool",hookDiagnosticsTargetLabel:"target",hookDiagnosticsUnknown:"Unknown",hookDiagnostics:"Hook Diagnostics",hookEvent:"Event",hookExecutions:"Executions",hookAvgLatency:"Avg Latency",hookFailureRate:"Failure Rate",hookLastRun:"Last Run",hookLatencyWarning:"Latency > 500ms",activityMetrics:"Activity",activityTotalSessions:"Total Sessions",activityMostActive:"Most Active Projects",activityPeriod24h:"24h",activityPeriod7d:"7d",activityPeriod30d:"30d",activityNoData:"No activity data",addProjectTitle:"Add Project",addProjectDescription:"Add a new ClaudeKit project to the control center",projectPath:"Project Path",pathPlaceholder:"/path/to/project",alias:"Alias",aliasOptional:"(optional)",aliasPlaceholder:"my-project",aliasDescription:"Custom display name for the project",pathRequired:"Path is required",failedToAdd:"Failed to add project",cancel:"Cancel",adding:"Adding...",somethingWentWrong:"Something went wrong",reloadApp:"Reload App",serverNotRunning:"Server Not Running",startServerMessage:"The Config UI requires the backend server to be running.",runThisCommand:"Run this command",tryAgain:"Try Again",projectConfig:"Project Config",inheritedFromGlobal:"Inherited from Global",localOverride:"Local Override",viewGlobalConfig:"This field inherits from global config. View",onboardingTitle:"Welcome to ClaudeKit",onboardingSubtitle:"Choose your kit and get started in minutes",kitEngineerName:"ClaudeKit Engineer",kitEngineerTagline:"AI-powered coding with skills, hooks, and multi-agent workflows",kitMarketingName:"ClaudeKit Marketing",kitMarketingTagline:"Content automation: campaigns, social media, analytics",featureAgents:"AI Agents",featureAgentsDesc:"Specialized agents for different tasks",featureHooks:"Lifecycle Hooks",featureHooksDesc:"Customize Claude's behavior at key moments",featureSkills:"Skills Library",featureSkillsDesc:"Pre-built capabilities you can activate",featureMultiAgent:"Multi-Agent Workflows",featureMultiAgentDesc:"Coordinate multiple agents for complex tasks",featureContent:"Content Generation",featureContentDesc:"Automated content creation and optimization",featureSocial:"Social Media Tools",featureSocialDesc:"Scheduling, analytics, and engagement automation",stepChooseKit:"Choose Kit",stepConfigure:"Configure",stepInstall:"Install",back:"Back",next:"Next",install:"Install",installSuccess:"Installation Complete!",installSuccessDesc:"{kit} is ready to use",getStarted:"Get Started",goToDashboard:"Go to Dashboard",kitConfig:"Kit Config",kitConfigSubtitle:"Configure ClaudeKit Engineer settings",scopeGlobal:"Global",scopeProject:"Project",sectionGeneral:"General",sectionPaths:"Paths",sectionPrivacy:"Privacy & Trust",sectionProject:"Project Detection",sectionIntegrations:"Integrations",sectionHooks:"Hooks",sectionAdvanced:"Advanced",fieldCodingLevel:"Coding Level",fieldCodingLevelDesc:"Your coding experience level (-1=auto, 0=beginner, 1=intermediate, 2=advanced, 3=expert, 4=tech-lead, 5=god-mode)",fieldStatusline:"Statusline Mode",fieldStatuslineDesc:"How much info to show in the status line",fieldStatuslineColors:"Statusline Colors",fieldStatuslineColorsDesc:"Enable ANSI color output in the statusline",fieldStatuslineQuota:"Statusline Quota Display",fieldStatuslineQuotaDesc:"Show the 5h / wk quota chips in the statusline",fieldThinkingLanguage:"Thinking Language",fieldThinkingLanguageDesc:"Language for Claude's internal reasoning (null=English)",fieldResponseLanguage:"Response Language",fieldResponseLanguageDesc:"Language for Claude's responses (null=match user)",fieldDocsPath:"Docs Directory",fieldDocsPathDesc:"Path to documentation directory",fieldPlansPath:"Plans Directory",fieldPlansPathDesc:"Path to plans directory",fieldGlobalPlansPath:"Global Plans Directory",fieldGlobalPlansPathDesc:"Path to global plans directory",fieldPrivacyBlock:"Privacy Block",fieldPrivacyBlockDesc:"Block access to sensitive files (.env, credentials)",fieldTrustEnabled:"Trust Mode",fieldTrustEnabledDesc:"Enable auto-approval for tool calls",fieldTrustPassphrase:"Trust Passphrase",fieldTrustPassphraseDesc:"Passphrase to enable trust mode",fieldProjectType:"Project Type",fieldProjectTypeDesc:"Override auto-detected project type",fieldPackageManager:"Package Manager",fieldPackageManagerDesc:"Override auto-detected package manager",fieldFramework:"Framework",fieldFrameworkDesc:"Override auto-detected framework",fieldGeminiModel:"Gemini Model",fieldGeminiModelDesc:"Gemini model for CLI commands; legacy gemini-3.0-* ids auto-map",geminiModel25Flash:"Gemini 2.5 Flash — All tiers",geminiModel25Pro:"Gemini 2.5 Pro — May hit capacity limits",geminiModel3FlashPreview:"Gemini 3 Flash Preview — Pro/Ultra only",geminiModel3ProPreview:"Gemini 3 Pro Preview — Pro/Ultra only",fieldResearchUseGemini:"Use Gemini for Research",fieldResearchUseGeminiDesc:"Use Gemini CLI instead of WebSearch",fieldDocsMaxLoc:"Max Lines per Doc",fieldDocsMaxLocDesc:"Maximum lines of code per documentation file",fieldPlanNamingFormat:"Plan Naming Format",fieldPlanNamingFormatDesc:"Format for plan directory names",fieldPlanDateFormat:"Plan Date Format",fieldPlanDateFormatDesc:"Date format for plan names (moment.js)",fieldPlanValidationMode:"Validation Mode",fieldPlanValidationModeDesc:"How to validate plans before implementation",fieldPlanMinQuestions:"Min Questions",fieldPlanMinQuestionsDesc:"Minimum validation questions",fieldPlanMaxQuestions:"Max Questions",fieldPlanMaxQuestionsDesc:"Maximum validation questions",fieldAssertions:"Assertions",fieldAssertionsDesc:"Code assertions and rules to enforce",fieldHookSessionInit:"Session Init",fieldHookSessionInitDesc:"Project detection and environment setup",fieldHookSubagentInit:"Subagent Init",fieldHookSubagentInitDesc:"Inject context to subagents",fieldHookDescriptiveName:"Descriptive Name",fieldHookDescriptiveNameDesc:"Enforce kebab-case descriptive file naming for scripts",fieldHookDevRulesReminder:"Dev Rules Reminder",fieldHookDevRulesReminderDesc:"Inject development rules context",fieldHookUsageContextAwareness:"Usage Prompt Awareness",fieldHookUsageContextAwarenessDesc:"Inject usage-limit awareness into prompts",fieldHookContextTracking:"Context Tracking",fieldHookContextTrackingDesc:"Context window tracking (% used, token counts)",fieldHookScoutBlock:"Scout Block",fieldHookScoutBlockDesc:"Block heavy directories from exploration",fieldHookPrivacyBlock:"Privacy Block Hook",fieldHookPrivacyBlockDesc:"Block sensitive files from reading",fieldHookSimplifyGate:"Simplify Gate",fieldHookSimplifyGateDesc:"UserPromptSubmit hook — opt-in. When enabled (simplify.gate.enabled=true), hard-blocks ship/merge/pr/deploy/publish and soft-warns commit/finalize/release when live diff exceeds thresholds.",sectionSimplify:"Simplify Gate",fieldSimplifyThresholdLocDelta:"Total LOC threshold",fieldSimplifyThresholdLocDeltaDesc:"Total LOC change (across all files) above which the gate fires.",fieldSimplifyThresholdFileCount:"File count threshold",fieldSimplifyThresholdFileCountDesc:"Number of changed files above which the gate fires.",fieldSimplifyThresholdSingleFileLoc:"Per-file LOC threshold",fieldSimplifyThresholdSingleFileLocDesc:"Per-file LOC change above which the gate fires.",fieldSimplifyGateEnabled:"Enabled",fieldSimplifyGateEnabledDesc:"Master toggle. Off by default (opt-in). Enable to activate the gate; env CK_SIMPLIFY_DISABLED=1 always bypasses.",fieldSimplifyGateHardVerbs:"Hard-block verbs",fieldSimplifyGateHardVerbsDesc:"Verbs that hard-block when thresholds breached.",fieldSimplifyGateSoftVerbs:"Soft-warn verbs",fieldSimplifyGateSoftVerbsDesc:"Verbs that emit a non-blocking warning.",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",migrateReason_newItem:"New item from provider",migrateReason_newProviderForItem:"New provider for this item",migrateReason_targetDeletedSourceChanged:"Target was deleted but source has updates",migrateReason_targetDirEmptyReinstall:"Target directory is empty — reinstalling",migrateReason_forceReinstall:"Force reinstall requested",migrateReason_forceOverwrite:"Force overwrite (you edited this, --force active)",migrateReason_registryUpgradeReinstall:"Registry upgrade requires reinstall",migrateReason_sourceChanged:"Source has been updated",migrateReason_registryUpgradeHeal:"Healing stale target after registry upgrade",migrateReason_noChanges:"No changes detected",migrateReason_userEditsPreserved:"User edits preserved",migrateReason_userDeletedRespected:"User deletion respected",migrateReason_targetUpToDateBackfill:"Target is up to date",migrateReason_providerChecksumUnavailable:"Provider checksum unavailable",migrateReason_targetStateUnknown:"Target state could not be determined",migrateReason_sourceRemovedOrphan:"Source removed — cleaning up orphan",migrateReason_renamedCleanup:"Item renamed — removing old path",migrateReason_pathMigratedCleanup:"Path migrated — removing old location",migrateReason_bothChanged:"Both source and target changed",migrateReason_targetStateUnknownSourceChanged:"Source changed but target state unknown",migrateBanner_emptyDir_title:"Detected empty directory",migrateBanner_emptyDir_body:"items below will be reinstalled. Uncheck any to skip.",migrateBanner_emptyDirRespected_title:"Respecting your deletion",migrateBanner_emptyDirRespected_body:"is empty. Respecting your deletion.",migrateBanner_reinstallCta:"Reinstall these items",migrateModeLabel:"Migration mode",migrateModeReconcile:"Reconcile",migrateModeReconcileDesc:"Smart-detects drift",migrateModeInstall:"Install",migrateModeInstallDesc:"Pick items to install",migrateModeConfirmTitle:"Switch mode?",migrateModeConfirmBody:"You have {count} pending changes. Switching to {mode} mode will discard them.",migrateModeConfirmSwitch:"Switch & discard",migrateSmartDefaultInstall:"Fresh install detected — defaulting to Install mode",migrateSmartDefaultReconcile:"Existing registry found — defaulting to Reconcile mode",migrateInstallSelectAll:"Select all",migrateInstallDeselectAll:"Deselect all",migrateInstallDirItem:"dir",migrateInstallAlreadyInstalled:"installed",migrateInstallNoCandidates:"No installable items found for the selected providers.",migrateInstallSelectedCount:"{count} of {total} items selected",migrateInstallCta:"Install {count} selected items",migrateInstallInstalling:"Installing...",migrateInstallLoadingCandidates:"Fetching available items...",migrateFlip_moveToSkip:"Move to Skip",migrateFlip_moveToInstall:"Move to Install",migrateFlip_checkAll:"Check all",migrateFlip_uncheckAll:"Uncheck all",migrateFlip_toggleItem:"Toggle item",migrateConflictBanner_title:"Conflicts detected",migrateConflictBanner_cta:"Open conflict resolver",migrateConflictBanner_hide:"Hide conflict resolver",migrateShowSkippedItems:"Show skipped items",migrateHideSkippedItems:"Hide skipped items",migrateConflictBadge:"Conflict",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",plansNav:"Plans",plansTitle:"Plans Dashboard",plansGlobalTitle:"All Projects",plansSubtitle:"Browse active plans, inspect phase timelines, and manage progress from one place.",plansEmpty:"No plans found",plansSearch:"Search plans...",plansProjectFilter:"Filter by project",plansAllProjects:"All projects",plansSortBy:"Sort by",plansViewGrid:"Grid",plansViewKanban:"Kanban",plansFilterAll:"All statuses",plansSortDateDesc:"Newest first",plansSortDateAsc:"Oldest first",plansSortNameAsc:"Name A-Z",plansSortNameDesc:"Name Z-A",plansSortProgress:"Highest progress",plansLabel:"Plan",plansStatusPending:"Pending",plansStatusInProgress:"In Progress",plansStatusInReview:"In Review",plansStatusDone:"Done",plansStatusCancelled:"Cancelled",plansCompletedCount:"{count} completed",plansProjectPlans:"{count} plans",plansProjectLoadIssues:"Some projects could not be scanned",plansStatusUnknown:"Unknown",plansBackToPlans:"Back to Plans",plansBackToPlan:"Back to Plan",plansPrevious:"Previous",plansNext:"Next",plansContents:"Contents",plansValidate:"Validate",plansStartNext:"Start Next",plansRestart:"Restart",plansStart:"Start",plansComplete:"Complete",plansReset:"Reset",plansTimeline:"Timeline",plansActivity:"Activity",plansActivitySubtitle:"Last 12 weeks",plansActivityCombined:"Combined",plansActivityCommits:"Commits",plansActivityFiles:"Files",plansActivityEmpty:"No activity data available.",plansHeatmapLoadError:"Failed to load activity heatmap.",plansHeatmapChanges:"{date} • {count} changes",plansRead:"Read",plansPhases:"Phases",plansPhase:"Phase",plansPhaseCountCompact:"PH-{count}",plansKanbanEmpty:"Empty",plansLoadingPlan:"Loading plan...",plansLoadingReader:"Loading document...",plansLoadPlanFailed:"Failed to load plan ({status})",plansLoadPlanFallback:"Failed to load plan",plansLoadFileFailed:"Failed to load document ({status})",plansLoadFileFallback:"Failed to load document",plansProgressComplete:"{count}% complete",plansPhaseCount:"{count} phases",plansPriority:"Priority",plansUpdated:"Updated",plansLastUpdated:"Last Updated",plansPriorityLabel:"Priority {value}",plansUpdatedLabel:"Updated {value}",plansTimelineAvgDays:"{count} avg days",plansNoEffort:"No effort",plansNotFound:"Plan not found",plansQuickInfoTitle:"Plan Overview",plansQuickInfoDescription:"Use this view to track phase progress, timeline coverage, and recent activity for this plan.",plansCurrentStatus:"Current Status",plansHeatmapMon:"Mon",plansHeatmapWed:"Wed",plansHeatmapFri:"Fri",developmentFeature:"Development",betaFeature:"Beta",experimentalFeature:"Experimental",sectionModelTaxonomy:"Model Taxonomy",taxonomyDescription:"Customize model mappings for portable migration to other coding agents.",taxonomyTierHeavy:"Heavy (opus)",taxonomyTierBalanced:"Balanced (sonnet)",taxonomyTierLight:"Light (haiku)",taxonomyModel:"Model",taxonomyEffort:"Effort",taxonomyResetProvider:"Reset",taxonomyTier:"Tier",statuslineBuilder:"Status Line Builder",statuslineBuilderDescription:"Visually design your Claude Code status-line using drag-and-drop",statuslineSections:"Sections",statuslinePreview:"Preview",statuslineTheme:"Color Theme",statuslineSettings:"General Settings",statuslineResetDefaults:"Reset to Defaults",statuslineSave:"Save",statuslineBaseMode:"Base Mode",statuslineBreakpoint:"Responsive Breakpoint",statuslineMaxAgents:"Max Agent Rows",statuslineTodoTruncation:"Todo Truncation",statuslineEnable:"Enable",statuslineDisable:"Disable",statuslineDragHint:"Drag to reorder, toggle to enable/disable sections",statuslinePresetDefault:"Default",statuslinePresetMonochrome:"Monochrome",statuslinePresetSolarized:"Solarized",statuslinePresetNord:"Nord",statuslinePresetDracula:"Dracula",statuslinePresetCatppuccin:"Catppuccin",statuslinePresetGruvbox:"Gruvbox",statuslinePresetTokyoNight:"Tokyo Night",statuslinePresetRosePine:"Rosé Pine",statuslinePresetOneDark:"One Dark",statuslinePresetAyu:"Ayu",statuslinePresetKanagawa:"Kanagawa",statuslinePresetStealth:"Stealth",statuslinePresetHacker:"Hacker",statuslineSaved:"Saved successfully",statuslineSaveError:"Save failed",statusline:"Status Line",statuslineCollapseSettings:"Collapse settings",statuslineExpandSettings:"Expand settings",statuslineIconOverride:"Icon override",statuslineLabelOverride:"Label override",statuslineMaxWidth:"Max width (chars)",statuslineIconPlaceholder:"e.g. 🤖",statuslineMaxWidthPlaceholder:"auto",statuslineCustomColors:"Custom colors",statuslineColorContextGroup:"Context Window",statuslineColorQuotaGroup:"Usage Quota",statuslineColorGeneralGroup:"General",statuslineColorSectionGroup:"Section Colors",statuslineColorContextLow:"Low (<50%)",statuslineColorContextMid:"Mid (50-75%)",statuslineColorContextHigh:"High (>75%)",statuslineColorAccent:"Accent",statuslineColorMuted:"Muted",statuslineColorSeparator:"Separator",statuslineModeFullDesc:"All sections visible",statuslineModeCompactDesc:"Condensed display",statuslineModeMinimalDesc:"Essential info only",statuslineModeNoneDesc:"Disabled",statuslinePreviewTitle:"Claude Code — statusline preview",statuslinePreviewEmptyLine:"(empty line)",statuslinePreviewNoLines:"(no lines configured)",statuslineSectionModelLabel:"Model",statuslineSectionContextLabel:"Context Window",statuslineSectionQuotaLabel:"Usage Quota",statuslineSectionDirectoryLabel:"Directory",statuslineSectionGitLabel:"Git Status",statuslineSectionCostLabel:"Cost",statuslineSectionChangesLabel:"Changes",statuslineSectionAgentsLabel:"Agents",statuslineSectionTodosLabel:"Tasks",statuslineSectionModelDesc:"AI model name and provider",statuslineSectionContextDesc:"Context window usage bar",statuslineSectionQuotaDesc:"5-hour and weekly usage quota",statuslineSectionDirectoryDesc:"Current working directory",statuslineSectionGitDesc:"Git branch, staged/unstaged changes",statuslineSectionCostDesc:"Session cost estimate",statuslineSectionChangesDesc:"Lines added and removed",statuslineSectionAgentsDesc:"Recent agent activity",statuslineSectionTodosDesc:"Current task progress",statuslineSectionsVisible:"sections visible",statuslineLoadErrorSaveDisabled:"Could not load saved layout. Saving is disabled to prevent data loss.",statuslineAddLine:"Add Line",statuslineRemoveLine:"Remove",statuslineHiddenSections:"Hidden Sections",statuslineDragToLine:"Drag sections to a line to show them",statuslineQuotaLow:"Quota Low",statuslineQuotaHigh:"Quota High",statuslineLine:"Line",sessionsTitle:"Sessions",sessionDetail:"Session Detail",sessionMessages:"messages",sessionToolCalls:"tool calls",sessionDuration:"Duration",noSessionsData:"No sessions found",sessionReadOnly:"Read-only view",sessionLastActive:"Last active",sessionProjectSessions:"Project Sessions",sessionBack:"Back",sessionLoading:"Loading...",sessionError:"Failed to load",sessionCount:"sessions",sessionToolInput:"Input",sessionToolResult:"Result",sessionToolsUsed:"Tools Used",sessionSystemContext:"System Context",sessionExpandAll:"Expand all",sessionCollapseAll:"Collapse all",sessionNoContent:"No text content",sessionUser:"User",sessionAssistant:"Assistant",sessionThinking:"Thinking...",sessionSearchPlaceholder:"Search in conversation...",sessionSearchResults:"results",sessionNoResults:"No matches",sessionGroupMessages:"messages",palettePlaceholder:"Search agents, commands, skills...",paletteNoResults:"No results found",paletteAgents:"Agents",paletteCommands:"Commands",paletteSkills:"Skills",paletteProjects:"Projects",paletteNavigation:"Navigation",skillsBrowser:"Skills",skillsCount:"{count} skills",skillDetail:"Skill Detail",searchSkillsBrowserPlaceholder:"Search skills...",noSkillsBrowserFound:"No skills found",backToSkillsBrowser:"Back to Skills",skillTriggers:"Triggers",skillLocal:"Local",skillGithub:"GitHub",systemNavLabel:"System",dashboardTitle:"Dashboard",dashboardAgents:"Agents",dashboardCommands:"Commands",dashboardSkills:"Skills",dashboardMcpServers:"MCP Servers",configured:"Configured",available:"Available",modelDistribution:"Model Distribution",recentAgents:"Recent Agents",suggestionsTitle:"Suggestions",acrossAgents:"across {count} agents",noAgentsConfigured:"No agents configured in ~/.claude/agents/",mcpTitle:"MCP Servers",mcpServerName:"Server",mcpCommand:"Command",mcpArgs:"Arguments",mcpSource:"Source",mcpStatus:"Status",mcpConfigured:"Configured",mcpNoServers:"No MCP servers configured",mcpSourceSettings:"settings.json",mcpSourceMcpJson:".mcp.json",mcpSourceProject:"Project",mcpToolCount:"Tools",agentsBrowser:"Agents",agentsBrowserCount:"{count} agents",filterAll:"All",agentDetail:"Agent Detail",agentInstructions:"Instructions",agentFrontmatter:"Configuration",searchAgentsPlaceholder:"Search agents...",noAgentsFound:"No agents found",backToAgents:"Back to Agents",commandsBrowser:"Commands",commandsCount:"{count} commands",commandDetail:"Command Detail",searchCommandsPlaceholder:"Search commands...",noCommandsFound:"No commands found",backToCommands:"Back to Commands",rootCommands:"Root",selectToView:"Select an item to view details",indexingFrom:"Indexing from",workflowsTitle:"Workflows",workflowsSubtitle:"Learn ClaudeKit through interactive workflow visualization.",workflowsCredit:"Workflows data and visualization layout inspired by",workflowImplementationRecipe:"Implementation Recipe",workflowSearchPlaceholder:"Search workflows...",workflowNoResults:"No workflows found",loadingWorkflows:"Loading workflows...",workflowCategoryAll:"All",workflowCategoryGettingStarted:"Getting Started",workflowCategoryDesignFrontend:"Design & Frontend",workflowCategoryDebuggingFixes:"Debugging & Fixes",workflowCategoryPlanningReview:"Planning & Review",workflowCategoryResearchDocs:"Research & Docs",workflowCategoryShipping:"Shipping",workflowCategoryBackendInfra:"Backend & Infra",workflowCategoryMediaCreative:"Media & Creative",workflowCategoryAdvanced:"Advanced",workflowComplexityBeginner:"Beginner",workflowComplexityIntermediate:"Intermediate",workflowComplexityAdvanced:"Advanced",workflowBuildFeature:"Build a New Feature",workflowBuildFeatureDesc:"Add new functionality to applications systematically.",workflowQuickImplementation:"Quick Implementation",workflowQuickImplementationDesc:"Fast track implementation for small, understood features.",workflowStartNewProject:"Start New Project",workflowStartNewProjectDesc:"Bootstrap a brand new project with right foundations.",workflowFrontendDesign:"Frontend Design",workflowFrontendDesignDesc:"Create beautiful user interfaces guided by design taste bots.",workflowAiDesignStitch:"AI Design Stitch",workflowAiDesignStitchDesc:"Orchestrate Google Stitch for generating designs from prompt.",workflowExcalidraw:"Excalidraw Design",workflowExcalidrawDesc:"Visualize architectures or mockups using Excalidraw JSON.",workflowFixBug:"Fix Bug",workflowFixBugDesc:"Identify root cause and automatically fix codebase issues.",workflowSecurityAudit:"Security Audit",workflowSecurityAuditDesc:"Thorough security check on the repository.",workflowTestScenarios:"Test Scenarios",workflowTestScenariosDesc:"Generate edge cases and test scenarios by decomposing features.",workflowStride:"STRIDE Analysis",workflowStrideDesc:"Perform a STRIDE + OWASP-based security audit threat model.",workflowCodeReview:"Code Review",workflowCodeReviewDesc:"Review code quality with adversarial rigor.",workflowPlanValidate:"Plan + Validate",workflowPlanValidateDesc:"Draft an architectural plan and rigorously validate its technical feasible.",workflowAdversarialReview:"Adversarial Review",workflowAdversarialReviewDesc:"Trigger a harsh red-team review mapping out potential failure modes.",workflowAutoresearch:"Autonomous Loop",workflowAutoresearchDesc:"Run an autonomous iterative optimization loop for any metric.",workflowXia:"Extract/Port Feature",workflowXiaDesc:"Port or extract a feature algorithm from an external codebase.",workflowVisualDocumentation:"Visual Documentation",workflowVisualDocumentationDesc:"Build diagrams outlining current repo logic and architectures.",workflowTechnicalResearch:"Technical Research",workflowTechnicalResearchDesc:"Investigate technological solutions deeply before writing code.",workflowLlmsTxt:"Generate llms.txt",workflowLlmsTxtDesc:"Analyze the codebase and construct a comprehensive llms.txt file.",workflowDevops:"DevOps / Release",workflowDevopsDesc:"Configure Docker, CI/CD and deploy standard web platforms.",workflowShip:"Ship Pipeline",workflowShipDesc:"Merge, test, review, commit, bump semantic version and PR.",workflowDatabaseOps:"Database Operations",workflowDatabaseOpsDesc:"Write complex aggregation pipelines or optimize database performance.",workflowRemotion:"Remotion Video",workflowRemotionDesc:"Build programmatic video sequences internally.",workflowShowOff:"Show Off Demo",workflowShowOffDesc:"Build an interactive self-contained HTML showcase for a repo.",workflowAgentTeams:"Agent Teams",workflowAgentTeamsDesc:"Spawn isolated team members for parallel coordinated labor.",workflowWorktree:"Worktree Parallelism",workflowWorktreeDesc:"Instantly isolate feature iterations in new worktrees."},vi:{loading:"Đang tải...",error:"Lỗi",selectProject:"Chọn dự án để xem bảng điều khiển",controlCenter:"Trung tâm điều khiển",settings:"Cài đặt",sync:"Đồng bộ",offline:"Ngoại tuyến",switchToLight:"Chuyển sang chế độ sáng",switchToDark:"Chuyển sang chế độ tối",settingsSection:"Cài đặt",overviewSection:"Tổng quan",entitiesSection:"Thực thể",toolsSection:"Công cụ",configEditor:"Trình chỉnh sửa cấu hình",projects:"Dự án",addProject:"Thêm dự án",global:"Toàn cục",skills:"Kỹ năng",skillsNav:"Kỹ năng",health:"Sức khỏe",collapse:"Thu gọn",expand:"Mở rộng",installing:"Đang cài đặt...",manage:"Quản lý",uninstall:"Gỡ cài đặt",installGlobally:"Cài đặt toàn cục",installGloballyDesc:"Khả dụng cho tất cả dự án thay vì chỉ dự án hiện tại",selectAtLeastOneAgent:"Vui lòng chọn ít nhất một agent",installationFailed:"Cài đặt thất bại",allSkills:"Tất cả kỹ năng",refresh:"Làm mới",browseAndManageSkills:"Duyệt và quản lý kỹ năng cho agents của bạn",detected:"Đã phát hiện",notDetected:"Chưa phát hiện",sessions:"phiên",noSessions:"Không có phiên",terminal:"Terminal",terminalSub:"Mở bash tại đường dẫn",editor:"Trình soạn thảo",editorSub:"Mở trong VS Code",useGlobalFallback:"Dùng fallback global",openAtPath:"Mở tại đường dẫn dự án",openAppOnly:"Chỉ mở ứng dụng",actionOptionsLoadFailed:"Không thể tải tùy chọn editor/terminal",launch:"Khởi chạy",launchSub:"Bắt đầu Claude Code",config:"Cấu hình",configSub:"Quản lý cài đặt dự án",recentSessions:"Phiên gần đây",viewAllHistory:"Xem tất cả lịch sử",showLess:"Thu gọn",actionFailed:"Thao tác thất bại",loadingSessions:"Đang tải phiên...",noSessionsFound:"Không tìm thấy phiên nào",configuration:"Cài đặt Claude",planSettingsTitle:"Cài đặt Kế hoạch",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",plansDirectory:"Thư mục kế hoạch",validationMode:"Chế độ xác thực",planScopeLabel:"Phạm vi",planScopeProject:"dự án",planScopeGlobal:"toàn cục",activePlansLabel:"Kế hoạch đang hoạt động",activePlansTitle:"Kế hoạch đang hoạt động",noActivePlansFound:"Không có kế hoạch đang hoạt động",openPlan:"Mở kế hoạch",openKanban:"Mở Kanban",blockedByLabel:"Bị chặn bởi",progressLabel:"Tiến độ",editProjectConfig:"Chỉnh sửa cấu hình dự án",projectPreferenceSaveFailed:"Không thể lưu tùy chọ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",desktopModeLabel:"Chế độ Desktop",desktopModeActionsMessage:"Các thao tác nhanh của dự án hiện vẫn dùng CLI hoặc web dashboard trong chế độ desktop.",desktopModePlansMessage:"Các bảng điều khiển kế hoạch hiện vẫn chạy trong web workflow ở chế độ desktop.",desktopModeQuickActionsHint:"Chế độ desktop hiện giữ các thao tác nhanh của dự án trong CLI. Hãy dùng ck config, ck migrate, hoặc terminal/editor của bạn cho các thao tác cần backend.",desktopModeMigrateTitle:"Di trú hiện vẫn dùng CLI",desktopModeMigrateDescription:"Ứng dụng desktop không còn chạy backend Express cho migrate trong Phase 5A. Việc lập kế hoạch và thực thi di trú vẫn thuộc về workflow CLI.",desktopModeMigrateHint:"Chạy ck migrate trong terminal khi cần di trú.",desktopModeOnboardingTitle:"Onboarding desktop sẽ có ở giai đoạn tiếp theo",desktopModeOnboardingDescription:"Luồng onboarding hiện tại cài kit thông qua web backend, và phần đó đã được chủ động loại khỏi chế độ desktop.",desktopModeOnboardingHint:"Dùng ck init hoặc ck config trong terminal hoặc web dashboard để onboarding lúc này.",desktopOnboardingEyebrow:"Lần mở đầu",desktopOnboardingTitle:"Chào mừng đến ClaudeKit Control Center",desktopOnboardingDescription:"Hãy chuẩn bị ứng dụng desktop bằng cách tìm các dự án Claude mà bạn muốn quản lý tại đây.",desktopOnboardingWelcomeBody:"Ứng dụng sẽ quét thư mục home, projects, code và dev để tìm workspace Claude, sau đó cho bạn chọn các dự án cần đăng ký.",desktopOnboardingStart:"Tìm dự án của tôi",desktopOnboardingScanning:"Đang quét các thư mục phát triển phổ biến...",desktopOnboardingScanningHint:"Ứng dụng sẽ kiểm tra home, ~/projects, ~/code và ~/dev để tìm workspace Claude.",desktopOnboardingScanFailed:"Không thể quét dự án Claude",desktopOnboardingScanPartialWarning:"Có {count} vị trí quét không thể đọc được. Ứng dụng đang hiển thị các dự án đã tìm thấy thành công.",desktopOnboardingSelectTitle:"Chọn dự án để thêm",desktopOnboardingSelectDescription:"Hãy chọn các dự án bạn muốn ClaudeKit Control Center đăng ký ngay bây giờ.",desktopOnboardingNoProjects:"Không tìm thấy dự án Claude nào trong các thư mục phát triển phổ biến. Bạn vẫn có thể vào dashboard và thêm thủ công sau.",desktopOnboardingSelectedCount:"Đã chọn {count}",desktopOnboardingContinue:"Tiếp tục",desktopOnboardingSkip:"Bỏ qua lúc này",desktopOnboardingSaving:"Đang lưu...",desktopOnboardingAddFailed:"Không thể thêm các dự án đã chọn",desktopOnboardingDoneTitle:"Mọi thứ đã sẵn sàng",desktopOnboardingDoneDescription:"Tùy chọn onboarding đã được lưu. Từ bây giờ ClaudeKit Control Center sẽ mở thẳng vào dashboard.",desktopOnboardingOpenDashboard:"Mở Dashboard",desktopOnboardingKitDetected:"Đã phát hiện ClaudeKit",desktopOnboardingPartialAddWarning:"{failed} trong số {total} dự án đã chọn không thể được thêm vào. Bạn có thể đăng ký thủ công sau.",desktopModePlansTitle:"Bảng điều khiển kế hoạch hiện vẫn ở web workflow",desktopModePlansDescription:"Phase 5A loại bỏ runtime Express khỏi chế độ desktop. Bảng điều khiển kế hoạch đầy đủ vẫn phụ thuộc vào phân tích và thao tác kế hoạch ở backend, sẽ được xử lý ở các bước sau.",desktopModePlansHint:"Dùng ck config cho bảng điều khiển kế hoạch, hoặc mở kế hoạch trực tiếp từ workflow CLI.",desktopModePlanDetailTitle:"Phân tích kế hoạch chi tiết hiện vẫn ở web dashboard",desktopModePlanDetailDescription:"Timeline, heatmap và các thao tác với kế hoạch vẫn phụ thuộc vào API kế hoạch ở backend. Phase 5A chủ động tắt các bề mặt đó trong desktop mode thay vì để lại các request chết.",desktopModePlanDetailHint:"Dùng ck config cho dashboard kế hoạch chi tiết và các thao tác kế hoạch.",desktopModePlanReaderTitle:"Trình đọc kế hoạch hiện vẫn ở web dashboard",desktopModePlanReaderDescription:"Phase 5A loại bỏ runtime Express, nhưng trình đọc markdown hiện tại vẫn phụ thuộc vào các route tệp kế hoạch ở backend.",desktopModePlanReaderHint:"Dùng ck config khi bạn cần trải nghiệm đọc kế hoạch đầy đủ.",backToDashboard:"Quay lại bảng điều khiển",educationalConfigEditor:"Trình chỉnh sửa cấu hình hướng dẫn",discard:"Hủy bỏ",saveChanges:"Lưu thay đổi",mergedView:"Chế độ gộp",localConfig:"Cục bộ (.ck.json)",globalConfig:"Toàn cục",syntaxValid:"Cú pháp hợp lệ",configurationHelp:"Hướng dẫn cấu hình",field:"Trường",type:"Kiểu",default:"Mặc định",description:"Mô tả",validValues:"Giá trị hợp lệ",systemEffect:"Hiệu ứng hệ thống",exampleUsage:"Ví dụ sử dụng",knowledgeBase:"Cơ sở kiến thức",clickToSeeHelp:"Nhấp vào bất kỳ trường cấu hình nào để xem tài liệu chi tiết và ví dụ sử dụng.",extractedFrom:"Trích xuất từ ClaudeKit v2.x Specification",resetToDefault:"Đặt lại",saving:"Đang lưu...",saved:"Đã lưu",confirmReset:"Đặt lại về mặc định?",confirmResetMessage:"Tất cả thay đổi sẽ bị mất và được thay thế bằng giá trị mặc định.",confirm:"Xác nhận",saveFailed:"Lưu thất bại",configTab:"Cấu hình",systemTab:"Hệ thống",formTab:"Biểu mẫu",jsonTab:"JSON",readOnly:"Chỉ đọc",installedKit:"Kit đã cài",kitVersion:"Phiên bản Kit",installedOn:"Cài đặt vào",noKitInstalled:"Chưa cài kit",components:"Thành phần",agents:"Agents",commands:"Commands",workflows:"Workflows",kitSkills:"Skills",fileOwnership:"Quyền sở hữu tệp",ownershipCk:"do kit quản lý",ownershipUser:"do người dùng",ownershipModified:"đã chỉnh sửa",componentInventory:"Thành phần đã cài",installedHooks:"Hooks đã cài",installedMcpServers:"MCP Servers",lastChecked:"Kiểm tra cập nhật",staleIndicator:"Cũ",skippedVersion:"Đã bỏ qua",filesModifiedFromDefaults:"tệp đã sửa so với mặc định",cliCard:"ClaudeKit CLI",checkForUpdates:"Kiểm tra cập nhật",checking:"Đang kiểm tra...",upToDate:"Đã cập nhật",updateAvailable:"Có bản cập nhật",updateNow:"Cập nhật ngay",updating:"Đang cập nhật...",updateSuccess:"Cập nhật hoàn tất!",updateFailed:"Cập nhật thất bại",closeModal:"Đóng",showDetails:"Xem chi tiết",hideDetails:"Ẩn chi tiết",environment:"Môi trường",claudeConfigPath:"Cấu hình Claude",nodeVersion:"Node",bunVersion:"Bun",osVersion:"Hệ điều hành",envShell:"Shell",envHomeDir:"Thư mục gốc",envCpuCores:"Nhân CPU",envTotalMemory:"Bộ nhớ",cliPackageManager:"Trình quản lý gói",cliInstallLocation:"Vị trí cài đặt",cliGitVersion:"Git",cliGhVersion:"GitHub CLI",channelStable:"Ổn định",channelBeta:"Beta",betaBadge:"Beta",latestVersion:"Mới nhất",selectVersion:"Chọn phiên bản",loadingVersions:"Đang tải...",prereleaseLabel:"Thử nghiệm",currentVersionLabel:"Hiện tại",checkAll:"Kiểm tra tất cả",checkingAll:"Đang kiểm tra...",updateAll:"Cập nhật tất cả",updatesAvailable:"{count} bản cập nhật",allUpToDate:"Tất cả đã cập nhật",systemControlTower:"Trung tâm hệ thống",systemOverviewTitle:"Tổng quan cập nhật & môi trường",systemOverviewDesc:"Theo dõi CLI và kit, rồi nâng cấp từ một nơi.",installedComponentsHeading:"Thành phần đã cài",updateReadiness:"Mức sẵn sàng cập nhật",checkedComponents:"Đã kiểm tra",activeChannel:"Kênh",readyToScan:"Sẵn sàng kiểm tra",noTrackedFiles:"Không phát hiện tệp theo dõi",kitsLabel:"Kit",componentFilterAll:"Tất cả",componentFilterUpdates:"Bản cập nhật",componentFilterUpdatesCount:"Bản cập nhật ({count})",componentFilterUpToDate:"Đã cập nhật",componentFilterUpToDateCount:"Đã cập nhật ({count})",componentFilterCli:"CLI",componentFilterKits:"Kit",noComponentsMatchFilter:"Không có thành phần phù hợp bộ lọc hiện tại.",runCheckAllForFilter:"Hãy chạy Kiểm tra tất cả để nạp dữ liệu cho bộ lọc này.",noUpdatesFound:"Không có bản cập nhật. Các thành phần đã kiểm tra đều mới nhất.",noUpToDateYet:"Chưa có thành phần nào ở trạng thái đã cập nhật.",configWorkspaceHint:"Chỉnh sửa cấu hình hoặc quản lý cập nhật hệ thống trong một màn hình.",settingsJsonHeading:"JSON Cài đặt Claude",settingsJsonMissing:"Không tìm thấy tệp ~/.claude/settings.json.",settingsJsonLoadFailed:"Không thể tải ~/.claude/settings.json.",settingsLoadFailedDetail:"Chi tiết lỗi:",configLoadFailed:"Không thể tải cấu hình.",configLoadFailedDetail:"Chi tiết lỗi:",settingsBackupSaved:"Đã lưu bản sao lưu",hookDiagnosticsTitle:"Chẩn đoán Hook",hookDiagnosticsDesc:"Xem hoạt động hook gần đây và lỗi mà không cần mở tệp JSONL thủ công.",hookDiagnosticsPathPending:"Đang xác định đường dẫn log...",hookDiagnosticsScopeGlobal:"Hook toàn cục",hookDiagnosticsEntries:"Bản ghi",hookDiagnosticsCrashes:"Sự cố",hookDiagnosticsWarnings:"Cảnh báo",hookDiagnosticsBlocks:"Chặn",hookDiagnosticsLastEvent:"Sự kiện cuối",hookDiagnosticsLoading:"Đang tải chẩn đoán hook...",hookDiagnosticsLoadFailed:"Không thể tải chẩn đoán hook",hookDiagnosticsMissing:"Chưa tìm thấy tệp log hook cho phạm vi này.",hookDiagnosticsEmpty:"Tệp log hook có tồn tại nhưng không có bản ghi đọc được.",hookDiagnosticsParseErrorsNotice:"Đã bỏ qua {count} dòng log bị lỗi khi tải chẩn đoán.",hookDiagnosticsTruncatedNotice:"Đang hiển thị cửa sổ bản ghi gần đây để giữ giao diện phản hồi tốt với log lớn.",hookDiagnosticsToolLabel:"công cụ",hookDiagnosticsTargetLabel:"mục tiêu",hookDiagnosticsUnknown:"Không rõ",hookDiagnostics:"Chẩn đoán Hook",hookEvent:"Sự kiện",hookExecutions:"Lần chạy",hookAvgLatency:"Trung bình",hookFailureRate:"Tỉ lệ lỗi",hookLastRun:"Lần cuối",hookLatencyWarning:"Độ trễ > 500ms",activityMetrics:"Hoạt động",activityTotalSessions:"Tổng phiên",activityMostActive:"Dự án hoạt động nhiều nhất",activityPeriod24h:"24h",activityPeriod7d:"7 ngày",activityPeriod30d:"30 ngày",activityNoData:"Không có dữ liệu",addProjectTitle:"Thêm dự án",addProjectDescription:"Thêm dự án ClaudeKit mới vào trung tâm điều khiển",projectPath:"Đường dẫn dự án",pathPlaceholder:"/đường/dẫn/dự/án",alias:"Bí danh",aliasOptional:"(tùy chọn)",aliasPlaceholder:"dự-án-của-tôi",aliasDescription:"Tên hiển thị tùy chỉnh cho dự án",pathRequired:"Đường dẫn bắt buộc",failedToAdd:"Không thể thêm dự án",cancel:"Hủy",adding:"Đang thêm...",somethingWentWrong:"Đã xảy ra lỗi",reloadApp:"Tải lại ứng dụng",serverNotRunning:"Máy chủ không chạy",startServerMessage:"Config UI yêu cầu máy chủ backend đang chạy.",runThisCommand:"Chạy lệnh này",tryAgain:"Thử lại",projectConfig:"Cấu hình dự án",inheritedFromGlobal:"Kế thừa từ toàn cục",localOverride:"Ghi đè cục bộ",viewGlobalConfig:"Trường này kế thừa từ cấu hình toàn cục. Xem",onboardingTitle:"Chào mừng đến ClaudeKit",onboardingSubtitle:"Chọn kit của bạn và bắt đầu trong vài phút",kitEngineerName:"ClaudeKit Engineer",kitEngineerTagline:"Lập trình AI với skills, hooks và multi-agent",kitMarketingName:"ClaudeKit Marketing",kitMarketingTagline:"Tự động hóa nội dung: chiến dịch, mạng xã hội, phân tích",featureAgents:"AI Agents",featureAgentsDesc:"Các agent chuyên biệt cho từng tác vụ",featureHooks:"Lifecycle Hooks",featureHooksDesc:"Tùy chỉnh hành vi của Claude tại các thời điểm quan trọng",featureSkills:"Thư viện Skills",featureSkillsDesc:"Các khả năng có sẵn bạn có thể kích hoạt",featureMultiAgent:"Multi-Agent Workflows",featureMultiAgentDesc:"Phối hợp nhiều agent cho các tác vụ phức tạp",featureContent:"Tạo nội dung",featureContentDesc:"Tự động tạo và tối ưu nội dung",featureSocial:"Công cụ mạng xã hội",featureSocialDesc:"Lên lịch, phân tích và tự động tương tác",stepChooseKit:"Chọn Kit",stepConfigure:"Cấu hình",stepInstall:"Cài đặt",back:"Quay lại",next:"Tiếp theo",install:"Cài đặt",installSuccess:"Cài đặt hoàn tất!",installSuccessDesc:"{kit} đã sẵn sàng sử dụng",getStarted:"Bắt đầu",goToDashboard:"Đi đến Dashboard",kitConfig:"Cấu hình Kit",kitConfigSubtitle:"Cấu hình ClaudeKit Engineer",scopeGlobal:"Toàn cục",scopeProject:"Dự án",sectionGeneral:"Cài đặt chung",sectionPaths:"Đường dẫn",sectionPrivacy:"Bảo mật & Tin cậy",sectionProject:"Phát hiện dự án",sectionIntegrations:"Tích hợp",sectionHooks:"Hooks",sectionAdvanced:"Nâng cao",fieldCodingLevel:"Cấp độ lập trình",fieldCodingLevelDesc:"Cấp độ kinh nghiệm (-1=tự động, 0=mới bắt đầu, 1=trung cấp, 2=nâng cao, 3=chuyên gia, 4=tech-lead, 5=thần)",fieldStatusline:"Chế độ thanh trạng thái",fieldStatuslineDesc:"Lượng thông tin hiển thị trên thanh trạng thái",fieldStatuslineColors:"Màu thanh trạng thái",fieldStatuslineColorsDesc:"Bật màu ANSI trong thanh trạng thái",fieldStatuslineQuota:"Hiển thị Quota Statusline",fieldStatuslineQuotaDesc:"Hiển thị các nhãn quota 5h / wk trong statusline",fieldThinkingLanguage:"Ngôn ngữ suy nghĩ",fieldThinkingLanguageDesc:"Ngôn ngữ cho suy luận nội bộ của Claude (null=Tiếng Anh)",fieldResponseLanguage:"Ngôn ngữ phản hồi",fieldResponseLanguageDesc:"Ngôn ngữ cho phản hồi của Claude (null=theo người dùng)",fieldDocsPath:"Thư mục tài liệu",fieldDocsPathDesc:"Đường dẫn đến thư mục tài liệu",fieldPlansPath:"Thư mục kế hoạch",fieldPlansPathDesc:"Đường dẫn đến thư mục kế hoạch",fieldGlobalPlansPath:"Thư mục kế hoạch toàn cục",fieldGlobalPlansPathDesc:"Đường dẫn đến thư mục kế hoạch toàn cục",fieldPrivacyBlock:"Chặn quyền riêng tư",fieldPrivacyBlockDesc:"Chặn truy cập file nhạy cảm (.env, credentials)",fieldTrustEnabled:"Chế độ tin cậy",fieldTrustEnabledDesc:"Tự động phê duyệt các tool calls",fieldTrustPassphrase:"Mật khẩu tin cậy",fieldTrustPassphraseDesc:"Mật khẩu để bật chế độ tin cậy",fieldProjectType:"Loại dự án",fieldProjectTypeDesc:"Ghi đè loại dự án tự động phát hiện",fieldPackageManager:"Trình quản lý gói",fieldPackageManagerDesc:"Ghi đè trình quản lý gói tự động phát hiện",fieldFramework:"Framework",fieldFrameworkDesc:"Ghi đè framework tự động phát hiện",fieldGeminiModel:"Mô hình Gemini",fieldGeminiModelDesc:"Mô hình Gemini cho các lệnh CLI; id gemini-3.0-* cũ sẽ tự động ánh xạ",geminiModel25Flash:"Gemini 2.5 Flash — Mọi tài khoản",geminiModel25Pro:"Gemini 2.5 Pro — Có thể bị giới hạn dung lượng",geminiModel3FlashPreview:"Gemini 3 Flash Preview — Chỉ Pro/Ultra",geminiModel3ProPreview:"Gemini 3 Pro Preview — Chỉ Pro/Ultra",fieldResearchUseGemini:"Dùng Gemini cho nghiên cứu",fieldResearchUseGeminiDesc:"Dùng Gemini CLI thay vì WebSearch",fieldDocsMaxLoc:"Số dòng tối đa/tài liệu",fieldDocsMaxLocDesc:"Số dòng code tối đa cho mỗi file tài liệu",fieldPlanNamingFormat:"Định dạng tên kế hoạch",fieldPlanNamingFormatDesc:"Định dạng cho tên thư mục kế hoạch",fieldPlanDateFormat:"Định dạng ngày kế hoạch",fieldPlanDateFormatDesc:"Định dạng ngày cho tên kế hoạch (moment.js)",fieldPlanValidationMode:"Chế độ xác thực",fieldPlanValidationModeDesc:"Cách xác thực kế hoạch trước khi triển khai",fieldPlanMinQuestions:"Số câu hỏi tối thiểu",fieldPlanMinQuestionsDesc:"Số câu hỏi xác thực tối thiểu",fieldPlanMaxQuestions:"Số câu hỏi tối đa",fieldPlanMaxQuestionsDesc:"Số câu hỏi xác thực tối đa",fieldAssertions:"Assertions",fieldAssertionsDesc:"Các assertions và quy tắc cần thực thi",fieldHookSessionInit:"Khởi tạo phiên",fieldHookSessionInitDesc:"Phát hiện dự án và thiết lập môi trường",fieldHookSubagentInit:"Khởi tạo subagent",fieldHookSubagentInitDesc:"Inject context vào subagents",fieldHookDescriptiveName:"Tên mô tả",fieldHookDescriptiveNameDesc:"Bắt buộc đặt tên file dạng kebab-case mô tả cho scripts",fieldHookDevRulesReminder:"Nhắc nhở quy tắc dev",fieldHookDevRulesReminderDesc:"Inject context quy tắc phát triển",fieldHookUsageContextAwareness:"Nhận thức sử dụng cho prompt",fieldHookUsageContextAwarenessDesc:"Inject nhận thức giới hạn sử dụng vào prompt",fieldHookContextTracking:"Theo dõi ngữ cảnh",fieldHookContextTrackingDesc:"Theo dõi cửa sổ ngữ cảnh (% đã dùng, số token)",fieldHookScoutBlock:"Chặn Scout",fieldHookScoutBlockDesc:"Chặn thư mục nặng khỏi việc khám phá",fieldHookPrivacyBlock:"Hook chặn quyền riêng tư",fieldHookPrivacyBlockDesc:"Chặn đọc file nhạy cảm",fieldHookSimplifyGate:"Cổng đơn giản hóa",fieldHookSimplifyGateDesc:"Hook UserPromptSubmit — opt-in. Khi bật (simplify.gate.enabled=true), chặn cứng ship/merge/pr/deploy/publish và cảnh báo nhẹ commit/finalize/release khi diff vượt ngưỡng.",sectionSimplify:"Cổng đơn giản hóa",fieldSimplifyThresholdLocDelta:"Ngưỡng tổng LOC",fieldSimplifyThresholdLocDeltaDesc:"Tổng LOC thay đổi (toàn bộ file) vượt ngưỡng này thì cổng kích hoạt.",fieldSimplifyThresholdFileCount:"Ngưỡng số file",fieldSimplifyThresholdFileCountDesc:"Số file thay đổi vượt ngưỡng này thì cổng kích hoạt.",fieldSimplifyThresholdSingleFileLoc:"Ngưỡng LOC mỗi file",fieldSimplifyThresholdSingleFileLocDesc:"LOC thay đổi trong một file vượt ngưỡng này thì cổng kích hoạt.",fieldSimplifyGateEnabled:"Bật",fieldSimplifyGateEnabledDesc:"Công tắc chính. Tắt mặc định (opt-in). Bật để kích hoạt cổng; env CK_SIMPLIFY_DISABLED=1 luôn bỏ qua.",fieldSimplifyGateHardVerbs:"Động từ chặn cứng",fieldSimplifyGateHardVerbsDesc:"Động từ chặn cứng khi vượt ngưỡng.",fieldSimplifyGateSoftVerbs:"Động từ cảnh báo nhẹ",fieldSimplifyGateSoftVerbsDesc:"Động từ phát cảnh báo không chặn.",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",migrateReason_newItem:"Mục mới từ provider",migrateReason_newProviderForItem:"Provider mới cho mục này",migrateReason_targetDeletedSourceChanged:"Đích đã xóa nhưng nguồn có thay đổi mới",migrateReason_targetDirEmptyReinstall:"Thư mục đích trống — cài lại",migrateReason_forceReinstall:"Yêu cầu cài lại bắt buộc",migrateReason_forceOverwrite:"Ghi đè bắt buộc (bạn đã chỉnh sửa, --force đang bật)",migrateReason_registryUpgradeReinstall:"Nâng cấp registry yêu cầu cài lại",migrateReason_sourceChanged:"Nguồn đã được cập nhật",migrateReason_registryUpgradeHeal:"Sửa đích cũ sau nâng cấp registry",migrateReason_noChanges:"Không phát hiện thay đổi",migrateReason_userEditsPreserved:"Giữ nguyên chỉnh sửa của người dùng",migrateReason_userDeletedRespected:"Tôn trọng việc xóa của người dùng",migrateReason_targetUpToDateBackfill:"Đích đã cập nhật",migrateReason_providerChecksumUnavailable:"Không có checksum provider",migrateReason_targetStateUnknown:"Không xác định được trạng thái đích",migrateReason_sourceRemovedOrphan:"Nguồn đã xóa — dọn dẹp orphan",migrateReason_renamedCleanup:"Mục đã đổi tên — xóa đường dẫn cũ",migrateReason_pathMigratedCleanup:"Đường dẫn đã di chuyển — xóa vị trí cũ",migrateReason_bothChanged:"Cả nguồn và đích đều có thay đổi",migrateReason_targetStateUnknownSourceChanged:"Nguồn thay đổi nhưng trạng thái đích không rõ",migrateBanner_emptyDir_title:"Phát hiện thư mục trống",migrateBanner_emptyDir_body:"mục bên dưới sẽ được cài lại. Bỏ chọn để bỏ qua.",migrateBanner_emptyDirRespected_title:"Tôn trọng việc xóa của bạn",migrateBanner_emptyDirRespected_body:"đang trống. Tôn trọng việc xóa của bạn.",migrateBanner_reinstallCta:"Cài lại các mục này",migrateModeLabel:"Chế độ di chuyển",migrateModeReconcile:"Đồng bộ",migrateModeReconcileDesc:"Phát hiện thay đổi thông minh",migrateModeInstall:"Cài đặt",migrateModeInstallDesc:"Chọn mục để cài",migrateModeConfirmTitle:"Chuyển chế độ?",migrateModeConfirmBody:"Bạn có {count} thay đổi chờ xử lý. Chuyển sang chế độ {mode} sẽ hủy chúng.",migrateModeConfirmSwitch:"Chuyển & hủy",migrateSmartDefaultInstall:"Phát hiện cài đặt mới — mặc định chế độ Cài đặt",migrateSmartDefaultReconcile:"Đã có registry — mặc định chế độ Đồng bộ",migrateInstallSelectAll:"Chọn tất cả",migrateInstallDeselectAll:"Bỏ chọn tất cả",migrateInstallDirItem:"thư mục",migrateInstallAlreadyInstalled:"đã cài",migrateInstallNoCandidates:"Không tìm thấy mục cài đặt nào cho provider đã chọn.",migrateInstallSelectedCount:"Đã chọn {count} / {total} mục",migrateInstallCta:"Cài {count} mục đã chọn",migrateInstallInstalling:"Đang cài...",migrateInstallLoadingCandidates:"Đang tải danh sách mục...",migrateFlip_moveToSkip:"Chuyển sang Bỏ qua",migrateFlip_moveToInstall:"Chuyển sang Cài",migrateFlip_checkAll:"Chọn tất cả",migrateFlip_uncheckAll:"Bỏ chọn tất cả",migrateFlip_toggleItem:"Bật/tắt mục",migrateConflictBanner_title:"Phát hiện xung đột",migrateConflictBanner_cta:"Mở trình giải quyết xung đột",migrateConflictBanner_hide:"Ẩn trình giải quyết xung đột",migrateShowSkippedItems:"Hiện mục đã bỏ qua",migrateHideSkippedItems:"Ẩn mục đã bỏ qua",migrateConflictBadge:"Xung đột",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",plansNav:"Kế hoạch",plansTitle:"Bảng điều khiển kế hoạch",plansGlobalTitle:"Tất cả dự án",plansSubtitle:"Xem mọi kế hoạch đang hoạt động, timeline giai đoạn và thao tác nhanh trong một nơi.",plansEmpty:"Không tìm thấy kế hoạch",plansSearch:"Tìm kế hoạch...",plansProjectFilter:"Lọc theo dự án",plansAllProjects:"Tất cả dự án",plansSortBy:"Sắp xếp theo",plansViewGrid:"Lưới",plansViewKanban:"Kanban",plansFilterAll:"Tất cả trạng thái",plansSortDateDesc:"Mới nhất",plansSortDateAsc:"Cũ nhất",plansSortNameAsc:"Tên A-Z",plansSortNameDesc:"Tên Z-A",plansSortProgress:"Tiến độ cao nhất",plansLabel:"Kế hoạch",plansStatusPending:"Chờ xử lý",plansStatusInProgress:"Đang thực hiện",plansStatusInReview:"Đang rà soát",plansStatusDone:"Hoàn tất",plansStatusCancelled:"Đã huỷ",plansCompletedCount:"{count} hoàn thành",plansProjectPlans:"{count} kế hoạch",plansProjectLoadIssues:"Một số dự án không thể quét",plansStatusUnknown:"Chưa rõ",plansBackToPlans:"Quay lại danh sách kế hoạch",plansBackToPlan:"Quay lại kế hoạch",plansPrevious:"Trước",plansNext:"Sau",plansContents:"Mục lục",plansValidate:"Kiểm tra",plansStartNext:"Bắt đầu tiếp theo",plansRestart:"Bắt đầu lại",plansStart:"Bắt đầu",plansComplete:"Hoàn thành",plansReset:"Đặt lại",plansTimeline:"Timeline",plansActivity:"Hoạt động",plansActivitySubtitle:"12 tuần gần đây",plansActivityCombined:"Tổng hợp",plansActivityCommits:"Commit",plansActivityFiles:"Tệp",plansActivityEmpty:"Chưa có dữ liệu hoạt động.",plansHeatmapLoadError:"Không thể tải heatmap hoạt động.",plansHeatmapChanges:"{date} • {count} thay đổi",plansRead:"Đọc",plansPhases:"Giai đoạn",plansPhase:"Giai đoạn",plansPhaseCountCompact:"GD-{count}",plansKanbanEmpty:"Trống",plansLoadingPlan:"Đang tải kế hoạch...",plansLoadingReader:"Đang tải tài liệu...",plansLoadPlanFailed:"Không thể tải kế hoạch ({status})",plansLoadPlanFallback:"Không thể tải kế hoạch",plansLoadFileFailed:"Không thể tải tài liệu ({status})",plansLoadFileFallback:"Không thể tải tài liệu",plansProgressComplete:"Hoàn thành {count}%",plansPhaseCount:"{count} giai đoạn",plansPriority:"Ưu tiên",plansUpdated:"Cập nhật",plansLastUpdated:"Cập nhật lần cuối",plansPriorityLabel:"Ưu tiên {value}",plansUpdatedLabel:"Cập nhật {value}",plansTimelineAvgDays:"Trung bình {count} ngày",plansNoEffort:"Chưa có effort",plansNotFound:"Không tìm thấy kế hoạch",plansQuickInfoTitle:"Tổng quan kế hoạch",plansQuickInfoDescription:"Dùng chế độ xem này để theo dõi tiến độ giai đoạn, phạm vi timeline và hoạt động gần đây của kế hoạch.",plansCurrentStatus:"Trạng thái hiện tại",plansHeatmapMon:"T Hai",plansHeatmapWed:"T Tư",plansHeatmapFri:"T Sáu",developmentFeature:"Đang phát triển",betaFeature:"Beta",experimentalFeature:"Thử nghiệm",sectionModelTaxonomy:"Phân loại mô hình",taxonomyDescription:"Tuỳ chỉnh ánh xạ mô hình cho migration portable sang coding agent khác.",taxonomyTierHeavy:"Nặng (opus)",taxonomyTierBalanced:"Cân bằng (sonnet)",taxonomyTierLight:"Nhẹ (haiku)",taxonomyModel:"Mô hình",taxonomyEffort:"Mức nỗ lực",taxonomyResetProvider:"Đặt lại",taxonomyTier:"Cấp độ",statuslineBuilder:"Trình tạo dòng trạng thái",statuslineBuilderDescription:"Thiết kế bố cục dòng trạng thái bằng kéo và thả",statuslineSections:"Các mục",statuslinePreview:"Xem trước",statuslineTheme:"Giao diện màu sắc",statuslineSettings:"Cài đặt chung",statuslineResetDefaults:"Đặt lại mặc định",statuslineSave:"Lưu",statuslineBaseMode:"Chế độ cơ bản",statuslineBreakpoint:"Điểm ngắt responsive",statuslineMaxAgents:"Số agent tối đa",statuslineTodoTruncation:"Cắt ngắn task",statuslineEnable:"Bật",statuslineDisable:"Tắt",statuslineDragHint:"Kéo để thay đổi thứ tự, bật/tắt từng mục",statuslinePresetDefault:"Mặc định",statuslinePresetMonochrome:"Đơn sắc",statuslinePresetSolarized:"Solarized",statuslinePresetNord:"Nord",statuslinePresetDracula:"Dracula",statuslinePresetCatppuccin:"Catppuccin",statuslinePresetGruvbox:"Gruvbox",statuslinePresetTokyoNight:"Tokyo Night",statuslinePresetRosePine:"Rosé Pine",statuslinePresetOneDark:"One Dark",statuslinePresetAyu:"Ayu",statuslinePresetKanagawa:"Kanagawa",statuslinePresetStealth:"Ẩn mình",statuslinePresetHacker:"Hacker",statuslineSaved:"Đã lưu thành công",statuslineSaveError:"Lưu thất bại",statusline:"Dòng trạng thái",statuslineCollapseSettings:"Thu gọn cài đặt",statuslineExpandSettings:"Mở rộng cài đặt",statuslineIconOverride:"Ghi đè biểu tượng",statuslineLabelOverride:"Ghi đè nhãn",statuslineMaxWidth:"Chiều rộng tối đa (ký tự)",statuslineIconPlaceholder:"vd. 🤖",statuslineMaxWidthPlaceholder:"tự động",statuslineCustomColors:"Màu tùy chỉnh",statuslineColorContextGroup:"Cửa sổ ngữ cảnh",statuslineColorQuotaGroup:"Hạn mức sử dụng",statuslineColorGeneralGroup:"Chung",statuslineColorSectionGroup:"Màu từng mục",statuslineColorContextLow:"Thấp (<50%)",statuslineColorContextMid:"Trung (50-75%)",statuslineColorContextHigh:"Cao (>75%)",statuslineColorAccent:"Nhấn mạnh",statuslineColorMuted:"Giảm nhạt",statuslineColorSeparator:"Dấu phân cách",statuslineModeFullDesc:"Hiển thị tất cả các mục",statuslineModeCompactDesc:"Hiển thị thu gọn",statuslineModeMinimalDesc:"Chỉ thông tin cần thiết",statuslineModeNoneDesc:"Đã tắt",statuslinePreviewTitle:"Claude Code — xem trước dòng trạng thái",statuslinePreviewEmptyLine:"(dòng trống)",statuslinePreviewNoLines:"(chưa cấu hình dòng nào)",statuslineSectionModelLabel:"Mô hình",statuslineSectionContextLabel:"Cửa sổ ngữ cảnh",statuslineSectionQuotaLabel:"Hạn mức sử dụng",statuslineSectionDirectoryLabel:"Thư mục",statuslineSectionGitLabel:"Trạng thái Git",statuslineSectionCostLabel:"Chi phí",statuslineSectionChangesLabel:"Thay đổi",statuslineSectionAgentsLabel:"Agents",statuslineSectionTodosLabel:"Nhiệm vụ",statuslineSectionModelDesc:"Tên mô hình AI và nhà cung cấp",statuslineSectionContextDesc:"Thanh sử dụng cửa sổ ngữ cảnh",statuslineSectionQuotaDesc:"Hạn mức sử dụng 5 giờ và hàng tuần",statuslineSectionDirectoryDesc:"Thư mục làm việc hiện tại",statuslineSectionGitDesc:"Nhánh Git, thay đổi đã/chưa staged",statuslineSectionCostDesc:"Ước tính chi phí phiên",statuslineSectionChangesDesc:"Dòng thêm và xóa",statuslineSectionAgentsDesc:"Hoạt động agent gần đây",statuslineSectionTodosDesc:"Tiến độ tác vụ hiện tại",statuslineSectionsVisible:"mục hiển thị",statuslineLoadErrorSaveDisabled:"Không thể tải bố cục đã lưu. Tính năng lưu đã bị tắt để tránh mất dữ liệu.",statuslineAddLine:"Thêm dòng",statuslineRemoveLine:"Xóa",statuslineHiddenSections:"Mục ẩn",statuslineDragToLine:"Kéo mục vào dòng để hiển thị",statuslineQuotaLow:"Hạn mức thấp",statuslineQuotaHigh:"Hạn mức cao",statuslineLine:"Dòng",sessionsTitle:"Phiên làm việc",sessionDetail:"Chi tiết phiên",sessionMessages:"tin nhắn",sessionToolCalls:"lệnh gọi",sessionDuration:"Thời lượng",noSessionsData:"Không tìm thấy phiên",sessionReadOnly:"Chế độ chỉ xem",sessionLastActive:"Hoạt động lần cuối",sessionProjectSessions:"Phiên dự án",sessionBack:"Quay lại",sessionLoading:"Đang tải...",sessionError:"Tải thất bại",sessionCount:"phiên",sessionToolInput:"Đầu vào",sessionToolResult:"Kết quả",sessionToolsUsed:"Công cụ đã dùng",sessionSystemContext:"Ngữ cảnh hệ thống",sessionExpandAll:"Mở rộng tất cả",sessionCollapseAll:"Thu gọn tất cả",sessionNoContent:"Không có nội dung",sessionUser:"Người dùng",sessionAssistant:"Trợ lý",sessionThinking:"Đang suy nghĩ...",sessionSearchPlaceholder:"Tìm trong hội thoại...",sessionSearchResults:"kết quả",sessionNoResults:"Không tìm thấy",sessionGroupMessages:"tin nhắn",palettePlaceholder:"Tìm agents, lệnh, skills...",paletteNoResults:"Không tìm thấy kết quả",paletteAgents:"Agents",paletteCommands:"Lệnh",paletteSkills:"Skills",paletteProjects:"Dự án",paletteNavigation:"Điều hướng",skillsBrowser:"Skills",skillsCount:"{count} skills",skillDetail:"Chi tiết Skill",searchSkillsBrowserPlaceholder:"Tìm skills...",noSkillsBrowserFound:"Không tìm thấy skill",backToSkillsBrowser:"Quay lại Skills",skillTriggers:"Kích hoạt",skillLocal:"Cục bộ",skillGithub:"GitHub",systemNavLabel:"Hệ thống",dashboardTitle:"Bảng điều khiển",dashboardAgents:"Agents",dashboardCommands:"Lệnh",dashboardSkills:"Skills",dashboardMcpServers:"MCP Servers",configured:"Đã cấu hình",available:"Có sẵn",modelDistribution:"Phân bổ Model",recentAgents:"Agents gần đây",suggestionsTitle:"Gợi ý",acrossAgents:"trên {count} agents",noAgentsConfigured:"Chưa có agents trong ~/.claude/agents/",mcpTitle:"MCP Servers",mcpServerName:"Server",mcpCommand:"Lệnh",mcpArgs:"Tham số",mcpSource:"Nguồn",mcpStatus:"Trạng thái",mcpConfigured:"Đã cấu hình",mcpNoServers:"Chưa cấu hình MCP server",mcpSourceSettings:"settings.json",mcpSourceMcpJson:".mcp.json",mcpSourceProject:"Dự án",mcpToolCount:"Công cụ",agentsBrowser:"Agents",agentsBrowserCount:"{count} agents",filterAll:"Tất cả",agentDetail:"Chi tiết Agent",agentInstructions:"Hướng dẫn",agentFrontmatter:"Cấu hình",searchAgentsPlaceholder:"Tìm agents...",noAgentsFound:"Không tìm thấy agent",backToAgents:"Quay lại Agents",commandsBrowser:"Lệnh",commandsCount:"{count} lệnh",commandDetail:"Chi tiết lệnh",searchCommandsPlaceholder:"Tìm lệnh...",noCommandsFound:"Không tìm thấy lệnh",backToCommands:"Quay lại Lệnh",rootCommands:"Gốc",selectToView:"Chọn mục để xem chi tiết",indexingFrom:"Lấy từ",workflowsTitle:"Quy trình",workflowsSubtitle:"Tìm hiểu ClaudeKit thông qua hình ảnh hóa quy trình tương tác.",workflowsCredit:"Dữ liệu quy trình và giao diện được lấy cảm hứng từ",workflowImplementationRecipe:"Công thức triển khai",workflowSearchPlaceholder:"Tìm quy trình...",workflowNoResults:"Không tìm thấy quy trình",loadingWorkflows:"Đang tải quy trình...",workflowCategoryAll:"Tất cả",workflowCategoryGettingStarted:"Bắt đầu",workflowCategoryDesignFrontend:"Thiết kế & Frontend",workflowCategoryDebuggingFixes:"Xóa lỗi & Kiểm thử",workflowCategoryPlanningReview:"Lập kế hoạch & Đánh giá",workflowCategoryResearchDocs:"Nghiên cứu & Tài liệu",workflowCategoryShipping:"Triển khai",workflowCategoryBackendInfra:"Backend & Hạ tầng",workflowCategoryMediaCreative:"Truyền thông & Sáng tạo",workflowCategoryAdvanced:"Nâng cao",workflowComplexityBeginner:"Cơ bản",workflowComplexityIntermediate:"Trung bình",workflowComplexityAdvanced:"Nâng cao",workflowBuildFeature:"Xây dựng tính năng mới",workflowBuildFeatureDesc:"Thêm chức năng mới vào ứng dụng một cách hệ thống.",workflowQuickImplementation:"Triển khai nhanh",workflowQuickImplementationDesc:"Triển khai nhanh chóng các tính năng nhỏ gọn.",workflowStartNewProject:"Bắt đầu dự án mới",workflowStartNewProjectDesc:"Tạo lập một dự án mới hoàn toàn với nền tảng tiêu chuẩn.",workflowFrontendDesign:"Thiết kế Frontend",workflowFrontendDesignDesc:"Tạo giao diện người dùng dựa trên nguyên tắc thẩm mỹ cao.",workflowAiDesignStitch:"Thiết kế bằng AI Stitch",workflowAiDesignStitchDesc:"Điều khiển Google Stitch để tạo bản thiết kế từ văn bản.",workflowExcalidraw:"Bản vẽ Excalidraw",workflowExcalidrawDesc:"Diễn họa kiến trúc hoạt động sử dụng Excalidraw JSON.",workflowFixBug:"Sửa lỗi (Fix Bug)",workflowFixBugDesc:"Xác định nguyên nhân gốc rễ và tự động sửa các lỗi trong mã nguồn.",workflowSecurityAudit:"Kiểm toán Bảo mật",workflowSecurityAuditDesc:"Kiểm tra bảo mật toàn diện trên kho ứng dụng.",workflowTestScenarios:"Tình huống thử nghiệm",workflowTestScenariosDesc:"Tạo các trường hợp biên và tình huống thử nghiệm tính năng con.",workflowStride:"Phân tích STRIDE",workflowStrideDesc:"Thực hiện mô hình hóa và phân tích rủi ro bảo mật theo chuẩn STRIDE.",workflowCodeReview:"Code Review",workflowCodeReviewDesc:"Đánh giá chất lượng mã nguồn một cách kỹ lưỡng.",workflowPlanValidate:"Lập Kế hoạch + Kiểm chứng",workflowPlanValidateDesc:"Lập bản thảo thiết kế kiến trúc và đánh giá tính khả thi kỹ thuật.",workflowAdversarialReview:"Đánh giá Đối kháng",workflowAdversarialReviewDesc:"Kích hoạt chức năng đánh giá mức độ rủi ro hệ thống.",workflowAutoresearch:"Vòng lặp tự động (Autoloop)",workflowAutoresearchDesc:"Chạy vòng lặp tối ưu hóa tự động cho bất kỳ chỉ số nào.",workflowXia:"Chuyển giao thuật toán",workflowXiaDesc:"Chuyển giao hoặc tách rời thuật toán từ một kho lưu trữ bên ngoài.",workflowVisualDocumentation:"Diễn họa Tài liệu",workflowVisualDocumentationDesc:"Tạo sơ đồ mô tả logic và kiến trúc trong hệ thống hiện tại.",workflowTechnicalResearch:"Nghiên cứu Kỹ thuật",workflowTechnicalResearchDesc:"Phân tích sâu rộng cho các giải pháp kiến trúc trước khi triển khai.",workflowLlmsTxt:"Tạo cấu trúc llms.txt",workflowLlmsTxtDesc:"Phân tích mã nguồn và sinh tập tin llms.txt tiêu chuẩn.",workflowDevops:"DevOps / Triển khai",workflowDevopsDesc:"Cấu hình Docker, CI/CD và triển khai quy trình nền tảng web.",workflowShip:"Cập bến (Ship Pipeline)",workflowShipDesc:"Hợp nhất, kiểm thử, đánh giá, commit, và tạo Pull Request mới.",workflowDatabaseOps:"Thao tác CSDL",workflowDatabaseOpsDesc:"Tái cấu trúc các pipeline dữ liệu phức tạp tăng cường hiệu năng CSDL.",workflowRemotion:"Remotion Video",workflowRemotionDesc:"Xây dựng chuỗi video code thông qua thư viện Remotion.",workflowShowOff:"Show-Off Demo",workflowShowOffDesc:"Tạo file demo HTML tĩnh và trực quan cho mục đích showcase ứng dụng.",workflowAgentTeams:"Đội ngũ Agents",workflowAgentTeamsDesc:"Sinh các agent song song thực hiện nhiều tác vụ kết nối với nhau.",workflowWorktree:"Worktree Song song",workflowWorktreeDesc:"Cách ly và làm việc đồng thời trên nhiều luồng phát triển bằng worktrees."}},Im=g.createContext(null),kw="ck-dashboard-lang";function WN(){const t=localStorage.getItem(kw);return t==="en"||t==="vi"?t:navigator.language.startsWith("vi")?"vi":"en"}function UN({children:t}){const[e,n]=g.useState(WN),r=g.useCallback(o=>{localStorage.setItem(kw,o),n(o)},[]),s=g.useCallback(o=>HN[e][o],[e]),i=g.useMemo(()=>({lang:e,setLang:r,t:s}),[e,r,s]);return c.jsx(Im.Provider,{value:i,children:t})}function ee(){const t=g.useContext(Im);if(!t)throw new Error("useI18n must be used within I18nProvider");return t}class KN extends g.Component{constructor(){super(...arguments);g0(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){console.error("App error:",n,r.componentStack)}render(){if(this.state.hasError){const n=this.state.error?.name==="ServerUnavailableError";return c.jsx(Im.Consumer,{children:r=>c.jsx("div",{className:"flex h-screen items-center justify-center bg-dash-bg",children:c.jsx("div",{className:"text-center space-y-4 max-w-md px-6",children:n?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"w-16 h-16 mx-auto rounded-full bg-orange-500/10 border border-orange-500/30 flex items-center justify-center text-3xl",children:"🔌"}),c.jsx("h1",{className:"text-2xl font-bold text-orange-500",children:r?.t("serverNotRunning")??"Server Not Running"}),c.jsx("p",{className:"text-dash-text-secondary",children:r?.t("startServerMessage")??"The Config UI requires the backend server to be running."}),c.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-lg p-4",children:[c.jsx("p",{className:"text-xs text-dash-text-muted uppercase tracking-widest mb-2 font-bold",children:r?.t("runThisCommand")??"Run this command"}),c.jsx("code",{className:"block text-sm text-dash-accent font-mono bg-dash-bg px-3 py-2 rounded border border-dash-border",children:"ck config"})]}),c.jsx("button",{onClick:()=>window.location.reload(),className:"px-6 py-2 bg-dash-accent text-dash-bg rounded-lg font-bold hover:bg-dash-accent-hover transition-colors",children:r?.t("tryAgain")??"Try Again"})]}):c.jsxs(c.Fragment,{children:[c.jsx("h1",{className:"text-2xl font-bold text-red-500",children:r?.t("somethingWentWrong")??"Something went wrong"}),c.jsx("p",{className:"text-dash-text-muted",children:this.state.error?.message}),c.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-dash-accent text-white rounded-md hover:opacity-90",children:r?.t("reloadApp")??"Reload App"})]})})})})}return this.props.children}}const GN="modulepreload",qN=function(t){return"/"+t},G0={},YN=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=o?.nonce||o?.getAttribute("nonce");s=Promise.allSettled(n.map(l=>{if(l=qN(l),l in G0)return;G0[l]=!0;const d=l.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const h=document.createElement("link");if(h.rel=d?"stylesheet":GN,d||(h.as="script"),h.crossOrigin="",h.href=l,a&&h.setAttribute("nonce",a),document.head.appendChild(h),d)return new Promise((f,p)=>{h.addEventListener("load",f),h.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return e().catch(i)})},_n=({direction:t="horizontal",isDragging:e=!1,onMouseDown:n})=>{const r=t==="horizontal";return c.jsx("div",{onMouseDown:n,className:`
|
|
22
|
+
group flex items-center justify-center shrink-0
|
|
23
|
+
${r?"w-2 cursor-col-resize":"h-2 cursor-row-resize"}
|
|
24
|
+
${e?"bg-dash-accent/20":"hover:bg-dash-surface-hover/50"}
|
|
25
|
+
transition-colors
|
|
26
|
+
`,children:c.jsx("div",{className:`
|
|
27
|
+
rounded-full transition-all
|
|
28
|
+
${r?"w-0.5 h-8":"h-0.5 w-8"}
|
|
29
|
+
${e?"bg-dash-accent":"bg-dash-border group-hover:bg-dash-text-muted"}
|
|
30
|
+
`})})};function XN(t,e,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)}function ZN(t,e,n,r,s){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var ad;function QN(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function Ae(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}class JN{get rid(){return XN(this,ad,"f")}constructor(e){ad.set(this,void 0),ZN(this,ad,e)}async close(){return Ae("plugin:resources|close",{rid:this.rid})}}ad=new WeakMap;const eP=t=>Ae("read_config",{projectPath:t}),Sw=(t,e)=>Ae("write_config",{projectPath:t,config:e}),Cw=t=>Ae("read_settings",{projectPath:t}),tP=t=>Ae("settings_file_exists",{projectPath:t}),nP=(t,e)=>Ae("write_settings",{projectPath:t,settings:e}),rP=()=>Ae("get_global_config_path"),sP=()=>Ae("get_global_config_dir"),$m=()=>Ae("get_home_dir"),Bm=()=>Ae("list_projects"),iP=t=>Ae("add_project",{path:t}),oP=t=>Ae("remove_project",{path:t}),aP=t=>Ae("touch_project",{path:t}),lP=(t,e)=>Ae("scan_for_projects",{rootPath:t,...e!==void 0&&{maxDepth:e}}),cP=(t,e)=>Ae("list_project_sessions",{projectId:t,limit:e}),dP=(t,e,n,r)=>Ae("get_session_detail",{projectId:t,sessionId:e,...n!==void 0&&{limit:n},...r!==void 0&&{offset:r}}),uP=()=>Ae("get_system_info"),hP=()=>Ae("get_global_metadata"),jw=()=>Ae("scan_agents"),fP=t=>Ae("get_agent_detail",{slug:t}),Nw=()=>Ae("scan_commands"),pP=t=>Ae("get_command_detail",{slug:t}),mP=()=>Ae("scan_skills"),gP=t=>Ae("discover_mcp_servers",{...t!==void 0}),xP=()=>Ae("get_dashboard_stats");function nt(){return typeof window<"u"&&"__TAURI_INTERNALS__"in window}const bP=[{type:"navigation",name:"Dashboard",description:"Project overview",route:"/"},{type:"navigation",name:"Config Editor",description:"Edit Claude configuration",route:"/config/global"},{type:"navigation",name:"Skills",description:"Browse and manage skills",route:"/skills"},{type:"navigation",name:"Migrate",description:"Migrate stack to other providers",route:"/migrate"},{type:"navigation",name:"Status Line",description:"Customize Claude Code statusline",route:"/statusline"},{type:"navigation",name:"Plans",description:"Visual dashboard for plans and phases",route:"/plans"},{type:"navigation",name:"System",description:"System updates and environment info",route:"/system"}];function yP(t,e){if(!e.trim())return!0;const n=`${t.name} ${t.description}`.toLowerCase();return e.toLowerCase().trim().split(/\s+/).every(r=>n.includes(r))}function Qf(t){const e=[];for(const n of t)n.children?e.push(...Qf(n.children)):e.push({type:"command",name:n.name,description:n.description??"",route:`/commands?selected=${encodeURIComponent(n.path)}`});return e}function vP({projects:t}){const[e,n]=g.useState([]),[r,s]=g.useState(!0);g.useEffect(()=>{let l=!1;async function d(){const u=[];if(nt()){try{const[m,x,b]=await Promise.allSettled([jw(),Nw(),mP()]);if(m.status==="fulfilled")for(const y of m.value)u.push({type:"agent",name:y.name||y.slug,description:y.description??"",route:`/agents?selected=${encodeURIComponent(y.slug)}`});if(x.status==="fulfilled"&&u.push(...Qf(x.value)),b.status==="fulfilled")for(const y of b.value)u.push({type:"skill",name:y.name,description:y.description??"",route:`/skills?selected=${encodeURIComponent(y.name)}`})}catch{}l||(n(u),s(!1));return}const[h,f,p]=await Promise.allSettled([fetch("/api/agents/browser"),fetch("/api/commands"),fetch("/api/skills/browse")]);if(h.status==="fulfilled"&&h.value.ok)try{const m=await h.value.json();for(const x of m.agents??[])u.push({type:"agent",name:x.name||x.slug,description:x.description??"",route:`/agents?selected=${encodeURIComponent(x.slug)}`})}catch{}if(f.status==="fulfilled"&&f.value.ok)try{const m=await f.value.json();u.push(...Qf(m.tree??[]))}catch{}if(p.status==="fulfilled"&&p.value.ok)try{const m=await p.value.json();for(const x of m.skills??[])u.push({type:"skill",name:x.name,description:x.description??"",route:`/skills?selected=${encodeURIComponent(x.name)}`})}catch{}l||(n(u),s(!1))}return d(),()=>{l=!0}},[]);const i=g.useMemo(()=>t.filter(l=>!l.path.endsWith("/.claude")&&l.path!=="~/.claude").map(l=>({type:"project",name:l.name||l.path.split("/").pop()||l.path,description:l.path,route:`/project/${l.id}`})),[t]),o=g.useMemo(()=>[...bP,...i,...e],[i,e]);return{search:g.useMemo(()=>l=>{const u=l.trim()?o.filter(f=>yP(f,l)):o,h={project:[],navigation:[],agent:[],command:[],skill:[]};for(const f of u){const p=h[f.type];p.length<5&&p.push(f)}return h},[o]),loading:r}}const q0=["navigation","project","agent","command","skill"],wP={navigation:"bg-dash-accent/20 text-dash-accent",project:"bg-dash-text-muted/20 text-dash-text-muted",agent:"bg-[#e85d4a]/20 text-[#e85d4a]",command:"bg-blue-500/20 text-blue-400",skill:"bg-green-500/20 text-green-400"};function Y0({text:t,query:e}){if(!e.trim())return c.jsx("span",{children:t});const n=e.trim().toLowerCase().split(/\s+/).filter(Boolean).sort((i,o)=>o.length-i.length),r=[];let s=t;for(;s.length>0;){let i=-1,o=0,a="";for(const l of n){const d=s.toLowerCase().indexOf(l);d!==-1&&(i===-1||d<i||d===i&&l.length>o)&&(i=d,o=l.length,a=l)}if(i===-1||!a){r.push({text:s,match:!1});break}i>0&&r.push({text:s.slice(0,i),match:!1}),r.push({text:s.slice(i,i+o),match:!0}),s=s.slice(i+o)}return c.jsx("span",{children:r.map((i,o)=>i.match?c.jsx("mark",{className:"bg-dash-accent/30 text-dash-text rounded-sm px-0.5",children:i.text},`m${o}`):c.jsx("span",{children:i.text},`s${o}`))})}const kP=({open:t,projects:e,onClose:n})=>{const{t:r}=ee(),s=Ft(),i=g.useRef(null),o=g.useRef(null),[a,l]=g.useState(""),[d,u]=g.useState(0),{search:h,loading:f}=vP({projects:e}),p=h(a),m=q0.flatMap(w=>p[w]??[]);g.useEffect(()=>{t&&(l(""),u(0),setTimeout(()=>i.current?.focus(),0))},[t]),g.useEffect(()=>{o.current?.querySelector(`[data-idx="${d}"]`)?.scrollIntoView({block:"nearest"})},[d]);const x=g.useCallback(w=>{s(w.route),n()},[s,n]),b=g.useCallback(w=>{if(w.key==="Escape"){n();return}if(w.key==="ArrowDown"){w.preventDefault(),u(C=>Math.min(C+1,m.length-1));return}if(w.key==="ArrowUp"){w.preventDefault(),u(C=>Math.max(C-1,0));return}if(w.key==="Enter"){w.preventDefault();const C=m[d];C&&x(C)}},[m,d,n,x]),y=w=>{l(w.target.value),u(0)};if(!t)return null;let k=0;const v=w=>{switch(w){case"navigation":return r("paletteNavigation");case"project":return r("paletteProjects");case"agent":return r("paletteAgents");case"command":return r("paletteCommands");case"skill":return r("paletteSkills")}};return c.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[12vh]",style:{background:"rgba(0,0,0,0.5)",backdropFilter:"blur(4px)"},"aria-label":"Search",onClick:n,onKeyDown:w=>w.key==="Escape"&&n(),children:c.jsxs("div",{className:"w-full max-w-[600px] mx-4 bg-dash-surface border border-dash-border rounded-xl shadow-2xl overflow-hidden",onClick:w=>w.stopPropagation(),onKeyDown:w=>w.stopPropagation(),children:[c.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-dash-border",children:[c.jsx("svg",{className:"w-4 h-4 text-dash-text-muted shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),c.jsx("input",{ref:i,type:"text",className:"flex-1 bg-transparent text-dash-text placeholder:text-dash-text-muted text-base outline-none",placeholder:r("palettePlaceholder"),value:a,onChange:y,onKeyDown:b,autoComplete:"off",spellCheck:!1}),c.jsx("kbd",{className:"hidden sm:block text-[10px] text-dash-text-muted bg-dash-surface border border-dash-border rounded px-1.5 py-0.5",children:"esc"})]}),c.jsxs("div",{ref:o,className:"max-h-[420px] overflow-y-auto py-2",children:[f&&c.jsx("div",{className:"px-4 py-6 text-center text-dash-text-muted text-sm",children:r("loading")}),!f&&m.length===0&&c.jsx("div",{className:"px-4 py-6 text-center text-dash-text-muted text-sm",children:r("paletteNoResults")}),!f&&q0.map(w=>{const C=p[w];if(!C||C.length===0)return null;const j=v(w);return c.jsxs("div",{children:[c.jsx("div",{className:"px-4 py-1.5 text-[10px] font-semibold uppercase tracking-widest text-dash-text-muted",children:j}),C.map(S=>{const P=k++,D=P===d;return c.jsxs("button",{type:"button","data-idx":P,className:`w-full flex items-center gap-3 px-4 py-2.5 text-left cursor-pointer transition-colors ${D?"bg-dash-accent/10 text-dash-text":"text-dash-text hover:bg-dash-surface"}`,onClick:()=>x(S),onMouseEnter:()=>u(P),children:[c.jsx("span",{className:`shrink-0 text-[10px] font-medium px-1.5 py-0.5 rounded ${wP[w]}`,children:j}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"text-sm font-medium truncate",children:c.jsx(Y0,{text:S.name,query:a})}),S.description&&c.jsx("div",{className:"text-xs text-dash-text-muted truncate mt-0.5",children:c.jsx(Y0,{text:S.description,query:a})})]}),D&&c.jsx("kbd",{className:"shrink-0 text-[10px] text-dash-text-muted bg-dash-surface border border-dash-border rounded px-1.5 py-0.5",children:"↵"})]},`${w}-${S.route}`)})]},w)})]}),m.length>0&&c.jsxs("div",{className:"px-4 py-2 border-t border-dash-border flex gap-4 text-[10px] text-dash-text-muted",children:[c.jsx("span",{children:"↑↓ navigate"}),c.jsx("span",{children:"↵ select"}),c.jsx("span",{children:"esc close"})]})]})})};var mr=(t=>(t.HEALTHY="healthy",t.WARNING="warning",t.ERROR="error",t.LOADING="loading",t.UNKNOWN="unknown",t))(mr||{}),Gn=(t=>(t.ENGINEER="engineer",t.MARKETING="marketing",t.ARCHITECT="architect",t.RESEARCHER="researcher",t.DEVOP="devops",t))(Gn||{});const SP=/^[A-Za-z]:\//;function Pw(t=""){return t&&t.replace(/\\/g,"/").replace(SP,e=>e.toUpperCase())}const CP=/^[/\\]{2}/,jP=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,Ow=/^[A-Za-z]:$/,NP=function(t){if(t.length===0)return".";t=Pw(t);const e=t.match(CP),n=Jf(t),r=t[t.length-1]==="/";return t=PP(t,!n),t.length===0?n?"/":r?"./":".":(r&&(t+="/"),Ow.test(t)&&(t+="/"),e?n?`//${t}`:`//./${t}`:n&&!Jf(t)?`/${t}`:t)},_i=function(...t){let e="";for(const n of t)if(n)if(e.length>0){const r=e[e.length-1]==="/",s=n[0]==="/";r&&s?e+=n.slice(1):e+=r||s?n:`/${n}`}else e+=n;return NP(e)};function PP(t,e){let n="",r=0,s=-1,i=0,o=null;for(let a=0;a<=t.length;++a){if(a<t.length)o=t[a];else{if(o==="/")break;o="/"}if(o==="/"){if(!(s===a-1||i===1))if(i===2){if(n.length<2||r!==2||n[n.length-1]!=="."||n[n.length-2]!=="."){if(n.length>2){const l=n.lastIndexOf("/");l===-1?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}else if(n.length>0){n="",r=0,s=a,i=0;continue}}e&&(n+=n.length>0?"/..":"..",r=2)}else n.length>0?n+=`/${t.slice(s+1,a)}`:n=t.slice(s+1,a),r=a-s-1;s=a,i=0}else o==="."&&i!==-1?++i:i=-1}return n}const Jf=function(t){return jP.test(t)},OP=function(t){const e=Pw(t).replace(/\/$/,"").split("/").slice(0,-1);return e.length===1&&Ow.test(e[0])&&(e[0]+="/"),e.join("/")||(Jf(t)?"/":".")},Mt="/api";class Nh extends Error{constructor(){super("Backend server is not running. Start it with: ck config"),this.name="ServerUnavailableError"}}async function en(){if(!nt())try{if(!(await fetch(`${Mt}/health`,{method:"GET"})).ok)throw new Nh}catch(t){throw t instanceof Nh?t:new Nh}}function Fm(t){const e=new TextEncoder().encode(t);let n="";for(const i of e)n+=String.fromCharCode(i);return`discovered-${btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}async function zn(t){if(nt())if(t.allowFallback)try{return await t.tauri()}catch(e){console.error("[api] Tauri command failed, falling back to web:",e)}else return t.tauri();return t.web()}function Ru(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,planSettings:t.planSettings,activePlans:t.activePlans,preferences:t.preferences}}function zm(t){return{id:Fm(t.path),name:t.name,path:t.path,health:t.hasClaudeConfig?mr.HEALTHY:mr.UNKNOWN,kitType:Gn.ENGINEER,model:"claude-sonnet-4-5",activeHooks:0,mcpServers:0,skills:[]}}async function Ew(t){try{const e=await Cw(t.path);return{...t,model:e.model||t.model,activeHooks:Array.isArray(e.hooks)?e.hooks.length:0,mcpServers:e.mcpServers!=null&&typeof e.mcpServers=="object"?Object.keys(e.mcpServers).length:0}}catch{return t}}async function Dw(){return zn({tauri:async()=>{const e=(await Bm()).map(zm);return Promise.all(e.map(Ew))},web:async()=>{await en();const t=await fetch(`${Mt}/projects`);if(!t.ok)throw new Error("Failed to fetch projects");return(await t.json()).map(Ru)}})}const Nd=new Map,EP=5e3;async function Mw(t){const e=Nd.get(t);if(e&&Date.now()-e.timestamp<EP)return e.data;const n=await zn({tauri:async()=>{const s=(await Bm()).find(i=>Fm(i.path)===t);if(!s)throw new Error(`Project not found: ${t}`);return Ew(zm(s))},web:async()=>{await en();const r=await fetch(`${Mt}/projects/${encodeURIComponent(t)}`);if(!r.ok)throw new Error("Failed to fetch project");const s=await r.json();return Ru(s)}});return Nd.set(t,{data:n,timestamp:Date.now()}),n}function Pd(t){t?Nd.delete(t):Nd.clear()}async function DP(t,e){return zn({tauri:async()=>(await cP(t,e)).map(r=>({id:r.id,timestamp:r.timestamp,duration:r.duration,summary:r.summary})),web:async()=>{try{await en();const n=e!==void 0?`?limit=${e}`:"",r=await fetch(`${Mt}/sessions/${encodeURIComponent(t)}${n}`);return r.ok?r.json():[]}catch{return[]}}})}async function MP(t,e,n,r){return zn({tauri:async()=>await dP(t,e,n,r),web:async()=>{await en();const s=new URLSearchParams;n!==void 0&&s.set("limit",String(n)),r!==void 0&&s.set("offset",String(r));const i=await fetch(`${Mt}/sessions/${encodeURIComponent(t)}/${encodeURIComponent(e)}?${s.toString()}`);if(!i.ok)throw new Error("Failed to fetch session detail");return i.json()}})}async function AP(t,e){if(nt())throw new Error("Project quick actions require the web dashboard (ck config ui) — not yet available in desktop mode");await en();const n=new URLSearchParams;t&&n.set("projectId",t);const r=await fetch(`${Mt}/actions/options?${n.toString()}`,{signal:e});if(!r.ok)throw new Error("Failed to fetch action options");return r.json()}async function TP(t,e,n,r){if(nt())throw new Error("Project quick actions require the web dashboard (ck config ui) — not yet available in desktop mode");await en();const s=await fetch(`${Mt}/actions/open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:t,path:e,appId:n,projectId:r})});if(!s.ok){const i=await s.json().catch(()=>({error:"Action failed"}));throw new Error(i.error||"Action failed")}}async function LP(){return zn({tauri:async()=>{const t=await $m(),e=_i(t,".claude","settings.json");let n,r;try{[n,r]=await Promise.all([tP(t),Cw(t)])}catch(s){const i=s instanceof Error?s.message:String(s);throw new Error(`Failed to read settings from ${e}: ${i}`)}return{path:e,exists:n,settings:r}},web:async()=>{await en();try{const r=await fetch(`${Mt}/settings/raw`);if(r.ok)return r.json()}catch{}const t=await fetch(`${Mt}/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 RP(t){return zn({tauri:async()=>{const e=await rP(),n=await $m();return await nP(n,t),{success:!0,path:e,backupPath:null,absolutePath:e}},web:async()=>{await en();const e=await fetch(`${Mt}/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 Aw(t){return zn({tauri:async()=>{const e=await iP(t.path);return zm(e)},web:async()=>{await en();const e=await fetch(`${Mt}/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 Ru(n)}})}async function _P(t){return zn({tauri:async()=>{const n=(await Bm()).find(r=>Fm(r.path)===t);if(!n)throw new Error(`Project not found: ${t}`);await oP(n.path),Pd(t)},web:async()=>{await en();const e=await fetch(`${Mt}/projects/${encodeURIComponent(t)}`,{method:"DELETE"});if(!e.ok){const n=await e.text();throw new Error(n||"Failed to remove project")}Pd(t)}})}async function Tw(t,e){return zn({allowFallback:!0,tauri:async()=>{throw new Error("Project updates require the web dashboard (ck config ui) — not yet available in desktop mode")},web:async()=>{await en();const n=await fetch(`${Mt}/projects/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok){const s=await n.text();throw new Error(s||"Failed to update project")}Pd(t);const r=await n.json();return Ru(r)}})}async function IP(t){nt()&&(await aP(t),Pd())}async function $P(){return zn({tauri:async()=>await hP(),web:async()=>{const t=await fetch(`${Mt}/metadata/global`);return t.ok?t.json():(console.error("Failed to fetch global metadata"),{})}})}async function BP(){return zn({tauri:async()=>await xP(),web:async()=>{await en();const t=await fetch(`${Mt}/dashboard/stats`);if(!t.ok)throw new Error("Failed to fetch dashboard stats");return t.json()}})}async function FP(){return zn({tauri:async()=>await uP(),web:async()=>{await en();const t=await fetch(`${Mt}/system/info`);if(!t.ok)throw new Error("Failed to fetch system info");return t.json()}})}async function zP(){await en();const t=await fetch(`${Mt}/migrate/providers`);if(!t.ok)throw new Error("Failed to fetch migration providers");return t.json()}async function Ph(){await en();const t=await fetch(`${Mt}/migrate/discovery`);if(!t.ok)throw new Error("Failed to discover migration items");return t.json()}function VP(){const[t,e]=g.useState(null),[n,r]=g.useState(!0),[s,i]=g.useState(null);return g.useEffect(()=>{let o=!1;async function a(){r(!0),i(null);try{const l=await BP();if(o)return;e({agents:l.agents??0,commands:l.commands??0,skills:l.skills??0,mcpServers:l.mcpServers??0})}catch(l){if(o)return;i(l instanceof Error?l.message:"Failed to load counts")}finally{o||r(!1)}}return a(),()=>{o=!0}},[]),{counts:t,loading:n,error:s}}const HP=({isOpen:t,onClose:e,onAdd:n})=>{const{t:r}=ee(),[s,i]=g.useState(""),[o,a]=g.useState(""),[l,d]=g.useState(!1),[u,h]=g.useState(null);g.useEffect(()=>{t||(i(""),a(""),h(null),d(!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(),!s.trim()){h(r("pathRequired"));return}try{d(!0),h(null);const m={path:s.trim(),...o.trim()&&{alias:o.trim()}};await n(m),e()}catch(m){h(m instanceof Error?m.message:r("failedToAdd"))}finally{d(!1)}};return t?c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:e,children:c.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-lg shadow-xl max-w-md w-full mx-4",onClick:p=>p.stopPropagation(),children:[c.jsxs("div",{className:"px-6 py-4 border-b border-dash-border",children:[c.jsx("h2",{className:"text-lg font-bold text-dash-text",children:r("addProjectTitle")}),c.jsx("p",{className:"text-sm text-dash-text-muted mt-1",children:r("addProjectDescription")})]}),c.jsxs("form",{onSubmit:f,className:"p-6 space-y-4",children:[c.jsxs("div",{children:[c.jsxs("label",{htmlFor:"project-path",className:"block text-sm font-medium text-dash-text mb-2",children:[r("projectPath")," ",c.jsx("span",{className:"text-red-500",children:"*"})]}),c.jsx("input",{id:"project-path",type:"text",value:s,onChange:p=>i(p.target.value),placeholder:r("pathPlaceholder"),disabled:l,className:"w-full px-3 py-2 bg-dash-bg border border-dash-border rounded-md text-dash-text placeholder-dash-text-muted focus:outline-none focus:ring-2 focus:ring-dash-accent focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed"})]}),c.jsxs("div",{children:[c.jsxs("label",{htmlFor:"project-alias",className:"block text-sm font-medium text-dash-text mb-2",children:[r("alias")," ",r("aliasOptional")]}),c.jsx("input",{id:"project-alias",type:"text",value:o,onChange:p=>a(p.target.value),placeholder:r("aliasPlaceholder"),disabled:l,className:"w-full px-3 py-2 bg-dash-bg border border-dash-border rounded-md text-dash-text placeholder-dash-text-muted focus:outline-none focus:ring-2 focus:ring-dash-accent focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed"}),c.jsx("p",{className:"text-xs text-dash-text-muted mt-1",children:r("aliasDescription")})]}),u&&c.jsx("div",{className:"px-3 py-2 bg-red-500/10 border border-red-500/20 rounded-md",children:c.jsx("p",{className:"text-sm text-red-500",children:u})}),c.jsxs("div",{className:"flex gap-3 pt-2",children:[c.jsx("button",{type:"button",onClick:e,disabled:l,className:"flex-1 px-4 py-2 border border-dash-border rounded-md text-dash-text-secondary hover:bg-dash-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:r("cancel")}),c.jsx("button",{type:"submit",disabled:l||!s.trim(),className:"flex-1 px-4 py-2 bg-dash-accent text-white rounded-md hover:bg-dash-accent/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:r(l?"adding":"addProject")})]})]})]})}):null},WP=({vertical:t=!1})=>{const{lang:e,setLang:n}=ee();return c.jsxs("div",{className:`flex ${t?"flex-col":""} items-center rounded-lg border border-dash-border overflow-hidden`,children:[c.jsx("button",{onClick:()=>n("en"),className:`px-2 py-1 text-xs font-medium transition-colors ${e==="en"?"bg-dash-accent text-dash-bg":"text-dash-text-muted hover:bg-dash-surface-hover"}`,title:"English",children:"EN"}),c.jsx("button",{onClick:()=>n("vi"),className:`px-2 py-1 text-xs font-medium transition-colors ${e==="vi"?"bg-dash-accent text-dash-bg":"text-dash-text-muted hover:bg-dash-surface-hover"}`,title:"Tiếng Việt",children:"VI"})]})},UP=({projects:t,currentProjectId:e,isCollapsed:n,width:r,isConnected:s,theme:i,onSwitchProject:o,onToggle:a,onAddProject:l,onToggleTheme:d})=>{const{t:u}=ee(),h=Ft(),f=sr(),[p,m]=g.useState(!1),{counts:x}=VP(),b=f.pathname==="/"||f.pathname==="/dashboard",y=b,k=f.pathname==="/config/global",v=f.pathname==="/migrate",w=f.pathname==="/statusline",C=f.pathname==="/mcp",j=f.pathname.startsWith("/plans"),S=f.pathname==="/agents",P=f.pathname==="/commands",D=f.pathname==="/skills",A=f.pathname==="/workflows",N=[...t].filter(E=>!E.path.endsWith("/.claude")&&E.path!=="~/.claude").sort((E,M)=>E.pinned&&!M.pinned?-1:!E.pinned&&M.pinned?1:E.name.localeCompare(M.name)),T=r?{width:`${r}px`}:void 0,I=r?"":n?"w-14":"w-72",O=r?r>=160:!n;return c.jsxs("aside",{style:T,className:`${I} bg-dash-surface border-r border-dash-border flex flex-col transition-all duration-300 ease-in-out z-20 h-full overflow-hidden`,children:[c.jsxs("div",{className:`flex items-center ${O?"p-6 gap-3":"p-2 justify-center"}`,children:[c.jsx("img",{src:"/images/logo-transparent-32.png",alt:"ClaudeKit",className:"w-8 h-8 shrink-0"}),O&&c.jsxs("div",{className:"overflow-hidden",children:[c.jsx("h1",{className:"text-sm font-bold truncate tracking-tight text-dash-text",children:"ClaudeKit"}),c.jsx("p",{className:"text-[10px] text-dash-text-muted font-medium uppercase tracking-wider",children:u("controlCenter")})]})]}),c.jsxs("div",{className:`${O?"px-4":"px-2"} py-2 space-y-1`,children:[O&&c.jsx("p",{className:"px-2 pb-2 text-[10px] font-bold text-dash-text-muted uppercase tracking-widest",children:u("overviewSection")}),c.jsx(cr,{icon:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 104 0M9 5a2 2 0 014 0m-6 4h10M9 12h6m-6 4h4"})}),label:u("plansNav"),isCollapsed:!O,active:j,onClick:()=>h("/plans")}),c.jsx(cr,{icon:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"})}),label:u("systemNavLabel"),isCollapsed:!O,active:b,onClick:()=>h("/")})]}),c.jsxs("div",{className:`${O?"px-4":"px-2"} py-2 space-y-1 border-t border-dash-border`,children:[O&&c.jsx("p",{className:"px-2 pb-2 pt-2 text-[10px] font-bold text-dash-text-muted uppercase tracking-widest",children:u("entitiesSection")}),c.jsx(cr,{icon:c.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),label:u("workflowsTitle"),isCollapsed:!O,active:A,onClick:()=>h("/workflows")}),c.jsx(cr,{icon:c.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z"})}),label:u("agentsBrowser"),isCollapsed:!O,active:S,onClick:()=>h("/agents"),badge:O&&x?String(x.agents):void 0}),c.jsx(cr,{icon:c.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),label:u("commandsBrowser"),isCollapsed:!O,active:P,onClick:()=>h("/commands"),badge:O&&x?String(x.commands):void 0}),c.jsx(cr,{icon:c.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})}),label:u("skillsNav"),isCollapsed:!O,active:D,onClick:()=>h("/skills"),badge:O&&x?String(x.skills):void 0}),c.jsx(cr,{icon:c.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 12h14M12 5l7 7-7 7"})}),label:u("mcpTitle"),isCollapsed:!O,active:C,onClick:()=>h("/mcp"),badge:O&&x?String(x.mcpServers):void 0})]}),c.jsxs("div",{className:`${O?"px-4":"px-2"} py-2 space-y-1 border-t border-dash-border`,children:[O&&c.jsx("p",{className:"px-2 pb-2 pt-2 text-[10px] font-bold text-dash-text-muted uppercase tracking-widest",children:u("toolsSection")}),c.jsx(cr,{icon:c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),label:u("configEditor"),isCollapsed:!O,active:k,onClick:()=>h("/config/global")}),c.jsx(cr,{icon:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 10V7m0 10a2 2 0 002 2h2a2 2 0 002-2V7a2 2 0 00-2-2h-2a2 2 0 00-2 2"})}),label:u("statusline"),isCollapsed:!O,active:w,onClick:()=>h("/statusline")}),c.jsx(cr,{icon:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 4a2 2 0 114 0v1a1 1 0 001 1h3a1 1 0 011 1v3a1 1 0 01-1 1h-1a2 2 0 100 4h1a1 1 0 011 1v3a1 1 0 01-1 1h-3a1 1 0 01-1-1v-1a2 2 0 10-4 0v1a1 1 0 01-1 1H7a1 1 0 01-1-1v-3a1 1 0 00-1-1H4a2 2 0 110-4h1a1 1 0 001-1V7a1 1 0 011-1h3a1 1 0 001-1V4z"})}),label:u("migrate"),isCollapsed:!O,active:v,onClick:()=>h("/migrate")})]}),c.jsxs("div",{className:`flex-1 overflow-y-auto overflow-x-hidden ${O?"px-4":"px-2"} py-2 space-y-1 border-t border-dash-border`,children:[O&&c.jsx("p",{className:"px-2 pb-2 pt-2 text-[10px] font-bold text-dash-text-muted uppercase tracking-widest",children:u("projects")}),N.map(E=>{const M=f.pathname.endsWith("/config"),R=e===E.id&&!k&&!M&&!v&&!w&&!C&&!j&&!S&&!P&&!D&&!A&&!y;return c.jsxs("button",{onClick:()=>o(E.id),className:`w-full group relative flex items-center ${O?"gap-2.5 px-2 py-1.5":"justify-center p-2"} rounded-md transition-colors ${R?"bg-dash-accent-subtle text-dash-accent border border-dash-accent/10":"text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text border border-transparent"}`,children:[c.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${E.health===mr.HEALTHY?"bg-dash-accent":E.health===mr.WARNING?"bg-orange-400":"bg-red-500"} ${R?"animate-pulse":""}`}),O&&c.jsxs(c.Fragment,{children:[E.pinned&&c.jsx("span",{className:"text-xs",children:"📌"}),c.jsx("span",{className:"text-sm font-medium truncate",children:E.name})]}),!O&&c.jsxs("div",{className:"absolute left-14 px-2 py-1 bg-dash-text text-dash-bg text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none border border-dash-border z-50",children:[E.pinned&&"📌 ",E.name]})]},E.id)}),c.jsxs("button",{onClick:()=>m(!0),className:`w-full flex items-center ${O?"gap-3 p-2.5":"justify-center p-2"} rounded-md text-dash-text-muted hover:bg-dash-surface-hover hover:text-dash-text-secondary transition-colors mt-4`,children:[c.jsx("div",{className:`${O?"w-5 h-5":""} flex items-center justify-center`,children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}),O&&c.jsx("span",{className:"text-sm font-medium",children:u("addProject")})]})]}),c.jsx(HP,{isOpen:p,onClose:()=>m(!1),onAdd:l}),c.jsx("div",{className:"border-t border-dash-border",children:c.jsxs("div",{className:`py-3 flex items-center ${O?"px-3 justify-between":"justify-center flex-col gap-2"}`,children:[c.jsxs("div",{className:"flex items-center gap-2",title:u(s?"sync":"offline"),children:[c.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${s?"bg-dash-accent shadow-[0_0_8px_var(--dash-accent-glow)]":"bg-red-500"}`}),O&&c.jsx("span",{className:"text-[10px] font-bold text-dash-text-muted uppercase tracking-widest",children:u(s?"sync":"offline")})]}),c.jsxs("div",{className:`flex items-center gap-1 ${O?"":"flex-col"}`,children:[c.jsx(WP,{vertical:!O}),c.jsx("button",{onClick:d,className:"w-8 h-8 rounded-lg flex items-center justify-center text-dash-text-muted hover:bg-dash-surface-hover hover:text-dash-text transition-colors",title:u(i==="dark"?"switchToLight":"switchToDark"),children:i==="dark"?c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364-6.364l-.707.707M6.343 17.657l-.707.707M17.657 17.657l-.707-.707M6.343 6.343l-.707-.707M12 5a7 7 0 100 14 7 7 0 000-14z"})}):c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})})}),c.jsx("button",{onClick:a,className:"w-8 h-8 rounded-lg flex items-center justify-center text-dash-text-muted hover:bg-dash-surface-hover hover:text-dash-text transition-colors",title:u(n?"expand":"collapse"),children:n?c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M5 5l7 7-7 7"})}):c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 19l-7-7 7-7m8 14l-7-7 7-7"})})})]})]})})]})},cr=({icon:t,label:e,badge:n,isCollapsed:r,active:s,onClick:i,disabled:o})=>c.jsxs("button",{onClick:i,disabled:o,className:`w-full group relative flex items-center ${r?"justify-center p-2":"gap-3 p-2"} rounded-md transition-colors ${o?"opacity-50 cursor-not-allowed":s?"bg-dash-surface-hover text-dash-text":"text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text"}`,children:[c.jsx("div",{className:`${r?"":"w-5 h-5"} flex items-center justify-center`,children:t}),!r&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-sm font-medium flex-1 text-left",children:e}),n&&c.jsx("span",{className:"ml-auto text-[10px] font-mono text-dash-text-disabled bg-dash-surface px-1.5 py-0.5 rounded",children:n})]}),r&&c.jsx("div",{className:"absolute left-14 px-2 py-1 bg-dash-text text-dash-bg text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none border border-dash-border z-50",children:e})]});function KP(t){const[e,n]=g.useState([]),[r,s]=g.useState(!1),[i,o]=g.useState(null),a=g.useCallback(async()=>{if(!t){n([]);return}try{s(!0),o(null);const l=await DP(t,999);n(l)}catch(l){o(l instanceof Error?l.message:"Failed to load sessions")}finally{s(!1)}},[t]);return g.useEffect(()=>{a()},[a]),{sessions:e,loading:r,error:i,reload:a}}function GP(){const[t,e]=g.useState([]),[n,r]=g.useState(!0),[s,i]=g.useState(null),o=g.useCallback(async()=>{try{r(!0),i(null);const u=await Dw();e(u)}catch(u){i(u instanceof Error?u.message:"Failed to load projects")}finally{r(!1)}},[]),a=g.useCallback(async u=>{const h=await Aw(u);return await o(),h},[o]),l=g.useCallback(async u=>{await _P(u),await o()},[o]),d=g.useCallback(async(u,h)=>{const f=await Tw(u,h);return await o(),f},[o]);return g.useEffect(()=>{o()},[o]),{projects:t,loading:n,error:s,reload:o,addProject:a,removeProject:l,updateProject:d}}function qP(t,e,n=50,r=0){const[s,i]=g.useState(null),[o,a]=g.useState(!1),[l,d]=g.useState(null),u=g.useCallback(async()=>{if(!t||!e){i(null);return}try{a(!0),d(null);const h=await MP(t,e,n,r);i(h)}catch(h){d(h instanceof Error?h.message:"Failed to load")}finally{a(!1)}},[t,e,n,r]);return g.useEffect(()=>{u()},[u]),{data:s,loading:o,error:l,reload:u}}const YP="https://json-schema.org/draft-07/schema#",XP="https://claudekit.cc/schemas/ck-config.schema.json",ZP="ClaudeKit Configuration",QP="Configuration schema for ClaudeKit Engineer .ck.json files",JP="object",eO={$schema:{type:"string",description:"JSON Schema reference for editor autocompletion"},codingLevel:{type:"integer",minimum:-1,maximum:5,default:-1,description:"User coding experience level: -1=auto, 0=beginner, 1=intermediate, 2=advanced, 3=expert, 4=tech-lead, 5=god-mode"},privacyBlock:{type:"boolean",default:!0,description:"Enable privacy block hook to protect sensitive files (.env, credentials, etc.)"},docs:{type:"object",description:"Documentation settings",properties:{maxLoc:{type:"integer",minimum:100,maximum:5e3,default:800,description:"Maximum lines of code per documentation file"}},additionalProperties:!1},plan:{type:"object",description:"Plan naming and validation settings",properties:{namingFormat:{type:"string",default:"{date}-{issue}-{slug}",description:"Format for plan directory names. Variables: {date}, {issue}, {slug}"},dateFormat:{type:"string",default:"YYMMDD-HHmm",description:"Date format for plan names (moment.js format)"},issuePrefix:{type:"string",default:"GH-",description:"Prefix for issue references (e.g., GH-, JIRA-)"},reportsDir:{type:"string",default:"reports",description:"Subdirectory name for reports within plans"},resolution:{type:"object",description:"Plan resolution settings",properties:{order:{type:"array",items:{type:"string",enum:["session","branch","directory"]},default:["session","branch"],description:"Order of resolution strategies for plan context"},branchPattern:{type:"string",default:"(?:feat|fix|chore|refactor|docs)/(?:[^/]+/)?(.+)",description:"Regex pattern to extract plan slug from branch name"}},additionalProperties:!1},validation:{type:"object",description:"Plan validation settings",properties:{mode:{type:"string",enum:["prompt","auto","strict","none"],default:"prompt",description:"Validation mode: prompt=ask questions, auto=auto-validate, strict=require all, none=skip"},minQuestions:{type:"integer",minimum:0,maximum:20,default:3,description:"Minimum validation questions to ask"},maxQuestions:{type:"integer",minimum:1,maximum:20,default:8,description:"Maximum validation questions to ask"},focusAreas:{type:"array",items:{type:"string",enum:["assumptions","risks","tradeoffs","architecture","security","performance","testing","dependencies"]},default:["assumptions","risks","tradeoffs","architecture"],description:"Focus areas for validation questions"}},additionalProperties:!1}},additionalProperties:!1},paths:{type:"object",description:"Directory paths configuration",properties:{docs:{type:"string",default:"docs",description:"Path to documentation directory"},plans:{type:"string",default:"plans",description:"Path to plans directory"},globalPlans:{type:"string",default:"plans",description:"Path to global plans directory (relative to ~/.claude or absolute)"}},additionalProperties:!1},locale:{type:"object",description:"Language and locale settings",properties:{thinkingLanguage:{type:["string","null"],default:null,description:"Language for Claude's thinking (null=English)"},responseLanguage:{type:["string","null"],default:null,description:"Language for Claude's responses (null=match user)"}},additionalProperties:!1},trust:{type:"object",description:"Trust mode settings for auto-approval",properties:{passphrase:{type:["string","null"],default:null,description:"Passphrase to enable trust mode (null=disabled)"},enabled:{type:"boolean",default:!1,description:"Whether trust mode is currently enabled"}},additionalProperties:!1},project:{type:"object",description:"Project type detection settings",properties:{type:{type:"string",enum:["auto","library","application","monorepo","cli","api","web","mobile"],default:"auto",description:"Project type (auto=detect from package.json)"},packageManager:{type:"string",enum:["auto","npm","yarn","pnpm","bun"],default:"auto",description:"Package manager (auto=detect from lockfile)"},framework:{type:"string",enum:["auto","react","vue","angular","svelte","nextjs","nuxt","express","nestjs","fastify","none"],default:"auto",description:"Framework (auto=detect from dependencies)"}},additionalProperties:!1},gemini:{type:"object",description:"Gemini CLI configuration",properties:{model:{type:"string",enum:["gemini-2.5-flash","gemini-2.5-pro","gemini-3-pro-preview","gemini-3-flash-preview"],default:"gemini-3-flash-preview",description:"Gemini model to use for CLI commands. Legacy gemini-3.0-* ids are auto-mapped to the current preview aliases when loading config."}},additionalProperties:!1},skills:{type:"object",description:"Per-skill configuration",properties:{research:{type:"object",properties:{useGemini:{type:"boolean",default:!0,description:"Use Gemini CLI for research (false=use WebSearch)"}},additionalProperties:!0}},additionalProperties:{type:"object",description:"Custom skill configuration"}},assertions:{type:"array",items:{type:"object",properties:{pattern:{type:"string",description:"Glob pattern or regex for files to match"},rule:{type:"string",description:"Assertion rule to enforce"},message:{type:"string",description:"Error message when assertion fails"}}},default:[],description:"Code assertions and rules to enforce"},statusline:{type:"string",enum:["full","compact","minimal","none"],default:"full",description:"Statusline display mode: full=all features, compact=2-3 lines, minimal=single text line, none=disabled"},statuslineColors:{type:"boolean",default:!0,description:"Enable ANSI colors in statusline output. Set false for plain text. Respects NO_COLOR/FORCE_COLOR env vars."},statuslineQuota:{type:"boolean",default:!0,description:"Show the cosmetic 5h / wk quota chips in the statusline. Disable to keep the statusline layout without usage-window percentages."},statuslineLayout:{type:"object",description:"Advanced statusline layout config for the visual builder. When absent, uses hardcoded defaults (backward compatible). Takes precedence over the statusline field when both are set.",properties:{baseMode:{type:"string",enum:["full","compact","minimal","none"],default:"full",description:"Starting template mode for the layout"},lines:{type:"array",description:"Layout lines. Each inner array is one terminal row containing section IDs in left-to-right order. Sections not listed in any line are hidden.",items:{type:"array",items:{type:"string",enum:["model","context","quota","directory","git","cost","changes","agents","todos"]}},maxItems:10},sectionConfig:{type:"object",description:"Per-section visual customization keyed by section ID.",additionalProperties:{type:"object",properties:{icon:{type:"string",description:"Custom emoji/icon override",maxLength:20},label:{type:"string",description:"Custom label override",maxLength:50},color:{type:"string",description:"ANSI named color (e.g. red, cyan, green). Hex codes not supported.",maxLength:30,pattern:"^[a-zA-Z]+$"},maxWidth:{type:"integer",minimum:10,description:"Maximum character width for this section",maximum:500}},additionalProperties:!1}},theme:{type:"object",description:"Color theme overrides",properties:{name:{type:"string",description:"Theme name (informational)",maxLength:50},contextLow:{type:"string",default:"green",description:"Context bar color when usage <50%",maxLength:30,pattern:"^[a-zA-Z]+$"},contextMid:{type:"string",default:"yellow",description:"Context bar color when usage 50-75%",maxLength:30,pattern:"^[a-zA-Z]+$"},contextHigh:{type:"string",default:"red",description:"Context bar color when usage >75%",maxLength:30,pattern:"^[a-zA-Z]+$"},accent:{type:"string",default:"cyan",description:"Accent color for highlights",maxLength:30,pattern:"^[a-zA-Z]+$"},muted:{type:"string",default:"dim",description:"Muted text color",maxLength:30,pattern:"^[a-zA-Z]+$"},separator:{type:"string",default:"dim",description:"Separator color",maxLength:30,pattern:"^[a-zA-Z]+$"}},additionalProperties:!1},responsiveBreakpoint:{type:"number",minimum:.5,maximum:1,default:.85,description:"Terminal width fraction at which compact mode activates"},maxAgentRows:{type:"integer",minimum:1,maximum:10,default:4,description:"Maximum rows to show in agents section"},todoTruncation:{type:"integer",minimum:20,maximum:100,default:50,description:"Max characters before truncating todo text"}},additionalProperties:!1},hooks:{type:"object",description:"Toggle individual hooks on/off. Default: all enabled.",properties:{"session-init":{type:"boolean",default:!0,description:"SessionStart hook - project detection and env setup"},"subagent-init":{type:"boolean",default:!0,description:"SubagentStart hook - injects context to subagents"},"descriptive-name":{type:"boolean",default:!0,description:"PreToolUse hook - enforces kebab-case descriptive file naming for scripts"},"dev-rules-reminder":{type:"boolean",default:!0,description:"UserPromptSubmit hook - injects dev rules context"},"usage-context-awareness":{type:"boolean",default:!0,description:"UserPromptSubmit/PostToolUse hook - inject usage-limit awareness into prompt context"},"context-tracking":{type:"boolean",default:!0,description:"Context window tracking injection (% used, token counts) in dev-rules-reminder"},"scout-block":{type:"boolean",default:!0,description:"PreToolUse hook - blocks heavy directories"},"privacy-block":{type:"boolean",default:!0,description:"PreToolUse hook - blocks sensitive files"},"simplify-gate":{type:"boolean",default:!0,description:"UserPromptSubmit hook - hard-blocks ship/merge/pr/deploy/publish and soft-warns commit/finalize/release when live diff exceeds simplify thresholds. Bypass via CK_SIMPLIFY_DISABLED=1."}},additionalProperties:!1},simplify:{type:"object",description:"Signal-driven simplifier orchestration. Live git diff thresholds + verb-based gate.",properties:{threshold:{type:"object",description:"LOC/file thresholds that trip the gate. Nested object stays open for forward-compat fields.",properties:{locDelta:{type:"integer",minimum:0,default:400,description:"Total LOC change (across all files) above which the gate fires."},fileCount:{type:"integer",minimum:0,default:8,description:"Number of changed files above which the gate fires."},singleFileLoc:{type:"integer",minimum:0,default:200,description:"Per-file LOC change above which the gate fires."}}},gate:{type:"object",description:"UserPromptSubmit gate behavior. Nested object stays open for forward-compat fields.",properties:{enabled:{type:"boolean",default:!1,description:"Master toggle. Off by default (opt-in). Set true to activate; env CK_SIMPLIFY_DISABLED=1 always bypasses."},hardVerbs:{type:"array",items:{type:"string"},default:["ship","merge","pr","deploy","publish"],description:"Verbs that hard-block (continue:false) when thresholds breached."},softVerbs:{type:"array",items:{type:"string"},default:["commit","finalize","release"],description:"Verbs that soft-warn (additionalContext) when thresholds breached."}}}},additionalProperties:!1},updatePipeline:{type:"object",description:"3-step update pipeline: CLI update -> kit init -> provider migrate (each independent)",properties:{autoInitAfterUpdate:{type:"boolean",default:!1,description:"Automatically run ck init after ck update when kit has new version"},autoMigrateAfterUpdate:{type:"boolean",default:!1,description:"Automatically run ck migrate after ck update for detected providers (independent of init)"},migrateProviders:{oneOf:[{type:"string",const:"auto"},{type:"array",items:{type:"string"}}],default:"auto",description:"Which providers to auto-migrate. 'auto' scans filesystem."}},additionalProperties:!1},modelTaxonomy:{type:"object",description:"Custom model mappings for portable migration. Keys are provider names (e.g., 'codex', 'gemini-cli'), values map tiers to model config.",additionalProperties:{type:"object",properties:{heavy:{type:"object",properties:{model:{type:"string",description:"Target model name"},effort:{type:"string",description:"Effort/reasoning level (provider-specific)"}},required:["model"]},balanced:{type:"object",properties:{model:{type:"string",description:"Target model name"},effort:{type:"string",description:"Effort/reasoning level (provider-specific)"}},required:["model"]},light:{type:"object",properties:{model:{type:"string",description:"Target model name"},effort:{type:"string",description:"Effort/reasoning level (provider-specific)"}},required:["model"]}}}}},tO=!0,nO={$schema:YP,$id:XP,title:ZP,description:QP,type:JP,properties:eO,additionalProperties:tO};var Ke;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},t.getValidEnumValues=s=>{const i=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(const o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Ke||(Ke={}));var X0;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(X0||(X0={}));const ge=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rs=t=>{switch(typeof t){case"undefined":return ge.undefined;case"string":return ge.string;case"number":return Number.isNaN(t)?ge.nan:ge.number;case"boolean":return ge.boolean;case"function":return ge.function;case"bigint":return ge.bigint;case"symbol":return ge.symbol;case"object":return Array.isArray(t)?ge.array:t===null?ge.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ge.promise:typeof Map<"u"&&t instanceof Map?ge.map:typeof Set<"u"&&t instanceof Set?ge.set:typeof Date<"u"&&t instanceof Date?ge.date:ge.object;default:return ge.unknown}},re=Ke.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Wr extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const d=o.path[l];l===o.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(n(o))):a[d]=a[d]||{_errors:[]},a=a[d],l++}}};return s(this),r}static assert(e){if(!(e instanceof Wr))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ke.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Wr.create=t=>new Wr(t);const ep=(t,e)=>{let n;switch(t.code){case re.invalid_type:t.received===ge.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case re.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Ke.jsonStringifyReplacer)}`;break;case re.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ke.joinValues(t.keys,", ")}`;break;case re.invalid_union:n="Invalid input";break;case re.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ke.joinValues(t.options)}`;break;case re.invalid_enum_value:n=`Invalid enum value. Expected ${Ke.joinValues(t.options)}, received '${t.received}'`;break;case re.invalid_arguments:n="Invalid function arguments";break;case re.invalid_return_type:n="Invalid function return type";break;case re.invalid_date:n="Invalid date";break;case re.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Ke.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case re.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case re.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case re.custom:n="Invalid input";break;case re.invalid_intersection_types:n="Intersection results could not be merged";break;case re.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case re.not_finite:n="Number must be finite";break;default:n=e.defaultError,Ke.assertNever(t)}return{message:n}};let rO=ep;function sO(){return rO}const iO=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="";const l=r.filter(d=>!!d).slice().reverse();for(const d of l)a=d(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}};function ue(t,e){const n=sO(),r=iO({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===ep?void 0:ep].filter(s=>!!s)});t.common.issues.push(r)}class Jt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return Ee;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return Jt.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return Ee;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}}const Ee=Object.freeze({status:"aborted"}),Zo=t=>({status:"dirty",value:t}),Vn=t=>({status:"valid",value:t}),Z0=t=>t.status==="aborted",Q0=t=>t.status==="dirty",Yi=t=>t.status==="valid",Od=t=>typeof Promise<"u"&&t instanceof Promise;var be;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(be||(be={}));class Nr{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const J0=(t,e)=>{if(Yi(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Wr(t.common.issues);return this._error=n,this._error}}};function Le(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{const{message:l}=t;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:s}}class Ve{get description(){return this._def.description}_getType(e){return rs(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:rs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Jt,ctx:{common:e.parent.common,data:e.data,parsedType:rs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Od(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rs(e)},s=this._parseSync({data:e,path:r.path,parent:r});return J0(r,s)}"~validate"(e){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rs(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:n});return Yi(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>Yi(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rs(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(Od(s)?s:Promise.resolve(s));return J0(r,i)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=e(s),a=()=>i.addIssue({code:re.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new Qi({schema:this,typeName:Oe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return ms.create(this,this._def)}nullable(){return Ji.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return kr.create(this)}promise(){return Td.create(this,this._def)}or(e){return Dd.create([this,e],this._def)}and(e){return Md.create(this,e,this._def)}transform(e){return new Qi({...Le(this._def),schema:this,typeName:Oe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new sp({...Le(this._def),innerType:this,defaultValue:n,typeName:Oe.ZodDefault})}brand(){return new OO({typeName:Oe.ZodBranded,type:this,...Le(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new ip({...Le(this._def),innerType:this,catchValue:n,typeName:Oe.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Vm.create(this,e)}readonly(){return op.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const oO=/^c[^\s-]{8,}$/i,aO=/^[0-9a-z]+$/,lO=/^[0-9A-HJKMNP-TV-Z]{26}$/i,cO=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,dO=/^[a-z0-9_-]{21}$/i,uO=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,hO=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,fO=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,pO="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Oh;const mO=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,gO=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,xO=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,bO=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,yO=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,vO=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Lw="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",wO=new RegExp(`^${Lw}$`);function Rw(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function kO(t){return new RegExp(`^${Rw(t)}$`)}function SO(t){let e=`${Lw}T${Rw(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function CO(t,e){return!!((e==="v4"||!e)&&mO.test(t)||(e==="v6"||!e)&&xO.test(t))}function jO(t,e){if(!uO.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function NO(t,e){return!!((e==="v4"||!e)&&gO.test(t)||(e==="v6"||!e)&&bO.test(t))}class zr extends Ve{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ge.string){const i=this._getOrReturnCtx(e);return ue(i,{code:re.invalid_type,expected:ge.string,received:i.parsedType}),Ee}const r=new Jt;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),ue(s,{code:re.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),ue(s,{code:re.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?ue(s,{code:re.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&ue(s,{code:re.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")fO.test(e.data)||(s=this._getOrReturnCtx(e,s),ue(s,{validation:"email",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Oh||(Oh=new RegExp(pO,"u")),Oh.test(e.data)||(s=this._getOrReturnCtx(e,s),ue(s,{validation:"emoji",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")cO.test(e.data)||(s=this._getOrReturnCtx(e,s),ue(s,{validation:"uuid",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")dO.test(e.data)||(s=this._getOrReturnCtx(e,s),ue(s,{validation:"nanoid",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")oO.test(e.data)||(s=this._getOrReturnCtx(e,s),ue(s,{validation:"cuid",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")aO.test(e.data)||(s=this._getOrReturnCtx(e,s),ue(s,{validation:"cuid2",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")lO.test(e.data)||(s=this._getOrReturnCtx(e,s),ue(s,{validation:"ulid",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),ue(s,{validation:"url",code:re.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),ue(s,{validation:"regex",code:re.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),ue(s,{code:re.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),ue(s,{code:re.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),ue(s,{code:re.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?SO(i).test(e.data)||(s=this._getOrReturnCtx(e,s),ue(s,{code:re.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?wO.test(e.data)||(s=this._getOrReturnCtx(e,s),ue(s,{code:re.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?kO(i).test(e.data)||(s=this._getOrReturnCtx(e,s),ue(s,{code:re.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?hO.test(e.data)||(s=this._getOrReturnCtx(e,s),ue(s,{validation:"duration",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?CO(e.data,i.version)||(s=this._getOrReturnCtx(e,s),ue(s,{validation:"ip",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?jO(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),ue(s,{validation:"jwt",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?NO(e.data,i.version)||(s=this._getOrReturnCtx(e,s),ue(s,{validation:"cidr",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?yO.test(e.data)||(s=this._getOrReturnCtx(e,s),ue(s,{validation:"base64",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?vO.test(e.data)||(s=this._getOrReturnCtx(e,s),ue(s,{validation:"base64url",code:re.invalid_string,message:i.message}),r.dirty()):Ke.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:re.invalid_string,...be.errToObj(r)})}_addCheck(e){return new zr({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...be.errToObj(e)})}url(e){return this._addCheck({kind:"url",...be.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...be.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...be.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...be.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...be.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...be.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...be.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...be.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...be.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...be.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...be.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...be.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...be.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...be.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...be.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...be.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...be.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...be.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...be.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...be.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...be.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...be.errToObj(n)})}nonempty(e){return this.min(1,be.errToObj(e))}trim(){return new zr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new zr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new zr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}zr.create=t=>new zr({checks:[],typeName:Oe.ZodString,coerce:t?.coerce??!1,...Le(t)});function PO(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}class Xi extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ge.number){const i=this._getOrReturnCtx(e);return ue(i,{code:re.invalid_type,expected:ge.number,received:i.parsedType}),Ee}let r;const s=new Jt;for(const i of this._def.checks)i.kind==="int"?Ke.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),ue(r,{code:re.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),ue(r,{code:re.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),ue(r,{code:re.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?PO(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),ue(r,{code:re.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),ue(r,{code:re.not_finite,message:i.message}),s.dirty()):Ke.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,be.toString(n))}gt(e,n){return this.setLimit("min",e,!1,be.toString(n))}lte(e,n){return this.setLimit("max",e,!0,be.toString(n))}lt(e,n){return this.setLimit("max",e,!1,be.toString(n))}setLimit(e,n,r,s){return new Xi({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:be.toString(s)}]})}_addCheck(e){return new Xi({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:be.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:be.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:be.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:be.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:be.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:be.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:be.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:be.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:be.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ke.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}Xi.create=t=>new Xi({checks:[],typeName:Oe.ZodNumber,coerce:t?.coerce||!1,...Le(t)});class wa extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ge.bigint)return this._getInvalidInput(e);let r;const s=new Jt;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),ue(r,{code:re.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),ue(r,{code:re.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),ue(r,{code:re.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Ke.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return ue(n,{code:re.invalid_type,expected:ge.bigint,received:n.parsedType}),Ee}gte(e,n){return this.setLimit("min",e,!0,be.toString(n))}gt(e,n){return this.setLimit("min",e,!1,be.toString(n))}lte(e,n){return this.setLimit("max",e,!0,be.toString(n))}lt(e,n){return this.setLimit("max",e,!1,be.toString(n))}setLimit(e,n,r,s){return new wa({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:be.toString(s)}]})}_addCheck(e){return new wa({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:be.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:be.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:be.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:be.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:be.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}wa.create=t=>new wa({checks:[],typeName:Oe.ZodBigInt,coerce:t?.coerce??!1,...Le(t)});class tp extends Ve{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ge.boolean){const r=this._getOrReturnCtx(e);return ue(r,{code:re.invalid_type,expected:ge.boolean,received:r.parsedType}),Ee}return Vn(e.data)}}tp.create=t=>new tp({typeName:Oe.ZodBoolean,coerce:t?.coerce||!1,...Le(t)});class Ed extends Ve{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ge.date){const i=this._getOrReturnCtx(e);return ue(i,{code:re.invalid_type,expected:ge.date,received:i.parsedType}),Ee}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return ue(i,{code:re.invalid_date}),Ee}const r=new Jt;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),ue(s,{code:re.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),ue(s,{code:re.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Ke.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ed({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:be.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:be.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Ed.create=t=>new Ed({checks:[],coerce:t?.coerce||!1,typeName:Oe.ZodDate,...Le(t)});class ex extends Ve{_parse(e){if(this._getType(e)!==ge.symbol){const r=this._getOrReturnCtx(e);return ue(r,{code:re.invalid_type,expected:ge.symbol,received:r.parsedType}),Ee}return Vn(e.data)}}ex.create=t=>new ex({typeName:Oe.ZodSymbol,...Le(t)});class tx extends Ve{_parse(e){if(this._getType(e)!==ge.undefined){const r=this._getOrReturnCtx(e);return ue(r,{code:re.invalid_type,expected:ge.undefined,received:r.parsedType}),Ee}return Vn(e.data)}}tx.create=t=>new tx({typeName:Oe.ZodUndefined,...Le(t)});class nx extends Ve{_parse(e){if(this._getType(e)!==ge.null){const r=this._getOrReturnCtx(e);return ue(r,{code:re.invalid_type,expected:ge.null,received:r.parsedType}),Ee}return Vn(e.data)}}nx.create=t=>new nx({typeName:Oe.ZodNull,...Le(t)});class rx extends Ve{constructor(){super(...arguments),this._any=!0}_parse(e){return Vn(e.data)}}rx.create=t=>new rx({typeName:Oe.ZodAny,...Le(t)});class sx extends Ve{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Vn(e.data)}}sx.create=t=>new sx({typeName:Oe.ZodUnknown,...Le(t)});class ys extends Ve{_parse(e){const n=this._getOrReturnCtx(e);return ue(n,{code:re.invalid_type,expected:ge.never,received:n.parsedType}),Ee}}ys.create=t=>new ys({typeName:Oe.ZodNever,...Le(t)});class ix extends Ve{_parse(e){if(this._getType(e)!==ge.undefined){const r=this._getOrReturnCtx(e);return ue(r,{code:re.invalid_type,expected:ge.void,received:r.parsedType}),Ee}return Vn(e.data)}}ix.create=t=>new ix({typeName:Oe.ZodVoid,...Le(t)});class kr extends Ve{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==ge.array)return ue(n,{code:re.invalid_type,expected:ge.array,received:n.parsedType}),Ee;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(ue(n,{code:o?re.too_big:re.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(ue(n,{code:re.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(ue(n,{code:re.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new Nr(n,o,n.path,a)))).then(o=>Jt.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new Nr(n,o,n.path,a)));return Jt.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new kr({...this._def,minLength:{value:e,message:be.toString(n)}})}max(e,n){return new kr({...this._def,maxLength:{value:e,message:be.toString(n)}})}length(e,n){return new kr({...this._def,exactLength:{value:e,message:be.toString(n)}})}nonempty(e){return this.min(1,e)}}kr.create=(t,e)=>new kr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Oe.ZodArray,...Le(e)});function Ci(t){if(t instanceof bt){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=ms.create(Ci(r))}return new bt({...t._def,shape:()=>e})}else return t instanceof kr?new kr({...t._def,type:Ci(t.element)}):t instanceof ms?ms.create(Ci(t.unwrap())):t instanceof Ji?Ji.create(Ci(t.unwrap())):t instanceof ti?ti.create(t.items.map(e=>Ci(e))):t}class bt extends Ve{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=Ke.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==ge.object){const d=this._getOrReturnCtx(e);return ue(d,{code:re.invalid_type,expected:ge.object,received:d.parsedType}),Ee}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof ys&&this._def.unknownKeys==="strip"))for(const d in s.data)o.includes(d)||a.push(d);const l=[];for(const d of o){const u=i[d],h=s.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new Nr(s,h,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof ys){const d=this._def.unknownKeys;if(d==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(d==="strict")a.length>0&&(ue(s,{code:re.unrecognized_keys,keys:a}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const u of a){const h=s.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new Nr(s,h,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const u of l){const h=await u.key,f=await u.value;d.push({key:h,value:f,alwaysSet:u.alwaysSet})}return d}).then(d=>Jt.mergeObjectSync(r,d)):Jt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return be.errToObj,new bt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{const s=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:be.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new bt({...this._def,unknownKeys:"strip"})}passthrough(){return new bt({...this._def,unknownKeys:"passthrough"})}extend(e){return new bt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new bt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Oe.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new bt({...this._def,catchall:e})}pick(e){const n={};for(const r of Ke.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new bt({...this._def,shape:()=>n})}omit(e){const n={};for(const r of Ke.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new bt({...this._def,shape:()=>n})}deepPartial(){return Ci(this)}partial(e){const n={};for(const r of Ke.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new bt({...this._def,shape:()=>n})}required(e){const n={};for(const r of Ke.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof ms;)i=i._def.innerType;n[r]=i}return new bt({...this._def,shape:()=>n})}keyof(){return _w(Ke.objectKeys(this.shape))}}bt.create=(t,e)=>new bt({shape:()=>t,unknownKeys:"strip",catchall:ys.create(),typeName:Oe.ZodObject,...Le(e)});bt.strictCreate=(t,e)=>new bt({shape:()=>t,unknownKeys:"strict",catchall:ys.create(),typeName:Oe.ZodObject,...Le(e)});bt.lazycreate=(t,e)=>new bt({shape:t,unknownKeys:"strip",catchall:ys.create(),typeName:Oe.ZodObject,...Le(e)});class Dd extends Ve{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new Wr(a.ctx.common.issues));return ue(n,{code:re.invalid_union,unionErrors:o}),Ee}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const l of r){const d={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new Wr(l));return ue(n,{code:re.invalid_union,unionErrors:a}),Ee}}get options(){return this._def.options}}Dd.create=(t,e)=>new Dd({options:t,typeName:Oe.ZodUnion,...Le(e)});function np(t,e){const n=rs(t),r=rs(e);if(t===e)return{valid:!0,data:t};if(n===ge.object&&r===ge.object){const s=Ke.objectKeys(e),i=Ke.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(const a of i){const l=np(t[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===ge.array&&r===ge.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<t.length;i++){const o=t[i],a=e[i],l=np(o,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===ge.date&&r===ge.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Md extends Ve{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(Z0(i)||Z0(o))return Ee;const a=np(i.value,o.value);return a.valid?((Q0(i)||Q0(o))&&n.dirty(),{status:n.value,value:a.data}):(ue(r,{code:re.invalid_intersection_types}),Ee)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Md.create=(t,e,n)=>new Md({left:t,right:e,typeName:Oe.ZodIntersection,...Le(n)});class ti extends Ve{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ge.array)return ue(r,{code:re.invalid_type,expected:ge.array,received:r.parsedType}),Ee;if(r.data.length<this._def.items.length)return ue(r,{code:re.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ee;!this._def.rest&&r.data.length>this._def.items.length&&(ue(r,{code:re.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Nr(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>Jt.mergeArray(n,o)):Jt.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new ti({...this._def,rest:e})}}ti.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ti({items:t,typeName:Oe.ZodTuple,rest:null,...Le(e)})};class Ad extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ge.object)return ue(r,{code:re.invalid_type,expected:ge.object,received:r.parsedType}),Ee;const s=[],i=this._def.keyType,o=this._def.valueType;for(const a in r.data)s.push({key:i._parse(new Nr(r,a,r.path,a)),value:o._parse(new Nr(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Jt.mergeObjectAsync(n,s):Jt.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Ve?new Ad({keyType:e,valueType:n,typeName:Oe.ZodRecord,...Le(r)}):new Ad({keyType:zr.create(),valueType:e,typeName:Oe.ZodRecord,...Le(n)})}}class ox extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ge.map)return ue(r,{code:re.invalid_type,expected:ge.map,received:r.parsedType}),Ee;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,l],d)=>({key:s._parse(new Nr(r,a,r.path,[d,"key"])),value:i._parse(new Nr(r,l,r.path,[d,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const d=await l.key,u=await l.value;if(d.status==="aborted"||u.status==="aborted")return Ee;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(d.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const d=l.key,u=l.value;if(d.status==="aborted"||u.status==="aborted")return Ee;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(d.value,u.value)}return{status:n.value,value:a}}}}ox.create=(t,e,n)=>new ox({valueType:e,keyType:t,typeName:Oe.ZodMap,...Le(n)});class ka extends Ve{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ge.set)return ue(r,{code:re.invalid_type,expected:ge.set,received:r.parsedType}),Ee;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(ue(r,{code:re.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(ue(r,{code:re.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const d=new Set;for(const u of l){if(u.status==="aborted")return Ee;u.status==="dirty"&&n.dirty(),d.add(u.value)}return{status:n.value,value:d}}const a=[...r.data.values()].map((l,d)=>i._parse(new Nr(r,l,r.path,d)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,n){return new ka({...this._def,minSize:{value:e,message:be.toString(n)}})}max(e,n){return new ka({...this._def,maxSize:{value:e,message:be.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}ka.create=(t,e)=>new ka({valueType:t,minSize:null,maxSize:null,typeName:Oe.ZodSet,...Le(e)});class ax extends Ve{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}ax.create=(t,e)=>new ax({getter:t,typeName:Oe.ZodLazy,...Le(e)});class rp extends Ve{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return ue(n,{received:n.data,code:re.invalid_literal,expected:this._def.value}),Ee}return{status:"valid",value:e.data}}get value(){return this._def.value}}rp.create=(t,e)=>new rp({value:t,typeName:Oe.ZodLiteral,...Le(e)});function _w(t,e){return new Zi({values:t,typeName:Oe.ZodEnum,...Le(e)})}class Zi extends Ve{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return ue(n,{expected:Ke.joinValues(r),received:n.parsedType,code:re.invalid_type}),Ee}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return ue(n,{received:n.data,code:re.invalid_enum_value,options:r}),Ee}return Vn(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Zi.create(e,{...this._def,...n})}exclude(e,n=this._def){return Zi.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}Zi.create=_w;class lx extends Ve{_parse(e){const n=Ke.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ge.string&&r.parsedType!==ge.number){const s=Ke.objectValues(n);return ue(r,{expected:Ke.joinValues(s),received:r.parsedType,code:re.invalid_type}),Ee}if(this._cache||(this._cache=new Set(Ke.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=Ke.objectValues(n);return ue(r,{received:r.data,code:re.invalid_enum_value,options:s}),Ee}return Vn(e.data)}get enum(){return this._def.values}}lx.create=(t,e)=>new lx({values:t,typeName:Oe.ZodNativeEnum,...Le(e)});class Td extends Ve{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ge.promise&&n.common.async===!1)return ue(n,{code:re.invalid_type,expected:ge.promise,received:n.parsedType}),Ee;const r=n.parsedType===ge.promise?n.data:Promise.resolve(n.data);return Vn(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Td.create=(t,e)=>new Td({type:t,typeName:Oe.ZodPromise,...Le(e)});class Qi extends Ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Oe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{ue(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return Ee;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Ee:l.status==="dirty"||n.value==="dirty"?Zo(l.value):l});{if(n.value==="aborted")return Ee;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?Ee:a.status==="dirty"||n.value==="dirty"?Zo(a.value):a}}if(s.type==="refinement"){const o=a=>{const l=s.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Ee:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Ee:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Yi(o))return Ee;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Yi(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):Ee);Ke.assertNever(s)}}Qi.create=(t,e,n)=>new Qi({schema:t,typeName:Oe.ZodEffects,effect:e,...Le(n)});Qi.createWithPreprocess=(t,e,n)=>new Qi({schema:e,effect:{type:"preprocess",transform:t},typeName:Oe.ZodEffects,...Le(n)});class ms extends Ve{_parse(e){return this._getType(e)===ge.undefined?Vn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ms.create=(t,e)=>new ms({innerType:t,typeName:Oe.ZodOptional,...Le(e)});class Ji extends Ve{_parse(e){return this._getType(e)===ge.null?Vn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ji.create=(t,e)=>new Ji({innerType:t,typeName:Oe.ZodNullable,...Le(e)});class sp extends Ve{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===ge.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}sp.create=(t,e)=>new sp({innerType:t,typeName:Oe.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Le(e)});class ip extends Ve{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Od(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Wr(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Wr(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ip.create=(t,e)=>new ip({innerType:t,typeName:Oe.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Le(e)});class cx extends Ve{_parse(e){if(this._getType(e)!==ge.nan){const r=this._getOrReturnCtx(e);return ue(r,{code:re.invalid_type,expected:ge.nan,received:r.parsedType}),Ee}return{status:"valid",value:e.data}}}cx.create=t=>new cx({typeName:Oe.ZodNaN,...Le(t)});class OO extends Ve{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Vm extends Ve{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ee:i.status==="dirty"?(n.dirty(),Zo(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Ee:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new Vm({in:e,out:n,typeName:Oe.ZodPipeline})}}class op extends Ve{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Yi(s)&&(s.value=Object.freeze(s.value)),s);return Od(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}op.create=(t,e)=>new op({innerType:t,typeName:Oe.ZodReadonly,...Le(e)});var Oe;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Oe||(Oe={}));const ze=zr.create,er=Xi.create,It=tp.create;ys.create;const vs=kr.create,lt=bt.create,EO=Dd.create;Md.create;ti.create;const Iw=Ad.create,DO=rp.create,Es=Zi.create;Td.create;ms.create;Ji.create;const MO=Es(["prompt","auto","strict","none"]),AO=Es(["assumptions","risks","tradeoffs","architecture","security","performance","testing","dependencies"]),TO=Es(["session","branch","directory"]),LO=Es(["auto","library","application","monorepo","cli","api","web","mobile"]),RO=Es(["auto","npm","yarn","pnpm","bun"]),_O=Es(["auto","react","vue","angular","svelte","nextjs","nuxt","express","nestjs","fastify","none"]),IO={"gemini-3.0-flash":"gemini-3-flash-preview","gemini-3.0-pro":"gemini-3-pro-preview","gemini-3-flash":"gemini-3-flash-preview","gemini-3-pro":"gemini-3-pro-preview"},$O=ze().default("gemini-3-flash-preview"),$w=Es(["full","compact","minimal","none"]),BO=Es(["model","context","quota","directory","git","cost","changes","agents","todos"]),FO=lt({icon:ze().max(20).optional(),label:ze().max(50).optional(),color:ze().max(30).regex(/^[a-zA-Z]+$/).optional(),maxWidth:er().int().min(10).max(500).optional()}),zO=lt({name:ze().max(50).optional(),contextLow:ze().max(30).regex(/^[a-zA-Z]+$/).default("green"),contextMid:ze().max(30).regex(/^[a-zA-Z]+$/).default("yellow"),contextHigh:ze().max(30).regex(/^[a-zA-Z]+$/).default("red"),accent:ze().max(30).regex(/^[a-zA-Z]+$/).default("cyan"),muted:ze().max(30).regex(/^[a-zA-Z]+$/).default("dim"),separator:ze().max(30).regex(/^[a-zA-Z]+$/).default("dim"),quotaLow:ze().max(30).regex(/^[a-zA-Z]+$/).optional(),quotaHigh:ze().max(30).regex(/^[a-zA-Z]+$/).optional()}),VO=lt({baseMode:$w.default("full"),lines:vs(vs(BO)).max(10).optional(),sectionConfig:Iw(ze(),FO).optional(),theme:zO.optional(),responsiveBreakpoint:er().min(.5).max(1).default(.85),maxAgentRows:er().int().min(1).max(10).default(4),todoTruncation:er().int().min(20).max(100).default(50)}),HO=er().int().min(-1).max(5),WO=lt({order:vs(TO).optional(),branchPattern:ze().optional()}),UO=lt({mode:MO.optional(),minQuestions:er().int().min(0).max(20).optional(),maxQuestions:er().int().min(1).max(20).optional(),focusAreas:vs(AO).optional()}),KO=lt({namingFormat:ze().optional(),dateFormat:ze().optional(),issuePrefix:ze().optional(),reportsDir:ze().optional(),resolution:WO.optional(),validation:UO.optional()}),GO=lt({maxLoc:er().int().min(100).max(5e3).optional()}),qO=lt({docs:ze().optional(),plans:ze().optional(),globalPlans:ze().optional()}),YO=lt({thinkingLanguage:ze().nullable().optional(),responseLanguage:ze().nullable().optional()}),XO=lt({passphrase:ze().nullable().optional(),enabled:It().optional()}),ZO=lt({type:LO.optional(),packageManager:RO.optional(),framework:_O.optional()}),QO=lt({model:$O.optional()}),JO=lt({research:lt({useGemini:It().optional()}).passthrough().optional()}).passthrough(),eE=lt({autoInitAfterUpdate:It().default(!1),autoMigrateAfterUpdate:It().default(!1),migrateProviders:EO([DO("auto"),vs(ze())]).default("auto")});function tE(t){const e=t.trim();return(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e).trim().toLowerCase()}function nE(t){if(typeof t!="string")return t;const e=t.trim().toLowerCase();return IO[e]??e}function rE(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 dx(t){const e=t.map(tE).filter(Boolean).filter((n,r,s)=>s.indexOf(n)===r);return e.length===0||e.length===1&&e[0]==="auto"?"auto":e.filter(n=>n!=="auto")}function Bw(t){if(typeof t=="string"){const e=rE(t),n=Array.isArray(e)?e:String(e).split(",");return dx(n)}return Array.isArray(t)?dx(t.filter(e=>typeof e=="string")):typeof t=="number"||typeof t=="boolean"?Bw(String(t)):t}function sE(t){if(!t||typeof t!="object"||Array.isArray(t))return t;const e=structuredClone(t),n=e.gemini,r=e.updatePipeline;if(n&&typeof n=="object"&&!Array.isArray(n)){const s=n;"model"in s&&(s.model=nE(s.model))}if(r&&typeof r=="object"&&!Array.isArray(r)){const s=r;"migrateProviders"in s&&(s.migrateProviders=Bw(s.migrateProviders))}return e}const Eh=lt({model:ze(),effort:ze().optional()}),iE=lt({heavy:Eh.optional(),balanced:Eh.optional(),light:Eh.optional()}),oE=Iw(ze(),iE),aE=lt({pattern:ze().optional(),rule:ze().optional(),message:ze().optional()}),lE=lt({"session-init":It().optional(),"subagent-init":It().optional(),"descriptive-name":It().optional(),"dev-rules-reminder":It().optional(),"usage-context-awareness":It().optional(),"context-tracking":It().optional(),"scout-block":It().optional(),"privacy-block":It().optional(),"simplify-gate":It().optional()}).passthrough(),cE=lt({threshold:lt({locDelta:er().int().nonnegative().default(400),fileCount:er().int().nonnegative().default(8),singleFileLoc:er().int().nonnegative().default(200)}).passthrough().default({}),gate:lt({enabled:It().default(!1),hardVerbs:vs(ze()).default(["ship","merge","pr","deploy","publish"]),softVerbs:vs(ze()).default(["commit","finalize","release"])}).passthrough().default({})}).strict(),dE=lt({$schema:ze().optional(),codingLevel:HO.optional(),statusline:$w.optional(),statuslineColors:It().optional(),statuslineQuota:It().optional(),statuslineLayout:VO.optional(),privacyBlock:It().optional(),docs:GO.optional(),plan:KO.optional(),paths:qO.optional(),locale:YO.optional(),trust:XO.optional(),project:ZO.optional(),gemini:QO.optional(),skills:JO.optional(),assertions:vs(aE).optional(),hooks:lE.optional(),simplify:cE.optional(),updatePipeline:eE.optional(),modelTaxonomy:oE.optional()}).passthrough(),Fw={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
|
+
"codingLevel": 1
|
|
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
|
+
"privacyBlock": false
|
|
34
|
+
}`},"plan.namingFormat":{path:"plan.namingFormat",type:"string",default:'"{date}-{issue}-{slug}"',description:"Template for naming plan directories. Uses placeholder tokens that get replaced at runtime.",descriptionVi:"Mẫu đặt tên thư mục kế hoạch. Sử dụng các token placeholder được thay thế khi chạy.",effect:"{date} is replaced with formatted date, {issue} is extracted from branch, {slug} is for agent substitution.",effectVi:"{date} được thay bằng ngày đã định dạng, {issue} trích xuất từ branch, {slug} cho agent thay thế.",example:`{
|
|
35
|
+
"plan": {
|
|
36
|
+
"namingFormat": "{date}-{slug}"
|
|
37
|
+
}
|
|
38
|
+
}`},"plan.dateFormat":{path:"plan.dateFormat",type:"string",default:'"YYMMDD-HHmm"',description:"Date format string for {date} token in naming pattern.",descriptionVi:"Chuỗi định dạng ngày cho token {date} trong mẫu đặt tên.",example:`{
|
|
39
|
+
"plan": {
|
|
40
|
+
"dateFormat": "YYMMDD"
|
|
41
|
+
}
|
|
42
|
+
}`},"plan.issuePrefix":{path:"plan.issuePrefix",type:"string | null",default:"null",description:"Prefix to prepend to extracted issue numbers in plan naming (e.g., 'GH-', 'JIRA-').",descriptionVi:"Tiền tố thêm vào số issue trích xuất trong đặt tên kế hoạch (vd: 'GH-', 'JIRA-').",example:`{
|
|
43
|
+
"plan": {
|
|
44
|
+
"issuePrefix": "GH-"
|
|
45
|
+
}
|
|
46
|
+
}`},"plan.reportsDir":{path:"plan.reportsDir",type:"string",default:'"reports"',description:"Subdirectory name within plan directory for storing reports.",descriptionVi:"Tên thư mục con trong thư mục kế hoạch để lưu trữ báo cáo.",example:`{
|
|
47
|
+
"plan": {
|
|
48
|
+
"reportsDir": "reports"
|
|
49
|
+
}
|
|
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
|
+
"plan": {
|
|
52
|
+
"resolution": {
|
|
53
|
+
"order": ["session", "branch"]
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}`},"plan.resolution.branchPattern":{path:"plan.resolution.branchPattern",type:"string (regex)",default:'"(?:feat|fix|chore|refactor|docs)/(?:[^/]+/)?(.+)"',description:"Regex pattern for extracting plan slug from git branch name. Capture group 1 is used as the slug.",descriptionVi:"Mẫu regex để trích xuất slug kế hoạch từ tên nhánh git. Nhóm bắt 1 được dùng làm slug.",example:`{
|
|
57
|
+
"plan": {
|
|
58
|
+
"resolution": {
|
|
59
|
+
"branchPattern": "(?:feat|fix)/(.+)"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
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
|
+
"plan": {
|
|
64
|
+
"validation": {
|
|
65
|
+
"mode": "auto"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}`},"plan.validation.minQuestions":{path:"plan.validation.minQuestions",type:"number",default:"3",description:"Minimum number of validation questions to ask during plan review.",descriptionVi:"Số câu hỏi xác thực tối thiểu trong quá trình xem xét kế hoạch.",example:`{
|
|
69
|
+
"plan": {
|
|
70
|
+
"validation": {
|
|
71
|
+
"minQuestions": 5
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}`},"plan.validation.maxQuestions":{path:"plan.validation.maxQuestions",type:"number",default:"8",description:"Maximum number of validation questions to ask during plan review.",descriptionVi:"Số câu hỏi xác thực tối đa trong quá trình xem xét kế hoạch.",example:`{
|
|
75
|
+
"plan": {
|
|
76
|
+
"validation": {
|
|
77
|
+
"maxQuestions": 10
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}`},"plan.validation.focusAreas":{path:"plan.validation.focusAreas",type:"string[]",default:'["assumptions", "risks", "tradeoffs", "architecture"]',description:"Categories of questions to focus on during validation interview.",descriptionVi:"Các danh mục câu hỏi tập trung trong phỏng vấn xác thực.",example:`{
|
|
81
|
+
"plan": {
|
|
82
|
+
"validation": {
|
|
83
|
+
"focusAreas": ["security", "performance"]
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}`},"paths.docs":{path:"paths.docs",type:"string",default:'"docs"',description:"Path to documentation directory (relative to project root or absolute).",descriptionVi:"Đường dẫn thư mục tài liệu (tương đối với thư mục gốc hoặc tuyệt đối).",example:`{
|
|
87
|
+
"paths": {
|
|
88
|
+
"docs": "docs"
|
|
89
|
+
}
|
|
90
|
+
}`},"paths.plans":{path:"paths.plans",type:"string",default:'"plans"',description:"Path to plans directory (relative to project root or absolute).",descriptionVi:"Đường dẫn thư mục kế hoạch (tương đối với thư mục gốc hoặc tuyệt đối).",example:`{
|
|
91
|
+
"paths": {
|
|
92
|
+
"plans": "plans"
|
|
93
|
+
}
|
|
94
|
+
}`},"paths.globalPlans":{path:"paths.globalPlans",type:"string",default:'"plans"',description:"Path to global plans directory (relative to ~/.claude or absolute). Used when plan scope is global.",descriptionVi:"Đường dẫn thư mục kế hoạch toàn cục (tương đối với ~/.claude hoặc tuyệt đối). Dùng khi phạm vi kế hoạch là toàn cục.",example:`{
|
|
95
|
+
"paths": {
|
|
96
|
+
"globalPlans": "plans"
|
|
97
|
+
}
|
|
98
|
+
}`},"locale.thinkingLanguage":{path:"locale.thinkingLanguage",type:"string | null",default:"null",description:"Language for internal reasoning and logic. Recommended: 'en' for precision.",descriptionVi:"Ngôn ngữ suy luận nội bộ và logic. Khuyến nghị: 'en' để chính xác.",example:`{
|
|
99
|
+
"locale": {
|
|
100
|
+
"thinkingLanguage": "en"
|
|
101
|
+
}
|
|
102
|
+
}`},"locale.responseLanguage":{path:"locale.responseLanguage",type:"string | null",default:"null",description:"Language for user-facing output (responses, explanations, comments).",descriptionVi:"Ngôn ngữ cho đầu ra người dùng (phản hồi, giải thích, nhận xét).",example:`{
|
|
103
|
+
"locale": {
|
|
104
|
+
"responseLanguage": "fr"
|
|
105
|
+
}
|
|
106
|
+
}`},"trust.enabled":{path:"trust.enabled",type:"boolean",default:"false",description:"Enables trusted execution mode. When enabled, bypasses certain security prompts.",descriptionVi:"Bật chế độ thực thi tin cậy. Khi bật, bỏ qua một số lời nhắc bảo mật.",example:`{
|
|
107
|
+
"trust": {
|
|
108
|
+
"enabled": true
|
|
109
|
+
}
|
|
110
|
+
}`},"trust.passphrase":{path:"trust.passphrase",type:"string | null",default:"null",description:"Secret passphrase for testing context injection and trust verification.",descriptionVi:"Cụm mật khẩu bí mật để kiểm tra tiêm ngữ cảnh và xác minh tin cậy.",example:`{
|
|
111
|
+
"trust": {
|
|
112
|
+
"passphrase": "super-secret-key"
|
|
113
|
+
}
|
|
114
|
+
}`},"project.type":{path:"project.type",type:"string",default:'"auto"',validValues:["auto","library","application","monorepo","cli","api","web","mobile"],description:"Override automatic project type detection.",descriptionVi:"Ghi đè phát hiện loại dự án tự động.",example:`{
|
|
115
|
+
"project": {
|
|
116
|
+
"type": "monorepo"
|
|
117
|
+
}
|
|
118
|
+
}`},"project.packageManager":{path:"project.packageManager",type:"string",default:'"auto"',validValues:["auto","npm","yarn","pnpm","bun"],description:"Override automatic package manager detection.",descriptionVi:"Ghi đè phát hiện trình quản lý gói tự động.",example:`{
|
|
119
|
+
"project": {
|
|
120
|
+
"packageManager": "pnpm"
|
|
121
|
+
}
|
|
122
|
+
}`},"project.framework":{path:"project.framework",type:"string",default:'"auto"',validValues:["auto","react","vue","angular","svelte","nextjs","nuxt","express","nestjs","fastify","none"],description:"Override automatic framework detection.",descriptionVi:"Ghi đè phát hiện framework tự động.",example:`{
|
|
123
|
+
"project": {
|
|
124
|
+
"framework": "nextjs"
|
|
125
|
+
}
|
|
126
|
+
}`},docs:{path:"docs",type:"object",default:"{}",description:"Configuration for documentation management including file size limits and splitting behavior.",descriptionVi:"Cấu hình quản lý tài liệu bao gồm giới hạn kích thước tệp và hành vi chia nhỏ.",effect:"Controls how documentation files are processed and split when they exceed size limits.",effectVi:"Điều khiển cách các tệp tài liệu được xử lý và chia nhỏ khi vượt quá giới hạn kích thước."},"docs.maxLoc":{path:"docs.maxLoc",type:"number",default:"800",description:"Maximum lines of code per documentation file before automatic splitting is triggered.",descriptionVi:"Số dòng code tối đa mỗi tệp tài liệu trước khi tự động chia nhỏ được kích hoạt.",effect:"When a documentation file exceeds this line count, the system will suggest or automatically split it into smaller files for better readability and maintenance.",effectVi:"Khi tệp tài liệu vượt quá số dòng này, hệ thống sẽ đề xuất hoặc tự động chia nhỏ thành các tệp nhỏ hơn để dễ đọc và bảo trì hơn.",example:`{
|
|
127
|
+
"docs": {
|
|
128
|
+
"maxLoc": 1000
|
|
129
|
+
}
|
|
130
|
+
}`},gemini:{path:"gemini",type:"object",default:"{}",description:"Configuration for Google Gemini API integration used for CLI commands and research tasks.",descriptionVi:"Cấu hình tích hợp Google Gemini API dùng cho lệnh CLI và tác vụ nghiên cứu.",effect:"Controls which Gemini model is used for research, web search, and other AI-powered CLI operations.",effectVi:"Điều khiển model Gemini nào được dùng cho nghiên cứu, tìm kiếm web và các thao tác CLI hỗ trợ AI khác."},"gemini.model":{path:"gemini.model",type:"string",default:'"gemini-3-flash-preview"',validValues:["gemini-2.5-flash","gemini-2.5-pro","gemini-3-pro-preview","gemini-3-flash-preview"],description:"Gemini model used for CLI commands and research operations. Pick a known model or type any valid model ID. Legacy gemini-3.0-* ids are auto-mapped on load.",descriptionVi:"Model Gemini dùng cho lệnh CLI và thao tác nghiên cứu. Chọn model có sẵn hoặc nhập ID model bất kỳ. Các id gemini-3.0-* cũ sẽ được tự động ánh xạ khi tải.",effect:"Determines which Gemini model handles research, web search, and other auxiliary tasks. Flash models are faster but less capable than Pro models.",effectVi:"Xác định model Gemini nào xử lý nghiên cứu, tìm kiếm web và các tác vụ phụ trợ khác. Model Flash nhanh hơn nhưng kém khả năng hơn model Pro.",example:`{
|
|
131
|
+
"gemini": {
|
|
132
|
+
"model": "gemini-2.5-pro"
|
|
133
|
+
}
|
|
134
|
+
}`},skills:{path:"skills",type:"object",default:"{}",description:"Configuration for skills system including research behavior and custom skill settings.",descriptionVi:"Cấu hình hệ thống kỹ năng bao gồm hành vi nghiên cứu và cài đặt kỹ năng tùy chỉnh.",effect:"Controls how skills are executed, particularly research operations and their AI provider choices.",effectVi:"Điều khiển cách các kỹ năng được thực thi, đặc biệt là thao tác nghiên cứu và lựa chọn nhà cung cấp AI."},"skills.research":{path:"skills.research",type:"object",default:"{}",description:"Configuration specific to the research skill behavior and AI provider selection.",descriptionVi:"Cấu hình riêng cho hành vi kỹ năng nghiên cứu và lựa chọn nhà cung cấp AI.",effect:"Determines whether research operations use Gemini CLI or Claude's built-in WebSearch tool.",effectVi:"Xác định liệu thao tác nghiên cứu có dùng Gemini CLI hay công cụ WebSearch tích hợp của Claude."},"skills.research.useGemini":{path:"skills.research.useGemini",type:"boolean",default:"true",description:"When enabled, uses Gemini CLI for research operations instead of Claude's WebSearch tool.",descriptionVi:"Khi bật, dùng Gemini CLI cho thao tác nghiên cứu thay vì công cụ WebSearch của Claude.",effect:"Gemini CLI offers faster search results and lower token costs for research, but requires Gemini API setup. WebSearch is built-in but more expensive.",effectVi:"Gemini CLI cung cấp kết quả tìm kiếm nhanh hơn và chi phí token thấp hơn cho nghiên cứu, nhưng cần thiết lập Gemini API. WebSearch tích hợp sẵn nhưng đắt hơn.",example:`{
|
|
135
|
+
"skills": {
|
|
136
|
+
"research": {
|
|
137
|
+
"useGemini": false
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}`},hooks:{path:"hooks",type:"object",default:"{}",description:"Configuration for lifecycle hooks that inject context, enforce rules, and enhance safety throughout the development workflow.",descriptionVi:"Cấu hình các hook vòng đời tiêm ngữ cảnh, thực thi quy tắc và tăng cường an toàn trong suốt quy trình phát triển.",effect:"Controls which hooks are active. Each hook fires at specific points in the workflow to inject context or enforce guardrails.",effectVi:"Điều khiển hook nào đang hoạt động. Mỗi hook kích hoạt tại các điểm cụ thể trong quy trình để tiêm ngữ cảnh hoặc thực thi bảo vệ."},"hooks.session-init":{path:"hooks.session-init",type:"boolean",default:"true",description:"Runs project detection and environment setup at the start of every Claude Code session.",descriptionVi:"Chạy phát hiện dự án và thiết lập môi trường khi bắt đầu mỗi phiên Claude Code.",effect:"When enabled, automatically detects project type, framework, package manager, and injects relevant context into the session.",effectVi:"Khi bật, tự động phát hiện loại dự án, framework, trình quản lý gói và tiêm ngữ cảnh liên quan vào phiên.",example:`{
|
|
141
|
+
"hooks": {
|
|
142
|
+
"session-init": false
|
|
143
|
+
}
|
|
144
|
+
}`},"hooks.subagent-init":{path:"hooks.subagent-init",type:"boolean",default:"true",description:"Injects context (paths, plans, reports) into spawned subagents to ensure consistency.",descriptionVi:"Tiêm ngữ cảnh (đường dẫn, kế hoạch, báo cáo) vào các subagent được tạo để đảm bảo nhất quán.",effect:"Ensures subagents inherit work context, know where to save reports, and follow the same plan structure as the parent agent.",effectVi:"Đảm bảo subagent kế thừa ngữ cảnh làm việc, biết nơi lưu báo cáo và tuân theo cùng cấu trúc kế hoạch với agent cha.",example:`{
|
|
145
|
+
"hooks": {
|
|
146
|
+
"subagent-init": false
|
|
147
|
+
}
|
|
148
|
+
}`},"hooks.descriptive-name":{path:"hooks.descriptive-name",type:"boolean",default:"true",description:"Injects descriptive naming context so agents generate meaningful, self-documenting file and variable names.",descriptionVi:"Tiêm ngữ cảnh đặt tên mô tả để agent tạo tên tệp và biến có ý nghĩa, tự tài liệu hóa.",effect:"When enabled, reminds the agent to use long, descriptive kebab-case names for files and clear variable naming conventions.",effectVi:"Khi bật, nhắc nhở agent sử dụng tên kebab-case dài, mô tả cho tệp và quy ước đặt tên biến rõ ràng.",example:`{
|
|
149
|
+
"hooks": {
|
|
150
|
+
"descriptive-name": false
|
|
151
|
+
}
|
|
152
|
+
}`},"hooks.dev-rules-reminder":{path:"hooks.dev-rules-reminder",type:"boolean",default:"true",description:"Injects development rules context before tool execution to maintain coding standards.",descriptionVi:"Tiêm ngữ cảnh quy tắc phát triển trước khi thực thi công cụ để duy trì chuẩn code.",effect:"Reminds the agent of coding standards, file naming conventions, and project-specific rules before file operations.",effectVi:"Nhắc nhở agent về chuẩn code, quy ước đặt tên tệp và quy tắc riêng của dự án trước thao tác tệp.",example:`{
|
|
153
|
+
"hooks": {
|
|
154
|
+
"dev-rules-reminder": false
|
|
155
|
+
}
|
|
156
|
+
}`},"hooks.usage-context-awareness":{path:"hooks.usage-context-awareness",type:"boolean",default:"true",description:"Injects usage-limit awareness into prompt context so the agent can react before overruns.",descriptionVi:"Tiêm nhận biết giới hạn sử dụng vào ngữ cảnh prompt để agent phản ứng trước khi vượt quá.",effect:"When enabled, reminder context can warn the agent to stay concise or split work when usage windows are tight.",effectVi:"Khi bật, ngữ cảnh nhắc nhở có thể cảnh báo agent nên ngắn gọn hơn hoặc chia nhỏ công việc khi cửa sổ sử dụng trở nên chặt.",example:`{
|
|
157
|
+
"hooks": {
|
|
158
|
+
"usage-context-awareness": false
|
|
159
|
+
}
|
|
160
|
+
}`},"hooks.context-tracking":{path:"hooks.context-tracking",type:"boolean",default:"true",description:"Tracks context window usage and injects awareness data so agents can optimize token consumption.",descriptionVi:"Theo dõi sử dụng cửa sổ ngữ cảnh và tiêm dữ liệu nhận biết để agent tối ưu hóa tiêu thụ token.",effect:"When enabled, monitors context percentage and remaining capacity, warning the agent when approaching limits to prevent truncation.",effectVi:"Khi bật, giám sát phần trăm ngữ cảnh và dung lượng còn lại, cảnh báo agent khi tiến gần giới hạn để ngăn cắt xén.",example:`{
|
|
161
|
+
"hooks": {
|
|
162
|
+
"context-tracking": false
|
|
163
|
+
}
|
|
164
|
+
}`},"hooks.scout-block":{path:"hooks.scout-block",type:"boolean",default:"true",description:"Blocks heavy directories (node_modules, .git, dist) from exploration to save tokens.",descriptionVi:"Chặn các thư mục nặng (node_modules, .git, dist) khỏi khám phá để tiết kiệm token.",effect:"Prevents the agent from reading irrelevant or large directories that waste tokens and context window space.",effectVi:"Ngăn agent đọc các thư mục không liên quan hoặc lớn lãng phí token và không gian cửa sổ ngữ cảnh.",example:`{
|
|
165
|
+
"hooks": {
|
|
166
|
+
"scout-block": false
|
|
167
|
+
}
|
|
168
|
+
}`},"hooks.privacy-block":{path:"hooks.privacy-block",type:"boolean",default:"true",description:"Blocks reading sensitive files (.env, credentials, secrets) to protect user privacy.",descriptionVi:"Chặn đọc các tệp nhạy cảm (.env, thông tin xác thực, bí mật) để bảo vệ quyền riêng tư người dùng.",effect:"When enabled, prompts user for permission before accessing files that may contain API keys, passwords, or other secrets.",effectVi:"Khi bật, nhắc người dùng cho phép trước khi truy cập tệp có thể chứa API keys, mật khẩu hoặc bí mật khác.",example:`{
|
|
169
|
+
"hooks": {
|
|
170
|
+
"privacy-block": false
|
|
171
|
+
}
|
|
172
|
+
}`},"hooks.simplify-gate":{path:"hooks.simplify-gate",type:"boolean",default:"true",description:"UserPromptSubmit hook that hard-blocks ship/merge/pr/deploy/publish verbs and soft-warns commit/finalize/release when the live `git diff HEAD` plus untracked files exceed the simplify thresholds. Bypass with env CK_SIMPLIFY_DISABLED=1.",descriptionVi:"Hook UserPromptSubmit chặn cứng các động từ ship/merge/pr/deploy/publish và cảnh báo nhẹ commit/finalize/release khi `git diff HEAD` cộng file chưa track vượt ngưỡng simplify. Bỏ qua bằng env CK_SIMPLIFY_DISABLED=1.",effect:"Stateless hook. Recomputes signals from live git on every fire. Hard-block exits with code 2; soft-warn injects additionalContext. Verb matching uses word boundaries plus negation guards.",effectVi:"Hook không trạng thái. Tính lại tín hiệu từ git mỗi lần chạy. Chặn cứng thoát mã 2; cảnh báo nhẹ chèn additionalContext. So khớp động từ dùng word boundary và bảo vệ phủ định.",example:`{
|
|
173
|
+
"hooks": {
|
|
174
|
+
"simplify-gate": false
|
|
175
|
+
}
|
|
176
|
+
}`},"simplify.threshold.locDelta":{path:"simplify.threshold.locDelta",type:"integer",default:"400",description:"Total LOC change (across all files) above which the simplify gate fires.",descriptionVi:"Tổng LOC thay đổi (toàn bộ file) vượt ngưỡng này thì cổng simplify kích hoạt.",effect:"Computed from `git diff --numstat HEAD --ignore-all-space` plus per-file line counts of untracked files.",effectVi:"Tính từ `git diff --numstat HEAD --ignore-all-space` cộng số dòng từng file chưa track.",example:`{
|
|
177
|
+
"simplify": {
|
|
178
|
+
"threshold": { "locDelta": 800 }
|
|
179
|
+
}
|
|
180
|
+
}`},"simplify.threshold.fileCount":{path:"simplify.threshold.fileCount",type:"integer",default:"8",description:"Number of changed files above which the simplify gate fires.",descriptionVi:"Số file thay đổi vượt ngưỡng này thì cổng simplify kích hoạt.",effect:"Counts unique files in the union of `git diff HEAD` tracked changes and `git ls-files --others --exclude-standard` untracked files.",effectVi:"Đếm file duy nhất trong hợp của thay đổi đã track (`git diff HEAD`) và file chưa track (`git ls-files --others --exclude-standard`).",example:`{
|
|
181
|
+
"simplify": {
|
|
182
|
+
"threshold": { "fileCount": 12 }
|
|
183
|
+
}
|
|
184
|
+
}`},"simplify.threshold.singleFileLoc":{path:"simplify.threshold.singleFileLoc",type:"integer",default:"200",description:"Per-file LOC change above which the simplify gate fires (matches CLAUDE.md 200-line modularization rule).",descriptionVi:"Thay đổi LOC mỗi file vượt ngưỡng này thì cổng simplify kích hoạt (khớp luật chia module 200 dòng trong CLAUDE.md).",effect:"Triggered if ANY single file's add+delete count crosses the threshold, even if total LOC and file count stay below their thresholds.",effectVi:"Kích hoạt nếu BẤT KỲ một file nào có tổng add+delete vượt ngưỡng, ngay cả khi tổng LOC và số file vẫn dưới ngưỡng.",example:`{
|
|
185
|
+
"simplify": {
|
|
186
|
+
"threshold": { "singleFileLoc": 300 }
|
|
187
|
+
}
|
|
188
|
+
}`},"simplify.gate.enabled":{path:"simplify.gate.enabled",type:"boolean",default:"false",description:"Master toggle for the simplify gate. Off by default (opt-in). Set true to activate; env CK_SIMPLIFY_DISABLED=1 always bypasses.",descriptionVi:"Công tắc chính cho cổng simplify. Tắt mặc định (opt-in). Đặt true để kích hoạt; env CK_SIMPLIFY_DISABLED=1 luôn bỏ qua.",effect:"When false (default), the hook exits 0 immediately on every prompt. Set true to enforce thresholds against ship/merge/pr/deploy/publish verbs.",effectVi:"Khi false (mặc định), hook thoát 0 ngay lập tức cho mọi prompt. Đặt true để áp dụng ngưỡng với động từ ship/merge/pr/deploy/publish.",example:`{
|
|
189
|
+
"simplify": {
|
|
190
|
+
"gate": { "enabled": true }
|
|
191
|
+
}
|
|
192
|
+
}`},"simplify.gate.hardVerbs":{path:"simplify.gate.hardVerbs",type:"array",default:'["ship", "merge", "pr", "deploy", "publish"]',description:"Verbs that HARD-BLOCK the prompt (exit code 2) when simplify thresholds are breached.",descriptionVi:"Động từ CHẶN CỨNG prompt (mã thoát 2) khi vượt ngưỡng simplify.",effect:"Matched case-insensitively with word boundaries (`\\b`) plus negation guards (`don't|never|not <verb>` and `ship on` idiom skip the match).",effectVi:"So khớp không phân biệt hoa thường với word boundary (`\\b`) cộng bảo vệ phủ định (`don't|never|not <verb>` và idiom `ship on` bỏ qua).",example:`{
|
|
193
|
+
"simplify": {
|
|
194
|
+
"gate": { "hardVerbs": ["release"] }
|
|
195
|
+
}
|
|
196
|
+
}`},"simplify.gate.softVerbs":{path:"simplify.gate.softVerbs",type:"array",default:'["commit", "finalize", "release"]',description:"Verbs that emit a non-blocking warning (additionalContext) when simplify thresholds are breached.",descriptionVi:"Động từ phát cảnh báo không chặn (additionalContext) khi vượt ngưỡng simplify.",effect:"Same matching rules as hardVerbs. The warning text points the user at `code-simplifier`.",effectVi:"Quy tắc khớp giống hardVerbs. Cảnh báo trỏ người dùng đến `code-simplifier`.",example:`{
|
|
197
|
+
"simplify": {
|
|
198
|
+
"gate": { "softVerbs": ["commit", "push"] }
|
|
199
|
+
}
|
|
200
|
+
}`},"updatePipeline.autoInitAfterUpdate":{path:"updatePipeline.autoInitAfterUpdate",type:"boolean",default:"false",description:"Automatically runs `ck init` after `ck update` when the installed kit content has a newer version.",descriptionVi:"Tự động chạy `ck init` sau `ck update` khi nội dung kit đã cài có phiên bản mới hơn.",effect:"Power users can reduce the update flow to one command. This setting is read from global config for update runs.",effectVi:"Người dùng nâng cao có thể rút gọn quy trình cập nhật còn một lệnh. Thiết lập này được đọc từ global config trong lúc update.",example:`{
|
|
201
|
+
"updatePipeline": {
|
|
202
|
+
"autoInitAfterUpdate": true,
|
|
203
|
+
"autoMigrateAfterUpdate": true,
|
|
204
|
+
"migrateProviders": ["codex"]
|
|
205
|
+
}
|
|
206
|
+
}`},"updatePipeline.autoMigrateAfterUpdate":{path:"updatePipeline.autoMigrateAfterUpdate",type:"boolean",default:"false",description:"Automatically runs `ck migrate` as an independent step after `ck update` for detected or configured providers.",descriptionVi:"Tự động chạy `ck migrate` như bước độc lập sau `ck update` cho các provider được phát hiện hoặc đã cấu hình.",effect:"Runs independently of kit init — even if kit is already at latest, providers can still be synced.",effectVi:"Chạy độc lập với kit init — ngay cả khi kit đã ở phiên bản mới nhất, provider vẫn có thể được đồng bộ.",example:`{
|
|
207
|
+
"updatePipeline": {
|
|
208
|
+
"autoInitAfterUpdate": true,
|
|
209
|
+
"autoMigrateAfterUpdate": true,
|
|
210
|
+
"migrateProviders": ["codex"]
|
|
211
|
+
}
|
|
212
|
+
}`},"updatePipeline.migrateProviders":{path:"updatePipeline.migrateProviders",type:'"auto" | string[]',default:'"auto"',validValues:["auto"],description:'Choose which providers are auto-migrated. Use `auto` to scan the filesystem, enter a comma-separated list such as `codex, cursor`, or paste a JSON array like `["codex"]` and the form will normalize it.',descriptionVi:'Chọn provider nào sẽ được auto-migrate. Dùng `auto` để quét hệ thống tệp, nhập danh sách phân tách bằng dấu phẩy như `codex, cursor`, hoặc dán JSON array như `["codex"]` và form sẽ tự chuẩn hóa.',effect:"`auto` targets every detected provider. A specific list limits the auto-migrate step to those providers only.",effectVi:"`auto` nhắm đến mọi provider được phát hiện. Danh sách cụ thể sẽ giới hạn bước auto-migrate chỉ còn các provider đó.",example:`{
|
|
213
|
+
"updatePipeline": {
|
|
214
|
+
"autoInitAfterUpdate": true,
|
|
215
|
+
"autoMigrateAfterUpdate": true,
|
|
216
|
+
"migrateProviders": ["codex"]
|
|
217
|
+
}
|
|
218
|
+
}`},statusline:{path:"statusline",type:"string",default:'"full"',validValues:["full","compact","minimal","none"],description:"Controls how much information is displayed in the Claude Code status line during operations.",descriptionVi:"Điều khiển lượng thông tin hiển thị trong dòng trạng thái Claude Code trong khi thao tác.",effect:"'full' shows all details (tokens, model, cost). 'compact' shows summary. 'minimal' shows only critical info. 'none' hides status line.",effectVi:"'full' hiển thị tất cả chi tiết (token, model, chi phí). 'compact' hiển thị tóm tắt. 'minimal' chỉ hiển thị thông tin quan trọng. 'none' ẩn dòng trạng thái.",example:`{
|
|
219
|
+
"statusline": "compact"
|
|
220
|
+
}`},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:`{
|
|
221
|
+
"statuslineColors": false
|
|
222
|
+
}`},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:`{
|
|
223
|
+
"statuslineQuota": false
|
|
224
|
+
}`},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:`{
|
|
225
|
+
"assertions": ["Use strict mode", "No console.logs"]
|
|
226
|
+
}`}};function zw(t,e,n){const r={...t},s=e.split(".");let i=r;for(let o=0;o<s.length-1;o++){const a=s[o];!(a in i)||typeof i[a]!="object"||i[a]===null?i[a]={}:i[a]={...i[a]},i=i[a]}return i[s[s.length-1]]=n,r}function ap(t,e){const n=e.split(".");let r=t;for(const s of n){if(r==null||typeof r!="object")return;r=r[s]}return r}function Vw(t,e){const n=e.split(".");let r=t;for(const s of n){if(!r.properties)return{};const i=r.properties;if(!i[s])return{};r=i[s]}return r}function uE(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 hE(t,e){if(!t)return null;const n=Fw[t];if(n)return n;if(!e)return null;const r=Vw(e,t);if(Object.keys(r).length===0)return null;const s=Array.isArray(r.enum)?r.enum.map(i=>String(i)):Array.isArray(r.oneOf)?r.oneOf.map(i=>{if(!i||typeof i!="object")return null;const o=i;return o.const!==void 0?String(o.const):null}).filter(i=>!!i):void 0;return{path:t,type:uE(r),default:r.default!==void 0?JSON.stringify(r.default):"n/a",validValues:s&&s.length>0?s:void 0,description:typeof r.description=="string"?r.description:"Schema-derived help is available for this field.",descriptionVi:typeof r.description=="string"?r.description:"Trường này đang hiển thị mô tả được suy ra từ schema."}}function fE(t,e){return t??e??null}function $o(t){return t==="auto"?"auto":Array.isArray(t)?t.join(", "):typeof t=="string"?t:""}function pE(t){const e=t.trim();return(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e).trim().toLowerCase()}function mE(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 Hw(t){const e=mE(t),n=(Array.isArray(e)?e:String(e).split(",")).map(pE).filter(Boolean).filter((r,s,i)=>i.indexOf(r)===s);return n.length===0||n.length===1&&n[0]==="auto"?"auto":n.filter(r=>r!=="auto")}function gE(t){return t.trim()===""?null:Hw(t)}const Wl="/api";function xE(t){return OP(t)}async function _u(t,e){if(t==="global"){const r=await sP();return{projectRoot:xE(r),path:_i(r,".ck.json")}}if(!e)throw new Error("Project ID is required for project config");const n=await Mw(e);return{projectRoot:n.path,path:_i(n.path,".claude",".ck.json")}}function Hm(t,e,n=""){if(t==null)return{};if(Array.isArray(t))return n?{[n]:e}:{};if(typeof t!="object")return n?{[n]:e}:{};const r=Object.entries(t);if(r.length===0)return n?{[n]:e}:{};const s={};for(const[i,o]of r){const a=n?`${n}.${i}`:i;Object.assign(s,Hm(o,e,a))}return s}function Wm(t,e){const n={...t};for(const[r,s]of Object.entries(e)){const i=n[r];if(s&&typeof s=="object"&&!Array.isArray(s)&&i&&typeof i=="object"&&!Array.isArray(i)){n[r]=Wm(i,s);continue}n[r]=s}return n}function Um(t){const e=dE.safeParse(sE(t));if(!e.success)throw new Error(e.error.issues[0]?.message??"Config validation failed");return e.data}function bE(t,e){const n=zw({},t,e);return Um(n)}async function Iu(t,e){const n=await eP(t);try{return Um(n)}catch(r){if(e?.fallbackToEmpty)return console.warn("[ck-config-api] Config validation failed, using raw config as-is",r),n;throw r}}async function ux(t){if(nt()){const r=await _u("global"),s=await Iu(r.projectRoot,{fallbackToEmpty:!0});return{config:s,sources:Hm(s,"global"),globalPath:r.path,projectPath:null}}const e=`${Wl}/ck-config`,n=await fetch(e);if(!n.ok)throw new Error(`Failed to fetch ck-config: ${n.status}`);return n.json()}async function Ld(t,e){if(nt()){const s=await _u(t,e),i=await Iu(s.projectRoot,{fallbackToEmpty:!0});return{config:i,sources:Hm(i,t),globalPath:t==="global"?s.path:"",projectPath:t==="project"?s.path:null}}const n=new URLSearchParams({scope:t});e&&n.set("projectId",e);const r=await fetch(`${Wl}/ck-config?${n}`);if(!r.ok)throw new Error(`Failed to fetch ck-config: ${r.status}`);return r.json()}async function Ww(t){if(nt()){const n=await _u(t.scope,t.projectId),r=await Iu(n.projectRoot,{fallbackToEmpty:!0}),s=Wm(r,Um(t.config));return await Sw(n.projectRoot,s),{success:!0,path:n.path,scope:t.scope,config:s}}const e=await fetch(`${Wl}/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 Uw(){if(nt())return nO;const t=await fetch(`${Wl}/ck-config/schema`);if(!t.ok)throw new Error(`Failed to fetch schema: ${t.status}`);return t.json()}async function yE(t,e,n,r){if(nt()){const i=await _u(n,r),o=await Iu(i.projectRoot,{fallbackToEmpty:!0}),a=bE(t,e),l=Wm(o,a);await Sw(i.projectRoot,l);return}const s=await fetch(`${Wl}/ck-config/field`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:n,projectId:r,fieldPath:t,value:e})});if(!s.ok){const i=await s.json().catch(()=>({error:"Unknown error"}));throw new Error(i.error||`Failed to update field: ${s.status}`)}}var lp;(function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WINDOW_CREATED="tauri://window-created",t.WEBVIEW_CREATED="tauri://webview-created",t.DRAG_ENTER="tauri://drag-enter",t.DRAG_OVER="tauri://drag-over",t.DRAG_DROP="tauri://drag-drop",t.DRAG_LEAVE="tauri://drag-leave"})(lp||(lp={}));async function vE(t,e){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(t,e),await Ae("plugin:event|unlisten",{event:t,eventId:e})}async function cp(t,e,n){var r;const s=typeof n?.target=="string"?{kind:"AnyLabel",label:n.target}:(r=n?.target)!==null&&r!==void 0?r:{kind:"Any"};return Ae("plugin:event|listen",{event:t,target:s,handler:QN(e)}).then(i=>async()=>vE(t,i))}const wE=Object.freeze(Object.defineProperty({__proto__:null,get TauriEvent(){return lp},listen:cp},Symbol.toStringTag,{value:"Module"}));async function kE(t,e){return await Rd.load(t,e)}class SE{get store(){return this._store||(this._store=kE(this.path,this.options)),this._store}constructor(e,n){this.path=e,this.options=n}async init(){await this.store}async set(e,n){return(await this.store).set(e,n)}async get(e){return(await this.store).get(e)}async has(e){return(await this.store).has(e)}async delete(e){return(await this.store).delete(e)}async clear(){await(await this.store).clear()}async reset(){await(await this.store).reset()}async keys(){return(await this.store).keys()}async values(){return(await this.store).values()}async entries(){return(await this.store).entries()}async length(){return(await this.store).length()}async reload(e){await(await this.store).reload(e)}async save(){await(await this.store).save()}async onKeyChange(e,n){return(await this.store).onKeyChange(e,n)}async onChange(e){return(await this.store).onChange(e)}async close(){this._store&&await(await this._store).close()}}class Rd extends JN{constructor(e){super(e)}static async load(e,n){const r=await Ae("plugin:store|load",{path:e,options:n});return new Rd(r)}static async get(e){return await Ae("plugin:store|get_store",{path:e}).then(n=>n?new Rd(n):null)}async set(e,n){await Ae("plugin:store|set",{rid:this.rid,key:e,value:n})}async get(e){const[n,r]=await Ae("plugin:store|get",{rid:this.rid,key:e});return r?n:void 0}async has(e){return await Ae("plugin:store|has",{rid:this.rid,key:e})}async delete(e){return await Ae("plugin:store|delete",{rid:this.rid,key:e})}async clear(){await Ae("plugin:store|clear",{rid:this.rid})}async reset(){await Ae("plugin:store|reset",{rid:this.rid})}async keys(){return await Ae("plugin:store|keys",{rid:this.rid})}async values(){return await Ae("plugin:store|values",{rid:this.rid})}async entries(){return await Ae("plugin:store|entries",{rid:this.rid})}async length(){return await Ae("plugin:store|length",{rid:this.rid})}async reload(e){await Ae("plugin:store|reload",{rid:this.rid,...e})}async save(){await Ae("plugin:store|save",{rid:this.rid})}async onKeyChange(e,n){return await cp("store://change",r=>{r.payload.resourceId===this.rid&&r.payload.key===e&&n(r.payload.exists?r.payload.value:void 0)})}async onChange(e){return await cp("store://change",n=>{n.payload.resourceId===this.rid&&e(n.payload.key,n.payload.exists?n.payload.value:void 0)})}}const CE="control-center-state.json",Km="desktopOnboardingCompleted",dp=new SE(CE,{defaults:{[Km]:!1}});async function jE(){return!!await dp.get(Km)}async function NE(t){await dp.set(Km,t),await dp.save()}function PE({projectCount:t,projectsLoading:e}){const n=nt(),[r,s]=g.useState(n),[i,o]=g.useState(!1),[a,l]=g.useState(!1);return g.useEffect(()=>{let d=!1;if(!n){s(!1),o(!1);return}if(a){s(!1),o(!1);return}if(e){s(!0);return}async function u(){s(!0);try{if(await jE()||t>0){d||o(!1);return}const f=await Ld("global"),p=Object.keys(f.config).length>0;d||o(!p)}catch(h){console.error("[desktop-onboarding] Failed to evaluate first-run state",h),d||o(t===0)}finally{d||s(!1)}}return u(),()=>{d=!0}},[n,a,t,e]),{checking:r,shouldShowOnboarding:i,dismissOnboarding:()=>{l(!0),s(!1),o(!1)}}}function OE(){const[t,e]=g.useState(!1);return g.useEffect(()=>{},[]),{updateAvailable:t}}function yo({storageKey:t,defaultSize:e,minSize:n,maxSize:r,direction:s="horizontal",invert:i=!1}){const[o,a]=g.useState(()=>{if(typeof window>"u")return e;const p=localStorage.getItem(t);if(p){const m=Number.parseInt(p,10);if(!Number.isNaN(m)&&m>=n&&m<=r)return m}return e}),[l,d]=g.useState(!1);g.useEffect(()=>{localStorage.setItem(t,String(o))},[o,t]);const u=g.useCallback(p=>{p.preventDefault(),d(!0);const m=s==="horizontal"?p.clientX:p.clientY,x=o,b=k=>{const w=((s==="horizontal"?k.clientX:k.clientY)-m)*(i?-1:1),C=Math.max(n,Math.min(r,x+w));a(C)},y=()=>{d(!1),document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",y),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",b),document.addEventListener("mouseup",y),document.body.style.cursor=s==="horizontal"?"col-resize":"row-resize",document.body.style.userSelect="none"},[o,n,r,s,i]),h=g.useCallback(()=>{a(e)},[e]),f=g.useCallback(p=>{a(Math.max(n,Math.min(r,p)))},[n,r]);return{size:o,isDragging:l,startDrag:u,setSize:f,reset:h}}const EE=()=>{const{t}=ee(),e=Ft(),n=sr(),{projectId:r}=zl(),s=nt();OE();const[i,o]=g.useState(null);g.useEffect(()=>{r&&o(r)},[r]),g.useEffect(()=>{if(!s)return;let M=!1,R;return(async()=>{try{const{listen:_}=await YN(async()=>{const{listen:F}=await Promise.resolve().then(()=>wE);return{listen:F}},[]);if(M)return;const $=await _("tray-open",F=>{const z=F.payload;if(z){if(z.destination==="project"&&z.projectId){e(`/project/${encodeURIComponent(z.projectId)}`);return}if(z.destination==="settings"){if(z.projectId){e(`/config/project/${encodeURIComponent(z.projectId)}`);return}e("/config/global");return}e("/dashboard")}});if(M){$();return}R=$}catch(_){M||console.error("[desktop-tray] Failed to register tray-open listener",_)}})(),()=>{M=!0,R?.()}},[s,e]);const[a,l]=g.useState(()=>typeof window<"u"&&localStorage.getItem("claudekit-theme")||"dark"),[d]=g.useState(!0),[u,h]=g.useState(!1);g.useEffect(()=>{const M=R=>{(R.metaKey||R.ctrlKey)&&R.key==="k"&&(R.preventDefault(),h(_=>!_))};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[]);const{size:f,isDragging:p,startDrag:m,setSize:x}=yo({storageKey:"claudekit-sidebar-width",defaultSize:288,minSize:56,maxSize:400}),b=f<=56,{projects:y,loading:k,error:v,addProject:w,reload:C}=GP(),{checking:j,shouldShowOnboarding:S,dismissOnboarding:P}=PE({projectCount:y.length,projectsLoading:k}),D=async M=>{await w(M)};g.useEffect(()=>{const M=n.pathname.startsWith("/project/");y.length===0||r||!M||e(`/project/${y[0].id}`,{replace:!0})},[y,r,e,n.pathname]),g.useEffect(()=>{!s||j||S&&n.pathname!=="/onboarding"&&e("/onboarding",{replace:!0})},[s,n.pathname,e,j,S]),g.useEffect(()=>{const M=window.document.documentElement;a==="dark"?(M.classList.add("dark"),M.setAttribute("data-theme","dark")):(M.classList.remove("dark"),M.setAttribute("data-theme","light")),localStorage.setItem("claudekit-theme",a)},[a]);const A=()=>l(M=>M==="light"?"dark":"light"),N=g.useMemo(()=>y.find(M=>M.id===i)||null,[y,i]);g.useEffect(()=>{if(!s||!r)return;const M=encodeURIComponent(r),R=F=>n.pathname===F||n.pathname.startsWith(`${F}/`);if(!(R(`/project/${r}`)||R(`/project/${M}`)||R(`/config/project/${r}`)||R(`/config/project/${M}`)||R(`/sessions/${r}`)||R(`/sessions/${M}`)))return;const $=y.find(F=>F.id===r);$?.path&&IP($.path).catch(F=>{console.error("[desktop-tray] Failed to touch project recency",F)})},[s,n.pathname,y,r]);const T=M=>{e(`/project/${M}`)},I=()=>{x(b?288:56)};if(k||s&&j)return c.jsx("div",{className:"flex h-screen w-full bg-dash-bg text-dash-text items-center justify-center",children:c.jsx("div",{className:"animate-pulse text-dash-text-muted",children:t("loading")})});if(v)return c.jsx("div",{className:"flex h-screen w-full bg-dash-bg text-dash-text items-center justify-center",children:c.jsxs("div",{className:"text-red-500",children:[t("error"),": ",v]})});const O=s&&n.pathname==="/onboarding",E={project:N,isConnected:d,theme:a,onToggleTheme:A,reloadProjects:C,dismissDesktopOnboarding:P};return O?c.jsx("div",{className:"flex h-screen w-full bg-dash-bg text-dash-text overflow-hidden font-sans transition-colors duration-300",children:c.jsx("main",{className:"flex flex-1 flex-col overflow-hidden p-4 md:p-6",children:c.jsx(U0,{context:E})})}):c.jsxs("div",{className:"flex h-screen w-full bg-dash-bg text-dash-text overflow-hidden font-sans transition-colors duration-300",children:[c.jsx(kP,{open:u,projects:y,onClose:()=>h(!1)}),c.jsx(UP,{projects:y,currentProjectId:i,isCollapsed:b,width:f,isConnected:d,theme:a,onSwitchProject:T,onToggle:I,onAddProject:D,onToggleTheme:A}),c.jsx(_n,{direction:"horizontal",isDragging:p,onMouseDown:m}),c.jsx("div",{className:"flex-1 flex flex-col min-w-0 h-full relative",children:c.jsx("main",{className:"flex-1 flex flex-col overflow-hidden p-4 md:p-6",children:c.jsx(U0,{context:E})})})]})};function ld(t){return t.toLowerCase().trim().replace(/[`*_~]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function DE(t){return t.split(`
|
|
227
|
+
`).flatMap(e=>{const n=/^(#{1,6})\s+(.+)$/.exec(e.trim());return n?[{level:n[1].length,text:n[2].trim(),id:ld(n[2])}]:[]})}function Rr(t,e){const n=/(\*\*(.+?)\*\*|\*(.+?)\*|_(.+?)_|`([^`]+)`|\[([^\]]+)\]\(([^)]+)\))/g,r=[];let s=0,i=0;for(const o of t.matchAll(n)){o.index!==void 0&&o.index>s&&r.push(t.slice(s,o.index));const a=`${e}-inline-${i++}`;o[0].startsWith("**")?r.push(c.jsx("strong",{children:o[2]},a)):o[0].startsWith("`")?r.push(c.jsx("code",{className:"bg-[var(--dash-surface)] border border-[var(--dash-border)] px-1.5 py-0.5 rounded text-sm font-mono text-[var(--dash-accent)]",children:o[5]},a)):o[0].startsWith("[")?r.push(c.jsx("a",{href:o[7],target:"_blank",rel:"noopener noreferrer",className:"text-[var(--dash-accent)] hover:underline",children:o[6]},a)):r.push(c.jsx("em",{children:o[3]??o[4]},a)),o.index!==void 0&&(s=o.index+o[0].length)}return s<t.length&&r.push(t.slice(s)),r.length===1?r[0]:c.jsx(c.Fragment,{children:r})}const ui=({content:t,className:e=""})=>{const n=t.split(`
|
|
228
|
+
`),r=[];let s=0,i=0;function o(){return i+=1,`md-${i}`}if(n[0]?.trim()==="---"){for(s=1;s<n.length&&n[s]?.trim()!=="---";)s++;s++}for(;s<n.length;){const a=n[s];if(a.startsWith("```")){const l=a.slice(3).trim(),d=[];for(s++;s<n.length&&!n[s].startsWith("```");)d.push(n[s]),s++;const u=o();r.push(c.jsxs("div",{className:"my-3",children:[l&&c.jsx("div",{className:"text-[10px] font-mono text-[var(--dash-text-muted)] bg-[var(--dash-surface)] border border-b-0 border-[var(--dash-border)] rounded-t px-3 py-1",children:l}),c.jsx("pre",{className:["overflow-x-auto p-4 text-xs font-mono text-[var(--dash-text)]","bg-[var(--dash-surface)] border border-[var(--dash-border)]",l?"rounded-b":"rounded"].join(" "),children:c.jsx("code",{children:d.join(`
|
|
229
|
+
`)})})]},u)),s++;continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(a.trim())){r.push(c.jsx("hr",{className:"border-[var(--dash-border)] my-4"},o())),s++;continue}if(a.startsWith("### ")){const l=a.slice(4);r.push(c.jsx("h3",{id:ld(l),className:"text-sm font-semibold text-[var(--dash-text)] mt-4 mb-1 scroll-mt-24",children:Rr(l,`h3-${i}`)},o())),s++;continue}if(a.startsWith("## ")){const l=a.slice(3);r.push(c.jsx("h2",{id:ld(l),className:"text-base font-semibold text-[var(--dash-text)] mt-5 mb-2 pb-1 border-b border-[var(--dash-border)] scroll-mt-24",children:Rr(l,`h2-${i}`)},o())),s++;continue}if(a.startsWith("# ")){const l=a.slice(2);r.push(c.jsx("h1",{id:ld(l),className:"text-xl font-bold text-[var(--dash-text)] mt-4 mb-2 first:mt-0 scroll-mt-24",children:Rr(l,`h1-${i}`)},o())),s++;continue}if(a.trim().startsWith("|")&&/^\|(?:\s*:?-+:?\s*\|)+\s*$/.test(n[s+1]?.trim()??"")){const l=a.trim().split("|").slice(1,-1).map(h=>h.trim()),d=[];for(s+=2;s<n.length&&n[s].trim().startsWith("|");)d.push(n[s].trim().split("|").slice(1,-1).map(h=>h.trim())),s++;const u=o();r.push(c.jsx("div",{className:"my-4 overflow-x-auto rounded-lg border border-[var(--dash-border)]",children:c.jsxs("table",{className:"min-w-full text-sm",children:[c.jsx("thead",{className:"bg-[var(--dash-surface)] text-[var(--dash-text)]",children:c.jsx("tr",{children:l.map((h,f)=>c.jsx("th",{className:"px-3 py-2 text-left font-semibold",children:Rr(h,`${u}-head-${f}`)},`${u}-head-${f}`))})}),c.jsx("tbody",{children:d.map((h,f)=>c.jsx("tr",{className:"border-t border-[var(--dash-border)] text-[var(--dash-text-muted)]",children:h.map((p,m)=>c.jsx("td",{className:"px-3 py-2 align-top",children:Rr(p,`${u}-cell-${f}-${m}`)},`${u}-cell-${f}-${m}`))},`${u}-row-${f}`))})]})},u));continue}if(a.startsWith("> ")){const l=[];for(;s<n.length&&n[s].startsWith("> ");)l.push(n[s].slice(2)),s++;const d=o();r.push(c.jsx("blockquote",{className:"border-l-2 border-[var(--dash-accent)] pl-4 italic text-[var(--dash-text-muted)] my-2",children:l.map((u,h)=>c.jsx("p",{className:"text-sm leading-relaxed",children:Rr(u,`${d}-q${h}`)},`${d}-q${h}`))},d));continue}if(/^\s*[-*+] /.test(a)){const l=[];for(;s<n.length&&/^\s*[-*+] /.test(n[s]);)l.push(n[s].replace(/^\s*[-*+] /,"")),s++;const d=o();r.push(c.jsx("ul",{className:"list-disc pl-6 space-y-1 my-2",children:l.map((u,h)=>c.jsx("li",{className:"text-sm text-[var(--dash-text)] leading-relaxed",children:Rr(u,`${d}-li${h}`)},`${d}-li${h}`))},d));continue}if(/^\d+\. /.test(a)){const l=[];for(;s<n.length&&/^\d+\. /.test(n[s]);)l.push(n[s].replace(/^\d+\. /,"")),s++;const d=o();r.push(c.jsx("ol",{className:"list-decimal pl-6 space-y-1 my-2",children:l.map((u,h)=>c.jsx("li",{className:"text-sm text-[var(--dash-text)] leading-relaxed",children:Rr(u,`${d}-ol${h}`)},`${d}-ol${h}`))},d));continue}if(a.trim()===""){r.push(c.jsx("div",{className:"h-2"},o())),s++;continue}r.push(c.jsx("p",{className:"text-sm text-[var(--dash-text)] leading-relaxed my-1",children:Rr(a,`p-${i}`)},o())),s++}return c.jsx("div",{className:`markdown-content ${e}`.trim(),children:r})};function ME(){const[t,e]=g.useState([]),[n,r]=g.useState(!0),[s,i]=g.useState(null),o=g.useCallback(async()=>{try{if(r(!0),i(null),nt()){const d=await jw();e(d.map(u=>({...u,model:u.model??null,color:u.color??null})));return}const a=await fetch("/api/agents/browser");if(!a.ok)throw new Error(`Request failed: ${a.status}`);const l=await a.json();e(l.agents)}catch(a){i(a instanceof Error?a.message:"Failed to load agents")}finally{r(!1)}},[]);return g.useEffect(()=>{o()},[o]),{agents:t,loading:n,error:s,reload:o}}function AE(t){const[e,n]=g.useState(null),[r,s]=g.useState(!1),[i,o]=g.useState(null),a=g.useCallback(async()=>{if(t)try{if(s(!0),o(null),nt()){const u=await fP(t);n({...u,model:u.model??null,color:u.color??null,frontmatter:u.frontmatter,body:u.body});return}const l=await fetch(`/api/agents/browser/${encodeURIComponent(t)}`);if(l.status===404)throw new Error("Agent not found");if(!l.ok)throw new Error(`Request failed: ${l.status}`);const d=await l.json();n(d)}catch(l){o(l instanceof Error?l.message:"Failed to load agent")}finally{s(!1)}},[t]);return g.useEffect(()=>{a()},[a]),{agent:e,loading:r,error:i}}function TE(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3.5 h-3.5 shrink-0 text-dash-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 3.104v5.714a2.25 2.25 0 01-.659 1.591L5 14.5M9.75 3.104c-.251.023-.501.05-.75.082m.75-.082a24.301 24.301 0 014.5 0m0 0v5.714a2.25 2.25 0 001.357 2.059l1.045.467A4.5 4.5 0 0121 15.75v.75m-4.5-6.75a.75.75 0 00-.75.75v3a.75.75 0 001.5 0v-3a.75.75 0 00-.75-.75z"})})}function Kw(t){if(!t)return"unset";const e=t.toLowerCase();return e.includes("opus")?"opus":e.includes("sonnet")?"sonnet":e.includes("haiku")?"haiku":"unset"}function LE(t){if(!t)return"unset";const e=Kw(t);return e!=="unset"?e:t.length>16?`${t.slice(0,14)}…`:t}const RE=({label:t,active:e,onClick:n})=>c.jsx("button",{type:"button",onClick:n,className:["px-2.5 py-0.5 rounded-full text-xs font-medium border transition-colors",e?"bg-dash-accent-subtle text-dash-accent border-dash-accent/30":"bg-transparent text-dash-text-muted border-dash-border hover:border-dash-accent/40 hover:text-dash-text"].join(" "),children:t});function _E({agent:t,selected:e,onClick:n}){return c.jsxs("button",{type:"button",onClick:n,className:["w-full flex items-start gap-2 px-3 py-2 rounded-md transition-colors text-left group",e?"bg-dash-accent/10 border border-dash-accent/30":"hover:bg-dash-surface-hover border border-transparent"].join(" "),children:[c.jsx(TE,{}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[c.jsx("span",{className:"text-sm font-semibold text-dash-accent font-mono",children:t.name}),t.model&&c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-medium shrink-0",children:LE(t.model)})]}),t.description&&c.jsx("p",{className:"text-xs text-dash-text-muted mt-0.5 truncate",children:t.description})]})]})}function IE({label:t,count:e}){return c.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[c.jsx("span",{className:"text-xs font-bold text-dash-text-muted uppercase tracking-wider flex-1",children:t}),c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold",children:e})]})}const $E=new Set(["name","description","color"]),BE=({frontmatter:t})=>{const e=Object.entries(t).filter(([n,r])=>!$E.has(n)&&r!==void 0&&r!==null&&r!=="");return e.length===0?null:c.jsx("div",{className:"rounded-lg border border-dash-border overflow-hidden text-sm",children:c.jsx("table",{className:"w-full",children:c.jsx("tbody",{children:e.map(([n,r])=>c.jsxs("tr",{className:"border-b border-dash-border last:border-0",children:[c.jsx("td",{className:"px-3 py-2 font-mono text-xs text-dash-text-muted bg-dash-surface w-32 shrink-0 align-top",children:n}),c.jsx("td",{className:"px-3 py-2 text-xs text-dash-text break-all",children:typeof r=="object"?JSON.stringify(r):String(r)})]},n))})})})},FE=({slug:t})=>{const{t:e}=ee(),{agent:n,loading:r,error:s}=AE(t);return r?c.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-dash-text-muted",children:e("loading")}):s?c.jsx("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm",children:s}):n?c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("h2",{className:"text-base font-semibold text-dash-text font-mono truncate flex-1",children:n.name}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:e("sessionReadOnly")})]}),n.description&&c.jsx("div",{className:"rounded-lg border border-dash-border bg-dash-surface px-4 py-3",children:c.jsx("p",{className:"text-sm text-dash-text-muted",children:n.description})}),c.jsx("div",{className:"flex items-center gap-2 text-xs text-dash-text-muted",children:c.jsxs("span",{className:"font-mono px-2 py-0.5 rounded bg-dash-surface border border-dash-border text-dash-accent",children:[n.dirLabel,"/",t,".md"]})}),c.jsx(BE,{frontmatter:n.frontmatter}),n.body&&c.jsx("div",{className:"rounded-lg border border-dash-border bg-dash-surface p-5 overflow-x-auto",children:c.jsx(ui,{content:n.body})})]}):null},zE=({message:t})=>c.jsx("div",{className:"flex items-center justify-center h-full text-sm text-dash-text-muted",children:t}),VE=()=>{const{t}=ee(),{agents:e,loading:n,error:r}=ME(),[s,i]=g.useState(""),[o,a]=g.useState("all"),[l,d]=g.useState(null),{size:u,isDragging:h,startDrag:f}=yo({storageKey:"ck-agents-panel-width",defaultSize:380,minSize:260,maxSize:650}),p=g.useMemo(()=>{let b=e;if(s.trim()){const y=s.toLowerCase();b=b.filter(k=>k.name.toLowerCase().includes(y)||k.description.toLowerCase().includes(y))}return o!=="all"&&(b=b.filter(y=>Kw(y.model)===o)),b},[e,s,o]),m=g.useMemo(()=>{const b=new Map;for(const y of p){const k=b.get(y.dirLabel)??[];k.push(y),b.set(y.dirLabel,k)}return b},[p]),x=[{key:"all",label:t("filterAll")},{key:"opus",label:"Opus"},{key:"sonnet",label:"Sonnet"},{key:"haiku",label:"Haiku"},{key:"unset",label:"Unset"}];return c.jsxs("div",{className:"flex h-full overflow-hidden",children:[c.jsxs("div",{style:{width:`${u}px`},className:"shrink-0 flex flex-col overflow-hidden border-r border-dash-border",children:[c.jsxs("div",{className:"shrink-0 px-4 pt-4 pb-3 border-b border-dash-border",children:[c.jsxs("div",{className:"flex items-start justify-between mb-3",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-base font-bold text-dash-text",children:t("agentsBrowser")}),!n&&!r&&c.jsx("p",{className:"text-xs text-dash-text-muted mt-0.5",children:t("agentsBrowserCount").replace("{count}",String(e.length))}),c.jsx("p",{className:"text-[11px] text-dash-text-muted font-mono mt-0.5",children:"~/.claude/agents/"})]}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:t("sessionReadOnly")})]}),c.jsxs("div",{className:"relative mb-2",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-dash-text-muted pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),c.jsx("input",{type:"text",value:s,onChange:b=>i(b.target.value),placeholder:t("searchAgentsPlaceholder"),className:"w-full pl-9 pr-4 py-2 text-sm bg-dash-surface border border-dash-border rounded-lg text-dash-text placeholder:text-dash-text-muted focus:outline-none focus:border-dash-accent/50 transition-colors"}),s&&c.jsx("button",{type:"button",onClick:()=>i(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-dash-text-muted hover:text-dash-text transition-colors",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),c.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:x.map(({key:b,label:y})=>c.jsx(RE,{label:y,active:o===b,onClick:()=>a(b)},b))})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-2 py-2",children:[n&&c.jsx("div",{className:"flex flex-1 items-center justify-center text-dash-text-muted text-sm p-8",children:t("loading")}),!n&&r&&c.jsx("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm m-2",children:r}),!n&&!r&&m.size===0&&c.jsx("div",{className:"flex items-center justify-center p-8 text-dash-text-muted text-sm",children:t("noAgentsFound")}),!n&&!r&&m.size>0&&c.jsx("div",{className:"flex flex-col gap-2 pb-4",children:Array.from(m.entries()).map(([b,y])=>c.jsxs("div",{children:[m.size>1&&c.jsx(IE,{label:b,count:y.length}),c.jsx("div",{className:"space-y-0.5",children:y.map(k=>c.jsx(_E,{agent:k,selected:l===k.slug,onClick:()=>d(k.slug)},`${k.dirLabel}/${k.slug}`))})]},b))})]})]}),c.jsx(_n,{onMouseDown:f,isDragging:h,direction:"horizontal"}),c.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:l?c.jsx(FE,{slug:l}):c.jsx(zE,{message:t("selectToView")})})]})};function HE(){const[t,e]=g.useState([]),[n,r]=g.useState(!0),[s,i]=g.useState(null),o=g.useCallback(async()=>{try{if(r(!0),i(null),nt()){e(await Nw());return}const a=await fetch("/api/commands");if(!a.ok)throw new Error(`HTTP ${a.status}`);const l=await a.json();e(l.tree)}catch(a){i(a instanceof Error?a.message:"Failed to load")}finally{r(!1)}},[]);return g.useEffect(()=>{o()},[o]),{tree:t,loading:n,error:s,reload:o}}function WE(t){const[e,n]=g.useState(null),[r,s]=g.useState(!1),[i,o]=g.useState(null),a=g.useCallback(async()=>{if(!t){n(null);return}try{if(s(!0),o(null),nt()){const h=await pP(t.replace(/\//g,"--"));n(h);return}const l=t.replace(/\//g,"--"),d=await fetch(`/api/commands/detail/${encodeURIComponent(l)}`);if(!d.ok)throw new Error(`HTTP ${d.status}`);const u=await d.json();n(u)}catch(l){o(l instanceof Error?l.message:"Failed to load")}finally{s(!1)}},[t]);return g.useEffect(()=>{a()},[a]),{detail:e,loading:r,error:i,reload:a}}function Gw(t){const e=[];for(const n of t)n.children?e.push(...Gw(n.children)):e.push(n);return e}function qw(t){return Gw(t).length}function UE(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7a2 2 0 012-2h4l2 2h8a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2V7z"})})}function Yw({open:t}){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:`w-3 h-3 shrink-0 transition-transform ${t?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}function KE(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3.5 h-3.5 shrink-0 text-dash-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3"})})}function Xw(t,e){if(!e)return!0;const n=e.toLowerCase();return t.name.toLowerCase().includes(n)||t.description?.toLowerCase().includes(n)?!0:t.children?t.children.some(r=>Xw(r,n)):!1}function Zw(t,e){return e?t.filter(n=>Xw(n,e)).map(n=>n.children?{...n,children:Zw(n.children,e)}:n):t}function Qw({node:t,selected:e,onSelect:n}){return c.jsxs("button",{type:"button",onClick:()=>n(t.path),className:["w-full flex items-start gap-2 px-3 py-2 rounded-md transition-colors text-left group",e?"bg-dash-accent/10 border border-dash-accent/30":"hover:bg-dash-surface-hover border border-transparent"].join(" "),children:[c.jsx(KE,{}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("span",{className:"text-sm font-semibold text-dash-accent font-mono",children:["/",t.name]}),t.description&&c.jsx("p",{className:"text-xs text-dash-text-muted mt-0.5 truncate",children:t.description})]})]})}function Jw({node:t,depth:e,forceOpen:n,selectedPath:r,onSelect:s}){const[i,o]=g.useState(!0),a=n||i,l=qw(t.children??[]);return c.jsxs("div",{className:e>0?"ml-3 border-l border-dash-border pl-2":"",children:[c.jsxs("button",{type:"button",onClick:()=>o(d=>!d),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-dash-surface-hover transition-colors text-left",children:[c.jsx(Yw,{open:a}),c.jsx(UE,{}),c.jsx("span",{className:"text-xs font-bold text-dash-text-muted uppercase tracking-wider flex-1",children:t.name}),c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold",children:l})]}),a&&c.jsx("div",{className:"mt-0.5 space-y-0.5",children:(t.children??[]).map(d=>d.children?c.jsx(Jw,{node:d,depth:e+1,forceOpen:n,selectedPath:r,onSelect:s},d.path):c.jsx(Qw,{node:d,selected:r===d.path,onSelect:s},d.path))})]})}function GE({nodes:t,forceOpen:e,selectedPath:n,onSelect:r,label:s}){const[i,o]=g.useState(!0),a=e||i;return t.length===0?null:c.jsxs("div",{children:[c.jsxs("button",{type:"button",onClick:()=>o(l=>!l),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-dash-surface-hover transition-colors text-left",children:[c.jsx(Yw,{open:a}),c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4 shrink-0 text-dash-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"})}),c.jsx("span",{className:"text-xs font-bold text-dash-text-muted uppercase tracking-wider flex-1",children:s}),c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold",children:t.length})]}),a&&c.jsx("div",{className:"mt-0.5 space-y-0.5",children:t.map(l=>c.jsx(Qw,{node:l,selected:n===l.path,onSelect:r},l.path))})]})}const qE=({commandPath:t})=>{const{t:e}=ee(),{detail:n,loading:r,error:s}=WE(t);return r?c.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-dash-text-muted",children:e("sessionLoading")}):s?c.jsxs("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm",children:[e("sessionError"),": ",s]}):n?c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsxs("h2",{className:"text-base font-semibold text-dash-text font-mono truncate flex-1",children:["/",n.name]}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:e("sessionReadOnly")})]}),n.description&&c.jsx("div",{className:"rounded-lg border border-dash-border bg-dash-surface px-4 py-3",children:c.jsx("p",{className:"text-sm text-dash-text-muted",children:n.description})}),c.jsx("div",{className:"flex items-center gap-2 text-xs text-dash-text-muted",children:c.jsxs("span",{className:"font-mono px-2 py-0.5 rounded bg-dash-surface border border-dash-border text-dash-accent",children:["~/.claude/commands/",n.path]})}),c.jsx("div",{className:"rounded-lg border border-dash-border bg-dash-surface p-5 overflow-x-auto",children:c.jsx(ui,{content:n.content})})]}):null},YE=({message:t})=>c.jsx("div",{className:"flex items-center justify-center h-full text-sm text-dash-text-muted",children:t}),XE=()=>{const{t}=ee(),{tree:e,loading:n,error:r}=HE(),[s,i]=g.useState(""),[o,a]=g.useState(null),{size:l,isDragging:d,startDrag:u}=yo({storageKey:"ck-commands-panel-width",defaultSize:380,minSize:260,maxSize:650}),h=g.useMemo(()=>Zw(e,s),[e,s]),f=h.filter(b=>!b.children),p=h.filter(b=>b.children),m=g.useMemo(()=>qw(e),[e]),x=s.trim().length>0;return c.jsxs("div",{className:"flex h-full overflow-hidden",children:[c.jsxs("div",{style:{width:`${l}px`},className:"shrink-0 flex flex-col overflow-hidden border-r border-dash-border",children:[c.jsxs("div",{className:"shrink-0 px-4 pt-4 pb-3 border-b border-dash-border",children:[c.jsxs("div",{className:"flex items-start justify-between mb-3",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-base font-bold text-dash-text",children:t("commandsBrowser")}),!n&&!r&&c.jsx("p",{className:"text-xs text-dash-text-muted mt-0.5",children:t("commandsCount").replace("{count}",String(m))}),c.jsx("p",{className:"text-[11px] text-dash-text-muted font-mono mt-0.5",children:"~/.claude/commands/"})]}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:t("sessionReadOnly")})]}),c.jsxs("div",{className:"relative",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-dash-text-muted pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),c.jsx("input",{type:"text",value:s,onChange:b=>i(b.target.value),placeholder:t("searchCommandsPlaceholder"),className:"w-full pl-9 pr-4 py-2 text-sm bg-dash-surface border border-dash-border rounded-lg text-dash-text placeholder:text-dash-text-muted focus:outline-none focus:border-dash-accent/50 transition-colors"}),s&&c.jsx("button",{type:"button",onClick:()=>i(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-dash-text-muted hover:text-dash-text transition-colors",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-2 py-2",children:[n&&c.jsx("div",{className:"flex flex-1 items-center justify-center text-dash-text-muted text-sm p-8",children:t("sessionLoading")}),!n&&r&&c.jsxs("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm m-2",children:[t("sessionError"),": ",r]}),!n&&!r&&h.length===0&&c.jsx("div",{className:"flex items-center justify-center p-8 text-dash-text-muted text-sm",children:t("noCommandsFound")}),!n&&!r&&h.length>0&&c.jsxs("div",{className:"flex flex-col gap-2 pb-4",children:[c.jsx(GE,{nodes:f,forceOpen:x,selectedPath:o,onSelect:a,label:t("rootCommands")}),p.map(b=>c.jsx(Jw,{node:b,depth:0,forceOpen:x,selectedPath:o,onSelect:a},b.path))]})]})]}),c.jsx(_n,{onMouseDown:u,isDragging:d,direction:"horizontal"}),c.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:o?c.jsx(qE,{commandPath:o}):c.jsx(YE,{message:t("selectToView")})})]})},ek=({title:t,filePath:e,onBack:n,onSave:r,onReset:s,saveStatus:i,syntaxError:o,showResetConfirm:a,setShowResetConfirm:l,badge:d,showActions:u=!0,showFilePath:h=!0})=>{const{t:f}=ee();return c.jsxs("div",{className:"flex items-center justify-between mb-3 shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("button",{onClick:n,className:"px-2 py-1 rounded-lg bg-dash-surface hover:bg-dash-surface-hover border border-dash-border text-sm text-dash-text-secondary hover:text-dash-text flex items-center group transition-all font-medium shadow-sm",title:f("backToDashboard"),children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4 group-hover:-translate-x-0.5 transition-transform",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),c.jsx("h1",{className:"text-xl font-bold tracking-tight text-dash-text",children:t}),d,h&&c.jsx("span",{className:"text-xs text-dash-text-muted mono",children:e})]}),u&&c.jsxs("div",{className:"flex items-center gap-2 relative",children:[a?c.jsxs("div",{className:"flex items-center gap-2 bg-red-500/10 border border-red-500/30 rounded-lg px-2 py-1 animate-in fade-in duration-200",children:[c.jsx("span",{className:"text-xs text-red-500 font-medium",children:f("confirmReset")}),c.jsx("button",{onClick:s,className:"px-2 py-0.5 rounded bg-red-500 text-white text-xs font-bold hover:bg-red-600 transition-colors",children:f("confirm")}),c.jsx("button",{onClick:()=>l(!1),className:"px-2 py-0.5 rounded bg-dash-surface text-dash-text-secondary text-xs font-bold hover:bg-dash-surface-hover transition-colors border border-dash-border",children:f("cancel")})]}):c.jsx("button",{onClick:()=>l(!0),className:"px-3 py-1.5 rounded-lg bg-dash-surface text-xs font-bold text-dash-text-secondary hover:bg-dash-surface-hover transition-colors border border-dash-border",children:f("resetToDefault")}),c.jsx("button",{onClick:r,disabled:!!o||i==="saving",className:`px-3 py-1.5 rounded-lg text-xs font-bold transition-all tracking-widest uppercase ${o?"bg-dash-surface text-dash-text-muted cursor-not-allowed border border-dash-border":i==="saved"?"bg-green-500 text-white shadow-lg shadow-green-500/20":i==="error"?"bg-red-500 text-white":"bg-dash-accent text-dash-bg hover:bg-dash-accent-hover shadow-lg shadow-dash-accent/20"}`,children:f(i==="saving"?"saving":i==="saved"?"saved":i==="error"?"saveFailed":"saveChanges")})]})]})},ZE=({value:t,onChange:e,onFocus:n,disabled:r})=>c.jsx("input",{type:"text",value:t??"",onChange:s=>e(s.target.value||null),onFocus:n,disabled:r,className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
|
|
230
|
+
text-dash-text placeholder-dash-text-muted
|
|
231
|
+
focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
|
|
232
|
+
disabled:opacity-50 disabled:cursor-not-allowed
|
|
233
|
+
transition-colors`,placeholder:"Enter value..."}),QE=({value:t,onChange:e,onFocus:n,schema:r,disabled:s})=>c.jsx("input",{type:"number",value:t!=null?String(t):"",onChange:i=>{const o=i.target.value;if(o==="")e(null);else{const a=r.type==="integer"?Number.parseInt(o,10):Number.parseFloat(o);Number.isNaN(a)||e(a)}},onFocus:n,min:r.minimum,max:r.maximum,disabled:s,className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
|
|
234
|
+
text-dash-text placeholder-dash-text-muted
|
|
235
|
+
focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
|
|
236
|
+
disabled:opacity-50 disabled:cursor-not-allowed
|
|
237
|
+
transition-colors`}),JE=({value:t,onChange:e,onFocus:n,disabled:r})=>{const s=t===!0;return c.jsx("button",{type:"button",role:"switch","aria-checked":s,onClick:()=>e(!s),onFocus:n,disabled:r,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors
|
|
238
|
+
focus:outline-none focus:ring-2 focus:ring-dash-accent/50
|
|
239
|
+
disabled:opacity-50 disabled:cursor-not-allowed
|
|
240
|
+
${s?"bg-dash-accent":"bg-dash-border"}`,children:c.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-sm transition-transform
|
|
241
|
+
${s?"translate-x-6":"translate-x-1"}`})})},eD=({value:t,onChange:e,onFocus:n,schema:r,disabled:s,enumLabels:i,editable:o})=>{const a=r.enum||[],l=`enum-list-${a.join("-").slice(0,32)}`;if(o){const d=h=>i?.[String(h)]??String(h),u=t!=null?d(t):"";return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",list:l,value:u,onChange:h=>{const f=h.target.value,p=a.find(m=>d(m)===f);e(p!=null?String(p):f===""?null:f)},onFocus:n,disabled:s,placeholder:"Select or type a model...",className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
|
|
242
|
+
text-dash-text
|
|
243
|
+
focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
|
|
244
|
+
disabled:opacity-50 disabled:cursor-not-allowed
|
|
245
|
+
transition-colors`}),c.jsx("datalist",{id:l,children:a.map(h=>{const f=d(h);return c.jsx("option",{value:f},String(h))})})]})}return c.jsxs("select",{value:t!=null?String(t):"",onChange:d=>{const u=d.target.value;u===""?e(null):a.includes(Number(u))?e(Number(u)):e(u)},onFocus:n,disabled:s,className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
|
|
246
|
+
text-dash-text
|
|
247
|
+
focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
|
|
248
|
+
disabled:opacity-50 disabled:cursor-not-allowed
|
|
249
|
+
transition-colors appearance-none cursor-pointer`,children:[c.jsx("option",{value:"",children:"-- Select --"}),a.map(d=>c.jsx("option",{value:String(d),children:i?.[String(d)]??String(d)},String(d)))]})},tD=({value:t,onChange:e,onFocus:n,disabled:r})=>{const[s,i]=g.useState(()=>$o(t)),[o,a]=g.useState(!1);return g.useEffect(()=>{o||i($o(t))},[o,t]),c.jsx("input",{type:"text",value:o?s:$o(t),onChange:l=>{const d=l.target.value;i(d);const u=gE(d);u!==null&&e(u)},onFocus:()=>{a(!0),i($o(t)),n?.()},onBlur:l=>{const d=l.target.value,u=Hw(d);a(!1),i($o(u)),e(u)},disabled:r,className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
|
|
250
|
+
text-dash-text placeholder-dash-text-muted
|
|
251
|
+
focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
|
|
252
|
+
disabled:opacity-50 disabled:cursor-not-allowed
|
|
253
|
+
transition-colors`,placeholder:"auto or codex, cursor"})},nD=({value:t,onChange:e,onFocus:n,disabled:r})=>{const s=Array.isArray(t)?t:[],[i,o]=g.useState(""),a=()=>{i.trim()&&(e([...s,i.trim()]),o(""))},l=d=>{const u=s.filter((h,f)=>f!==d);e(u.length>0?u:[])};return c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.map((d,u)=>c.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-dash-bg border border-dash-border rounded text-xs text-dash-text",children:[String(d),!r&&c.jsx("button",{type:"button",onClick:()=>l(u),className:"text-dash-text-muted hover:text-red-500 transition-colors",children:c.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},u))}),!r&&c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{type:"text",value:i,onChange:d=>o(d.target.value),onFocus:n,onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),a())},placeholder:"Add item...",className:`flex-1 px-2 py-1 text-xs bg-dash-bg border border-dash-border rounded
|
|
254
|
+
text-dash-text placeholder-dash-text-muted
|
|
255
|
+
focus:outline-none focus:ring-1 focus:ring-dash-accent/50`}),c.jsx("button",{type:"button",onClick:a,className:"px-2 py-1 text-xs bg-dash-accent text-white rounded hover:bg-dash-accent-hover transition-colors",children:"+"})]})]})},rD=({value:t,onChange:e,onFocus:n,disabled:r})=>{const[s,i]=g.useState(!1);return c.jsxs("div",{className:"relative",children:[c.jsx("input",{type:s?"text":"password",value:t??"",onChange:o=>e(o.target.value||null),onFocus:n,disabled:r,className:`w-full px-3 py-2 pr-10 text-sm bg-dash-bg border border-dash-border rounded-lg
|
|
256
|
+
text-dash-text placeholder-dash-text-muted
|
|
257
|
+
focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
|
|
258
|
+
disabled:opacity-50 disabled:cursor-not-allowed
|
|
259
|
+
transition-colors`,placeholder:"Enter passphrase..."}),c.jsx("button",{type:"button",onClick:()=>i(!s),className:"absolute right-2 top-1/2 -translate-y-1/2 text-dash-text-muted hover:text-dash-text transition-colors",children:s?c.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"})}):c.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})})]})},sD={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"},iD=({source:t})=>{const{t:e}=ee(),n=()=>{switch(t){case"default":return e("default");case"project":return e("scopeProject");case"global":return e("scopeGlobal")}};return c.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded font-bold uppercase tracking-wider ${sD[t]}`,children:n()})};function oD(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 aD=({fieldPath:t,label:e,description:n,schema:r,value:s,source:i,onChange:o,onFocus:a,disabled:l,enumLabels:d,editable:u})=>{const h=oD(r,t),f=()=>{const p={value:s,onChange:o,onFocus:a,schema:r,disabled:l};switch(h){case"boolean":return c.jsx(JE,{...p});case"number":return c.jsx(QE,{...p});case"enum":return c.jsx(eD,{...p,enumLabels:d,editable:u});case"string-array-union":return c.jsx(tD,{...p});case"array":return c.jsx(nD,{...p});case"password":return c.jsx(rD,{...p});case"object":return null;default:return c.jsx(ZE,{...p})}};return h==="object"?null:c.jsx("div",{className:"py-3 border-b border-dash-border/50 last:border-b-0",children:c.jsxs("div",{className:"flex items-start justify-between gap-4",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[c.jsx("span",{className:"text-sm font-medium text-dash-text",children:e}),c.jsx(iD,{source:i})]}),n&&c.jsx("p",{className:"text-xs text-dash-text-muted mb-2 leading-relaxed",children:n}),c.jsx("p",{className:"text-[10px] text-dash-text-muted/50 font-mono mb-2",children:t})]}),c.jsx("div",{className:h==="boolean"?"shrink-0":"w-1/2 max-w-xs",children:f()})]})})},lD=({id:t,title:e,defaultCollapsed:n=!1,children:r})=>{const[s,i]=g.useState(n);return c.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-lg overflow-hidden",children:[c.jsxs("button",{type:"button",onClick:()=>i(!s),className:"w-full flex items-center justify-between px-4 py-3 bg-dash-surface-hover/30 hover:bg-dash-surface-hover/50 transition-colors","aria-expanded":!s,"aria-controls":`section-${t}`,children:[c.jsx("h3",{className:"text-sm font-bold text-dash-text uppercase tracking-wider",children:e}),c.jsx("svg",{className:`w-4 h-4 text-dash-text-muted transition-transform duration-200 ${s?"":"rotate-180"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),c.jsx("div",{id:`section-${t}`,className:`transition-all duration-200 ease-in-out ${s?"max-h-0 overflow-hidden":"max-h-[2000px]"}`,children:c.jsx("div",{className:"px-4 py-2",children:r})})]})},cD=({schema:t,value:e,sources:n,sections:r,onChange:s,onFieldFocus:i,disabled:o})=>c.jsx("div",{className:"space-y-4",children:r.map((a,l)=>c.jsx(lD,{id:a.id,title:a.title,defaultCollapsed:a.defaultCollapsed??l>1,children:a.fields.map(d=>{const u=Vw(t,d.path),h=ap(e,d.path),f=n[d.path]||"default";return c.jsx(aD,{fieldPath:d.path,label:d.label,description:d.description||u.description,schema:u,value:h,source:f,onChange:p=>s(d.path,p),onFocus:()=>i?.(d.path),disabled:o,enumLabels:d.enumLabels,editable:d.editable},d.path)})},a.id))}),tk=({width:t,isLoading:e,schema:n,config:r,sources:s,sections:i,onChange:o,onFieldFocus:a,onNaturalHeightChange:l})=>{const{t:d}=ee(),u=g.useRef(null),h=g.useRef(null),f=g.useRef(null),p=g.useRef(null);return g.useEffect(()=>{if(!l)return;const m=()=>{const b=h.current?.getBoundingClientRect().height??0,y=f.current;if(!y){l(Math.ceil(b));return}const k=window.getComputedStyle(y),v=Number.parseFloat(k.paddingTop||"0"),w=Number.parseFloat(k.paddingBottom||"0"),C=p.current?.getBoundingClientRect().height??0;l(Math.ceil(b+v+w+C))};if(m(),typeof ResizeObserver>"u")return;const x=new ResizeObserver(()=>{m()});return u.current&&x.observe(u.current),h.current&&x.observe(h.current),f.current&&x.observe(f.current),p.current&&x.observe(p.current),()=>x.disconnect()},[l]),c.jsxs("div",{ref:u,"data-form-panel":!0,style:{width:`${t}%`},className:"bg-dash-surface border border-dash-border rounded-xl overflow-hidden flex flex-col shadow-sm min-w-0 h-full",children:[c.jsx("div",{ref:h,"data-form-panel-header":!0,className:"p-3 border-b border-dash-border bg-dash-surface-hover/50 shrink-0",children:c.jsx("h3",{className:"text-xs font-bold text-dash-text-secondary uppercase tracking-widest",children:d("formTab")})}),c.jsx("div",{ref:f,"data-form-panel-scroll":!0,className:"flex-1 overflow-auto p-4",children:c.jsx("div",{ref:p,"data-form-panel-content":!0,children:e?c.jsx("div",{className:"h-full flex items-center justify-center",children:c.jsx("div",{className:"animate-pulse text-dash-text-muted text-sm",children:d("loading")})}):n?c.jsx(cD,{schema:n,value:r,sources:s,sections:i,onChange:o,onFieldFocus:a}):null})})]})},nk=1024;let dD=0,Dh=class{constructor(e,n){this.from=e,this.to=n}};class _e{constructor(e={}){this.id=dD++,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=fn.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}_e.closedBy=new _e({deserialize:t=>t.split(" ")});_e.openedBy=new _e({deserialize:t=>t.split(" ")});_e.group=new _e({deserialize:t=>t.split(" ")});_e.isolate=new _e({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});_e.contextHash=new _e({perNode:!0});_e.lookAhead=new _e({perNode:!0});_e.mounted=new _e({perNode:!0});class ia{constructor(e,n,r,s=!1){this.tree=e,this.overlay=n,this.parser=r,this.bracketed=s}static get(e){return e&&e.props&&e.props[_e.mounted.id]}}const uD=Object.create(null);class fn{constructor(e,n,r,s=0){this.name=e,this.props=n,this.id=r,this.flags=s}static define(e){let n=e.props&&e.props.length?Object.create(null):uD,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new fn(e.name||"",n,e.id,r);if(e.props){for(let i of e.props)if(Array.isArray(i)||(i=i(s)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(_e.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let s of r.split(" "))n[s]=e[r];return r=>{for(let s=r.prop(_e.group),i=-1;i<(s?s.length:0);i++){let o=n[i<0?r.name:s[i]];if(o)return o}}}}fn.none=new fn("",Object.create(null),0,8);class Gm{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let s=null;for(let i of e){let o=i(r);if(o){s||(s=Object.assign({},r.props));let a=o[1],l=o[0];l.combine&&l.id in s&&(a=l.combine(s[l.id],a)),s[l.id]=a}}n.push(s?new fn(r.name,s,r.id,r.flags):r)}return new Gm(n)}}const yc=new WeakMap,hx=new WeakMap;var dt;(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"})(dt||(dt={}));class ft{constructor(e,n,r,s,i){if(this.type=e,this.children=n,this.positions=r,this.length=s,this.props=null,i&&i.length){this.props=Object.create(null);for(let[o,a]of i)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=ia.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let s=r.toString();s&&(n&&(n+=","),n+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new hp(this.topNode,e)}cursorAt(e,n=0,r=0){let s=yc.get(this)||this.topNode,i=new hp(s);return i.moveTo(e,n),yc.set(this,i._tree),i}get topNode(){return new In(this,0,0,null)}resolve(e,n=0){let r=Sa(yc.get(this)||this.topNode,e,n,!1);return yc.set(this,r),r}resolveInner(e,n=0){let r=Sa(hx.get(this)||this.topNode,e,n,!0);return hx.set(this,r),r}resolveStack(e,n=0){return pD(this,e,n)}iterate(e){let{enter:n,leave:r,from:s=0,to:i=this.length}=e,o=e.mode||0,a=(o&dt.IncludeAnonymous)>0;for(let l=this.cursor(o|dt.IncludeAnonymous);;){let d=!1;if(l.from<=i&&l.to>=s&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;d=!0}for(;d&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;d=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:Xm(fn.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new ft(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new ft(fn.none,n,r,s)))}static build(e){return mD(e)}}ft.empty=new ft(fn.none,[],[],0);class qm{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 qm(this.buffer,this.index)}}class ws{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return fn.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],s=this.set.types[n],i=s.name;if(/\W/.test(i)&&!s.isError&&(i=JSON.stringify(i)),e+=4,r==e)return i;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return i+"("+o.join(",")+")"}findChild(e,n,r,s,i){let{buffer:o}=this,a=-1;for(let l=e;l!=n&&!(rk(i,s,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,n,r){let s=this.buffer,i=new Uint16Array(n-e),o=0;for(let a=e,l=0;a<n;){i[l++]=s[a++],i[l++]=s[a++]-r;let d=i[l++]=s[a++]-r;i[l++]=s[a++]-e,o=Math.max(o,d)}return new ws(i,o,this.set)}}function rk(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 Sa(t,e,n,r){for(var s;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let o=!r&&t instanceof In&&t.index<0?null:t.parent;if(!o)return t;t=o}let i=r?0:dt.IgnoreOverlays;if(r)for(let o=t,a=o.parent;a;o=a,a=o.parent)o instanceof In&&o.index<0&&((s=a.enter(e,n,i))===null||s===void 0?void 0:s.from)!=o.from&&(t=a);for(;;){let o=t.enter(e,n,i);if(!o)return t;t=o}}class sk{cursor(e=0){return new hp(this,e)}getChild(e,n=null,r=null){let s=fx(this,e,n,r);return s.length?s[0]:null}getChildren(e,n=null,r=null){return fx(this,e,n,r)}resolve(e,n=0){return Sa(this,e,n,!1)}resolveInner(e,n=0){return Sa(this,e,n,!0)}matchContext(e){return up(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let s=n.lastChild;if(!s||s.to!=n.to)break;s.type.isError&&s.from==s.to?(r=n,n=s.prevSibling):n=s}return r}get node(){return this}get next(){return this.parent}}class In extends sk{constructor(e,n,r,s){super(),this._tree=e,this.from=n,this.index=r,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,s,i=0){var o;for(let a=this;;){for(let{children:l,positions:d}=a._tree,u=n>0?l.length:-1;e!=u;e+=n){let h=l[e],f=d[e]+a.from;if(!(!(i&dt.EnterBracketed&&h instanceof ft&&((o=ia.get(h))===null||o===void 0?void 0:o.overlay)===null&&(f>=r||f+h.length<=r))&&!rk(s,r,f,f+h.length))){if(h instanceof ws){if(i&dt.ExcludeBuffers)continue;let p=h.findChild(0,h.buffer.length,n,r-f,s);if(p>-1)return new fs(new hD(a,h,e,f),null,p)}else if(i&dt.IncludeAnonymous||!h.type.isAnonymous||Ym(h)){let p;if(!(i&dt.IgnoreMounts)&&(p=ia.get(h))&&!p.overlay)return new In(p.tree,f,e,a);let m=new In(h,f,e,a);return i&dt.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(n<0?h.children.length-1:0,n,r,s,i)}}}if(i&dt.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+n:e=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,n,r=0){let s;if(!(r&dt.IgnoreOverlays)&&(s=ia.get(this._tree))&&s.overlay){let i=e-this.from,o=r&dt.EnterBracketed&&s.bracketed;for(let{from:a,to:l}of s.overlay)if((n>0||o?a<=i:a<i)&&(n<0||o?l>=i:l>i))return new In(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function fx(t,e,n,r){let s=t.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let o=!1;!o;)if(o=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(e)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function up(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 hD{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class fs extends sk{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.context.start,r);return i<0?null:new fs(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,n,r=0){if(r&dt.ExcludeBuffers)return null;let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return i<0?null:new fs(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new fs(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 fs(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let o=r.buffer[this.index+1];e.push(r.slice(s,i,o)),n.push(0)}return new ft(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ik(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;i<t.length;i++){let o=t[i];(o.from>n.from||o.to<n.to)&&(n=o,e=i)}let r=n instanceof In&&n.index<0?null:n.parent,s=t.slice();return r?s[e]=r:s.splice(e,1),new fD(s,n)}class fD{constructor(e,n){this.heads=e,this.node=n}get next(){return ik(this.heads)}}function pD(t,e,n){let r=t.resolveInner(e,n),s=null;for(let i=r instanceof In?r:r.context.parent;i;i=i.parent)if(i.index<0){let o=i.parent;(s||(s=[r])).push(o.resolve(e,n)),i=o}else{let o=ia.get(i.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new In(o.tree,o.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(Sa(a,e,n,!1))}}return s?ik(s):r}class hp{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&~dt.EnterBracketed,e instanceof In)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:s}=this.buffer;return this.type=n||s.set.types[s.buffer[e]],this.from=r+s.buffer[e+1],this.to=r+s.buffer[e+2],!0}yield(e){return e?e instanceof In?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:s}=this.buffer,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.buffer.start,r);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&dt.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&dt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&dt.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:s}=this;if(s){if(e>0){if(this.index<s.buffer.buffer.length)return!1}else for(let i=0;i<this.index;i++)if(s.buffer.buffer[i+3]<this.index)return!1;({index:n,parent:r}=s)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let i=n+e,o=e<0?-1:r._tree.children.length;i!=o;i+=e){let a=r._tree.children[i];if(this.mode&dt.IncludeAnonymous||a instanceof ws||!a.type.isAnonymous||Ym(a))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let s=this.index,i=this.stack.length;i>=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;n=o,r=i+1;break e}s=this.stack[--i]}for(let s=r;s<this.stack.length;s++)n=new fs(this.buffer,n,this.stack[s]);return this.bufferNode=new fs(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let s=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(s=!0)}for(;;){if(s&&n&&n(this),s=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,s=!0}}}matchContext(e){if(!this.buffer)return up(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let s=e.length-1,i=this.stack.length-1;s>=0;i--){if(i<0)return up(this._tree,e,s);let o=r[n.buffer[this.stack[i]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function Ym(t){return t.children.some(e=>e instanceof ws||!e.type.isAnonymous||Ym(e))}function mD(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=nk,reused:i=[],minRepeatType:o=r.types.length}=t,a=Array.isArray(n)?new qm(n,n.length):n,l=r.types,d=0,u=0;function h(C,j,S,P,D,A){let{id:N,start:T,end:I,size:O}=a,E=u,M=d;if(O<0)if(a.next(),O==-1){let z=i[N];S.push(z),P.push(T-C);return}else if(O==-3){d=N;return}else if(O==-4){u=N;return}else throw new RangeError(`Unrecognized record size: ${O}`);let R=l[N],_,$,F=T-C;if(I-T<=s&&($=b(a.pos-j,D))){let z=new Uint16Array($.size-$.skip),V=a.pos-$.size,Z=z.length;for(;a.pos>V;)Z=y($.start,z,Z);_=new ws(z,I-$.start,r),F=$.start-C}else{let z=a.pos-O;a.next();let V=[],Z=[],U=N>=o?N:-1,Q=0,se=I;for(;a.pos>z;)U>=0&&a.id==U&&a.size>=0?(a.end<=se-s&&(m(V,Z,T,Q,a.end,se,U,E,M),Q=V.length,se=a.end),a.next()):A>2500?f(T,z,V,Z):h(T,z,V,Z,U,A+1);if(U>=0&&Q>0&&Q<V.length&&m(V,Z,T,Q,T,se,U,E,M),V.reverse(),Z.reverse(),U>-1&&Q>0){let ce=p(R,M);_=Xm(R,V,Z,0,V.length,0,I-T,ce,ce)}else _=x(R,V,Z,I-T,E-I,M)}S.push(_),P.push(F)}function f(C,j,S,P){let D=[],A=0,N=-1;for(;a.pos>j;){let{id:T,start:I,end:O,size:E}=a;if(E>4)a.next();else{if(N>-1&&I<N)break;N<0&&(N=O-s),D.push(T,I,O),A++,a.next()}}if(A){let T=new Uint16Array(A*4),I=D[D.length-2];for(let O=D.length-3,E=0;O>=0;O-=3)T[E++]=D[O],T[E++]=D[O+1]-I,T[E++]=D[O+2]-I,T[E++]=E;S.push(new ws(T,D[2]-I,r)),P.push(I-C)}}function p(C,j){return(S,P,D)=>{let A=0,N=S.length-1,T,I;if(N>=0&&(T=S[N])instanceof ft){if(!N&&T.type==C&&T.length==D)return T;(I=T.prop(_e.lookAhead))&&(A=P[N]+T.length+I)}return x(C,S,P,D,A,j)}}function m(C,j,S,P,D,A,N,T,I){let O=[],E=[];for(;C.length>P;)O.push(C.pop()),E.push(j.pop()+S-D);C.push(x(r.types[N],O,E,A-D,T-A,I)),j.push(D-S)}function x(C,j,S,P,D,A,N){if(A){let T=[_e.contextHash,A];N=N?[T].concat(N):[T]}if(D>25){let T=[_e.lookAhead,D];N=N?[T].concat(N):[T]}return new ft(C,j,S,P,N)}function b(C,j){let S=a.fork(),P=0,D=0,A=0,N=S.end-s,T={size:0,start:0,skip:0};e:for(let I=S.pos-C;S.pos>I;){let O=S.size;if(S.id==j&&O>=0){T.size=P,T.start=D,T.skip=A,A+=4,P+=4,S.next();continue}let E=S.pos-O;if(O<0||E<I||S.start<N)break;let M=S.id>=o?4:0,R=S.start;for(S.next();S.pos>E;){if(S.size<0)if(S.size==-3||S.size==-4)M+=4;else break e;else S.id>=o&&(M+=4);S.next()}D=R,P+=O,A+=M}return(j<0||P==C)&&(T.size=P,T.start=D,T.skip=A),T.size>4?T:void 0}function y(C,j,S){let{id:P,start:D,end:A,size:N}=a;if(a.next(),N>=0&&P<o){let T=S;if(N>4){let I=a.pos-(N-4);for(;a.pos>I;)S=y(C,j,S)}j[--S]=T,j[--S]=A-C,j[--S]=D-C,j[--S]=P}else N==-3?d=P:N==-4&&(u=P);return S}let k=[],v=[];for(;a.pos>0;)h(t.start||0,t.bufferStart||0,k,v,-1,0);let w=(e=t.length)!==null&&e!==void 0?e:k.length?v[0]+k[0].length:0;return new ft(l[t.topID],k.reverse(),v.reverse(),w)}const px=new WeakMap;function cd(t,e){if(!t.isAnonymous||e instanceof ws||e.type!=t)return 1;let n=px.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof ft)){n=1;break}n+=cd(t,r)}px.set(e,n)}return n}function Xm(t,e,n,r,s,i,o,a,l){let d=0;for(let m=r;m<s;m++)d+=cd(t,e[m]);let u=Math.ceil(d*1.5/8),h=[],f=[];function p(m,x,b,y,k){for(let v=b;v<y;){let w=v,C=x[v],j=cd(t,m[v]);for(v++;v<y;v++){let S=cd(t,m[v]);if(j+S>=u)break;j+=S}if(v==w+1){if(j>u){let S=m[w];p(S.children,S.positions,0,S.children.length,x[w]+k);continue}h.push(m[w])}else{let S=x[v-1]+m[v-1].length-C;h.push(Xm(t,m,x,w,v,C,S,null,l))}f.push(C+k-i)}}return p(e,n,r,s,0),(a||l)(h,f,o)}class Zs{constructor(e,n,r,s,i=!1,o=!1){this.from=e,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let s=[new Zs(0,e.length,e,0,!1,r)];for(let i of n)i.to>e.length&&s.push(i);return s}static applyChanges(e,n,r=128){if(!n.length)return e;let s=[],i=1,o=e.length?e[0]:null;for(let a=0,l=0,d=0;;a++){let u=a<n.length?n[a]:null,h=u?u.fromA:1e9;if(h-l>=r)for(;o&&o.from<h;){let f=o;if(l>=f.from||h<=f.to||d){let p=Math.max(f.from,l)-d,m=Math.min(f.to,h)-d;f=p>=m?null:new Zs(p,m,f.tree,f.offset+d,a>0,!!u)}if(f&&s.push(f),o.to>h)break;o=i<e.length?e[i++]:null}if(!u)break;l=u.toA,d=u.toA-u.toB}return s}}class ok{startParse(e,n,r){return typeof e=="string"&&(e=new gD(e)),r=r?r.length?r.map(s=>new Dh(s.from,s.to)):[new Dh(0,0)]:[new Dh(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let s=this.startParse(e,n,r);for(;;){let i=s.advance();if(i)return i}}}class gD{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 _e({perNode:!0});var mx={};class _d{constructor(e,n,r,s,i,o,a,l,d,u=0,h){this.p=e,this.stack=n,this.state=r,this.reducePos=s,this.pos=i,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=d,this.lookAhead=u,this.parent=h}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let s=e.parser.context;return new _d(e,[],n,r,r,0,[],0,s?new gx(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,s=e&65535,{parser:i}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=i.dynamicPrecedence(s);if(a&&(this.score+=a),r==0){this.pushState(i.getGoto(this.state,s,!0),this.reducePos),s<i.minRepeatTerm&&this.storeNode(s,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(s,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),d=l?this.stack[l-2]:this.p.ranges[0].from,u=this.reducePos-d;u>=2e3&&!(!((n=this.p.parser.nodeSet.types[s])===null||n===void 0)&&n.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=d,this.p.lastBigReductionSize=u));let h=l?this.stack[l-1]:0,f=this.bufferBase+this.buffer.length-h;if(s<i.minRepeatTerm||e&131072){let p=i.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(s,d,p,f+4,!0)}if(e&262144)this.state=this.stack[l];else{let p=this.stack[l-3];this.state=i.getGoto(p,s,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(s,d)}storeNode(e,n,r,s=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,a=this.buffer.length;if(a==0&&o.parent&&(a=o.bufferBase-o.parent.bufferBase,o=o.parent),a>0&&o.buffer[a-4]==0&&o.buffer[a-1]>-1){if(n==r)return;if(o.buffer[a-2]>=n){o.buffer[a-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,s);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let a=!1;for(let l=o;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,s>4&&(s-=4)}this.buffer[o]=e,this.buffer[o+1]=n,this.buffer[o+2]=r,this.buffer[o+3]=s}}shift(e,n,r,s){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=s,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,s,4);else{let i=e,{parser:o}=this.p;(s>this.pos||n<=o.maxNode)&&(this.pos=s,o.stateFlag(i,1)||(this.reducePos=s)),this.pushState(i,r),this.shiftContext(n,r),n<=o.maxNode&&this.buffer.push(n,r,s,4)}}apply(e,n,r,s){e&65536?this.reduce(e):this.shift(e,n,r,s)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(n,s),this.buffer.push(r,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),s=e.bufferBase+n;for(;e&&s==e.bufferBase;)e=e.parent;return new _d(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new xD(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if(!(r&65536))return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let s=[];for(let i=0,o;i<n.length;i+=2)(o=n[i+1])!=this.state&&this.p.parser.hasAction(o,e)&&s.push(n[i],o);if(this.stack.length<120)for(let i=0;s.length<8&&i<n.length;i+=2){let o=n[i+1];s.some((a,l)=>l&1&&a==o)||s.push(n[i],o)}n=s}let r=[];for(let s=0;s<n.length&&r.length<4;s+=2){let i=n[s+1];if(i==this.state)continue;let o=this.split();o.pushState(i,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(n[s],this.pos),o.reducePos=this.pos,o.score-=200,r.push(o)}return r}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if(!(n&65536))return!1;if(!e.validAction(this.state,n)){let r=n>>19,s=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],s,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(s,i)=>{if(!n.includes(s))return n.push(s),e.allActions(s,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-i;if(a>1){let l=o&65535,d=this.stack.length-a*3;if(d>=0&&e.getGoto(this.stack[d],l,!1)>=0)return a<<19|65536|l}}else{let a=r(o,i+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new gx(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 gx{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class xD{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=s}}class Id{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 Id(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 Id(this.stack,this.pos,this.index)}}function vc(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,s=0;r<t.length;){let i=0;for(;;){let o=t.charCodeAt(r++),a=!1;if(o==126){i=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),i+=l,a)break;i*=46}n?n[s++]=i:n=new e(i)}return n}class dd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const xx=new dd;class bD{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=xx,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,s=this.rangeIndex,i=this.pos+e;for(;i<r.from;){if(!s)return null;let o=this.ranges[--s];i-=r.from-o.to,r=o}for(;n<0?i>r.to:i>=r.to;){if(s==this.ranges.length-1)return null;let o=this.ranges[++s];i+=o.from-r.to,r=o}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,s;if(n>=0&&n<this.chunk.length)r=this.pos+e,s=this.chunk.charCodeAt(n);else{let i=this.resolveOffset(e,1);if(i==null)return-1;if(r=i,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)s=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),s=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),s}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=xx,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let s of this.ranges){if(s.from>=n)break;s.to>e&&(r+=this.input.read(Math.max(s.from,e),Math.min(s.to,n)))}return r}}class Ii{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;yD(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Ii.prototype.contextual=Ii.prototype.fallback=Ii.prototype.extend=!1;Ii.prototype.fallback=Ii.prototype.extend=!1;function yD(t,e,n,r,s,i){let o=0,a=1<<r,{dialect:l}=n.p.parser;e:for(;a&t[o];){let d=t[o+1];for(let p=o+3;p<d;p+=2)if((t[p+1]&a)>0){let m=t[p];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||vD(m,e.token.value,s,i))){e.acceptToken(m);break}}let u=e.next,h=0,f=t[o+2];if(e.next<0&&f>h&&t[d+f*3-3]==65535){o=t[d+f*3-1];continue e}for(;h<f;){let p=h+f>>1,m=d+p+(p<<1),x=t[m],b=t[m+1]||65536;if(u<x)f=p;else if(u>=b)h=p+1;else{o=t[m+2],e.advance();continue e}}break}}function bx(t,e,n){for(let r=e,s;(s=t[r])!=65535;r++)if(s==n)return r-e;return-1}function vD(t,e,n,r){let s=bx(n,r,e);return s<0||bx(n,r,t)<s}const mn=typeof process<"u"&&mx&&/\bparse\b/.test(mx.LOG);let Mh=null;function yx(t,e,n){let r=t.cursor(dt.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 wD{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?yx(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?yx(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],s=this.index[n];if(s==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=r.children[s],o=this.start[n]+r.positions[s];if(o>e)return this.nextStart=o,null;if(i instanceof ft){if(o==e){if(o<this.safeFrom)return null;let a=o+i.length;if(a<=this.safeTo){let l=i.prop(_e.lookAhead);if(!l||a+l<this.fragment.to)return i}}this.index[n]++,o+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+i.length}}}class kD{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new dd)}getActions(e){let n=0,r=null,{parser:s}=e.p,{tokenizers:i}=s,o=s.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let d=0;d<i.length;d++){if(!(1<<d&o))continue;let u=i[d],h=this.tokens[d];if(!(r&&!u.fallback)&&((u.contextual||h.start!=e.pos||h.mask!=o||h.context!=a)&&(this.updateCachedToken(h,u,e),h.mask=o,h.context=a),h.lookAhead>h.end+25&&(l=Math.max(h.lookAhead,l)),h.value!=0)){let f=n;if(h.extended>-1&&(n=this.addActions(e,h.extended,h.end,n)),n=this.addActions(e,h.value,h.end,n),!u.extend&&(r=h,n>f))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new dd,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 dd,{pos:r,p:s}=e;return n.start=r,n.end=Math.min(r+1,s.stream.end),n.value=r==s.stream.end?s.parser.eofTerm:0,n}updateCachedToken(e,n,r){let s=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(s,e),r),e.value>-1){let{parser:i}=r.p;for(let o=0;o<i.specialized.length;o++)if(i.specialized[o]==e.value){let a=i.specializers[o](this.stream.read(e.start,e.end),r);if(a>=0&&r.p.parser.dialect.allows(a>>1)){a&1?e.extended=a>>1:e.value=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,n,r,s){for(let i=0;i<s;i+=3)if(this.actions[i]==e)return s;return this.actions[s++]=e,this.actions[s++]=n,this.actions[s++]=r,s}addActions(e,n,r,s){let{state:i}=e,{parser:o}=e.p,{data:a}=o;for(let l=0;l<2;l++)for(let d=o.stateSlot(i,l?2:1);;d+=3){if(a[d]==65535)if(a[d+1]==1)d=Br(a,d+2);else{s==0&&a[d+1]==2&&(s=this.putAction(Br(a,d+2),n,r,s));break}a[d]==n&&(s=this.putAction(Br(a,d+1),n,r,s))}return s}}class SD{constructor(e,n,r,s){this.parser=e,this.input=n,this.ranges=s,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new bD(n,s),this.tokens=new kD(e,this.stream),this.topTerm=e.top[1];let{from:i}=s[0];this.stacks=[_d.start(this,e.top[0],i)],this.fragments=r.length&&this.stream.end-i>e.bufferLength*4?new wD(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],s,i;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let a=e[o];for(;;){if(this.tokens.mainToken=null,a.pos>n)r.push(a);else{if(this.advanceStack(a,r,e))continue;{s||(s=[],i=[]),s.push(a);let l=this.tokens.getMainToken(a);i.push(l.value,l.end)}}break}}if(!r.length){let o=s&&jD(s);if(o)return mn&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw mn&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&s){let o=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,i,r);if(o)return mn&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((a,l)=>l.score-a.score);r.length>o;)r.pop();r.some(a=>a.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let o=0;o<r.length-1;o++){let a=r[o];for(let l=o+1;l<r.length;l++){let d=r[l];if(a.sameState(d)||a.buffer.length>500&&d.buffer.length>500)if((a.score-d.score||a.buffer.length-d.buffer.length)>0)r.splice(l--,1);else{r.splice(o--,1);continue e}}}r.length>12&&(r.sort((o,a)=>a.score-o.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let o=1;o<r.length;o++)r[o].pos<this.minStackPos&&(this.minStackPos=r[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,n,r){let s=e.pos,{parser:i}=this,o=mn?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.curContext&&e.curContext.tracker.strict,u=d?e.curContext.hash:0;for(let h=this.fragments.nodeAt(s);h;){let f=this.parser.nodeSet.types[h.type.id]==h.type?i.getGoto(e.state,h.type.id):-1;if(f>-1&&h.length&&(!d||(h.prop(_e.contextHash)||0)==u))return e.useNode(h,f),mn&&console.log(o+this.stackID(e)+` (via reuse of ${i.getName(h.type.id)})`),!0;if(!(h instanceof ft)||h.children.length==0||h.positions[0]>0)break;let p=h.children[0];if(p instanceof ft&&h.positions[0]==0)h=p;else break}}let a=i.stateSlot(e.state,4);if(a>0)return e.reduce(a),mn&&console.log(o+this.stackID(e)+` (via always-reduce ${i.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let d=0;d<l.length;){let u=l[d++],h=l[d++],f=l[d++],p=d==l.length||!r,m=p?e:e.split(),x=this.tokens.mainToken;if(m.apply(u,h,x?x.start:m.pos,f),mn&&console.log(o+this.stackID(m)+` (via ${u&65536?`reduce of ${i.getName(u&65535)}`:"shift"} for ${i.getName(h)} @ ${s}${m==e?"":", split"})`),p)return!0;m.pos>s?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 vx(e,n),!0}}runRecovery(e,n,r){let s=null,i=!1;for(let o=0;o<e.length;o++){let a=e[o],l=n[o<<1],d=n[(o<<1)+1],u=mn?this.stackID(a)+" -> ":"";if(a.deadEnd&&(i||(i=!0,a.restart(),mn&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let h=a.split(),f=u;for(let p=0;p<10&&h.forceReduce()&&(mn&&console.log(f+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,r));p++)mn&&(f=this.stackID(h)+" -> ");for(let p of a.recoverByInsert(l))mn&&console.log(u+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,r);this.stream.end>a.pos?(d==a.pos&&(d++,l=0),a.recoverByDelete(l,d),mn&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),vx(a,r)):(!s||s.score<a.score)&&(s=a)}return s}stackToTree(e){return e.close(),ft.build({buffer:Id.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=(Mh||(Mh=new WeakMap)).get(e);return n||Mh.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function vx(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 CD{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}class $d extends ok{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let a=0;a<e.repeatNodeCount;a++)n.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),s=[];for(let a=0;a<n.length;a++)s.push([]);function i(a,l,d){s[a].push([l,l.deserialize(String(d))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=_e[l]);for(let d=1;d<a.length;){let u=a[d++];if(u>=0)i(u,l,a[d++]);else{let h=a[d+-u];for(let f=-u;f>0;f--)i(a[d++],l,h);d++}}}this.nodeSet=new Gm(n.map((a,l)=>fn.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:s[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=nk;let o=vc(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(wx),this.states=vc(e.states,Uint32Array),this.data=vc(e.stateData),this.goto=vc(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new Ii(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let s=new SD(this,e,n,r);for(let i of this.wrappers)s=i(s,e,n,r);return s}getGoto(e,n,r=!1){let s=this.goto;if(n>=s[0])return-1;for(let i=s[n+1];;){let o=s[i++],a=o&1,l=s[i++];if(a&&r)return l;for(let d=i+(o>>1);i<d;i++)if(s[i]==e)return l;if(a)return-1}}hasAction(e,n){let r=this.data;for(let s=0;s<2;s++)for(let i=this.stateSlot(e,s?2:1),o;;i+=3){if((o=r[i])==65535)if(r[i+1]==1)o=r[i=Br(r,i+2)];else{if(r[i+1]==2)return Br(r,i+2);break}if(o==n||o==0)return Br(r,i+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),s=r?n(r):void 0;for(let i=this.stateSlot(e,1);s==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Br(this.data,i+2);else break;s=n(Br(this.data,i+1))}return s}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Br(this.data,r+2);else break;if(!(this.data[r+2]&1)){let s=this.data[r+1];n.some((i,o)=>o&1&&i==s)||n.push(this.data[r],s)}}return n}configure(e){let n=Object.assign(Object.create($d.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let s=e.tokenizers.find(i=>i.from==r);return s?s.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,s)=>{let i=e.specializers.find(a=>a.from==r.external);if(!i)return r;let o=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[s]=wx(o),o})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let i of e.split(" ")){let o=n.indexOf(i);o>=0&&(r[o]=!0)}let s=null;for(let i=0;i<n.length;i++)if(!r[i])for(let o=this.dialects[n[i]],a;(a=this.data[o++])!=65535;)(s||(s=new Uint8Array(this.maxTerm+1)))[a]=1;return new CD(e,r,s)}static deserialize(e){return new $d(e)}}function Br(t,e){return t[e]|t[e+1]<<16}function jD(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 wx(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}let ND=0;class An{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=ND++}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 An&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let s=new An(r,[],null,[]);if(s.set.push(s),n)for(let i of n.set)s.set.push(i);return s}static defineModifier(e){let n=new Bd(e);return r=>r.modified.indexOf(n)>-1?r:Bd.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let PD=0;class Bd{constructor(e){this.name=e,this.instances=[],this.id=PD++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&OD(n,a.modified));if(r)return r;let s=[],i=new An(e.name,s,e,n);for(let a of n)a.instances.push(i);let o=ED(n);for(let a of e.set)if(!a.modified.length)for(let l of o)s.push(Bd.get(a,l));return i}}function OD(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function ED(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,s=e.length;r<s;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function ak(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],o=2,a=s;for(let h=0;;){if(a=="..."&&h>0&&h+3==s.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+s);if(i.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),h+=f[0].length,h==s.length)break;let p=s[h++];if(h==s.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+s);a=s.slice(h)}let l=i.length-1,d=i[l];if(!d)throw new RangeError("Invalid path: "+s);let u=new Ca(r,o,l>0?i.slice(0,l):null);e[d]=u.sort(e[d])}}return lk.add(e)}const lk=new _e({combine(t,e){let n,r,s;for(;t||e;){if(!t||e&&t.depth>=e.depth?(s=e,e=e.next):(s=t,t=t.next),n&&n.mode==s.mode&&!s.context&&!n.context)continue;let i=new Ca(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class Ca{constructor(e,n,r,s){this.tags=e,this.mode=n,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Ca.empty=new Ca([],2,null);function ck(t,e){let n=Object.create(null);for(let i of t)if(!Array.isArray(i.tag))n[i.tag.id]=i.class;else for(let o of i.tag)n[o.id]=i.class;let{scope:r,all:s=null}=e||{};return{style:i=>{let o=s;for(let a of i)for(let l of a.set){let d=n[l.id];if(d){o=o?o+" "+d:d;break}}return o},scope:r}}function DD(t,e){let n=null;for(let r of t){let s=r.style(e);s&&(n=n?n+" "+s:s)}return n}function MD(t,e,n,r=0,s=t.length){let i=new AD(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,s,"",i.highlighters),i.flush(s)}class AD{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,s,i){let{type:o,from:a,to:l}=e;if(a>=r||l<=n)return;o.isTop&&(i=this.highlighters.filter(p=>!p.scope||p.scope(o)));let d=s,u=TD(e)||Ca.empty,h=DD(i,u.tags);if(h&&(d&&(d+=" "),d+=h,u.mode==1&&(s+=(s?" ":"")+h)),this.startSpan(Math.max(n,a),d),u.opaque)return;let f=e.tree&&e.tree.prop(_e.mounted);if(f&&f.overlay){let p=e.node.enter(f.overlay[0].from+a,1),m=this.highlighters.filter(b=>!b.scope||b.scope(f.tree.type)),x=e.firstChild();for(let b=0,y=a;;b++){let k=b<f.overlay.length?f.overlay[b]:null,v=k?k.from+a:l,w=Math.max(n,y),C=Math.min(r,v);if(w<C&&x)for(;e.from<C&&(this.highlightRange(e,w,C,s,i),this.startSpan(Math.min(C,e.to),d),!(e.to>=v||!e.nextSibling())););if(!k||v>r)break;y=k.to+a,y>n&&(this.highlightRange(p.cursor(),Math.max(n,k.from+a),Math.min(r,y),"",m),this.startSpan(Math.min(r,y),d))}x&&e.parent()}else if(e.firstChild()){f&&(s="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,s,i),this.startSpan(Math.min(r,e.to),d)}while(e.nextSibling());e.parent()}}}function TD(t){let e=t.type.prop(lk);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const oe=An.define,wc=oe(),ss=oe(),kx=oe(ss),Sx=oe(ss),is=oe(),kc=oe(is),Ah=oe(is),fr=oe(),Is=oe(fr),dr=oe(),ur=oe(),fp=oe(),Bo=oe(fp),Sc=oe(),W={comment:wc,lineComment:oe(wc),blockComment:oe(wc),docComment:oe(wc),name:ss,variableName:oe(ss),typeName:kx,tagName:oe(kx),propertyName:Sx,attributeName:oe(Sx),className:oe(ss),labelName:oe(ss),namespace:oe(ss),macroName:oe(ss),literal:is,string:kc,docString:oe(kc),character:oe(kc),attributeValue:oe(kc),number:Ah,integer:oe(Ah),float:oe(Ah),bool:oe(is),regexp:oe(is),escape:oe(is),color:oe(is),url:oe(is),keyword:dr,self:oe(dr),null:oe(dr),atom:oe(dr),unit:oe(dr),modifier:oe(dr),operatorKeyword:oe(dr),controlKeyword:oe(dr),definitionKeyword:oe(dr),moduleKeyword:oe(dr),operator:ur,derefOperator:oe(ur),arithmeticOperator:oe(ur),logicOperator:oe(ur),bitwiseOperator:oe(ur),compareOperator:oe(ur),updateOperator:oe(ur),definitionOperator:oe(ur),typeOperator:oe(ur),controlOperator:oe(ur),punctuation:fp,separator:oe(fp),bracket:Bo,angleBracket:oe(Bo),squareBracket:oe(Bo),paren:oe(Bo),brace:oe(Bo),content:fr,heading:Is,heading1:oe(Is),heading2:oe(Is),heading3:oe(Is),heading4:oe(Is),heading5:oe(Is),heading6:oe(Is),contentSeparator:oe(fr),list:oe(fr),quote:oe(fr),emphasis:oe(fr),strong:oe(fr),link:oe(fr),monospace:oe(fr),strikethrough:oe(fr),inserted:oe(),deleted:oe(),changed:oe(),invalid:oe(),meta:Sc,documentMeta:oe(Sc),annotation:oe(Sc),processingInstruction:oe(Sc),definition:An.defineModifier("definition"),constant:An.defineModifier("constant"),function:An.defineModifier("function"),standard:An.defineModifier("standard"),local:An.defineModifier("local"),special:An.defineModifier("special")};for(let t in W){let e=W[t];e instanceof An&&(e.name=t)}ck([{tag:W.link,class:"tok-link"},{tag:W.heading,class:"tok-heading"},{tag:W.emphasis,class:"tok-emphasis"},{tag:W.strong,class:"tok-strong"},{tag:W.keyword,class:"tok-keyword"},{tag:W.atom,class:"tok-atom"},{tag:W.bool,class:"tok-bool"},{tag:W.url,class:"tok-url"},{tag:W.labelName,class:"tok-labelName"},{tag:W.inserted,class:"tok-inserted"},{tag:W.deleted,class:"tok-deleted"},{tag:W.literal,class:"tok-literal"},{tag:W.string,class:"tok-string"},{tag:W.number,class:"tok-number"},{tag:[W.regexp,W.escape,W.special(W.string)],class:"tok-string2"},{tag:W.variableName,class:"tok-variableName"},{tag:W.local(W.variableName),class:"tok-variableName tok-local"},{tag:W.definition(W.variableName),class:"tok-variableName tok-definition"},{tag:W.special(W.variableName),class:"tok-variableName2"},{tag:W.definition(W.propertyName),class:"tok-propertyName tok-definition"},{tag:W.typeName,class:"tok-typeName"},{tag:W.namespace,class:"tok-namespace"},{tag:W.className,class:"tok-className"},{tag:W.macroName,class:"tok-macroName"},{tag:W.propertyName,class:"tok-propertyName"},{tag:W.operator,class:"tok-operator"},{tag:W.comment,class:"tok-comment"},{tag:W.meta,class:"tok-meta"},{tag:W.invalid,class:"tok-invalid"},{tag:W.punctuation,class:"tok-punctuation"}]);const LD=ak({String:W.string,Number:W.number,"True False":W.bool,PropertyName:W.propertyName,Null:W.null,", :":W.separator,"[ ]":W.squareBracket,"{ }":W.brace}),RD=$d.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:[LD],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 pp=[],dk=[];(()=>{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?dk:pp).push(n=n+t[e])})();function _D(t){if(t<768)return!1;for(let e=0,n=pp.length;;){let r=e+n>>1;if(t<pp[r])n=r;else if(t>=dk[r])e=r+1;else return!0;if(e==n)return!1}}function Cx(t){return t>=127462&&t<=127487}const jx=8205;function ID(t,e,n=!0,r=!0){return(n?uk:$D)(t,e,r)}function uk(t,e,n){if(e==t.length)return e;e&&hk(t.charCodeAt(e))&&fk(t.charCodeAt(e-1))&&e--;let r=Th(t,e);for(e+=Nx(r);e<t.length;){let s=Th(t,e);if(r==jx||s==jx||n&&_D(s))e+=Nx(s),r=s;else if(Cx(s)){let i=0,o=e-2;for(;o>=0&&Cx(Th(t,o));)i++,o-=2;if(i%2==0)break;e+=2}else break}return e}function $D(t,e,n){for(;e>0;){let r=uk(t,e-2,n);if(r<e)return r;e--}return 0}function Th(t,e){let n=t.charCodeAt(e);if(!fk(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return hk(r)?(n-55296<<10)+(r-56320)+65536:n}function hk(t){return t>=56320&&t<57344}function fk(t){return t>=55296&&t<56320}function Nx(t){return t<65536?1:2}class Ge{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]=eo(this,e,n);let s=[];return this.decompose(0,e,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(n,this.length,s,1),gr.from(s,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=eo(this,e,n);let r=[];return this.decompose(e,n,r,0),gr.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),s=new oa(this),i=new oa(e);for(let o=n,a=n;;){if(s.next(o),i.next(o),o=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(a+=s.value.length,s.done||a>=r)return!0}}iter(e=1){return new oa(this,e)}iterRange(e,n=this.length){return new pk(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let s=this.line(e).from;r=this.iterRange(s,Math.max(s,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new mk(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]?Ge.empty:e.length<=32?new ht(e):gr.from(ht.split(e,[]))}}class ht extends Ge{constructor(e,n=BD(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,s){for(let i=0;;i++){let o=this.text[i],a=s+o.length;if((n?r:a)>=e)return new FD(s,a,r,o);s=a+1,r++}}decompose(e,n,r,s){let i=e<=0&&n>=this.length?this:new ht(Px(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(s&1){let o=r.pop(),a=ud(i.text,o.text.slice(),0,i.length);if(a.length<=32)r.push(new ht(a,o.length+i.length));else{let l=a.length>>1;r.push(new ht(a.slice(0,l)),new ht(a.slice(l)))}}else r.push(i)}replace(e,n,r){if(!(r instanceof ht))return super.replace(e,n,r);[e,n]=eo(this,e,n);let s=ud(this.text,ud(r.text,Px(this.text,0,e)),n),i=this.length+r.length-(n-e);return s.length<=32?new ht(s,i):gr.from(ht.split(s,[]),i)}sliceString(e,n=this.length,r=`
|
|
260
|
+
`){[e,n]=eo(this,e,n);let s="";for(let i=0,o=0;i<=n&&o<this.text.length;o++){let a=this.text[o],l=i+a.length;i>e&&o&&(s+=r),e<l&&n>i&&(s+=a.slice(Math.max(0,e-i),n-i)),i=l+1}return s}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],s=-1;for(let i of e)r.push(i),s+=i.length+1,r.length==32&&(n.push(new ht(r,s)),r=[],s=-1);return s>-1&&n.push(new ht(r,s)),n}}class gr extends Ge{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,s){for(let i=0;;i++){let o=this.children[i],a=s+o.length,l=r+o.lines-1;if((n?l:a)>=e)return o.lineInner(e,n,r,s);s=a+1,r=l+1}}decompose(e,n,r,s){for(let i=0,o=0;o<=n&&i<this.children.length;i++){let a=this.children[i],l=o+a.length;if(e<=l&&n>=o){let d=s&((o<=e?1:0)|(l>=n?2:0));o>=e&&l<=n&&!d?r.push(a):a.decompose(e-o,n-o,r,d)}o=l+1}}replace(e,n,r){if([e,n]=eo(this,e,n),r.lines<this.lines)for(let s=0,i=0;s<this.children.length;s++){let o=this.children[s],a=i+o.length;if(e>=i&&n<=a){let l=o.replace(e-i,n-i,r),d=this.lines-o.lines+l.lines;if(l.lines<d>>4&&l.lines>d>>6){let u=this.children.slice();return u[s]=l,new gr(u,this.length-(n-e)+r.length)}return super.replace(i,a,l)}i=a+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=`
|
|
261
|
+
`){[e,n]=eo(this,e,n);let s="";for(let i=0,o=0;i<this.children.length&&o<=n;i++){let a=this.children[i],l=o+a.length;o>e&&i&&(s+=r),e<l&&n>o&&(s+=a.sliceString(e-o,n-o,r)),o=l+1}return s}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof gr))return 0;let r=0,[s,i,o,a]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=n,i+=n){if(s==o||i==a)return r;let l=this.children[s],d=e.children[i];if(l!=d)return r+l.scanIdentical(d,n);r+=l.length+1}}static from(e,n=e.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let p of e)r+=p.lines;if(r<32){let p=[];for(let m of e)m.flatten(p);return new ht(p,n)}let s=Math.max(32,r>>5),i=s<<1,o=s>>1,a=[],l=0,d=-1,u=[];function h(p){let m;if(p.lines>i&&p instanceof gr)for(let x of p.children)h(x);else p.lines>o&&(l>o||!l)?(f(),a.push(p)):p instanceof ht&&l&&(m=u[u.length-1])instanceof ht&&p.lines+m.lines<=32?(l+=p.lines,d+=p.length+1,u[u.length-1]=new ht(m.text.concat(p.text),m.length+1+p.length)):(l+p.lines>s&&f(),l+=p.lines,d+=p.length+1,u.push(p))}function f(){l!=0&&(a.push(u.length==1?u[0]:gr.from(u,d)),d=-1,l=u.length=0)}for(let p of e)h(p);return f(),a.length==1?a[0]:new gr(a,n)}}Ge.empty=new ht([""],0);function BD(t){let e=-1;for(let n of t)e+=n.length+1;return e}function ud(t,e,n=0,r=1e9){for(let s=0,i=0,o=!0;i<t.length&&s<=r;i++){let a=t[i],l=s+a.length;l>=n&&(l>r&&(a=a.slice(0,r-s)),s<n&&(a=a.slice(n-s)),o?(e[e.length-1]+=a,o=!1):e.push(a)),s=l+1}return e}function Px(t,e,n){return ud(t,[""],e,n)}class oa{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 ht?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],i=this.offsets[r],o=i>>1,a=s instanceof ht?s.text.length:s.children.length;if(o==(n>0?a:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=`
|
|
262
|
+
`,this;e--}else if(s instanceof ht){let l=s.text[o+(n<0?-1:0)];if(this.offsets[r]+=n,l.length>Math.max(0,e))return this.value=e==0?l:n>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=s.children[o+(n<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof ht?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 pk{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new oa(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*n,this.value=s.length<=r?s:n<0?s.slice(s.length-r):s.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class mk{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:s}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Ge.prototype[Symbol.iterator]=function(){return this.iter()},oa.prototype[Symbol.iterator]=pk.prototype[Symbol.iterator]=mk.prototype[Symbol.iterator]=function(){return this});class FD{constructor(e,n,r,s){this.from=e,this.to=n,this.number=r,this.text=s}get length(){return this.to-this.from}}function eo(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function Ct(t,e,n=!0,r=!0){return ID(t,e,n,r)}function zD(t){return t>=56320&&t<57344}function VD(t){return t>=55296&&t<56320}function an(t,e){let n=t.charCodeAt(e);if(!VD(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return zD(r)?(n-55296<<10)+(r-56320)+65536:n}function Zm(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function xr(t){return t<65536?1:2}const mp=/\r\n?|\n/;var Zt=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(Zt||(Zt={}));class Sr{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];e+=r<0?this.sections[n]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,r=0,s=0;n<this.sections.length;){let i=this.sections[n++],o=this.sections[n++];o<0?(e(r,s,i),s+=i):s+=o,r+=i}}iterChangedRanges(e,n=!1){gp(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],s=this.sections[n++];s<0?e.push(r,s):e.push(s,r)}return new Sr(e)}composeDesc(e){return this.empty?e:e.empty?this:gk(this,e)}mapDesc(e,n=!1){return e.empty?this:xp(this,e,n)}mapPos(e,n=-1,r=Zt.Simple){let s=0,i=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],d=s+a;if(l<0){if(d>e)return i+(e-s);i+=a}else{if(r!=Zt.Simple&&d>=e&&(r==Zt.TrackDel&&s<e&&d>e||r==Zt.TrackBefore&&s<e||r==Zt.TrackAfter&&d>e))return null;if(d>e||d==e&&n<0&&!a)return e==s||n<0?i:i+l;i+=l}s=d}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return i}touchesRange(e,n=e){for(let r=0,s=0;r<this.sections.length&&s<=n;){let i=this.sections[r++],o=this.sections[r++],a=s+i;if(o>=0&&s<=n&&a>=e)return s<e&&a>n?"cover":!0;s=a}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],s=this.sections[n++];e+=(e?" ":"")+r+(s>=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Sr(e)}static create(e){return new Sr(e)}}class kt extends Sr{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 gp(this,(n,r,s,i,o)=>e=e.replace(s,s+(r-n),o),!1),e}mapDesc(e,n=!1){return xp(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let s=0,i=0;s<n.length;s+=2){let o=n[s],a=n[s+1];if(a>=0){n[s]=a,n[s+1]=o;let l=s>>1;for(;r.length<l;)r.push(Ge.empty);r.push(o?e.slice(i,i+o):Ge.empty)}i+=o}return new kt(n,r)}compose(e){return this.empty?e:e.empty?this:gk(this,e,!0)}map(e,n=!1){return e.empty?this:xp(this,e,n,!0)}iterChanges(e,n=!1){gp(this,e,n)}get desc(){return Sr.create(this.sections)}filter(e){let n=[],r=[],s=[],i=new ja(this);e:for(let o=0,a=0;;){let l=o==e.length?1e9:e[o++];for(;a<l||a==l&&i.len==0;){if(i.done)break e;let u=Math.min(i.len,l-a);Ut(s,u,-1);let h=i.ins==-1?-1:i.off==0?i.ins:0;Ut(n,u,h),h>0&&ps(r,n,i.text),i.forward(u),a+=u}let d=e[o++];for(;a<d;){if(i.done)break e;let u=Math.min(i.len,d-a);Ut(n,u,-1),Ut(s,u,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(u),a+=u}}return{changes:new kt(n,r),filtered:Sr.create(s)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],s=this.sections[n+1];s<0?e.push(r):s==0?e.push([r]):e.push([r].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,r){let s=[],i=[],o=0,a=null;function l(u=!1){if(!u&&!s.length)return;o<n&&Ut(s,n-o,-1);let h=new kt(s,i);a=a?a.compose(h.map(a)):h,s=[],i=[],o=0}function d(u){if(Array.isArray(u))for(let h of u)d(h);else if(u instanceof kt){if(u.length!=n)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${n})`);l(),a=a?a.compose(u.map(a)):u}else{let{from:h,to:f=h,insert:p}=u;if(h>f||h<0||f>n)throw new RangeError(`Invalid change range ${h} to ${f} (in doc of length ${n})`);let m=p?typeof p=="string"?Ge.of(p.split(r||mp)):p:Ge.empty,x=m.length;if(h==f&&x==0)return;h<o&&l(),h>o&&Ut(s,h-o,-1),Ut(s,f-h,x),ps(i,s,m),o=f}}return d(e),l(!a),a}static empty(e){return new kt(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let s=0;s<e.length;s++){let i=e[s];if(typeof i=="number")n.push(i,-1);else{if(!Array.isArray(i)||typeof i[0]!="number"||i.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length<s;)r.push(Ge.empty);r[s]=Ge.of(i.slice(1)),n.push(i[0],r[s].length)}}}return new kt(n,r)}static createSet(e,n){return new kt(e,n)}}function Ut(t,e,n,r=!1){if(e==0&&n<=0)return;let s=t.length-2;s>=0&&n<=0&&n==t[s+1]?t[s]+=e:s>=0&&e==0&&t[s]==0?t[s+1]+=n:r?(t[s]+=e,t[s+1]+=n):t.push(e,n)}function ps(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(Ge.empty);t.push(n)}}function gp(t,e,n){let r=t.inserted;for(let s=0,i=0,o=0;o<t.sections.length;){let a=t.sections[o++],l=t.sections[o++];if(l<0)s+=a,i+=a;else{let d=s,u=i,h=Ge.empty;for(;d+=a,u+=l,l&&r&&(h=h.append(r[o-2>>1])),!(n||o==t.sections.length||t.sections[o+1]<0);)a=t.sections[o++],l=t.sections[o++];e(s,d,i,u,h),s=d,i=u}}}function xp(t,e,n,r=!1){let s=[],i=r?[]:null,o=new ja(t),a=new ja(e);for(let l=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let d=Math.min(o.len,a.len);Ut(s,d,-1),o.forward(d),a.forward(d)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!n))){let d=a.len;for(Ut(s,a.ins,-1);d;){let u=Math.min(o.len,d);o.ins>=0&&l<o.i&&o.len<=u&&(Ut(s,0,o.ins),i&&ps(i,s,o.text),l=o.i),o.forward(u),d-=u}a.next()}else if(o.ins>=0){let d=0,u=o.len;for(;u;)if(a.ins==-1){let h=Math.min(u,a.len);d+=h,u-=h,a.forward(h)}else if(a.ins==0&&a.len<u)u-=a.len,a.next();else break;Ut(s,d,l<o.i?o.ins:0),i&&l<o.i&&ps(i,s,o.text),l=o.i,o.forward(o.len-u)}else{if(o.done&&a.done)return i?kt.createSet(s,i):Sr.create(s);throw new Error("Mismatched change set lengths")}}}function gk(t,e,n=!1){let r=[],s=n?[]:null,i=new ja(t),o=new ja(e);for(let a=!1;;){if(i.done&&o.done)return s?kt.createSet(r,s):Sr.create(r);if(i.ins==0)Ut(r,i.len,0,a),i.next();else if(o.len==0&&!o.done)Ut(r,0,o.ins,a),s&&ps(s,r,o.text),o.next();else{if(i.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(i.len2,o.len),d=r.length;if(i.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;Ut(r,l,u,a),s&&u&&ps(s,r,o.text)}else o.ins==-1?(Ut(r,i.off?0:i.len,l,a),s&&ps(s,r,i.textBit(l))):(Ut(r,i.off?0:i.len,o.off?0:o.ins,a),s&&!o.off&&ps(s,r,o.text));a=(i.ins>l||o.ins>=0&&o.len>l)&&(a||r.length>d),i.forward2(l),o.forward(l)}}}}class ja{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?Ge.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?Ge.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 Gs{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,s;return this.empty?r=s=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),r==this.from&&s==this.to?this:new Gs(r,s,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return q.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return q.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 q.range(e.anchor,e.head)}static create(e,n,r){return new Gs(e,n,r)}}class q{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:q.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 q([this.main],0)}addRange(e,n=!0){return q.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let r=this.ranges.slice();return r[n]=e,q.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 q(e.ranges.map(n=>Gs.fromJSON(n)),e.main)}static single(e,n=e){return new q([q.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;s<e.length;s++){let i=e[s];if(i.empty?i.from<=r:i.from<r)return q.normalized(e.slice(),n);r=i.to}return new q(e,n)}static cursor(e,n=0,r,s){return Gs.create(e,e,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(s??16777215)<<6)}static range(e,n,r,s){let i=(r??16777215)<<6|(s==null?7:Math.min(6,s));return n<e?Gs.create(n,e,48|i):Gs.create(e,n,(n>e?8:0)|i)}static normalized(e,n=0){let r=e[n];e.sort((s,i)=>s.from-i.from),n=e.indexOf(r);for(let s=1;s<e.length;s++){let i=e[s],o=e[s-1];if(i.empty?i.from<=o.to:i.from<o.to){let a=o.from,l=Math.max(i.to,o.to);s<=n&&n--,e.splice(--s,2,i.anchor>i.head?q.range(l,a):q.range(a,l))}}return new q(e,n)}}function xk(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let Qm=0;class pe{constructor(e,n,r,s,i){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=Qm++,this.default=e([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(e={}){return new pe(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:Jm),!!e.static,e.enables)}of(e){return new hd([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new hd(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new hd(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function Jm(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class hd{constructor(e,n,r,s){this.dependencies=e,this.facet=n,this.type=r,this.value=s,this.id=Qm++}dynamicSlot(e){var n;let r=this.value,s=this.facet.compareInput,i=this.id,o=e[i]>>1,a=this.type==2,l=!1,d=!1,u=[];for(let h of this.dependencies)h=="doc"?l=!0:h=="selection"?d=!0:((n=e[h.id])!==null&&n!==void 0?n:1)&1||u.push(e[h.id]);return{create(h){return h.values[o]=r(h),1},update(h,f){if(l&&f.docChanged||d&&(f.docChanged||f.selection)||bp(h,u)){let p=r(h);if(a?!Ox(p,h.values[o],s):!s(p,h.values[o]))return h.values[o]=p,1}return 0},reconfigure:(h,f)=>{let p,m=f.config.address[i];if(m!=null){let x=zd(f,m);if(this.dependencies.every(b=>b instanceof pe?f.facet(b)===h.facet(b):b instanceof zt?f.field(b,!1)==h.field(b,!1):!0)||(a?Ox(p=r(h),x,s):s(p=r(h),x)))return h.values[o]=x,0}else p=r(h);return h.values[o]=p,1}}}}function Ox(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 bp(t,e){let n=!1;for(let r of e)aa(t,r)&1&&(n=!0);return n}function HD(t,e,n){let r=n.map(l=>t[l.id]),s=n.map(l=>l.type),i=r.filter(l=>!(l&1)),o=t[e.id]>>1;function a(l){let d=[];for(let u=0;u<r.length;u++){let h=zd(l,r[u]);if(s[u]==2)for(let f of h)d.push(f);else d.push(h)}return e.combine(d)}return{create(l){for(let d of r)aa(l,d);return l.values[o]=a(l),1},update(l,d){if(!bp(l,i))return 0;let u=a(l);return e.compare(u,l.values[o])?0:(l.values[o]=u,1)},reconfigure(l,d){let u=bp(l,r),h=d.config.facets[e.id],f=d.facet(e);if(h&&!u&&Jm(n,h))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 Cc=pe.define({static:!0});class zt{constructor(e,n,r,s,i){this.id=e,this.createF=n,this.updateF=r,this.compareF=s,this.spec=i,this.provides=void 0}static define(e){let n=new zt(Qm++,e.create,e.update,e.compare||((r,s)=>r===s),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Cc).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,s)=>{let i=r.values[n],o=this.updateF(i,s);return this.compareF(i,o)?0:(r.values[n]=o,1)},reconfigure:(r,s)=>{let i=r.facet(Cc),o=s.facet(Cc),a;return(a=i.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(r.values[n]=a.create(r),1):s.config.address[this.id]!=null?(r.values[n]=s.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,Cc.of({field:this,create:e})]}get extension(){return this}}const zs={lowest:4,low:3,default:2,high:1,highest:0};function Fo(t){return e=>new bk(e,t)}const hi={highest:Fo(zs.highest),high:Fo(zs.high),default:Fo(zs.default),low:Fo(zs.low),lowest:Fo(zs.lowest)};class bk{constructor(e,n){this.inner=e,this.prec=n}}class $u{of(e){return new yp(this,e)}reconfigure(e){return $u.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class yp{constructor(e,n){this.compartment=e,this.inner=n}}class Fd{constructor(e,n,r,s,i,o){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=i,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,r){let s=[],i=Object.create(null),o=new Map;for(let f of WD(e,n,o))f instanceof zt?s.push(f):(i[f.facet.id]||(i[f.facet.id]=[])).push(f);let a=Object.create(null),l=[],d=[];for(let f of s)a[f.id]=d.length<<1,d.push(p=>f.slot(p));let u=r?.config.facets;for(let f in i){let p=i[f],m=p[0].facet,x=u&&u[f]||[];if(p.every(b=>b.type==0))if(a[m.id]=l.length<<1|1,Jm(x,p))l.push(r.facet(m));else{let b=m.combine(p.map(y=>y.value));l.push(r&&m.compare(b,r.facet(m))?r.facet(m):b)}else{for(let b of p)b.type==0?(a[b.id]=l.length<<1|1,l.push(b.value)):(a[b.id]=d.length<<1,d.push(y=>b.dynamicSlot(y)));a[m.id]=d.length<<1,d.push(b=>HD(b,m,p))}}let h=d.map(f=>f(a));return new Fd(e,o,h,a,l,i)}}function WD(t,e,n){let r=[[],[],[],[],[]],s=new Map;function i(o,a){let l=s.get(o);if(l!=null){if(l<=a)return;let d=r[l].indexOf(o);d>-1&&r[l].splice(d,1),o instanceof yp&&n.delete(o.compartment)}if(s.set(o,a),Array.isArray(o))for(let d of o)i(d,a);else if(o instanceof yp){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(o.compartment)||o.inner;n.set(o.compartment,d),i(d,a)}else if(o instanceof bk)i(o.inner,o.prec);else if(o instanceof zt)r[a].push(o),o.provides&&i(o.provides,a);else if(o instanceof hd)r[a].push(o),o.facet.extensions&&i(o.facet.extensions,zs.default);else{let d=o.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(d,a)}}return i(t,zs.default),r.reduce((o,a)=>o.concat(a))}function aa(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let s=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|s}function zd(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const yk=pe.define(),vp=pe.define({combine:t=>t.some(e=>e),static:!0}),vk=pe.define({combine:t=>t.length?t[0]:void 0,static:!0}),wk=pe.define(),kk=pe.define(),Sk=pe.define(),Ck=pe.define({combine:t=>t.length?t[0]:!1});class Or{constructor(e,n){this.type=e,this.value=n}static define(){return new UD}}class UD{of(e){return new Or(this,e)}}class KD{constructor(e){this.map=e}of(e){return new Me(this,e)}}class Me{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new Me(this.type,n)}is(e){return this.type==e}static define(e={}){return new KD(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let s of e){let i=s.map(n);i&&r.push(i)}return r}}Me.reconfigure=Me.define();Me.appendConfig=Me.define();class jt{constructor(e,n,r,s,i,o){this.startState=e,this.changes=n,this.selection=r,this.effects=s,this.annotations=i,this.scrollIntoView=o,this._doc=null,this._state=null,r&&xk(r,n.newLength),i.some(a=>a.type==jt.time)||(this.annotations=i.concat(jt.time.of(Date.now())))}static create(e,n,r,s,i,o){return new jt(e,n,r,s,i,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(jt.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}jt.time=Or.define();jt.userEvent=Or.define();jt.addToHistory=Or.define();jt.remote=Or.define();function GD(t,e){let n=[];for(let r=0,s=0;;){let i,o;if(r<t.length&&(s==e.length||e[s]>=t[r]))i=t[r++],o=t[r++];else if(s<e.length)i=e[s++],o=e[s++];else return n;!n.length||n[n.length-1]<i?n.push(i,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function jk(t,e,n){var r;let s,i,o;return n?(s=e.changes,i=kt.empty(e.changes.length),o=t.changes.compose(e.changes)):(s=e.changes.map(t.changes),i=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(s)),{changes:o,selection:e.selection?e.selection.map(i):(r=t.selection)===null||r===void 0?void 0:r.map(s),effects:Me.mapEffects(t.effects,s).concat(Me.mapEffects(e.effects,i)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function wp(t,e,n){let r=e.selection,s=$i(e.annotations);return e.userEvent&&(s=s.concat(jt.userEvent.of(e.userEvent))),{changes:e.changes instanceof kt?e.changes:kt.of(e.changes||[],n,t.facet(vk)),selection:r&&(r instanceof q?r:q.single(r.anchor,r.head)),effects:$i(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function Nk(t,e,n){let r=wp(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let i=1;i<e.length;i++){e[i].filter===!1&&(n=!1);let o=!!e[i].sequential;r=jk(r,wp(t,e[i],o?r.changes.newLength:t.doc.length),o)}let s=jt.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return YD(n?qD(s):s)}function qD(t){let e=t.startState,n=!0;for(let s of e.facet(wk)){let i=s(t);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:GD(n,i))}if(n!==!0){let s,i;if(n===!1)i=t.changes.invertedDesc,s=kt.empty(e.doc.length);else{let o=t.changes.filter(n);s=o.changes,i=o.filtered.mapDesc(o.changes).invertedDesc}t=jt.create(e,s,t.selection&&t.selection.map(i),Me.mapEffects(t.effects,i),t.annotations,t.scrollIntoView)}let r=e.facet(kk);for(let s=r.length-1;s>=0;s--){let i=r[s](t);i instanceof jt?t=i:Array.isArray(i)&&i.length==1&&i[0]instanceof jt?t=i[0]:t=Nk(e,$i(i),!1)}return t}function YD(t){let e=t.startState,n=e.facet(Sk),r=t;for(let s=n.length-1;s>=0;s--){let i=n[s](t);i&&Object.keys(i).length&&(r=jk(r,wp(e,i,t.changes.newLength),!0))}return r==t?t:jt.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const XD=[];function $i(t){return t==null?XD:Array.isArray(t)?t:[t]}var st=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(st||(st={}));const ZD=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let kp;try{kp=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function QD(t){if(kp)return kp.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||ZD.test(n)))return!0}return!1}function JD(t){return e=>{if(!/\S/.test(e))return st.Space;if(QD(e))return st.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return st.Word;return st.Other}}class Fe{constructor(e,n,r,s,i,o){this.config=e,this.doc=n,this.selection=r,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=i,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)aa(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 aa(this,r),zd(this,r)}update(...e){return Nk(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:s}=n;for(let a of e.effects)a.is($u.reconfigure)?(n&&(s=new Map,n.compartments.forEach((l,d)=>s.set(d,l)),n=null),s.set(a.value.compartment,a.value.extension)):a.is(Me.reconfigure)?(n=null,r=a.value):a.is(Me.appendConfig)&&(n=null,r=$i(r).concat(a.value));let i;n?i=e.startState.values.slice():(n=Fd.resolve(r,s,this),i=new Fe(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,d)=>d.reconfigure(l,this),null).values);let o=e.startState.facet(vp)?e.newSelection:e.newSelection.asSingle();new Fe(n,e.newDoc,o,i,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:q.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),s=this.changes(r.changes),i=[r.range],o=$i(r.effects);for(let a=1;a<n.ranges.length;a++){let l=e(n.ranges[a]),d=this.changes(l.changes),u=d.map(s);for(let f=0;f<a;f++)i[f]=i[f].map(u);let h=s.mapDesc(d,!0);i.push(l.range.map(h)),s=s.compose(u),o=Me.mapEffects(o,u).concat(Me.mapEffects($i(l.effects),h))}return{changes:s,selection:q.create(i,n.mainIndex),effects:o}}changes(e=[]){return e instanceof kt?e:kt.of(e,this.doc.length,this.facet(Fe.lineSeparator))}toText(e){return Ge.of(e.split(this.facet(Fe.lineSeparator)||mp))}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:(aa(this,n),zd(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let s=e[r];s instanceof zt&&this.config.address[s.id]!=null&&(n[r]=s.spec.toJSON(this.field(e[r]),this))}return n}static fromJSON(e,n={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(r){for(let i in r)if(Object.prototype.hasOwnProperty.call(e,i)){let o=r[i],a=e[i];s.push(o.init(l=>o.spec.fromJSON(a,l)))}}return Fe.create({doc:e.doc,selection:q.fromJSON(e.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(e={}){let n=Fd.resolve(e.extensions||[],new Map),r=e.doc instanceof Ge?e.doc:Ge.of((e.doc||"").split(n.staticFacet(Fe.lineSeparator)||mp)),s=e.selection?e.selection instanceof q?e.selection:q.single(e.selection.anchor,e.selection.head):q.single(0);return xk(s,r.length),n.staticFacet(vp)||(s=s.asSingle()),new Fe(n,r,s,n.dynamicSlots.map(()=>null),(i,o)=>o.create(i),null)}get tabSize(){return this.facet(Fe.tabSize)}get lineBreak(){return this.facet(Fe.lineSeparator)||`
|
|
263
|
+
`}get readOnly(){return this.facet(Ck)}phrase(e,...n){for(let r of this.facet(Fe.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let i=+(s||1);return!i||i>n.length?r:n[i-1]})),e}languageDataAt(e,n,r=-1){let s=[];for(let i of this.facet(yk))for(let o of i(this,n,r))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){let n=this.languageDataAt("wordChars",e);return JD(n.length?n[0]:"")}wordAt(e){let{text:n,from:r,length:s}=this.doc.lineAt(e),i=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let l=Ct(n,o,!1);if(i(n.slice(l,o))!=st.Word)break;o=l}for(;a<s;){let l=Ct(n,a);if(i(n.slice(a,l))!=st.Word)break;a=l}return o==a?null:q.range(o+r,a+r)}}Fe.allowMultipleSelections=vp;Fe.tabSize=pe.define({combine:t=>t.length?t[0]:4});Fe.lineSeparator=vk;Fe.readOnly=Ck;Fe.phrases=pe.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(s=>t[s]==e[s])}});Fe.languageData=yk;Fe.changeFilter=wk;Fe.transactionFilter=kk;Fe.transactionExtender=Sk;$u.reconfigure=Me.define();function Er(t,e,n={}){let r={};for(let s of t)for(let i of Object.keys(s)){let o=s[i],a=r[i];if(a===void 0)r[i]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](a,o);else throw new Error("Config merge conflict for field "+i)}for(let s in e)r[s]===void 0&&(r[s]=e[s]);return r}class ks{eq(e){return this==e}range(e,n=e){return Na.create(e,n,this)}}ks.prototype.startSide=ks.prototype.endSide=0;ks.prototype.point=!1;ks.prototype.mapMode=Zt.TrackDel;function eg(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}class Na{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new Na(e,n,r)}}function Sp(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class tg{constructor(e,n,r,s){this.from=e,this.to=n,this.value=r,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,s=0){let i=r?this.to:this.from;for(let o=s,a=i.length;;){if(o==a)return o;let l=o+a>>1,d=i[l]-e||(r?this.value[l].endSide:this.value[l].startSide)-n;if(l==o)return d>=0?o:a;d>=0?a=l:o=l+1}}between(e,n,r,s){for(let i=this.findIndex(n,-1e9,!0),o=this.findIndex(r,1e9,!1,i);i<o;i++)if(s(this.from[i]+e,this.to[i]+e,this.value[i])===!1)return!1}map(e,n){let r=[],s=[],i=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let d=this.value[l],u=this.from[l]+e,h=this.to[l]+e,f,p;if(u==h){let m=n.mapPos(u,d.startSide,d.mapMode);if(m==null||(f=p=m,d.startSide!=d.endSide&&(p=n.mapPos(u,d.endSide),p<f)))continue}else if(f=n.mapPos(u,d.startSide),p=n.mapPos(h,d.endSide),f>p||f==p&&d.startSide>0&&d.endSide<=0)continue;(p-f||d.endSide-d.startSide)<0||(o<0&&(o=f),d.point&&(a=Math.max(a,p-f)),r.push(d),s.push(f-o),i.push(p-o))}return{mapped:r.length?new tg(s,i,r,a):null,pos:o}}}class Ie{constructor(e,n,r,s){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=s}static create(e,n,r,s){return new Ie(e,n,r,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:s=0,filterTo:i=this.length}=e,o=e.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(Sp)),this.isEmpty)return n.length?Ie.of(n):this;let a=new Pk(this,null,-1).goto(0),l=0,d=[],u=new Ur;for(;a.value||l<n.length;)if(l<n.length&&(a.from-n[l].from||a.startSide-n[l].value.startSide)>=0){let h=n[l++];u.addInner(h.from,h.to,h.value)||d.push(h)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==n.length||this.chunkEnd(a.chunkIndex)<n[l].from)&&(!o||s>this.chunkEnd(a.chunkIndex)||i<this.chunkPos[a.chunkIndex])&&u.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||s>a.to||i<a.from||o(a.from,a.to,a.value))&&(u.addInner(a.from,a.to,a.value)||d.push(Na.create(a.from,a.to,a.value))),a.next());return u.finishInner(this.nextLayer.isEmpty&&!d.length?Ie.empty:this.nextLayer.update({add:d,filter:o,filterFrom:s,filterTo:i}))}map(e){if(e.empty||this.isEmpty)return this;let n=[],r=[],s=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],d=e.touchesRange(a,a+l.length);if(d===!1)s=Math.max(s,l.maxPoint),n.push(l),r.push(e.mapPos(a));else if(d===!0){let{mapped:u,pos:h}=l.map(a,e);u&&(s=Math.max(s,u.maxPoint),n.push(u),r.push(h))}}let i=this.nextLayer.map(e);return n.length==0?i:new Ie(r,n,i||Ie.empty,s)}between(e,n,r){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let i=this.chunkPos[s],o=this.chunk[s];if(n>=i&&e<=i+o.length&&o.between(i,e-i,n-i,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return Pa.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return Pa.from(e).goto(n)}static compare(e,n,r,s,i=-1){let o=e.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=i),a=n.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=i),l=Ex(o,a,r),d=new zo(o,l,i),u=new zo(a,l,i);r.iterGaps((h,f,p)=>Dx(d,h,u,f,p,s)),r.empty&&r.length==0&&Dx(d,0,u,0,0,s)}static eq(e,n,r=0,s){s==null&&(s=999999999);let i=e.filter(u=>!u.isEmpty&&n.indexOf(u)<0),o=n.filter(u=>!u.isEmpty&&e.indexOf(u)<0);if(i.length!=o.length)return!1;if(!i.length)return!0;let a=Ex(i,o),l=new zo(i,a,0).goto(r),d=new zo(o,a,0).goto(r);for(;;){if(l.to!=d.to||!Cp(l.active,d.active)||l.point&&(!d.point||!eg(l.point,d.point)))return!1;if(l.to>s)return!0;l.next(),d.next()}}static spans(e,n,r,s,i=-1){let o=new zo(e,null,i).goto(n),a=n,l=o.openStart;for(;;){let d=Math.min(o.to,r);if(o.point){let u=o.activeForPoint(o.to),h=o.pointFrom<n?u.length+1:o.point.startSide<0?u.length:Math.min(u.length,l);s.point(a,d,o.point,u,h,o.pointRank),l=Math.min(o.openEnd(d),u.length)}else d>a&&(s.span(a,d,o.active,l),l=o.openEnd(d));if(o.to>r)return l+(o.point&&o.to>r?1:0);a=o.to,o.next()}}static of(e,n=!1){let r=new Ur;for(let s of e instanceof Na?[e]:n?eM(e):e)r.add(s.from,s.to,s.value);return r.finish()}static join(e){if(!e.length)return Ie.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let s=e[r];s!=Ie.empty;s=s.nextLayer)n=new Ie(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}Ie.empty=new Ie([],[],null,-1);function eM(t){if(t.length>1)for(let e=t[0],n=1;n<t.length;n++){let r=t[n];if(Sp(e,r)>0)return t.slice().sort(Sp);e=r}return t}Ie.empty.nextLayer=Ie.empty;class Ur{finishChunk(e){this.chunks.push(new tg(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 Ur)).add(e,n,r)}addInner(e,n,r){let s=e-this.lastTo||r.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(Ie.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=Ie.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function Ex(t,e,n){let r=new Map;for(let i of t)for(let o=0;o<i.chunk.length;o++)i.chunk[o].maxPoint<=0&&r.set(i.chunk[o],i.chunkPos[o]);let s=new Set;for(let i of e)for(let o=0;o<i.chunk.length;o++){let a=r.get(i.chunk[o]);a!=null&&(n?n.mapPos(a):a)==i.chunkPos[o]&&!n?.touchesRange(a,a+i.chunk[o].length)&&s.add(i.chunk[o])}return s}class Pk{constructor(e,n,r,s=0){this.layer=e,this.skip=n,this.minPoint=r,this.rank=s}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,n,!1),this}gotoInner(e,n,r){for(;this.chunkIndex<this.layer.chunk.length;){let s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<e||s.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],n,!0);(!r||this.rangeIndex<s)&&this.setRangeIndex(s)}this.next()}forward(e,n){(this.to-e||this.endSide-n)<0&&this.gotoInner(e,n,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],n=this.layer.chunk[this.chunkIndex],r=e+n.from[this.rangeIndex];if(this.from=r,this.to=e+n.to[this.rangeIndex],this.value=n.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Pa{constructor(e){this.heap=e}static from(e,n=null,r=-1){let s=[];for(let i=0;i<e.length;i++)for(let o=e[i];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&s.push(new Pk(o,n,r,i));return s.length==1?s[0]:new Pa(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)Lh(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--)Lh(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(),Lh(this.heap,0)}}}function Lh(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let s=t[r];if(r+1<t.length&&s.compare(t[r+1])>=0&&(s=t[r+1],r++),n.compare(s)<0)break;t[r]=n,t[e]=s,e=r}}class zo{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=Pa.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){jc(this.active,e),jc(this.activeTo,e),jc(this.activeRank,e),this.minActive=Mx(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:s,rank:i}=this.cursor;for(;n<this.activeRank.length&&(i-this.activeRank[n]||s-this.activeTo[n])>0;)n++;Nc(this.active,n,r),Nc(this.activeTo,n,s),Nc(this.activeRank,n,i),e&&Nc(e,n,this.cursor.from),this.minActive=Mx(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&jc(r,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=i,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=i.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let s=r.length-1;s>=0&&r[s]<e;s--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let n=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function Dx(t,e,n,r,s,i){t.goto(e),n.goto(r);let o=r+s,a=r,l=r-e,d=!!i.boundChange;for(let u=!1;;){let h=t.to+l-n.to,f=h||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&&eg(t.point,n.point)&&Cp(t.activeForPoint(t.to),n.activeForPoint(n.to))||i.comparePoint(a,m,t.point,n.point),u=!1):(u&&i.boundChange(a),m>a&&!Cp(t.active,n.active)&&i.compareRange(a,m,t.active,n.active),d&&m<o&&(h||t.openEnd(p)!=n.openEnd(p))&&(u=!0)),p>o)break;a=p,f<=0&&t.next(),f>=0&&n.next()}}function Cp(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n]&&!eg(t[n],e[n]))return!1;return!0}function jc(t,e){for(let n=e,r=t.length-1;n<r;n++)t[n]=t[n+1];t.pop()}function Nc(t,e,n){for(let r=t.length-1;r>=e;r--)t[r+1]=t[r];t[e]=n}function Mx(t,e){let n=-1,r=1e9;for(let s=0;s<e.length;s++)(e[s]-r||t[s].endSide-t[n].endSide)<0&&(n=s,r=e[s]);return n}function vo(t,e,n=t.length){let r=0;for(let s=0;s<n&&s<t.length;)t.charCodeAt(s)==9?(r+=e-r%e,s++):(r++,s=Ct(t,s));return r}function jp(t,e,n,r){for(let s=0,i=0;;){if(i>=e)return s;if(s==t.length)break;i+=t.charCodeAt(s)==9?n-i%n:1,s=Ct(t,s)}return r===!0?-1:t.length}const Np="ͼ",Ax=typeof Symbol>"u"?"__"+Np:Symbol.for(Np),Pp=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Tx=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Ss{constructor(e,n){this.rules=[];let{finish:r}=n||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function i(o,a,l,d){let u=[],h=/^@(\w+)\b/.exec(o[0]),f=h&&h[1]=="keyframes";if(h&&a==null)return l.push(o[0]+";");for(let p in a){let m=a[p];if(/&/.test(p))i(p.split(/,\s*/).map(x=>o.map(b=>x.replace(/&/,b))).reduce((x,b)=>x.concat(b)),m,l);else if(m&&typeof m=="object"){if(!h)throw new RangeError("The value of a property ("+p+") should be a primitive value.");i(s(p),m,u,f)}else m!=null&&u.push(p.replace(/_.*/,"").replace(/[A-Z]/g,x=>"-"+x.toLowerCase())+": "+m+";")}(u.length||f)&&l.push((r&&!h&&!d?o.map(r):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in e)i(s(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
264
|
+
`)}static newName(){let e=Tx[Ax]||1;return Tx[Ax]=e+1,Np+e.toString(36)}static mount(e,n,r){let s=e[Pp],i=r&&r.nonce;s?i&&s.setNonce(i):s=new tM(e,i),s.mount(Array.isArray(n)?n:[n],e)}}let Lx=new Map;class tM{constructor(e,n){let r=e.ownerDocument||e,s=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let i=Lx.get(r);if(i)return e[Pp]=i;this.sheet=new s.CSSStyleSheet,Lx.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[Pp]=this}mount(e,n){let r=this.sheet,s=0,i=0;for(let o=0;o<e.length;o++){let a=e[o],l=this.modules.indexOf(a);if(l<i&&l>-1&&(this.modules.splice(l,1),i--,l=-1),l==-1){if(this.modules.splice(i++,0,a),r)for(let d=0;d<a.rules.length;d++)r.insertRule(a.rules[d],s++)}else{for(;i<l;)s+=this.modules[i++].rules.length;s+=a.rules.length,i++}}if(r)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
|
|
265
|
+
`;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 Cs={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:"'"},Oa={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},nM=typeof navigator<"u"&&/Mac/.test(navigator.platform),rM=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var $t=0;$t<10;$t++)Cs[48+$t]=Cs[96+$t]=String($t);for(var $t=1;$t<=24;$t++)Cs[$t+111]="F"+$t;for(var $t=65;$t<=90;$t++)Cs[$t]=String.fromCharCode($t+32),Oa[$t]=String.fromCharCode($t);for(var Rh in Cs)Oa.hasOwnProperty(Rh)||(Oa[Rh]=Cs[Rh]);function sM(t){var e=nM&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||rM&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Oa:Cs)[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 Xe(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var s=n[r];typeof s=="string"?t.setAttribute(r,s):s!=null&&(t[r]=s)}e++}for(;e<arguments.length;e++)Ok(t,arguments[e]);return t}function Ok(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++)Ok(t,e[n]);else throw new RangeError("Unsupported child node: "+e)}let Xt=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Op=typeof document<"u"?document:{documentElement:{style:{}}};const Ep=/Edge\/(\d+)/.exec(Xt.userAgent),Ek=/MSIE \d/.test(Xt.userAgent),Dp=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Xt.userAgent),Bu=!!(Ek||Dp||Ep),Rx=!Bu&&/gecko\/(\d+)/i.test(Xt.userAgent),_h=!Bu&&/Chrome\/(\d+)/.exec(Xt.userAgent),iM="webkitFontSmoothing"in Op.documentElement.style,Mp=!Bu&&/Apple Computer/.test(Xt.vendor),_x=Mp&&(/Mobile\/\w+/.test(Xt.userAgent)||Xt.maxTouchPoints>2);var fe={mac:_x||/Mac/.test(Xt.platform),windows:/Win/.test(Xt.platform),linux:/Linux|X11/.test(Xt.platform),ie:Bu,ie_version:Ek?Op.documentMode||6:Dp?+Dp[1]:Ep?+Ep[1]:0,gecko:Rx,gecko_version:Rx?+(/Firefox\/(\d+)/.exec(Xt.userAgent)||[0,0])[1]:0,chrome:!!_h,chrome_version:_h?+_h[1]:0,ios:_x,android:/Android\b/.test(Xt.userAgent),webkit_version:iM?+(/\bAppleWebKit\/(\d+)/.exec(Xt.userAgent)||[0,0])[1]:0,safari:Mp,safari_version:Mp?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Xt.userAgent)||[0,0])[1]:0,tabSize:Op.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function ng(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 Vd=Object.create(null);function rg(t,e,n){if(t==e)return!0;t||(t=Vd),e||(e=Vd);let r=Object.keys(t),s=Object.keys(e);if(r.length-0!=s.length-0)return!1;for(let i of r)if(i!=n&&(s.indexOf(i)==-1||t[i]!==e[i]))return!1;return!0}function oM(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 Ix(t,e,n){let r=!1;if(e)for(let s in e)n&&s in n||(r=!0,s=="style"?t.style.cssText="":t.removeAttribute(s));if(n)for(let s in n)e&&e[s]==n[s]||(r=!0,s=="style"?t.style.cssText=n[s]:t.setAttribute(s,n[s]));return r}function aM(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 Dr{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 Bt=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Bt||(Bt={}));class je extends ks{constructor(e,n,r,s){super(),this.startSide=e,this.endSide=n,this.widget=r,this.spec=s}get heightRelevant(){return!1}static mark(e){return new Ul(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 ni(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,s;if(e.isBlockGap)r=-5e8,s=4e8;else{let{start:i,end:o}=Dk(e,n);r=(i?n?-3e8:-1:5e8)-1,s=(o?n?2e8:1:-6e8)+1}return new ni(e,r,s,n,e.widget||null,!0)}static line(e){return new Kl(e)}static set(e,n=!1){return Ie.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}je.none=Ie.empty;class Ul extends je{constructor(e){let{start:n,end:r}=Dk(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?ng(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Vd}eq(e){return this==e||e instanceof Ul&&this.tagName==e.tagName&&rg(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)}}Ul.prototype.point=!1;class Kl extends je{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Kl&&this.spec.class==e.spec.class&&rg(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)}}Kl.prototype.mapMode=Zt.TrackBefore;Kl.prototype.point=!0;class ni extends je{constructor(e,n,r,s,i,o){super(n,r,i,e),this.block=s,this.isReplace=o,this.mapMode=s?n<=0?Zt.TrackBefore:Zt.TrackAfter:Zt.TrackDel}get type(){return this.startSide!=this.endSide?Bt.WidgetRange:this.startSide<=0?Bt.WidgetBefore:Bt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof ni&&lM(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)}}ni.prototype.point=!0;function Dk(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 lM(t,e){return t==e||!!(t&&e&&t.compare(e))}function Bi(t,e,n,r=0){let s=n.length-1;s>=0&&n[s]+r>=t?n[s]=Math.max(n[s],e):n.push(t,e)}class Ea extends ks{constructor(e,n){super(),this.tagName=e,this.attributes=n}eq(e){return e==this||e instanceof Ea&&this.tagName==e.tagName&&rg(this.attributes,e.attributes)}static create(e){return new Ea(e.tagName,e.attributes||Vd)}static set(e,n=!1){return Ie.of(e,n)}}Ea.prototype.startSide=Ea.prototype.endSide=-1;function Da(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function Ap(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function fd(t,e){if(!e.anchorNode)return!1;try{return Ap(t,e.anchorNode)}catch{return!1}}function la(t){return t.nodeType==3?Aa(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function ca(t,e,n,r){return n?$x(t,e,n,r,-1)||$x(t,e,n,r,1):!1}function js(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Hd(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function $x(t,e,n,r,s){for(;;){if(t==n&&e==r)return!0;if(e==(s<0?0:Kr(t))){if(t.nodeName=="DIV")return!1;let i=t.parentNode;if(!i||i.nodeType!=1)return!1;e=js(t)+(s<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(s<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=s<0?Kr(t):0}else return!1}}function Kr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Ma(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function cM(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 Mk(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 dM(t,e,n,r,s,i,o,a){let l=t.ownerDocument,d=l.defaultView||window;for(let u=t,h=!1;u&&!h;)if(u.nodeType==1){let f,p=u==l.body,m=1,x=1;if(p)f=cM(d);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(h=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let k=u.getBoundingClientRect();({scaleX:m,scaleY:x}=Mk(u,k)),f={left:k.left,right:k.left+u.clientWidth*m,top:k.top,bottom:k.top+u.clientHeight*x}}let b=0,y=0;if(s=="nearest")e.top<f.top?(y=e.top-(f.top+o),n>0&&e.bottom>f.bottom+y&&(y=e.bottom-f.bottom+o)):e.bottom>f.bottom&&(y=e.bottom-f.bottom+o,n<0&&e.top-y<f.top&&(y=e.top-(f.top+o)));else{let k=e.bottom-e.top,v=f.bottom-f.top;y=(s=="center"&&k<=v?e.top+k/2-v/2:s=="start"||s=="center"&&n<0?e.top-o:e.bottom-v+o)-f.top}if(r=="nearest"?e.left<f.left?(b=e.left-(f.left+i),n>0&&e.right>f.right+b&&(b=e.right-f.right+i)):e.right>f.right&&(b=e.right-f.right+i,n<0&&e.left<f.left+b&&(b=e.left-(f.left+i))):b=(r=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:r=="start"==a?e.left-i:e.right-(f.right-f.left)+i)-f.left,b||y)if(p)d.scrollBy(b,y);else{let k=0,v=0;if(y){let w=u.scrollTop;u.scrollTop+=y/x,v=(u.scrollTop-w)*x}if(b){let w=u.scrollLeft;u.scrollLeft+=b/m,k=(u.scrollLeft-w)*m}e={left:e.left-k,top:e.top-v,right:e.right-k,bottom:e.bottom-v},k&&Math.abs(k-b)<1&&(r="nearest"),v&&Math.abs(v-y)<1&&(s="nearest")}if(p)break;(e.top<f.top||e.bottom>f.bottom||e.left<f.left||e.right>f.right)&&(e={left:Math.max(e.left,f.left),right:Math.min(e.right,f.right),top:Math.max(e.top,f.top),bottom:Math.min(e.bottom,f.bottom)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function uM(t){let e=t.ownerDocument,n,r;for(let s=t.parentNode;s&&!(s==e.body||n&&r);)if(s.nodeType==1)!r&&s.scrollHeight>s.clientHeight&&(r=s),!n&&s.scrollWidth>s.clientWidth&&(n=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:n,y:r}}class hM{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?Kr(n):0),r,Math.min(e.focusOffset,r?Kr(r):0))}set(e,n,r,s){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let Bs=null;fe.safari&&fe.safari_version>=26&&(Bs=!1);function Ak(t){if(t.setActive)return t.setActive();if(Bs)return t.focus(Bs);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(Bs==null?{get preventScroll(){return Bs={preventScroll:!0},!0}}:void 0),!Bs){Bs=!1;for(let n=0;n<e.length;){let r=e[n++],s=e[n++],i=e[n++];r.scrollTop!=s&&(r.scrollTop=s),r.scrollLeft!=i&&(r.scrollLeft=i)}}}let Bx;function Aa(t,e,n=e){let r=Bx||(Bx=document.createRange());return r.setEnd(t,n),r.setStart(t,e),r}function Fi(t,e,n,r){let s={key:e,code:e,keyCode:n,which:n,cancelable:!0};r&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=r);let i=new KeyboardEvent("keydown",s);i.synthetic=!0,t.dispatchEvent(i);let o=new KeyboardEvent("keyup",s);return o.synthetic=!0,t.dispatchEvent(o),i.defaultPrevented||o.defaultPrevented}function fM(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function pM(t,e){let n=e.focusNode,r=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=r)return!1;for(r=Math.min(r,Kr(n));;)if(r){if(n.nodeType!=1)return!1;let s=n.childNodes[r-1];s.contentEditable=="false"?r--:(n=s,r=Kr(n))}else{if(n==t)return!0;r=js(n),n=n.parentNode}}function Tk(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function Lk(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=Kr(n)}else if(n.parentNode&&!Hd(n))r=js(n),n=n.parentNode;else return null}}function Rk(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&&!Hd(n))r=js(n)+1,n=n.parentNode;else return null}}class Xn{constructor(e,n,r=!0){this.node=e,this.offset=n,this.precise=r}static before(e,n){return new Xn(e.parentNode,js(e),n)}static after(e,n){return new Xn(e.parentNode,js(e)+1,n)}}var Je=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Je||(Je={}));const ri=Je.LTR,sg=Je.RTL;function _k(t){let e=[];for(let n=0;n<t.length;n++)e.push(1<<+t[n]);return e}const mM=_k("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),gM=_k("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Tp=Object.create(null),hr=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),n=t.charCodeAt(1);Tp[e]=n,Tp[n]=-e}function Ik(t){return t<=247?mM[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?gM[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const xM=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Vr{get dir(){return this.level%2?sg:ri}constructor(e,n,r){this.from=e,this.to=n,this.level=r}side(e,n){return this.dir==n==e?this.to:this.from}forward(e,n){return e==(this.dir==n)}static find(e,n,r,s){let i=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=n&&a.to>=n){if(a.level==r)return o;(i<0||(s!=0?s<0?a.from<n:a.to>n:e[i].level>a.level))&&(i=o)}}if(i<0)throw new RangeError("Index out of range");return i}}function $k(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++){let r=t[n],s=e[n];if(r.from!=s.from||r.to!=s.to||r.direction!=s.direction||!$k(r.inner,s.inner))return!1}return!0}const Ze=[];function bM(t,e,n,r,s){for(let i=0;i<=r.length;i++){let o=i?r[i-1].to:e,a=i<r.length?r[i].from:n,l=i?256:s;for(let d=o,u=l,h=l;d<a;d++){let f=Ik(t.charCodeAt(d));f==512?f=u:f==8&&h==4&&(f=16),Ze[d]=f==4?2:f,f&7&&(h=f),u=f}for(let d=o,u=l,h=l;d<a;d++){let f=Ze[d];if(f==128)d<a-1&&u==Ze[d+1]&&u&24?f=Ze[d]=u:Ze[d]=256;else if(f==64){let p=d+1;for(;p<a&&Ze[p]==64;)p++;let m=d&&u==8||p<n&&Ze[p]==8?h==1?1:8:256;for(let x=d;x<p;x++)Ze[x]=m;d=p-1}else f==8&&h==1&&(Ze[d]=1);u=f,f&7&&(h=f)}}}function yM(t,e,n,r,s){let i=s==1?2:1;for(let o=0,a=0,l=0;o<=r.length;o++){let d=o?r[o-1].to:e,u=o<r.length?r[o].from:n;for(let h=d,f,p,m;h<u;h++)if(p=Tp[f=t.charCodeAt(h)])if(p<0){for(let x=a-3;x>=0;x-=3)if(hr[x+1]==-p){let b=hr[x+2],y=b&2?s:b&4?b&1?i:s:0;y&&(Ze[h]=Ze[hr[x]]=y),a=x;break}}else{if(hr.length==189)break;hr[a++]=h,hr[a++]=f,hr[a++]=l}else if((m=Ze[h])==2||m==1){let x=m==s;l=x?0:1;for(let b=a-3;b>=0;b-=3){let y=hr[b+2];if(y&2)break;if(x)hr[b+2]|=2;else{if(y&4)break;hr[b+2]|=4}}}}}function vM(t,e,n,r){for(let s=0,i=r;s<=n.length;s++){let o=s?n[s-1].to:t,a=s<n.length?n[s].from:e;for(let l=o;l<a;){let d=Ze[l];if(d==256){let u=l+1;for(;;)if(u==a){if(s==n.length)break;u=n[s++].to,a=s<n.length?n[s].from:e}else if(Ze[u]==256)u++;else break;let h=i==1,f=(u<e?Ze[u]:r)==1,p=h==f?h?1:2:r;for(let m=u,x=s,b=x?n[x-1].to:t;m>l;)m==b&&(m=n[--x].from,b=x?n[x-1].to:t),Ze[--m]=p;l=u}else i=d,l++}}}function Lp(t,e,n,r,s,i,o){let a=r%2?2:1;if(r%2==s%2)for(let l=e,d=0;l<n;){let u=!0,h=!1;if(d==i.length||l<i[d].from){let x=Ze[l];x!=a&&(u=!1,h=x==16)}let f=!u&&a==1?[]:null,p=u?r:r+1,m=l;e:for(;;)if(d<i.length&&m==i[d].from){if(h)break e;let x=i[d];if(!u)for(let b=x.to,y=d+1;;){if(b==n)break e;if(y<i.length&&i[y].from==b)b=i[y++].to;else{if(Ze[b]==a)break e;break}}if(d++,f)f.push(x);else{x.from>l&&o.push(new Vr(l,x.from,p));let b=x.direction==ri!=!(p%2);Rp(t,b?r+1:r,s,x.inner,x.from,x.to,o),l=x.to}m=x.to}else{if(m==n||(u?Ze[m]!=a:Ze[m]==a))break;m++}f?Lp(t,l,m,r+1,s,f,o):l<m&&o.push(new Vr(l,m,p)),l=m}else for(let l=n,d=i.length;l>e;){let u=!0,h=!1;if(!d||l>i[d-1].to){let x=Ze[l-1];x!=a&&(u=!1,h=x==16)}let f=!u&&a==1?[]:null,p=u?r:r+1,m=l;e:for(;;)if(d&&m==i[d-1].to){if(h)break e;let x=i[--d];if(!u)for(let b=x.from,y=d;;){if(b==e)break e;if(y&&i[y-1].to==b)b=i[--y].from;else{if(Ze[b-1]==a)break e;break}}if(f)f.push(x);else{x.to<l&&o.push(new Vr(x.to,l,p));let b=x.direction==ri!=!(p%2);Rp(t,b?r+1:r,s,x.inner,x.from,x.to,o),l=x.from}m=x.from}else{if(m==e||(u?Ze[m-1]!=a:Ze[m-1]==a))break;m--}f?Lp(t,m,l,r+1,s,f,o):m<l&&o.push(new Vr(m,l,p)),l=m}}function Rp(t,e,n,r,s,i,o){let a=e%2?2:1;bM(t,s,i,r,a),yM(t,s,i,r,a),vM(s,i,r,a),Lp(t,s,i,e,n,r,o)}function wM(t,e,n){if(!t)return[new Vr(0,0,e==sg?1:0)];if(e==ri&&!n.length&&!xM.test(t))return Bk(t.length);if(n.length)for(;t.length>Ze.length;)Ze[Ze.length]=256;let r=[],s=e==ri?0:1;return Rp(t,s,s,n,0,t.length,r),r}function Bk(t){return[new Vr(0,t,0)]}let Fk="";function kM(t,e,n,r,s){var i;let o=r.head-t.from,a=Vr.find(e,o,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),l=e[a],d=l.side(s,n);if(o==d){let f=a+=s?1:-1;if(f<0||f>=e.length)return null;l=e[a=f],o=l.side(!s,n),d=l.side(s,n)}let u=Ct(t.text,o,l.forward(s,n));(u<l.from||u>l.to)&&(u=d),Fk=t.text.slice(Math.min(o,u),Math.max(o,u));let h=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return h&&u==d&&h.level+(s?0:1)<l.level?q.cursor(h.side(!s,n)+t.from,h.forward(s,n)?1:-1,h.level):q.cursor(u+t.from,l.forward(s,n)?-1:1,l.level)}function SM(t,e,n){for(let r=e;r<n;r++){let s=Ik(t.charCodeAt(r));if(s==1)return ri;if(s==2||s==4)return sg}return ri}const zk=pe.define(),Vk=pe.define(),Hk=pe.define(),Wk=pe.define(),_p=pe.define(),Uk=pe.define(),Kk=pe.define(),ig=pe.define(),og=pe.define(),Gk=pe.define({combine:t=>t.some(e=>e)}),qk=pe.define({combine:t=>t.some(e=>e)}),Yk=pe.define();class zi{constructor(e,n="nearest",r="nearest",s=5,i=5,o=!1){this.range=e,this.y=n,this.x=r,this.yMargin=s,this.xMargin=i,this.isSnapshot=o}map(e){return e.empty?this:new zi(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 zi(q.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Pc=Me.define({map:(t,e)=>t.map(e)}),Xk=Me.define();function dn(t,e,n){let r=t.facet(Wk);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 Fr=pe.define({combine:t=>t.length?t[0]:!0});let CM=0;const Oi=pe.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 pt{constructor(e,n,r,s,i){this.id=e,this.create=n,this.domEventHandlers=r,this.domEventObservers=s,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(Oi.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Oi.of({plugin:this,arg:e}))}static define(e,n){const{eventHandlers:r,eventObservers:s,provide:i,decorations:o}=n||{};return new pt(CM++,e,r,s,a=>{let l=[];return o&&l.push(Ta.of(d=>{let u=d.plugin(a);return u?o(u):je.none})),i&&l.push(i(a)),l})}static fromClass(e,n){return pt.define((r,s)=>new e(r,s),n)}}class Ih{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(dn(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){dn(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){dn(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Zk=pe.define(),ag=pe.define(),Ta=pe.define(),Qk=pe.define(),Jk=pe.define(),Gl=pe.define(),e2=pe.define();function Fx(t,e){let n=t.state.facet(e2);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(t):i),s=[];return Ie.spans(r,e.from,e.to,{point(){},span(i,o,a,l){let d=i-e.from,u=o-e.from,h=s;for(let f=a.length-1;f>=0;f--,l--){let p=a[f].spec.bidiIsolate,m;if(p==null&&(p=SM(e.text,d,u)),l>0&&h.length&&(m=h[h.length-1]).to==d&&m.direction==p)m.to=u,h=m.inner;else{let x={from:d,to:u,direction:p,inner:[]};h.push(x),h=x.inner}}}}),s}const t2=pe.define();function lg(t){let e=0,n=0,r=0,s=0;for(let i of t.state.facet(t2)){let o=i(t);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:e,right:n,top:r,bottom:s}}const Qo=pe.define();class Tn{constructor(e,n,r,s){this.fromA=e,this.toA=n,this.fromB=r,this.toB=s}join(e){return new Tn(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let s=e[n-1];if(!(s.fromA>r.toA)){if(s.toA<r.fromA)break;r=r.join(s),e.splice(n-1,1)}}return e.splice(n,0,r),e}static extendWithRanges(e,n){if(n.length==0)return e;let r=[];for(let s=0,i=0,o=0;;){let a=s<e.length?e[s].fromB:1e9,l=i<n.length?n[i]:1e9,d=Math.min(a,l);if(d==1e9)break;let u=d+o,h=d,f=u;for(;;)if(i<n.length&&n[i]<=h){let p=n[i+1];i+=2,h=Math.max(h,p);for(let m=s;m<e.length&&e[m].fromB<=h;m++)o=e[m].toA-e[m].toB;f=Math.max(f,p+o)}else if(s<e.length&&e[s].fromB<=h){let p=e[s++];h=Math.max(h,p.toB),f=Math.max(f,p.toA),o=p.toA-p.toB}else break;r.push(new Tn(u,f,d,h))}return r}}class Wd{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=kt.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,o,a,l)=>s.push(new Tn(i,o,a,l))),this.changedRanges=s}static create(e,n,r){return new Wd(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 jM=[];class yt{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 jM}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&&oM(this.dom,n)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,n=this.posAtStart){let r=n;for(let s of this.children){if(s==e)return r;r+=s.length+s.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,n){return null}domPosFor(e,n){let r=js(this.dom),s=this.length?e>0:n>0;return new Xn(this.parent.dom,r+(s?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof zu)return e;return null}static get(e){return e.cmTile}}class Fu extends yt{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let n=this.dom,r=null,s,i=e?.node==n?e:null,o=0;for(let a of this.children){if(a.sync(e),o+=a.length+a.breakAfter,s=r?r.nextSibling:n.firstChild,i&&s!=a.dom&&(i.written=!0),a.dom.parentNode==n)for(;s&&s!=a.dom;)s=zx(s);else n.insertBefore(a.dom,s);r=a.dom}for(s=r?r.nextSibling:n.firstChild,i&&s&&(i.written=!0);s;)s=zx(s);this.length=o}}function zx(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class zu extends Fu{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=yt.get(e);if(n&&this.owns(n))return n;e=e.parentNode}}blockTiles(e){for(let n=[],r=this,s=0,i=0;;)if(s==r.children.length){if(!n.length)return;r=r.parent,r.breakAfter&&i++,s=n.pop()}else{let o=r.children[s++];if(o instanceof gs)n.push(s),r=o,s=0;else{let a=i+o.length,l=e(o,i);if(l!==void 0)return l;i=a+o.breakAfter}}}resolveBlock(e,n){let r,s=-1,i,o=-1;if(this.blockTiles((a,l)=>{let d=l+a.length;if(e>=l&&e<=d){if(a.isWidget()&&n>=-1&&n<=1){if(a.flags&32)return!0;a.flags&16&&(r=void 0)}(l<e||e==d&&(n<-1?a.length:a.covers(1)))&&(!r||!a.isWidget()&&r.isWidget())&&(r=a,s=e-l),(d>e||e==l&&(n>1?a.length:a.covers(-1)))&&(!i||!a.isWidget()&&i.isWidget())&&(i=a,o=e-l)}}),!r&&!i)throw new Error("No tile at position "+e);return r&&n<0||!i?{tile:r,offset:s}:{tile:i,offset:o}}}class gs extends Fu{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 gs(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class to extends Fu{constructor(e,n){super(e),this.attrs=n}isLine(){return!0}static start(e,n,r){let s=new to(n||document.createElement("div"),e);return(!n||!r)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(e,n,r){let s=null,i=-1,o=null,a=-1;function l(u,h){for(let f=0,p=0;f<u.children.length&&p<=h;f++){let m=u.children[f],x=p+m.length;x>=h&&(m.isComposite()?l(m,h-p):(!o||o.isHidden&&(n>0||r&&PM(o,m)))&&(x>h||m.flags&32)?(o=m,a=h-p):(p<h||m.flags&16&&!m.isHidden)&&(s=m,i=h-p)),p=x}}l(this,e);let d=(n<0?s:o)||s||o;return d?{tile:d,offset:d==s?i:a}:null}coordsIn(e,n){let r=this.resolveInline(e,n,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),n):NM(this)}domIn(e,n){let r=this.resolveInline(e,n);if(r){let{tile:s,offset:i}=r;if(this.dom.contains(s.dom))return s.isText()?new Xn(s.dom,Math.min(s.dom.nodeValue.length,i)):s.domPosFor(i,s.flags&16?1:s.flags&32?-1:n);let o=r.tile.parent,a=!1;for(let l of o.children){if(a)return new Xn(l.dom,0);l==r.tile&&(a=!0)}}return new Xn(this.dom,0)}}function NM(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=la(e);return n[n.length-1]||null}function PM(t,e){let n=t.coordsIn(0,1),r=e.coordsIn(0,1);return n&&r&&r.top<n.bottom}class cn extends Fu{constructor(e,n){super(e),this.mark=n}get domAttrs(){return this.mark.attrs}static of(e,n){let r=new cn(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class qs extends yt{constructor(e,n){super(e,n.length),this.text=n}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,n){let r=this.dom.nodeValue.length;e>r&&(e=r);let s=e,i=e,o=0;e==0&&n<0||e==r&&n>=0?fe.chrome||fe.gecko||(e?(s--,o=1):i<r&&(i++,o=-1)):n<0?s--:i<r&&i++;let a=Aa(this.dom,s,i).getClientRects();if(!a.length)return null;let l=a[(o?o<0:n>=0)?0:a.length-1];return fe.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,d=>d.width)||l),o?Ma(l,o<0):l||null}static of(e,n){let r=new qs(n||document.createTextNode(e),e);return n||(r.flags|=2),r}}class no extends yt{constructor(e,n,r,s){super(e,n,s),this.widget=r}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,n){return this.coordsInWidget(e,n,!1)}coordsInWidget(e,n,r){let s=this.widget.coordsAt(this.dom,e,n);if(s)return s;if(r)return Ma(this.dom.getBoundingClientRect(),this.length?e==0:n<=0);{let i=this.dom.getClientRects(),o=null;if(!i.length)return null;let a=this.flags&16?!0:this.flags&32?!1:e>0;for(let l=a?i.length-1:0;o=i[l],!(e>0?l==0:l==i.length-1||o.top<o.bottom);l+=a?-1:1);return Ma(o,!a)}}get overrideDOMText(){if(!this.length)return Ge.empty;let{root:e}=this;if(!e)return Ge.empty;let n=this.posAtStart;return e.view.state.doc.slice(n,n+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,n,r,s,i){return i||(i=e.toDOM(n),e.editable||(i.contentEditable="false")),new no(i,r,e,s)}}class Ud extends yt{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 Ge.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class OM{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,n,r){let{tile:s,index:i,beforeBreak:o,parents:a}=this;for(;e||n>0;)if(s.isComposite())if(o){if(!e)break;r&&r.break(),e--,o=!1}else if(i==s.children.length){if(!e&&!a.length)break;r&&r.leave(s),o=!!s.breakAfter,{tile:s,index:i}=a.pop(),i++}else{let l=s.children[i],d=l.breakAfter;(n>0?l.length<=e:l.length<e)&&(!r||r.skip(l,0,l.length)!==!1||!l.isComposite)?(o=!!d,i++,e-=l.length):(a.push({tile:s,index:i}),s=l,i=0,r&&l.isComposite()&&r.enter(l))}else if(i==s.length)o=!!s.breakAfter,{tile:s,index:i}=a.pop(),i++;else if(e){let l=Math.min(e,s.length-i);r&&r.skip(s,i,i+l),e-=l,i+=l}else break;return this.tile=s,this.index=i,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class EM{constructor(e,n,r,s){this.from=e,this.to=n,this.wrapper=r,this.rank=s}}class DM{constructor(e,n,r){this.cache=e,this.root=n,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,n,r,s){var i;this.flushBuffer();let o=this.ensureMarks(n,r),a=o.lastChild;if(a&&a.isText()&&!(a.flags&8)){this.cache.reused.set(a,2);let l=o.children[o.children.length-1]=new qs(a.dom,a.text+e);l.parent=o}else o.append(s||qs.of(e,(i=this.cache.find(qs))===null||i===void 0?void 0:i.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,n){let r=this.curLine;r.dom!=n.line.dom&&(r.setDOM(this.cache.reused.has(n.line)?$h(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let s=r;for(let a=n.marks.length-1;a>=0;a--){let l=n.marks[a],d=s.lastChild;if(d instanceof cn&&d.mark.eq(l.mark))d.dom!=l.dom&&d.setDOM($h(l.dom)),s=d;else{if(this.cache.reused.get(l)){let h=yt.get(l.dom);h&&h.setDOM($h(l.dom))}let u=cn.of(l.mark,l.dom);s.append(u),s=u}this.cache.reused.set(l,2)}let i=yt.get(e.text);i&&this.cache.reused.set(i,2);let o=new qs(e.text,e.text.nodeValue);o.flags|=8,s.append(o)}addInlineWidget(e,n,r){let s=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);s||this.flushBuffer();let i=this.ensureMarks(n,r);!s&&!(e.flags&16)&&i.append(this.getBuffer(1)),i.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,n,r){this.flushBuffer(),this.ensureMarks(n,r).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let n=this.afterWidget||this.lastBlock;n.length+=e,this.pos+=e}addLineStart(e,n){var r;e||(e=n2);let s=to.start(e,n||((r=this.cache.find(to))===null||r===void 0?void 0:r.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=s)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,n){var r;let s=this.curLine;for(let i=e.length-1;i>=0;i--){let o=e[i],a;if(n>0&&(a=s.lastChild)&&a instanceof cn&&a.mark.eq(o))s=a,n--;else{let l=cn.of(o,(r=this.cache.find(cn,d=>d.mark.eq(o)))===null||r===void 0?void 0:r.dom);s.append(l),s=l,n=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!Vx(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(fe.ios&&Vx(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Bh,0,32)||new no(Bh.toDOM(),0,Bh,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 EM(e.from,e.to,e.value,e.rank),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-n.rank||this.wrappers[r-1].to-n.to)<0;)r--;this.wrappers.splice(r,0,n)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let n=this.root;for(let r of this.wrappers){let s=n.lastChild;if(r.from<this.pos&&s instanceof gs&&s.wrapper.eq(r.wrapper))n=s;else{let i=gs.of(r.wrapper,(e=this.cache.find(gs,o=>o.wrapper.eq(r.wrapper)))===null||e===void 0?void 0:e.dom);n.append(i),n=i}}return n}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let n=2|(e<0?16:32),r=this.cache.find(Ud,void 0,1);return r&&(r.flags=n),r||new Ud(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class MM{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:s,lineBreak:i,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=s;let a=this.textOff=Math.min(e,s.length);return i?null:s.slice(0,a)}let n=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,n);return this.textOff=n,r}}const Kd=[no,to,qs,cn,Ud,gs,zu];for(let t=0;t<Kd.length;t++)Kd[t].bucket=t;class AM{constructor(e){this.view=e,this.buckets=Kd.map(()=>[]),this.index=Kd.map(()=>0),this.reused=new Map}add(e){let n=e.constructor.bucket,r=this.buckets[n];r.length<6?r.push(e):r[this.index[n]=(this.index[n]+1)%6]=e}find(e,n,r=2){let s=e.bucket,i=this.buckets[s],o=this.index[s];for(let a=i.length-1;a>=0;a--){let l=(a+o)%i.length,d=i[l];if((!n||n(d))&&!this.reused.has(d))return i.splice(l,1),l<o&&this.index[s]--,this.reused.set(d,r),d}return null}findWidget(e,n,r){let s=this.buckets[0];if(s.length)for(let i=0,o=0;;i++){if(i==s.length){if(o)return null;o=1,i=0}let a=s[i];if(!this.reused.has(a)&&(o==0?a.widget.compare(e):a.widget.constructor==e.constructor&&e.updateDOM(a.dom,this.view)))return s.splice(i,1),i<this.index[0]&&this.index[0]--,this.reused.set(a,1),a.length=n,a.flags=a.flags&-498|r,a}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,n=2){if(!this.reused.has(e))return this.reused.set(e,n),e.dom}}class TM{constructor(e,n,r,s,i){this.view=e,this.decorations=s,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new AM(e),this.text=new MM(e.state.doc),this.builder=new DM(this.cache,new zu(e,e.contentDOM),Ie.iter(r)),this.cache.reused.set(n,2),this.old=new OM(n),this.reuseWalker={skip:(o,a,l)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,n){let r=n&&this.getCompositionContext(n.text);for(let s=0,i=0,o=0;;){let a=o<e.length?e[o++]:null,l=a?a.fromA:this.old.root.length;if(l>s){let d=l-s;this.preserve(d,!o,!a),s=l,i+=d}if(!a)break;this.forward(a.fromA,a.toA),n&&a.fromA<=n.range.fromA&&a.toA>=n.range.toA?(this.emit(i,n.range.fromB),this.builder.addComposition(n,r),this.text.skip(n.range.toB-n.range.fromB),this.emit(n.range.toB,a.toB)):this.emit(i,a.toB),i=a.toB,s=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,n,r){let s=_M(this.old),i=this.openMarks;this.old.advance(e,r?1:-1,{skip:(o,a,l)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(l-a);else{let d=l>0||a<o.length?no.of(o.widget,this.view,l-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);d.flags&256?(d.flags&=-2,this.builder.addBlockWidget(d)):(this.builder.ensureLine(null),this.builder.addInlineWidget(d,s,i),i=s.length)}else if(o.isText())this.builder.ensureLine(null),!a&&l==o.length?this.builder.addText(o.text,s,i,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,l),s,i)),i=s.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof Ud)this.cache.add(o);else if(o instanceof cn)this.builder.ensureLine(null),this.builder.addMark(o,s,i),this.cache.reused.set(o,1),i=s.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof cn&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=i=0):o instanceof cn&&(s.shift(),i=Math.min(i,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,n){let r=null,s=this.builder,i=0,o=Ie.spans(this.decorations,e,n,{point:(a,l,d,u,h,f)=>{if(d instanceof ni){if(this.disallowBlockEffectsFor[f]){if(d.block)throw new RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(i=u.length,h>u.length)s.continueWidget(l-a);else{let p=d.widget||(d.block?ro.block:ro.inline),m=LM(d),x=this.cache.findWidget(p,l-a,m)||no.of(p,this.view,l-a,m);d.block?(d.startSide>0&&s.addLineStartIfNotCovered(r),s.addBlockWidget(x)):(s.ensureLine(r),s.addInlineWidget(x,u,h))}r=null}else r=RM(r,d);l>a&&this.text.skip(l-a)},span:(a,l,d,u)=>{for(let h=a;h<l;){let f=this.text.next(Math.min(512,l-h));f==null?(s.addLineStartIfNotCovered(r),s.addBreak(),h++):(s.ensureLine(r),s.addText(f,d,u),h+=f.length),r=null}}});s.addLineStartIfNotCovered(r),this.openWidget=o>i,this.openMarks=o}forward(e,n){n-e<=10?this.old.advance(n-e,1,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-e-10,-1),this.old.advance(5,1,this.reuseWalker))}getCompositionContext(e){let n=[],r=null;for(let s=e.parentNode;;s=s.parentNode){let i=yt.get(s);if(s==this.view.contentDOM)break;i instanceof cn?n.push(i):i?.isLine()?r=i:s.nodeName=="DIV"&&!r&&s!=this.view.contentDOM?r=new to(s,n2):n.push(cn.of(new Ul({tagName:s.nodeName.toLowerCase(),attributes:aM(s)}),s))}return{line:r,marks:n}}}function Vx(t,e){let n=r=>{for(let s of r.children)if((e?s.isText():s.length)||n(s))return!0;return!1};return n(t)}function LM(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 n2={class:"cm-line"};function RM(t,e){let n=e.spec.attributes,r=e.spec.class;return!n&&!r||(t||(t={class:"cm-line"}),n&&ng(n,t),r&&(t.class+=" "+r)),t}function _M(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 cn&&e.push(r.mark)}return e}function $h(t){let e=yt.get(t);return e&&e.setDOM(t.cloneNode()),t}class ro extends Dr{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}}ro.inline=new ro("span");ro.block=new ro("div");const Bh=new class extends Dr{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Hx{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=je.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 zu(e,e.contentDOM),this.updateInner([new Tn(0,0,0,e.state.doc.length)],null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:u,toA:h})=>h<this.minWidthFrom||u>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?s=this.domChanged.newSel.head:!UM(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let i=s>-1?$M(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:u,to:h}=this.hasComposition;r=new Tn(u,h,e.changes.mapPos(u,-1),e.changes.mapPos(h,1)).addToSet(r.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(fe.ie||fe.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let l=zM(o,this.decorations,e.changes);l.length&&(r=Tn.extendWithRanges(r,l));let d=HM(a,this.blockWrappers,e.changes);return d.length&&(r=Tn.extendWithRanges(r,d)),i&&!r.some(u=>u.fromA<=i.range.fromA&&u.toA>=i.range.toA)&&(r=i.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(n||e.length){let o=this.tile,a=new TM(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=a.run(e,n),Ip(o,a.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let i=fe.chrome||fe.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(i),i&&(i.written||r.selectionRange.focusNode!=i.node||!this.tile.dom.contains(i.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let i of this.tile.children)i.isWidget()&&i.widget instanceof Fh&&s.push(i.dom);r.updateGaps(s)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(Xk)&&(this.editContextFormatting=r.value)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,s=this.view.root.activeElement,i=s==r,o=!i&&!(this.view.state.facet(Fr)||r.tabIndex>-1)&&fd(r,this.view.observer.selectionRange)&&!(s&&r.contains(s));if(!(i||n||o))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,d,u;if(l.empty?u=d=this.inlineDOMNearPos(l.anchor,l.assoc||1):(u=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),d=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),fe.gecko&&l.empty&&!this.hasComposition&&IM(d)){let f=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(f,d.node.childNodes[d.offset]||null)),d=u=new Xn(f,0),a=!0}let h=this.view.observer.selectionRange;(a||!h.focusNode||(!ca(d.node,d.offset,h.anchorNode,h.anchorOffset)||!ca(u.node,u.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,l))&&(this.view.observer.ignore(()=>{fe.android&&fe.chrome&&r.contains(h.focusNode)&&WM(h.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let f=Da(this.view.root);if(f)if(l.empty){if(fe.gecko){let p=BM(d.node,d.offset);if(p&&p!=3){let m=(p==1?Lk:Rk)(d.node,d.offset);m&&(d=new Xn(m.node,m.offset))}}f.collapse(d.node,d.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=l.bidiLevel)}else if(f.extend){f.collapse(d.node,d.offset);try{f.extend(u.node,u.offset)}catch{}}else{let p=document.createRange();l.anchor>l.head&&([d,u]=[u,d]),p.setEnd(u.node,u.offset),p.setStart(d.node,d.offset),f.removeAllRanges(),f.addRange(p)}o&&this.view.root.activeElement==r&&(r.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(d,u)),this.impreciseAnchor=d.precise?null:new Xn(h.anchorNode,h.anchorOffset),this.impreciseHead=u.precise?null:new Xn(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&ca(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=Da(e.root),{anchorNode:s,anchorOffset:i}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let o=this.lineAt(n.head,n.assoc);if(!o)return;let a=o.posAtStart;if(n.head==a||n.head==a+o.length)return;let l=this.coordsAt(n.head,-1),d=this.coordsAt(n.head,1);if(!l||!d||l.bottom>d.top)return;let u=this.domAtPos(n.head+n.assoc,n.assoc);r.collapse(u.node,u.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=n.from&&r.collapse(s,i)}posFromDOM(e,n){let r=this.tile.nearest(e);if(!r)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let s=r.posAtStart;if(r.isComposite()){let i;if(e==r.dom)i=r.dom.childNodes[n];else{let o=Kr(e)==0?0:n==0?-1:1;for(;;){let a=e.parentNode;if(a==r.dom)break;o==0&&a.firstChild!=a.lastChild&&(e==a.firstChild?o=-1:o=1),e=a}o<0?i=e:i=e.nextSibling}if(i==r.dom.firstChild)return s;for(;i&&!yt.get(i);)i=i.nextSibling;if(!i)return s+r.length;for(let o=0,a=s;;o++){let l=r.children[o];if(l.dom==i)return a;a+=l.length+l.breakAfter}}else return r.isText()?e==r.dom?s+n:s+(n?r.length:0):s}domAtPos(e,n){let{tile:r,offset:s}=this.tile.resolveBlock(e,n);return r.isWidget()?r.domPosFor(e,n):r.domIn(s,n)}inlineDOMNearPos(e,n){let r,s=-1,i=!1,o,a=-1,l=!1;return this.tile.blockTiles((d,u)=>{if(d.isWidget()){if(d.flags&32&&u>=e)return!0;d.flags&16&&(i=!0)}else{let h=u+d.length;if(u<=e&&(r=d,s=e-u,i=h<e),h>=e&&!o&&(o=d,a=e-u,l=u>e),u>e&&o)return!0}}),!r&&!o?this.domAtPos(e,n):(i&&o?r=null:l&&r&&(o=null),r&&n<0||!o?r.domIn(s,n):o.domIn(a,n))}coordsAt(e,n){let{tile:r,offset:s}=this.tile.resolveBlock(e,n);return r.isWidget()?r.widget instanceof Fh?null:r.coordsInWidget(s,n,!0):r.coordsIn(s,n)}lineAt(e,n){let{tile:r}=this.tile.resolveBlock(e,n);return r.isLine()?r:null}coordsForChar(e){let{tile:n,offset:r}=this.tile.resolveBlock(e,1);if(!n.isLine())return null;function s(i,o){if(i.isComposite())for(let a of i.children){if(a.length>=o){let l=s(a,o);if(l)return l}if(o-=a.length,o<0)break}else if(i.isText()&&o<i.length){let a=Ct(i.text,o);if(a==o)return null;let l=Aa(i.dom,o,a).getClientRects();for(let d=0;d<l.length;d++){let u=l[d];if(d==l.length-1||u.top<u.bottom&&u.left<u.right)return u}}return null}return s(n,r)}measureVisibleLineHeights(e){let n=[],{from:r,to:s}=e,i=this.view.contentDOM.clientWidth,o=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==Je.LTR,d=0,u=(h,f,p)=>{for(let m=0;m<h.children.length&&!(f>s);m++){let x=h.children[m],b=f+x.length,y=x.dom.getBoundingClientRect(),{height:k}=y;if(p&&!m&&(d+=y.top-p.top),x instanceof gs)b>r&&u(x,f,y);else if(f>=r&&(d>0&&n.push(-d),n.push(k+d),d=0,o)){let v=x.dom.lastChild,w=v?la(v):[];if(w.length){let C=w[w.length-1],j=l?C.right-y.left:y.right-C.left;j>a&&(a=j,this.minWidth=i,this.minWidthFrom=f,this.minWidthTo=b)}}p&&m==h.children.length-1&&(d+=p.bottom-y.bottom),f=b+x.breakAfter}};return u(this.tile,0,null),n}textDirectionAt(e){let{tile:n}=this.tile.resolveBlock(e,1);return getComputedStyle(n.dom).direction=="rtl"?Je.RTL:Je.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,l;for(let d of o.children){if(!d.isText()||/[^ -~]/.test(d.text))return;let u=la(d.dom);if(u.length!=1)return;a+=u[0].width,l=u[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:l}}});if(e)return e;let n=document.createElement("div"),r,s,i;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let o=la(n.firstChild)[0];r=n.getBoundingClientRect().height,s=o&&o.width?o.width/27:7,i=o&&o.height?o.height:r,n.remove()}),{lineHeight:r,charWidth:s,textHeight:i}}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,s=0;;s++){let i=s==n.viewports.length?null:n.viewports[s],o=i?i.from-1:this.view.state.doc.length;if(o>r){let a=(n.lineBlockAt(o).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(je.replace({widget:new Fh(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!i)break;r=i.to+1}return je.set(e)}updateDeco(){let e=1,n=this.view.state.facet(Ta).map(i=>(this.dynamicDecorationMap[e++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(Jk).map((i,o)=>{let a=typeof i=="function";return a&&(r=!0),a?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[e++]=r,n.push(Ie.join(s))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(Qk).map(i=>typeof i=="function"?i(this.view):i)}scrollIntoView(e){if(e.isSnapshot){let d=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=d.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let d of this.view.state.facet(Yk))try{if(d(this.view,e.range,e))return!0}catch(u){dn(this.view.state,u,"scroll handler")}let{range:n}=e,r=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1),s;if(!r)return;!n.empty&&(s=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,s.left),top:Math.min(r.top,s.top),right:Math.max(r.right,s.right),bottom:Math.max(r.bottom,s.bottom)});let i=lg(this.view),o={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;dM(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==Je.LTR)}lineHasWidget(e){let n=r=>r.isWidget()||r.children.some(n);return n(this.tile.resolveBlock(e,1).tile)}destroy(){Ip(this.tile)}}function Ip(t,e){let n=e?.get(t);if(n!=1){n==null&&t.destroy();for(let r of t.children)Ip(r,e)}}function IM(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 r2(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=Lk(n.focusNode,n.focusOffset),s=Rk(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let a=yt.get(s.node);if(!a||a.isText()&&a.text!=s.node.nodeValue)i=s;else if(t.docView.lastCompositionAfterCursor){let l=yt.get(r.node);!l||l.isText()&&l.text!=r.node.nodeValue||(i=s)}}if(t.docView.lastCompositionAfterCursor=i!=r,!i)return null;let o=e-i.offset;return{from:o,to:o+i.node.nodeValue.length,node:i.node}}function $M(t,e,n){let r=r2(t,n);if(!r)return null;let{node:s,from:i,to:o}=r,a=s.nodeValue;if(/[\n\r]/.test(a)||t.state.doc.sliceString(r.from,r.to)!=a)return null;let l=e.invertedDesc;return{range:new Tn(l.mapPos(i),l.mapPos(o),i,o),text:s}}function BM(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 FM=class{constructor(){this.changes=[]}compareRange(e,n){Bi(e,n,this.changes)}comparePoint(e,n){Bi(e,n,this.changes)}boundChange(e){Bi(e,e,this.changes)}};function zM(t,e,n){let r=new FM;return Ie.compare(t,e,n,r),r.changes}class VM{constructor(){this.changes=[]}compareRange(e,n){Bi(e,n,this.changes)}comparePoint(){}boundChange(e){Bi(e,e,this.changes)}}function HM(t,e,n){let r=new VM;return Ie.compare(t,e,n,r),r.changes}function WM(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 UM(t,e){let n=!1;return e&&t.iterChangedRanges((r,s)=>{r<e.to&&s>e.from&&(n=!0)}),n}class Fh extends Dr{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 KM(t,e,n=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),i=e-s.from;if(s.length==0)return q.cursor(e);i==0?n=1:i==s.length&&(n=-1);let o=i,a=i;n<0?o=Ct(s.text,i,!1):a=Ct(s.text,i);let l=r(s.text.slice(o,a));for(;o>0;){let d=Ct(s.text,o,!1);if(r(s.text.slice(d,o))!=l)break;o=d}for(;a<s.length;){let d=Ct(s.text,a);if(r(s.text.slice(a,d))!=l)break;a=d}return q.range(o+s.from,a+s.from)}function GM(t,e,n,r,s){let i=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let a=t.viewState.heightOracle.textHeight,l=Math.floor((s-n.top-(t.defaultLineHeight-a)*.5)/a);i+=l*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(n.from,n.to);return n.from+jp(o,i,t.state.tabSize)}function $p(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let s;for(let i of r.type){if(i.from>e)break;if(!(i.to<e)){if(i.from<e&&i.to>e)return i;(!s||i.type==Bt.Text&&(s.type!=i.type||(n<0?i.from<e:i.to>e)))&&(s=i)}}return s||r}return r}function qM(t,e,n,r){let s=$p(t,e.head,e.assoc||-1),i=!r||s.type!=Bt.Text||!(t.lineWrapping||s.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(i){let o=t.dom.getBoundingClientRect(),a=t.textDirectionAt(s.from),l=t.posAtCoords({x:n==(a==Je.LTR)?o.right-1:o.left+1,y:(i.top+i.bottom)/2});if(l!=null)return q.cursor(l,n?-1:1)}return q.cursor(n?s.to:s.from,n?-1:1)}function Wx(t,e,n,r){let s=t.state.doc.lineAt(e.head),i=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let d=kM(s,i,o,a,n),u=Fk;if(!d){if(s.number==(n?t.state.doc.lines:1))return a;u=`
|
|
266
|
+
`,s=t.state.doc.line(s.number+(n?1:-1)),i=t.bidiSpans(s),d=t.visualLineSide(s,!n)}if(l){if(!l(u))return a}else{if(!r)return d;l=r(u)}a=d}}function YM(t,e,n){let r=t.state.charCategorizer(e),s=r(n);return i=>{let o=r(i);return s==st.Space&&(s=o),s==o}}function XM(t,e,n,r){let s=e.head,i=n?1:-1;if(s==(n?t.state.doc.length:0))return q.cursor(s,e.assoc);let o=e.goalColumn,a,l=t.contentDOM.getBoundingClientRect(),d=t.coordsAtPos(s,e.assoc||-1),u=t.documentTop;if(d)o==null&&(o=d.left-l.left),a=i<0?d.top:d.bottom;else{let p=t.viewState.lineBlockAt(s);o==null&&(o=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-p.from))),a=(i<0?p.top:p.bottom)+u}let h=l.left+o,f=r??t.viewState.heightOracle.textHeight>>1;for(let p=0;;p+=10){let m=a+(f+p)*i,x=Bp(t,{x:h,y:m},!1,i);return q.cursor(x.pos,x.assoc,void 0,o)}}function da(t,e,n){for(;;){let r=0;for(let s of t)s.between(e-1,e+1,(i,o,a)=>{if(e>i&&e<o){let l=r||n||(e-i<o-e?-1:1);e=l<0?i:o,r=l}});if(!r)return e}}function s2(t,e){let n=null;for(let r=0;r<e.ranges.length;r++){let s=e.ranges[r],i=null;if(s.empty){let o=da(t,s.from,0);o!=s.from&&(i=q.cursor(o,-1))}else{let o=da(t,s.from,-1),a=da(t,s.to,1);(o!=s.from||a!=s.to)&&(i=q.range(s.from==s.anchor?o:a,s.from==s.head?o:a))}i&&(n||(n=e.ranges.slice()),n[r]=i)}return n?q.create(n,e.mainIndex):e}function zh(t,e,n){let r=da(t.state.facet(Gl).map(s=>s(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:q.cursor(r,r<n.from?1:-1)}class br{constructor(e,n){this.pos=e,this.assoc=n}}function Bp(t,e,n,r){let s=t.contentDOM.getBoundingClientRect(),i=s.top+t.viewState.paddingTop,{x:o,y:a}=e,l=a-i,d;for(;;){if(l<0)return new br(0,1);if(l>t.viewState.docHeight)return new br(t.state.doc.length,-1);if(d=t.elementAtHeight(l),r==null)break;if(d.type==Bt.Text){let f=t.docView.coordsAt(r<0?d.from:d.to,r);if(f&&(r<0?f.top<=l+i:f.bottom>=l+i))break}let h=t.viewState.heightOracle.textHeight/2;l=r>0?d.bottom+h:d.top-h}if(t.viewport.from>=d.to||t.viewport.to<=d.from){if(n)return null;if(d.type==Bt.Text){let h=GM(t,s,d,o,a);return new br(h,h==d.from?1:-1)}}if(d.type!=Bt.Text)return l<(d.top+d.bottom)/2?new br(d.from,1):new br(d.to,-1);let u=t.docView.lineAt(d.from,2);return(!u||u.length!=d.length)&&(u=t.docView.lineAt(d.from,-2)),i2(t,u,d.from,o,a)}function i2(t,e,n,r,s){let i=-1,o=null,a=1e9,l=1e9,d=s,u=s,h=(f,p)=>{for(let m=0;m<f.length;m++){let x=f[m];if(x.top==x.bottom)continue;let b=x.left>r?x.left-r:x.right<r?r-x.right:0,y=x.top>s?x.top-s:x.bottom<s?s-x.bottom:0;x.top<=u&&x.bottom>=d&&(d=Math.min(x.top,d),u=Math.max(x.bottom,u),y=0),(i<0||(y-l||b-a)<0)&&(i>=0&&l&&a<b&&o.top<=u-2&&o.bottom>=d+2?l=0:(i=p,a=b,l=y,o=x))}};if(e.isText()){for(let p=0;p<e.length;){let m=Ct(e.text,p);if(h(Aa(e.dom,p,m).getClientRects(),p),!a&&!l)break;p=m}return r>(o.left+o.right)/2==(Ux(t,i+n)==Je.LTR)?new br(n+Ct(e.text,i),-1):new br(n+i,1)}else{if(!e.length)return new br(n,1);for(let x=0;x<e.children.length;x++){let b=e.children[x];if(b.flags&48)continue;let y=(b.dom.nodeType==1?b.dom:Aa(b.dom,0,b.length)).getClientRects();if(h(y,x),!a&&!l)break}let f=e.children[i],p=e.posBefore(f,n);return f.isComposite()||f.isText()?i2(t,f,p,Math.max(o.left,Math.min(o.right,r)),s):r>(o.left+o.right)/2==(Ux(t,i+n)==Je.LTR)?new br(p+f.length,-1):new br(p,1)}}function Ux(t,e){let n=t.state.doc.lineAt(e);return t.bidiSpans(n)[Vr.find(t.bidiSpans(n),e-n.from,-1,1)].dir}const Jo="";class ZM{constructor(e,n){this.points=e,this.view=n,this.text="",this.lineSeparator=n.state.facet(Fe.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Jo}readRange(e,n){if(!e)return this;let r=e.parentNode;for(let s=e;;){this.findPointBefore(r,s);let i=this.text.length;this.readNode(s);let o=yt.get(s),a=s.nextSibling;if(a==n){o?.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=yt.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:Hd(s))||Hd(a)&&(s.nodeName!="BR"||o?.isWidget())&&this.text.length>i)&&!JM(a,n)&&this.lineBreak(),s=a}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,o=1,a;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=s.exec(n))&&(i=a.index,o=a[0].length),this.append(n.slice(r,i<0?n.length:i)),i<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=o-1);r=i+o}}readNode(e){let n=yt.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let s=r.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(QM(e,r.node,r.offset)?n:0))}}function QM(t,e,n){for(;;){if(!e||n<Kr(e))return!1;if(e==t)return!0;n=js(e)+1,e=e.parentNode}}function JM(t,e){let n;for(;!(t==e||!t);t=t.nextSibling){let r=yt.get(t);if(!r?.isWidget())return!1;r&&(n||(n=[])).push(r)}if(n)for(let r of n){let s=r.overrideDOMText;if(s?.length)return!1}return!0}class Kx{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}}class eA{constructor(e,n,r,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:i,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=o2(e.docView.tile,n,r,0))){let a=i||o?[]:nA(e),l=new ZM(a,e);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=rA(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=i&&i.node==a.focusNode&&i.offset==a.focusOffset||!Ap(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),d=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!Ap(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),u=e.viewport;if((fe.ios||fe.chrome)&&e.state.selection.main.empty&&l!=d&&(u.from>0||u.to<e.state.doc.length)){let h=Math.min(l,d),f=Math.max(l,d),p=u.from-h,m=u.to-f;(p==0||p==1||h==0)&&(m==0||m==-1||f==e.state.doc.length)&&(l=0,d=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(q.range(d,l)):this.newSel=q.single(d,l)}}}function o2(t,e,n,r){if(t.isComposite()){let s=-1,i=-1,o=-1,a=-1;for(let l=0,d=r,u=r;l<t.children.length;l++){let h=t.children[l],f=d+h.length;if(d<e&&f>n)return o2(h,e,n,d);if(f>=e&&s==-1&&(s=l,i=d),d>n&&h.dom.parentNode==t.dom){o=l,a=u;break}u=f,d=f+h.breakAfter}return{from:i,to:a<0?r+t.length:a,startDOM:(s?t.children[s-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:o<t.children.length&&o>=0?t.children[o].dom:null}}else return t.isText()?{from:r,to:r+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function a2(t,e){let n,{newSel:r}=e,s=t.state.selection.main,i=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,l=s.from,d=null;(i===8||fe.android&&e.text.length<a-o)&&(l=s.to,d="end");let u=l2(t.state.doc.sliceString(o,a,Jo),e.text,l-o,d);u&&(fe.chrome&&i==13&&u.toB==u.from+2&&e.text.slice(u.from,u.toB)==Jo+Jo&&u.toB--,n={from:o+u.from,to:o+u.toA,insert:Ge.of(e.text.slice(u.from,u.toB).split(Jo))})}else r&&(!t.hasFocus&&t.state.facet(Fr)||r.main.eq(s))&&(r=null);if(!n&&!r)return!1;if(!n&&e.typeOver&&!s.empty&&r&&r.main.empty?n={from:s.from,to:s.to,insert:t.state.doc.slice(s.from,s.to)}:(fe.mac||fe.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=q.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Ge.of([n.insert.toString().replace("."," ")])}):n&&n.from>=s.from&&n.to<=s.to&&(n.from!=s.from||n.to!=s.to)&&s.to-s.from-(n.to-n.from)<=4?n={from:s.from,to:s.to,insert:t.state.doc.slice(s.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,s.to))}:t.state.doc.lineAt(s.from).to<s.to&&t.docView.lineHasWidget(s.to)&&t.inputState.insertingTextAt>Date.now()-50?n={from:s.from,to:s.to,insert:t.state.toText(t.inputState.insertingText)}:fe.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==`
|
|
267
|
+
`&&t.lineWrapping&&(r&&(r=q.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:Ge.of([" "])}),n)return cg(t,n,r,i);if(r&&!r.main.eq(s)){let o=!1,a="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),a=t.inputState.lastSelectionOrigin,a=="select.pointer"&&(r=s2(t.state.facet(Gl).map(l=>l(t)),r))),t.dispatch({selection:r,scrollIntoView:o,userEvent:a}),!0}else return!1}function cg(t,e,n,r=-1){if(fe.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(fe.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&t.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Fi(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>s.head)&&Fi(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Fi(t.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,a=()=>o||(o=tA(t,e,n));return t.state.facet(Uk).some(l=>l(t,e.from,e.to,i,a))||t.dispatch(a()),!0}function tA(t,e,n){let r,s=t.state,i=s.selection.main,o=-1;if(e.from==e.to&&e.from<i.from||e.from>i.to){let l=e.from<i.from?-1:1,d=l<0?i.from:i.to,u=da(s.facet(Gl).map(h=>h(t)),d,l);e.from==u&&(o=u)}if(o>-1)r={changes:e,selection:q.cursor(e.from+e.insert.length,-1)};else if(e.from>=i.from&&e.to<=i.to&&e.to-e.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let l=i.from<e.from?s.sliceDoc(i.from,e.from):"",d=i.to>e.to?s.sliceDoc(e.to,i.to):"";r=s.replaceSelection(t.state.toText(l+e.insert.sliceString(0,void 0,t.state.lineBreak)+d))}else{let l=s.changes(e),d=n&&n.main.to<=l.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=i.to+10&&e.to>=i.to-10){let u=t.state.sliceDoc(e.from,e.to),h,f=n&&r2(t,n.main.head);if(f){let m=e.insert.length-(e.to-e.from);h={from:f.from,to:f.to-m}}else h=t.state.doc.lineAt(i.head);let p=i.to-e.to;r=s.changeByRange(m=>{if(m.from==i.from&&m.to==i.to)return{changes:l,range:d||m.map(l)};let x=m.to-p,b=x-u.length;if(t.state.sliceDoc(b,x)!=u||x>=h.from&&b<=h.to)return{range:m};let y=s.changes({from:b,to:x,insert:e.insert}),k=m.to-i.to;return{changes:y,range:d?q.range(Math.max(0,d.anchor+k),Math.max(0,d.head+k)):m.map(y)}})}else r={changes:l,selection:d&&s.selection.replaceRange(d)}}let a="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,a+=".compose",t.inputState.compositionFirstChange&&(a+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:a,scrollIntoView:!0})}function l2(t,e,n,r){let s=Math.min(t.length,e.length),i=0;for(;i<s&&t.charCodeAt(i)==e.charCodeAt(i);)i++;if(i==s&&t.length==e.length)return null;let o=t.length,a=e.length;for(;o>0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,i-Math.min(o,a));n-=o+l-i}if(o<i&&t.length<e.length){let l=n<=i&&n>=o?i-n:0;i-=l,a=i+(a-o),o=i}else if(a<i){let l=n<=i&&n>=a?i-n:0;i-=l,o=i+(o-a),a=i}return{from:i,toA:o,toB:a}}function nA(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}=t.observer.selectionRange;return n&&(e.push(new Kx(n,r)),(s!=n||i!=r)&&e.push(new Kx(s,i))),e}function rA(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?q.single(n+e,r+e):null}class sA{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,fe.safari&&e.contentDOM.addEventListener("input",()=>null),fe.gecko&&yA(e.contentDOM.ownerDocument)}handleEvent(e){!hA(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let s of r.observers)s(this.view,n);for(let s of r.handlers){if(n.defaultPrevented)break;if(s(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=iA(e),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let o=!n[i].handlers.length,a=r[i];a&&o!=!a.handlers.length&&(s.removeEventListener(i,this.handleEvent),a=null),a||s.addEventListener(i,this.handleEvent,{passive:o})}for(let i in r)i!="scroll"&&!n[i]&&s.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&d2.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),fe.android&&fe.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return fe.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=c2.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||oA.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,Fi(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:fe.safari&&!fe.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 Gx(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(s){dn(n.state,s)}}}function iA(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let s=r.spec,i=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(i)for(let a in i){let l=i[a];l&&n(a).handlers.push(Gx(r.value,l))}if(o)for(let a in o){let l=o[a];l&&n(a).observers.push(Gx(r.value,l))}}for(let r in tr)n(r).handlers.push(tr[r]);for(let r in Bn)n(r).observers.push(Bn[r]);return e}const c2=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],oA="dthko",d2=[16,17,18,20,91,92,224,225],Oc=6;function Ec(t){return Math.max(0,t)*.7+8}function aA(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class lA{constructor(e,n,r,s){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=uM(e.contentDOM),this.atoms=e.state.facet(Gl).map(o=>o(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(Fe.allowMultipleSelections)&&cA(e,n),this.dragging=uA(e,n)&&f2(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&&aA(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,s=0,i=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=lg(this.view);e.clientX-l.left<=s+Oc?n=-Ec(s-e.clientX):e.clientX+l.right>=o-Oc&&(n=Ec(e.clientX-o)),e.clientY-l.top<=i+Oc?r=-Ec(i-e.clientY):e.clientY+l.bottom>=a-Oc&&(r=Ec(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=s2(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 cA(t,e){let n=t.state.facet(zk);return n.length?n[0](e):fe.mac?e.metaKey:e.ctrlKey}function dA(t,e){let n=t.state.facet(Vk);return n.length?n[0](e):fe.mac?!e.altKey:!e.ctrlKey}function uA(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=Da(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i<s.length;i++){let o=s[i];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function hA(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=yt.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const tr=Object.create(null),Bn=Object.create(null),u2=fe.ie&&fe.ie_version<15||fe.ios&&fe.webkit_version<604;function fA(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(),h2(t,n.value)},50)}function Vu(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function h2(t,e){e=Vu(t.state,ig,e);let{state:n}=t,r,s=1,i=n.toText(e),o=i.lines==n.selection.ranges.length;if(Fp!=null&&n.selection.ranges.every(l=>l.empty)&&Fp==i.toString()){let l=-1;r=n.changeByRange(d=>{let u=n.doc.lineAt(d.from);if(u.from==l)return{range:d};l=u.from;let h=n.toText((o?i.line(s++).text:e)+n.lineBreak);return{changes:{from:u.from,insert:h},range:q.cursor(d.from+h.length)}})}else o?r=n.changeByRange(l=>{let d=i.line(s++);return{changes:{from:l.from,to:l.to,insert:d.text},range:q.cursor(l.from+d.length)}}):r=n.replaceSelection(i);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Bn.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};tr.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Bn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Bn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};tr.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(Hk))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=mA(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new lA(t,e,n,r)),r&&t.observer.ignore(()=>{Ak(t.contentDOM);let i=t.root.activeElement;i&&!i.contains(t.contentDOM)&&i.blur()});let s=t.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function qx(t,e,n,r){if(r==1)return q.cursor(e,n);if(r==2)return KM(t.state,e,n);{let s=t.docView.lineAt(e,n),i=t.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:i.from,a=s?s.posAtEnd:i.to;return a<t.state.doc.length&&a==i.to&&a++,q.range(o,a)}}const pA=fe.ie&&fe.ie_version<=11;let Yx=null,Xx=0,Zx=0;function f2(t){if(!pA)return t.detail;let e=Yx,n=Zx;return Yx=t,Zx=Date.now(),Xx=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Xx+1)%3:1}function mA(t,e){let n=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=f2(e),s=t.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,o,a){let l=t.posAndSideAtCoords({x:i.clientX,y:i.clientY},!1),d,u=qx(t,l.pos,l.assoc,r);if(n.pos!=l.pos&&!o){let h=qx(t,n.pos,n.assoc,r),f=Math.min(h.from,u.from),p=Math.max(h.to,u.to);u=f<u.from?q.range(f,p):q.range(p,f)}return o?s.replaceRange(s.main.extend(u.from,u.to)):a&&r==1&&s.ranges.length>1&&(d=gA(s,l.pos))?d:a?s.addRange(u):q.create([u])}}}function gA(t,e){for(let n=0;n<t.ranges.length;n++){let{from:r,to:s}=t.ranges[n];if(r<=e&&s>=e)return q.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}tr.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let s=t.docView.tile.nearest(e.target);if(s&&s.isWidget()){let i=s.posAtStart,o=i+s.length;(i>=n.to||o<=n.from)&&(n=q.range(i,o))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",Vu(t.state,og,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};tr.dragend=t=>(t.inputState.draggedContent=null,!1);function Qx(t,e,n,r){if(n=Vu(t.state,ig,n),!n)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=t.inputState,o=r&&i&&dA(t,e)?{from:i.from,to:i.to}:null,a={from:s,insert:n},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}tr.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),s=0,i=()=>{++s==n.length&&Qx(t,e,r.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o<n.length;o++){let a=new FileReader;a.onerror=i,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[o]=a.result),i()},a.readAsText(n[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Qx(t,e,r,!0),!0}return!1};tr.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=u2?null:e.clipboardData;return n?(h2(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(fA(t),!1)};function xA(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 bA(t){let e=[],n=[],r=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),n.push(s));if(!e.length){let s=-1;for(let{from:i}of t.selection.ranges){let o=t.doc.lineAt(i);o.number>s&&(e.push(o.text),n.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),s=o.number}r=!0}return{text:Vu(t,og,e.join(t.lineBreak)),ranges:n,linewise:r}}let Fp=null;tr.copy=tr.cut=(t,e)=>{let{text:n,ranges:r,linewise:s}=bA(t.state);if(!n&&!s)return!1;Fp=s?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=u2?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(xA(t,n),!1)};const p2=Or.define();function m2(t,e){let n=[];for(let r of t.facet(Kk)){let s=r(t,e);s&&n.push(s)}return n.length?t.update({effects:n,annotations:p2.of(!0)}):null}function g2(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=m2(t.state,e);n?t.dispatch(n):t.update([])}},10)}Bn.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),g2(t)};Bn.blur=t=>{t.observer.clearSelectionRange(),g2(t)};Bn.compositionstart=Bn.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Bn.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,fe.chrome&&fe.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Bn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};tr.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let i=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=e.getTargetRanges();if(i&&o.length){let a=o[0],l=t.posAtDOM(a.startContainer,a.startOffset),d=t.posAtDOM(a.endContainer,a.endOffset);return cg(t,{from:l,to:d,insert:t.state.toText(i)},null),!0}}let s;if(fe.chrome&&fe.android&&(s=c2.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return fe.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),fe.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Bn.compositionend(t,e),20),!1};const Jx=new Set;function yA(t){Jx.has(t)||(Jx.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const eb=["pre-wrap","normal","pre-line","break-spaces"];let so=!1;function tb(){so=!1}class vA{constructor(e){this.lineWrapping=e,this.doc=Ge.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 eb.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r<e.length;r++){let s=e[r];s<0?r++:this.heightSamples[Math.floor(s*10)]||(n=!0,this.heightSamples[Math.floor(s*10)]=!0)}return n}refresh(e,n,r,s,i,o){let a=eb.indexOf(e)>-1,l=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,l){this.heightSamples={};for(let d=0;d<o.length;d++){let u=o[d];u<0?d++:this.heightSamples[Math.floor(u*10)]=!0}}return l}}class wA{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class qn{constructor(e,n,r,s,i){this.from=e,this.length=n,this.top=r,this.height=s,this._content=i}get type(){return typeof this._content=="number"?Bt.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 ni?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 qn(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var et=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(et||(et={}));const pd=.001;class Qt{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)>pd&&(so=!0),this.height=e)}replace(e,n,r){return Qt.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,s){let i=this,o=r.doc;for(let a=s.length-1;a>=0;a--){let{fromA:l,toA:d,fromB:u,toB:h}=s[a],f=i.lineAt(l,et.ByPosNoHeight,r.setDoc(n),0,0),p=f.to>=d?f:i.lineAt(d,et.ByPosNoHeight,r,0,0);for(h+=p.to-d,d=p.to;a>0&&f.from<=s[a-1].toA;)l=s[a-1].fromA,u=s[a-1].fromB,a--,l<f.from&&(f=i.lineAt(l,et.ByPosNoHeight,r,0,0));u+=f.from-l,l=f.from;let m=dg.build(r.setDoc(o),e,u,h);i=Gd(i,i.replace(l,d,m))}return i.updateHeight(r,0)}static empty(){return new bn(0,0,0)}static of(e){if(e.length==1)return e[0];let n=0,r=e.length,s=0,i=0;for(;;)if(n==r)if(s>i*2){let a=e[n-1];a.break?e.splice(--n,1,a.left,null,a.right):e.splice(--n,1,a.left,a.right),r+=1+a.break,s-=a.size}else if(i>s*2){let a=e[r];a.break?e.splice(r,1,a.left,null,a.right):e.splice(r,1,a.left,a.right),r+=2+a.break,i-=a.size}else break;else if(s<i){let a=e[n++];a&&(s+=a.size)}else{let a=e[--r];a&&(i+=a.size)}let o=0;return e[n-1]==null?(o=1,n--):e[n]==null&&(o=1,r++),new SA(Qt.of(e.slice(0,n)),o,Qt.of(e.slice(r)))}}function Gd(t,e){return t==e?t:(t.constructor!=e.constructor&&(so=!0),e)}Qt.prototype.size=1;const kA=je.replace({});class x2 extends Qt{constructor(e,n,r){super(e,n),this.deco=r,this.spaceAbove=0}mainBlock(e,n){return new qn(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,n,r,s){return this.spaceAbove&&e<r+this.spaceAbove?new qn(s,0,r,this.spaceAbove,kA):this.mainBlock(r,s)}lineAt(e,n,r,s,i){let o=this.mainBlock(s,i);return this.spaceAbove?this.blockAt(0,r,s,i).join(o):o}forEachLine(e,n,r,s,i,o){e<=i+this.length&&n>=i&&o(this.lineAt(0,et.ByPos,r,s,i))}setMeasuredHeight(e){let n=e.heights[e.index++];n<0?(this.spaceAbove=-n,n=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}}class bn extends x2{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 qn(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,n,r){let s=r[0];return r.length==1&&(s instanceof bn||s instanceof _t&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof _t?s=new bn(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):Qt.of(r)}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more?this.setMeasuredHeight(s):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class _t extends Qt{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,s=e.doc.lineAt(n+this.length).number,i=s-r+1,o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*i);o=l/i,this.length>i+1&&(a=(this.height-l)/(this.length-i-1))}else o=this.height/i;return{firstLine:r,lastLine:s,perLine:o,perChar:a}}blockAt(e,n,r,s){let{firstLine:i,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(n,s);if(n.lineWrapping){let d=s+(e<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),u=n.doc.lineAt(d),h=a+u.length*l,f=Math.max(r,e-h/2);return new qn(u.from,u.length,f,h,0)}else{let d=Math.max(0,Math.min(o-i,Math.floor((e-r)/a))),{from:u,length:h}=n.doc.line(i+d);return new qn(u,h,r+a*d,a,0)}}lineAt(e,n,r,s,i){if(n==et.ByHeight)return this.blockAt(e,r,s,i);if(n==et.ByPosNoHeight){let{from:p,to:m}=r.doc.lineAt(e);return new qn(p,m-p,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(r,i),d=r.doc.lineAt(e),u=a+d.length*l,h=d.number-o,f=s+a*h+l*(d.from-i-h);return new qn(d.from,d.length,Math.max(s,Math.min(f,s+this.height-u)),u,0)}forEachLine(e,n,r,s,i,o){e=Math.max(e,i),n=Math.min(n,i+this.length);let{firstLine:a,perLine:l,perChar:d}=this.heightMetrics(r,i);for(let u=e,h=s;u<=n;){let f=r.doc.lineAt(u);if(u==e){let m=f.number-a;h+=l*m+d*(e-i-m)}let p=l+d*f.length;o(new qn(f.from,f.length,h,p,0)),h+=p,u=f.to+1}}replace(e,n,r){let s=this.length-n;if(s>0){let i=r[r.length-1];i instanceof _t?r[r.length-1]=new _t(i.length+s):r.push(null,new _t(s-1))}if(e>0){let i=r[0];i instanceof _t?r[0]=new _t(e+i.length):r.unshift(new _t(e-1),null)}return Qt.of(r)}decomposeLeft(e,n){n.push(new _t(e-1),null)}decomposeRight(e,n){n.push(null,new _t(this.length-e-1))}updateHeight(e,n=0,r=!1,s){let i=n+this.length;if(s&&s.from<=n+this.length&&s.more){let o=[],a=Math.max(n,s.from),l=-1;for(s.from>n&&o.push(new _t(s.from-n-1).updateHeight(e,n));a<=i&&s.more;){let u=e.doc.lineAt(a).length;o.length&&o.push(null);let h=s.heights[s.index++],f=0;h<0&&(f=-h,h=s.heights[s.index++]),l==-1?l=h:Math.abs(h-l)>=pd&&(l=-2);let p=new bn(u,h,f);p.outdated=!1,o.push(p),a+=u+1}a<=i&&o.push(null,new _t(i-a).updateHeight(e,a));let d=Qt.of(o);return(l<0||Math.abs(d.height-this.height)>=pd||Math.abs(l-this.heightMetrics(e,n).perLine)>=pd)&&(so=!0),Gd(this,d)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class SA extends Qt{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,s){let i=r+this.left.height;return e<i?this.left.blockAt(e,n,r,s):this.right.blockAt(e,n,i,s+this.left.length+this.break)}lineAt(e,n,r,s,i){let o=s+this.left.height,a=i+this.left.length+this.break,l=n==et.ByHeight?e<o:e<a,d=l?this.left.lineAt(e,n,r,s,i):this.right.lineAt(e,n,r,o,a);if(this.break||(l?d.to<a:d.from>a))return d;let u=n==et.ByPosNoHeight?et.ByPosNoHeight:et.ByPos;return l?d.join(this.right.lineAt(a,u,r,o,a)):this.left.lineAt(a,u,r,s,i).join(d)}forEachLine(e,n,r,s,i,o){let a=s+this.left.height,l=i+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,n,r,s,i,o),n>=l&&this.right.forEachLine(e,n,r,a,l,o);else{let d=this.lineAt(l,et.ByPos,r,s,i);e<d.from&&this.left.forEachLine(e,d.from-1,r,s,i,o),d.to>=e&&d.from<=n&&o(d),n>d.to&&this.right.forEachLine(d.to+1,n,r,a,l,o)}}replace(e,n,r){let s=this.left.length+this.break;if(n<s)return this.balanced(this.left.replace(e,n,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-s,n-s,r));let i=[];e>0&&this.decomposeLeft(e,i);let o=i.length;for(let a of r)i.push(a);if(e>0&&nb(i,o-1),n<this.length){let a=i.length;this.decomposeRight(n,i),nb(i,a)}return Qt.of(i)}decomposeLeft(e,n){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(r++,e>=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,n);e<r&&this.left.decomposeRight(e,n),this.break&&e<s&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?Qt.of(this.break?[e,null,n]:[e,n]):(this.left=Gd(this.left,e),this.right=Gd(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,s){let{left:i,right:o}=this,a=n+i.length+this.break,l=null;return s&&s.from<=n+i.length&&s.more?l=i=i.updateHeight(e,n,r,s):i.updateHeight(e,n,r),s&&s.from<=a+o.length&&s.more?l=o=o.updateHeight(e,a,r,s):o.updateHeight(e,a,r),l?this.balanced(i,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function nb(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof _t&&(r=t[e+1])instanceof _t&&t.splice(e-1,3,new _t(n.length+1+r.length))}const CA=5;class dg{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof bn?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new bn(r-this.pos,-1,0)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e<n||r.heightRelevant){let s=r.widget?r.widget.estimatedHeight:0,i=r.widget?r.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let o=n-e;r.block?this.addBlock(new x2(o,s,r)):(o||i||s>=CA)&&this.addLineDeco(s,i,o)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new bn(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,n){let r=new _t(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 bn)return e;let n=new bn(0,-1,0);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof bn)&&!this.isCovered?this.nodes.push(new bn(0,-1,0)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let s of this.nodes)s instanceof bn&&s.updateHeight(this.oracle,r),r+=s?s.length:1;return this.nodes}static build(e,n,r,s){let i=new dg(r,e);return Ie.spans(n,r,s,i,0),i.finish(r)}}function jA(t,e,n){let r=new NA;return Ie.compare(t,e,n,r,0),r.changes}class NA{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,r,s){(e<n||r&&r.heightRelevant||s&&s.heightRelevant)&&Bi(e,n,this.changes,5)}}function PA(t,e){let n=t.getBoundingClientRect(),r=t.ownerDocument,s=r.defaultView||window,i=Math.max(0,n.left),o=Math.min(s.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(s.innerHeight,n.bottom);for(let d=t.parentNode;d&&d!=r.body;)if(d.nodeType==1){let u=d,h=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&h.overflow!="visible"){let f=u.getBoundingClientRect();i=Math.max(i,f.left),o=Math.min(o,f.right),a=Math.max(a,f.top),l=Math.min(d==t.parentNode?s.innerHeight:l,f.bottom)}d=h.position=="absolute"||h.position=="fixed"?u.offsetParent:u.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:i-n.left,right:Math.max(i,o)-n.left,top:a-(n.top+e),bottom:Math.max(a,l)-(n.top+e)}}function OA(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 EA(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class Vh{constructor(e,n,r,s){this.from=e,this.to=n,this.size=r,this.displaySize=s}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++){let s=e[r],i=n[r];if(s.from!=i.from||s.to!=i.to||s.size!=i.size)return!1}return!0}draw(e,n){return je.replace({widget:new DA(this.displaySize*(n?e.scaleY:e.scaleX),n)}).range(this.from,this.to)}}class DA extends Dr{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 rb{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=sb,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Je.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=e.facet(ag).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new vA(n),this.stateDeco=e.facet(Ta).filter(r=>typeof r!="function"),this.heightMap=Qt.empty().applyChanges(this.stateDeco,Ge.empty,this.heightOracle.setDoc(e.doc),[new Tn(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=je.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!e.some(({from:i,to:o})=>s>=i&&s<=o)){let{from:i,to:o}=this.lineBlockAt(s);e.push(new Dc(i,o))}}return this.viewports=e.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?sb:new ug(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(ea(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Ta).filter(u=>typeof u!="function");let s=e.changedRanges,i=Tn.extendWithRanges(s,jA(r,this.stateDeco,e?e.changes:kt.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);tb(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||so)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let l=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.head<l.from||n.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,n));let d=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(d||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(qk)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Je.RTL:Je.LTR;let o=this.heightOracle.mustRefreshForWrapping(i),a=n.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let d=0,u=0;if(a.width&&a.height){let{scaleX:w,scaleY:C}=Mk(n,a);(w>.005&&Math.abs(this.scaleX-w)>.005||C>.005&&Math.abs(this.scaleY-C)>.005)&&(this.scaleX=w,this.scaleY=C,d|=16,o=l=!0)}let h=(parseInt(r.paddingTop)||0)*this.scaleY,f=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=f)&&(this.paddingTop=h,this.paddingBottom=f,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let p=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=p&&(this.scrollAnchorHeight=-1,this.scrollTop=p),this.scrolledToBottom=Tk(e.scrollDOM);let m=(this.printing?EA:PA)(n,this.paddingTop),x=m.top-this.pixelViewport.top,b=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(l=!0)),!this.inView&&!this.scrollTarget&&!OA(e.dom))return 0;let k=a.width;if((this.contentDOMWidth!=k||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),l){let w=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(w)&&(o=!0),o||s.lineWrapping&&Math.abs(k-this.contentDOMWidth)>s.charWidth){let{lineHeight:C,charWidth:j,textHeight:S}=e.docView.measureTextSize();o=C>0&&s.refresh(i,C,j,S,Math.max(5,k/j),w),o&&(e.docView.minWidth=0,d|=16)}x>0&&b>0?u=Math.max(x,b):x<0&&b<0&&(u=Math.min(x,b)),tb();for(let C of this.viewports){let j=C.from==this.viewport.from?w:e.docView.measureVisibleLineHeights(C);this.heightMap=(o?Qt.empty().applyChanges(this.stateDeco,Ge.empty,this.heightOracle,[new Tn(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new wA(C.from,j))}so&&(d|=2)}let v=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return v&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(u,this.scrollTarget),d|=this.updateForViewport()),(d&2||v)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),d}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,i=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new Dc(s.lineAt(o-r*1e3,et.ByHeight,i,0,0).from,s.lineAt(a+(1-r)*1e3,et.ByHeight,i,0,0).to);if(n){let{head:d}=n.range;if(d<l.from||d>l.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=s.lineAt(d,et.ByPos,i,0,0),f;n.y=="center"?f=(h.top+h.bottom)/2-u/2:n.y=="start"||n.y=="nearest"&&d<l.from?f=h.top:f=h.bottom-u,l=new Dc(s.lineAt(f-1e3/2,et.ByHeight,i,0,0).from,s.lineAt(f+u+1e3/2,et.ByHeight,i,0,0).to)}}return l}mapViewport(e,n){let r=n.mapPos(e.from,-1),s=n.mapPos(e.to,1);return new Dc(this.heightMap.lineAt(r,et.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,et.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:n},r=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(e,et.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,et.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||s<=o-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||i>=a+Math.max(10,Math.min(r,250)))&&s>o-2*1e3&&i<a+2*1e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let r=[];for(let s of e)n.touchesRange(s.from,s.to)||r.push(new Vh(n.mapPos(s.from),n.mapPos(s.to),s.size,s.displaySize));return r}ensureLineGaps(e,n){let r=this.heightOracle.lineWrapping,s=r?1e4:2e3,i=s>>1,o=s<<1;if(this.defaultTextDirection!=Je.LTR&&!r)return[];let a=[],l=(u,h,f,p)=>{if(h-u<i)return;let m=this.state.selection.main,x=[m.from];m.empty||x.push(m.to);for(let y of x)if(y>u&&y<h){l(u,y-10,f,p),l(y+10,h,f,p);return}let b=AA(e,y=>y.from>=f.from&&y.to<=f.to&&Math.abs(y.from-u)<i&&Math.abs(y.to-h)<i&&!x.some(k=>y.from<k&&y.to>k));if(!b){if(h<f.to&&n&&r&&n.visibleRanges.some(v=>v.from<=h&&v.to>=h)){let v=n.moveToLineBoundary(q.cursor(h),!1,!0).head;v>u&&(h=v)}let y=this.gapSize(f,u,h,p),k=r||y<2e6?y:2e6;b=new Vh(u,h,y,k)}a.push(b)},d=u=>{if(u.length<o||u.type!=Bt.Text)return;let h=MA(u.from,u.to,this.stateDeco);if(h.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,p,m;if(r){let x=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,b,y;if(f!=null){let k=Ac(h,f),v=((this.visibleBottom-this.visibleTop)/2+x)/u.height;b=k-v,y=k+v}else b=(this.visibleTop-u.top-x)/u.height,y=(this.visibleBottom-u.top+x)/u.height;p=Mc(h,b),m=Mc(h,y)}else{let x=h.total*this.heightOracle.charWidth,b=s*this.heightOracle.charWidth,y=0;if(x>2e6)for(let j of e)j.from>=u.from&&j.from<u.to&&j.size!=j.displaySize&&j.from*this.heightOracle.charWidth+y<this.pixelViewport.left&&(y=j.size-j.displaySize);let k=this.pixelViewport.left+y,v=this.pixelViewport.right+y,w,C;if(f!=null){let j=Ac(h,f),S=((v-k)/2+b)/x;w=j-S,C=j+S}else w=(k-b)/x,C=(v+b)/x;p=Mc(h,w),m=Mc(h,C)}p>u.from&&l(u.from,p,u,h),m<u.to&&l(m,u.to,u,h)};for(let u of this.viewportLines)Array.isArray(u.type)?u.type.forEach(d):d(u);return a}gapSize(e,n,r,s){let i=Ac(s,r)-Ac(s,n);return this.heightOracle.lineWrapping?e.height*i:s.total*this.heightOracle.charWidth*i}updateLineGaps(e){Vh.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=je.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=[];Ie.spans(n,this.viewport.from,this.viewport.to,{span(i,o){r.push({from:i,to:o})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let i=0;i<r.length&&!(s&8);i++){let o=this.visibleRanges[i],a=r[i];(o.from!=a.from||o.to!=a.to)&&(s|=4,e&&e.mapPos(o.from,-1)==a.from&&e.mapPos(o.to,1)==a.to||(s|=8))}return this.visibleRanges=r,s}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||ea(this.heightMap.lineAt(e,et.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)||ea(this.heightMap.lineAt(this.scaler.fromDOM(e),et.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 ea(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}}let Dc=class{constructor(e,n){this.from=e,this.to=n}};function MA(t,e,n){let r=[],s=t,i=0;return Ie.spans(n,t,e,{span(){},point(o,a){o>s&&(r.push({from:s,to:o}),i+=o-s),s=a}},20),s<e&&(r.push({from:s,to:e}),i+=e-s),{total:i,ranges:r}}function Mc({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let s=0;;s++){let{from:i,to:o}=e[s],a=o-i;if(r<=a)return i+r;r-=a}}function Ac(t,e){let n=0;for(let{from:r,to:s}of t.ranges){if(e<=s){n+=e-r;break}n+=s-r}return n/t.total}function AA(t,e){for(let n of t)if(e(n))return n}const sb={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class ug{constructor(e,n,r){let s=0,i=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let d=n.lineAt(a,et.ByPos,e,0,0).top,u=n.lineAt(l,et.ByPos,e,0,0).bottom;return s+=u-d,{from:a,to:l,top:d,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let a of this.viewports)a.domTop=o+(a.top-i)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),i=a.bottom}toDOM(e){for(let n=0,r=0,s=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||e<i.top)return s+(e-r)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);r=i.bottom,s=i.domBottom}}fromDOM(e){for(let n=0,r=0,s=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||e<i.domTop)return r+(e-s)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);r=i.bottom,s=i.domBottom}}eq(e){return e instanceof ug?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 ea(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new qn(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(s=>ea(s,e)):t._content)}const Tc=pe.define({combine:t=>t.join(" ")}),zp=pe.define({combine:t=>t.indexOf(!0)>-1}),Vp=Ss.newName(),b2=Ss.newName(),y2=Ss.newName(),v2={"&light":"."+b2,"&dark":"."+y2};function Hp(t,e,n){return new Ss(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return t;if(!n||!n[s])throw new RangeError(`Unsupported selector: ${s}`);return n[s]}):t+" "+r}})}const TA=Hp("."+Vp,{"&":{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"}},v2),LA={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Hh=fe.ie&&fe.ie_version<=11;class RA{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new hM,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);(fe.ie&&fe.ie_version<=11||fe.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&&fe.android&&e.constructor.EDIT_CONTEXT!==!1&&!(fe.chrome&&fe.chrome_version<126)&&(this.editContext=new IA(e),e.state.facet(Fr)&&(e.contentDOM.editContext=this.editContext.editContext)),Hh&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(Fr)?r.root.activeElement!=this.dom:!fd(this.dom,s))return;let i=s.anchorNode&&r.docView.tile.nearest(s.anchorNode);if(i&&i.isWidget()&&i.widget.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(fe.ie&&fe.ie_version<=11||fe.android&&fe.chrome)&&!r.state.selection.main.empty&&s.focusNode&&ca(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=Da(e.root);if(!n)return!1;let r=fe.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&_A(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=fd(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&pM(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),s&&(this.selectionChanged=!0),!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let r=this.dom;r;)if(r.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),n){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=n)r.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,LA),Hh&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Hh&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){var r;if(!this.delayedAndroidKey){let s=()=>{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&Fi(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,s=!1;for(let i of e){let o=this.readMutation(i);o&&(o.typeOver&&(s=!0),n==-1?{from:n,to:r}=o:(n=Math.min(o.from,n),r=Math.max(o.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&fd(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new eA(this.view,e,n,r);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,s=a2(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(e){let n=this.view.docView.tile.nearest(e.target);if(!n||n.isWidget())return null;if(n.markDirty(e.type=="attributes"),e.type=="childList"){let r=ib(n,e.previousSibling||e.target.previousSibling,-1),s=ib(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:s?n.posBefore(s):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Fr)!=e.state.facet(Fr)&&(e.view.contentDOM.editContext=e.state.facet(Fr)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function ib(t,e,n){for(;e;){let r=yt.get(e);if(r&&r.parent==t)return r;let s=e.parentNode;e=s!=t.dom?s:n>0?e.nextSibling:e.previousSibling}return null}function ob(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor,1);return ca(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function _A(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return ob(t,s)}let n=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?ob(t,n):null}class IA{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let s=e.state.selection.main,{anchor:i,head:o}=s,a=this.toEditorPos(r.updateRangeStart),l=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:a,drifted:!1});let d=l-a>r.text.length;a==this.from&&i<this.from?a=i:l==this.to&&i>this.to&&(l=i);let u=l2(e.state.sliceDoc(a,l),r.text,(d?s.from:s.to)-a,d?"end":null);if(!u){let f=q.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));f.main.eq(s)||e.dispatch({selection:f,userEvent:"select"});return}let h={from:u.from+a,to:u.toA+a,insert:Ge.of(r.text.slice(u.from,u.toB).split(`
|
|
268
|
+
`))};if((fe.mac||fe.android)&&h.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:l,insert:Ge.of([r.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let f=this.to-this.from+(h.to-h.from+h.insert.length);cg(e,h,q.single(this.toEditorPos(r.selectionStart,f),this.toEditorPos(r.selectionEnd,f)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),h.from<h.to&&!h.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let l=e.coordsForChar(o);i=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||i||new DOMRect,s.push(i)}n.updateCharacterBounds(r.rangeStart,s)},this.handlers.textformatupdate=r=>{let s=[];for(let i of r.getTextFormats()){let o=i.underlineStyle,a=i.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(i.rangeStart),d=this.toEditorPos(i.rangeEnd);if(l<d){let u=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;s.push(je.mark({attributes:{style:u}}).range(l,d))}}}e.dispatch({effects:Xk.of(je.set(s))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let s=Da(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((i,o,a,l,d)=>{if(r)return;let u=d.length-(o-i);if(s&&o>=s.to)if(s.from==i&&s.to==o&&s.insert.eq(d)){s=this.pendingContextChange=null,n+=u,this.to+=u;return}else s=null,this.revertPending(e.state);if(i+=n,o+=n,o<=this.from)this.from+=u,this.to+=u;else if(i<this.to){if(i<this.from||o>this.to||this.to-this.from+d.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),d.toString()),this.to+=u}n+=u}),s&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class ae{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(s=>s.forEach(i=>r(i,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||fM(e.parent)||document,this.viewState=new rb(e.state||Fe.create(e)),e.scrollTo&&e.scrollTo.is(Pc)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Oi).map(s=>new Ih(s));for(let s of this.plugins)s.update(this);this.observer=new RA(this),this.inputState=new sA(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Hx(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 jt?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,i=this.state;for(let f of e){if(f.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=f.state}if(this.destroyed){this.viewState.state=i;return}let o=this.hasFocus,a=0,l=null;e.some(f=>f.annotation(p2))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=m2(i,o),l||(a=1));let d=this.observer.delayedAndroidKey,u=null;if(d?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(u=null)):this.observer.clear(),i.facet(Fe.phrases)!=this.state.facet(Fe.phrases))return this.setState(i);s=Wd.create(this,i,e),s.flags|=a;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let f of e){if(h&&(h=h.map(f.changes)),f.scrollIntoView){let{main:p}=f.state.selection;h=new zi(p.empty?p:q.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of f.effects)p.is(Pc)&&(h=p.value.clip(this.state))}this.viewState.update(s,h),this.bidiCache=qd.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(Qo)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Tc)!=s.state.facet(Tc)&&(this.viewState.mustMeasureContent=!0),(n||r||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let f of this.state.facet(_p))try{f(s)}catch(p){dn(this.state,p,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!a2(this,u)&&d.force&&Fi(this.contentDOM,d.key,d.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new rb(e),this.plugins=e.facet(Oi).map(r=>new Ih(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new Hx(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(Oi),r=e.state.facet(Oi);if(n!=r){let s=[];for(let i of r){let o=n.indexOf(i);if(o<0)s.push(new Ih(i));else{let a=this.plugins[o];a.mustUpdate=e,s.push(a)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){dn(this.state,r,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,s=r.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(Tk(r))i=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(s);i=p.from,o=p.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let d=[];l&4||([this.measureRequests,d]=[d,this.measureRequests]);let u=d.map(p=>{try{return p.read(this)}catch(m){return dn(this.state,m),ab}}),h=Wd.create(this,this.state,[]),f=!1;h.flags|=l,n?n.flags|=l:n=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),f=this.docView.update(h),f&&this.docViewUpdate());for(let p=0;p<d.length;p++)if(u[p]!=ab)try{let m=d[p];m.write&&m.write(u[p],this)}catch(m){dn(this.state,m)}if(f&&this.docView.updateSelection(!0),!h.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=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-o;if(m>1||m<-1){s=s+m,r.scrollTop=s/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let a of this.state.facet(_p))a(n)}get themeClasses(){return Vp+" "+(this.state.facet(zp)?y2:b2)+" "+this.state.facet(Tc)}updateAttrs(){let e=lb(this,Zk,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Fr)?"true":"false",class:"cm-content",style:`${fe.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),lb(this,ag,n);let r=this.observer.ignore(()=>{let s=Ix(this.contentDOM,this.contentAttrs,n),i=Ix(this.dom,this.editorAttrs,e);return s||i});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let s of r.effects)if(s.is(ae.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Qo);let e=this.state.facet(ae.cspNonce);Ss.mount(this.root,this.styleModules.concat(TA).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 zh(this,e,Wx(this,e,n,r))}moveByGroup(e,n){return zh(this,e,Wx(this,e,n,r=>YM(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),i=r[n?r.length-1:0];return q.cursor(i.side(n,s)+e.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return qM(this,e,n,r)}moveVertically(e,n,r){return zh(this,e,XM(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=Bp(this,e,n);return r&&r.pos}posAndSideAtCoords(e,n=!0){return this.readMeasured(),Bp(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(e),i=this.bidiSpans(s),o=i[Vr.find(i,e-s.from,-1,n)];return Ma(r,o.dir==Je.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(Gk)||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>$A)return Bk(e.length);let n=this.textDirectionAt(e.from),r;for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||$k(i.isolates,r=Fx(this,e))))return i.order;r||(r=Fx(this,e));let s=wM(e.text,n,r);return this.bidiCache.push(new qd(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||fe.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Ak(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 Pc.of(new zi(typeof e=="number"?q.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 Pc.of(new zi(q.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 pt.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return pt.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=Ss.newName(),s=[Tc.of(r),Qo.of(Hp(`.${r}`,e))];return n&&n.dark&&s.push(zp.of(!0)),s}static baseTheme(e){return hi.lowest(Qo.of(Hp("."+Vp,e,v2)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&yt.get(r)||yt.get(e);return((n=s?.root)===null||n===void 0?void 0:n.view)||null}}ae.styleModule=Qo;ae.inputHandler=Uk;ae.clipboardInputFilter=ig;ae.clipboardOutputFilter=og;ae.scrollHandler=Yk;ae.focusChangeEffect=Kk;ae.perLineTextDirection=Gk;ae.exceptionSink=Wk;ae.updateListener=_p;ae.editable=Fr;ae.mouseSelectionStyle=Hk;ae.dragMovesSelection=Vk;ae.clickAddsSelectionRange=zk;ae.decorations=Ta;ae.blockWrappers=Qk;ae.outerDecorations=Jk;ae.atomicRanges=Gl;ae.bidiIsolatedRanges=e2;ae.scrollMargins=t2;ae.darkTheme=zp;ae.cspNonce=pe.define({combine:t=>t.length?t[0]:""});ae.contentAttributes=ag;ae.editorAttributes=Zk;ae.lineWrapping=ae.contentAttributes.of({class:"cm-lineWrapping"});ae.announce=Me.define();const $A=4096,ab={};class qd{constructor(e,n,r,s,i,o){this.from=e,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=o}static update(e,n){if(n.empty&&!e.some(i=>i.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:Je.LTR;for(let i=Math.max(0,e.length-10);i<e.length;i++){let o=e[i];o.dir==s&&!n.touchesRange(o.from,o.to)&&r.push(new qd(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function lb(t,e,n){for(let r=t.state.facet(e),s=r.length-1;s>=0;s--){let i=r[s],o=typeof i=="function"?i(t):i;o&&ng(o,n)}return n}const BA=fe.mac?"mac":fe.windows?"win":fe.linux?"linux":"key";function FA(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,o,a;for(let l=0;l<n.length-1;++l){const d=n[l];if(/^(cmd|meta|m)$/i.test(d))a=!0;else if(/^a(lt)?$/i.test(d))s=!0;else if(/^(c|ctrl|control)$/i.test(d))i=!0;else if(/^s(hift)?$/i.test(d))o=!0;else if(/^mod$/i.test(d))e=="mac"?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+d)}return s&&(r="Alt-"+r),i&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function Lc(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 zA=hi.default(ae.domEventHandlers({keydown(t,e){return k2(w2(e.state),t,e,"editor")}})),Hu=pe.define({enables:zA}),cb=new WeakMap;function w2(t){let e=t.facet(Hu),n=cb.get(e);return n||cb.set(e,n=WA(e.reduce((r,s)=>r.concat(s),[]))),n}function VA(t,e,n){return k2(w2(t.state),e,t,n)}let ds=null;const HA=4e3;function WA(t,e=BA){let n=Object.create(null),r=Object.create(null),s=(o,a)=>{let l=r[o];if(l==null)r[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},i=(o,a,l,d,u)=>{var h,f;let p=n[o]||(n[o]=Object.create(null)),m=a.split(/ (?!$)/).map(y=>FA(y,e));for(let y=1;y<m.length;y++){let k=m.slice(0,y).join(" ");s(k,!0),p[k]||(p[k]={preventDefault:!0,stopPropagation:!1,run:[v=>{let w=ds={view:v,prefix:k,scope:o};return setTimeout(()=>{ds==w&&(ds=null)},HA),!0}]})}let x=m.join(" ");s(x,!1);let b=p[x]||(p[x]={preventDefault:!1,stopPropagation:!1,run:((f=(h=p._any)===null||h===void 0?void 0:h.run)===null||f===void 0?void 0:f.slice())||[]});l&&b.run.push(l),d&&(b.preventDefault=!0),u&&(b.stopPropagation=!0)};for(let o of t){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let d of a){let u=n[d]||(n[d]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:h}=o;for(let f in u)u[f].run.push(p=>h(p,Wp))}let l=o[e]||o.key;if(l)for(let d of a)i(d,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&i(d,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return n}let Wp=null;function k2(t,e,n,r){Wp=e;let s=sM(e),i=an(s,0),o=xr(i)==s.length&&s!=" ",a="",l=!1,d=!1,u=!1;ds&&ds.view==n&&ds.scope==r&&(a=ds.prefix+" ",d2.indexOf(e.keyCode)<0&&(d=!0,ds=null));let h=new Set,f=b=>{if(b){for(let y of b.run)if(!h.has(y)&&(h.add(y),y(n)))return b.stopPropagation&&(u=!0),!0;b.preventDefault&&(b.stopPropagation&&(u=!0),d=!0)}return!1},p=t[r],m,x;return p&&(f(p[a+Lc(s,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(fe.windows&&e.ctrlKey&&e.altKey)&&!(fe.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(m=Cs[e.keyCode])&&m!=s?(f(p[a+Lc(m,e,!0)])||e.shiftKey&&(x=Oa[e.keyCode])!=s&&x!=m&&f(p[a+Lc(x,e,!1)]))&&(l=!0):o&&e.shiftKey&&f(p[a+Lc(s,e,!0)])&&(l=!0),!l&&f(p._any)&&(l=!0)),d&&(l=!0),l&&u&&e.stopPropagation(),Wp=null,l}class ql{constructor(e,n,r,s,i){this.className=e,this.left=n,this.top=r,this.width=s,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let s=e.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let i=S2(e);return[new ql(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return UA(e,n,r)}}function S2(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Je.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function db(t,e,n,r){let s=t.coordsAtPos(e,n*2);if(!s)return r;let i=t.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,a=t.posAtCoords({x:i.left+1,y:o}),l=t.posAtCoords({x:i.right-1,y:o});return a==null||l==null?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}function UA(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),s=Math.min(n.to,t.viewport.to),i=t.textDirection==Je.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=S2(t),d=o.querySelector(".cm-line"),u=d&&window.getComputedStyle(d),h=a.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),f=a.right-(u?parseInt(u.paddingRight):0),p=$p(t,r,1),m=$p(t,s,-1),x=p.type==Bt.Text?p:null,b=m.type==Bt.Text?m:null;if(x&&(t.lineWrapping||p.widgetLineBreaks)&&(x=db(t,r,1,x)),b&&(t.lineWrapping||m.widgetLineBreaks)&&(b=db(t,s,-1,b)),x&&b&&x.from==b.from&&x.to==b.to)return k(v(n.from,n.to,x));{let C=x?v(n.from,null,x):w(p,!1),j=b?v(null,n.to,b):w(m,!0),S=[];return(x||p).to<(b||m).from-(x&&b?1:0)||p.widgetLineBreaks>1&&C.bottom+t.defaultLineHeight/2<j.top?S.push(y(h,C.bottom,f,j.top)):C.bottom<j.top&&t.elementAtHeight((C.bottom+j.top)/2).type==Bt.Text&&(C.bottom=j.top=(C.bottom+j.top)/2),k(C).concat(S).concat(k(j))}function y(C,j,S,P){return new ql(e,C-l.left,j-l.top,S-C,P-j)}function k({top:C,bottom:j,horizontal:S}){let P=[];for(let D=0;D<S.length;D+=2)P.push(y(S[D],C,S[D+1],j));return P}function v(C,j,S){let P=1e9,D=-1e9,A=[];function N(O,E,M,R,_){let $=t.coordsAtPos(O,O==S.to?-2:2),F=t.coordsAtPos(M,M==S.from?2:-2);!$||!F||(P=Math.min($.top,F.top,P),D=Math.max($.bottom,F.bottom,D),_==Je.LTR?A.push(i&&E?h:$.left,i&&R?f:F.right):A.push(!i&&R?h:F.left,!i&&E?f:$.right))}let T=C??S.from,I=j??S.to;for(let O of t.visibleRanges)if(O.to>T&&O.from<I)for(let E=Math.max(O.from,T),M=Math.min(O.to,I);;){let R=t.state.doc.lineAt(E);for(let _ of t.bidiSpans(R)){let $=_.from+R.from,F=_.to+R.from;if($>=M)break;F>E&&N(Math.max($,E),C==null&&$<=T,Math.min(F,M),j==null&&F>=I,_.dir)}if(E=R.to+1,E>=M)break}return A.length==0&&N(T,C==null,I,j==null,t.textDirection),{top:P,bottom:D,horizontal:A}}function w(C,j){let S=a.top+(j?C.top:C.bottom);return{top:S,bottom:S,horizontal:[]}}}function KA(t,e){return t.constructor==e.constructor&&t.eq(e)}class GA{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(md)!=e.state.facet(md)&&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(md);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)=>!KA(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let s of e)s.update&&n&&s.constructor&&this.drawn[r].constructor&&s.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(s.draw(),n);for(;n;){let s=n.nextSibling;n.remove(),n=s}this.drawn=e,fe.safari&&fe.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 md=pe.define();function C2(t){return[pt.define(e=>new GA(e,t)),md.of(t)]}const La=pe.define({combine(t){return Er(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function qA(t={}){return[La.of(t),YA,XA,ZA,qk.of(!0)]}function j2(t){return t.startState.facet(La)!=t.state.facet(La)}const YA=C2({above:!0,markers(t){let{state:e}=t,n=e.facet(La),r=[];for(let s of e.selection.ranges){let i=s==e.selection.main;if(s.empty||n.drawRangeCursor){let o=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=s.empty?s:q.cursor(s.head,s.head>s.anchor?-1:1);for(let l of ql.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=j2(t);return n&&ub(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){ub(e.state,t)},class:"cm-cursorLayer"});function ub(t,e){e.style.animationDuration=t.facet(La).cursorBlinkRate+"ms"}const XA=C2({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:ql.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||j2(t)},class:"cm-selectionLayer"}),ZA=hi.highest(ae.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"}}}})),N2=Me.define({map(t,e){return t==null?null:e.mapPos(t)}}),ta=zt.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(N2)?r.value:n,t)}}),QA=pt.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(ta);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(ta)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(ta),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(ta)!=t&&this.view.dispatch({effects:N2.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 JA(){return[ta,QA]}function hb(t,e,n,r,s){e.lastIndex=0;for(let i=t.iterRange(n,r),o=n,a;!i.next().done;o+=i.value.length)if(!i.lineBreak)for(;a=e.exec(i.value);)s(o+a.index,a)}function eT(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:s,to:i}of n)s=Math.max(t.state.doc.lineAt(s).from,s-e),i=Math.min(t.state.doc.lineAt(i).to,i+e),r.length&&r[r.length-1].to>=s?r[r.length-1].to=i:r.push({from:s,to:i});return r}class tT{constructor(e){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:o=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,s)this.addMatch=(a,l,d,u)=>s(u,d,d+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,d,u)=>{let h=r(a,l,d);h&&u(d,d+a[0].length,h)};else if(r)this.addMatch=(a,l,d,u)=>u(d,d+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=o}createDeco(e){let n=new Ur,r=n.add.bind(n);for(let{from:s,to:i}of eT(e,this.maxLength))hb(e.state.doc,this.regexp,s,i,(o,a)=>this.addMatch(a,e,o,r));return n.finish()}updateDeco(e,n){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,o,a,l)=>{l>=e.view.viewport.from&&a<=e.view.viewport.to&&(r=Math.min(a,r),s=Math.max(l,s))}),e.viewportMoved||s-r>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,n.map(e.changes),r,s):n}updateRange(e,n,r,s){for(let i of e.visibleRanges){let o=Math.max(i.from,r),a=Math.min(i.to,s);if(a>=o){let l=e.state.doc.lineAt(o),d=l.to<a?e.state.doc.lineAt(a):l,u=Math.max(i.from,l.from),h=Math.min(i.to,d.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){u=o;break}for(;a<d.to;a++)if(this.boundary.test(d.text[a-d.from])){h=a;break}}let f=[],p,m=(x,b,y)=>f.push(y.range(x,b));if(l==d)for(this.regexp.lastIndex=u-l.from;(p=this.regexp.exec(l.text))&&p.index<h-l.from;)this.addMatch(p,e,p.index+l.from,m);else hb(e.state.doc,this.regexp,u,h,(x,b)=>this.addMatch(b,e,x,m));n=n.update({filterFrom:u,filterTo:h,filter:(x,b)=>x<u||b>h,add:f})}}return n}}const Up=/x/.unicode!=null?"gu":"g",nT=new RegExp(`[\0-\b
|
|
269
|
+
--\u2028\u2029\uFEFF-]`,Up),rT={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 Wh=null;function sT(){var t;if(Wh==null&&typeof document<"u"&&document.body){let e=document.body.style;Wh=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Wh||!1}const gd=pe.define({combine(t){let e=Er(t,{render:null,specialChars:nT,addSpecialChars:null});return(e.replaceTabs=!sT())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Up)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Up)),e}});function iT(t={}){return[gd.of(t),oT()]}let fb=null;function oT(){return fb||(fb=pt.fromClass(class{constructor(t){this.view=t,this.decorations=je.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(gd)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new tT({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:s}=n.state,i=an(e[0],0);if(i==9){let o=s.lineAt(r),a=n.state.tabSize,l=vo(o.text,a,r-o.from);return je.replace({widget:new dT((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=je.replace({widget:new cT(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(gd);t.startState.facet(gd)!=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 aT="•";function lT(t){return t>=32?aT:t==10?"":String.fromCharCode(9216+t)}class cT extends Dr{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=lT(this.code),r=e.state.phrase("Control character")+" "+(rT[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,r,n);if(s)return s;let i=document.createElement("span");return i.textContent=n,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class dT extends Dr{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 uT(){return fT}const hT=je.line({class:"cm-activeLine"}),fT=pt.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let s=t.lineBlockAt(r.head);s.from>e&&(n.push(hT.range(s.from)),e=s.from)}return je.set(n)}},{decorations:t=>t.decorations});class pT extends Dr{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?la(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),s=Ma(n[0],r.direction!="rtl"),i=parseInt(r.lineHeight);return s.bottom-s.top>i*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+i}:s}ignoreEvent(){return!1}}function mT(t){let e=pt.fromClass(class{constructor(n){this.view=n,this.placeholder=t?je.set([je.widget({widget:new pT(t),side:1}).range(0)]):je.none}get decorations(){return this.view.state.doc.length?je.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,ae.contentAttributes.of({"aria-placeholder":t})]:e}const Kp=2e3;function gT(t,e,n){let r=Math.min(e.line,n.line),s=Math.max(e.line,n.line),i=[];if(e.off>Kp||n.off>Kp||e.col<0||n.col<0){let o=Math.min(e.off,n.off),a=Math.max(e.off,n.off);for(let l=r;l<=s;l++){let d=t.doc.line(l);d.length<=a&&i.push(q.range(d.from+o,d.to+a))}}else{let o=Math.min(e.col,n.col),a=Math.max(e.col,n.col);for(let l=r;l<=s;l++){let d=t.doc.line(l),u=jp(d.text,o,t.tabSize,!0);if(u<0)i.push(q.cursor(d.to));else{let h=jp(d.text,a,t.tabSize);i.push(q.range(d.from+u,d.from+h))}}}return i}function xT(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function pb(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),s=n-r.from,i=s>Kp?-1:s==r.length?xT(t,e.clientX):vo(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function bT(t,e){let n=pb(t,e),r=t.state.selection;return n?{update(s){if(s.docChanged){let i=s.changes.mapPos(s.startState.doc.line(n.line).from),o=s.state.doc.lineAt(i);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},r=r.map(s.changes)}},get(s,i,o){let a=pb(t,s);if(!a)return r;let l=gT(t.state,n,a);return l.length?o?q.create(l.concat(r.ranges)):q.create(l):r}}:null}function yT(t){let e=n=>n.altKey&&n.button==0;return ae.mouseSelectionStyle.of((n,r)=>e(r)?bT(n,r):null)}const vT={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},wT={style:"cursor: crosshair"};function kT(t={}){let[e,n]=vT[t.key||"Alt"],r=pt.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||n(s))},keyup(s){(s.keyCode==e||!n(s))&&this.set(!1)},mousemove(s){this.set(n(s))}}});return[r,ae.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?wT:null})]}const Rc="-10000px";class P2{constructor(e,n,r,s){this.facet=n,this.createTooltipView=r,this.removeTooltipView=s,this.input=e.state.facet(n),this.tooltips=this.input.filter(o=>o);let i=null;this.tooltipViews=this.tooltips.map(o=>i=r(o,i))}update(e,n){var r;let s=e.state.facet(this.facet),i=s.filter(l=>l);if(s===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],a=n?[]:null;for(let l=0;l<i.length;l++){let d=i[l],u=-1;if(d){for(let h=0;h<this.tooltips.length;h++){let f=this.tooltips[h];f&&f.create==d.create&&(u=h)}if(u<0)o[l]=this.createTooltipView(d,l?o[l-1]:null),a&&(a[l]=!!d.above);else{let h=o[l]=this.tooltipViews[u];a&&(a[l]=n[u]),h.update&&h.update(e)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(r=l.destroy)===null||r===void 0||r.call(l));return n&&(a.forEach((l,d)=>n[d]=l),n.length=a.length),this.input=s,this.tooltips=i,this.tooltipViews=o,!0}}function ST(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Uh=pe.define({combine:t=>{var e,n,r;return{position:fe.ios?"absolute":((e=t.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(s=>s.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(s=>s.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||ST}}}),mb=new WeakMap,hg=pt.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(Uh);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 P2(t,fg,(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(Uh);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",n.dom.appendChild(s)}return n.dom.style.position=this.position,n.dom.style.top=Rc,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(fe.safari){let o=i.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(t=i.width/this.parent.offsetWidth,e=i.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=lg(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(Uh).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=t,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],d=this.manager.tooltipViews[a],{dom:u}=d,h=t.pos[a],f=t.size[a];if(!h||l.clip!==!1&&(h.bottom<=Math.max(n.top,r.top)||h.top>=Math.min(n.bottom,r.bottom)||h.right<Math.max(n.left,r.left)-.1||h.left>Math.min(n.right,r.right)+.1)){u.style.top=Rc;continue}let p=l.arrow?d.dom.querySelector(".cm-tooltip-arrow"):null,m=p?7:0,x=f.right-f.left,b=(e=mb.get(d))!==null&&e!==void 0?e:f.bottom-f.top,y=d.offset||jT,k=this.view.textDirection==Je.LTR,v=f.width>r.right-r.left?k?r.left:r.right-f.width:k?Math.max(r.left,Math.min(h.left-(p?14:0)+y.x,r.right-x)):Math.min(Math.max(r.left,h.left-x+(p?14:0)-y.x),r.right-x),w=this.above[a];!l.strictSide&&(w?h.top-b-m-y.y<r.top:h.bottom+b+m+y.y>r.bottom)&&w==r.bottom-h.bottom>h.top-r.top&&(w=this.above[a]=!w);let C=(w?h.top-r.top:r.bottom-h.bottom)-m;if(C<b&&d.resize!==!1){if(C<this.view.defaultLineHeight){u.style.top=Rc;continue}mb.set(d,b),u.style.height=(b=C)/i+"px"}else u.style.height&&(u.style.height="");let j=w?h.top-b-m-y.y:h.bottom+m+y.y,S=v+x;if(d.overlap!==!0)for(let P of o)P.left<S&&P.right>v&&P.top<j+b&&P.bottom>j&&(j=w?P.top-b-2-m:P.bottom+m+2);if(this.position=="absolute"?(u.style.top=(j-t.parent.top)/i+"px",gb(u,(v-t.parent.left)/s)):(u.style.top=j/i+"px",gb(u,v/s)),p){let P=h.left+(k?y.x:-y.x)-(v+14-7);p.style.left=P/s+"px"}d.overlap!==!0&&o.push({left:v,top:j,right:S,bottom:j+b}),u.classList.toggle("cm-tooltip-above",w),u.classList.toggle("cm-tooltip-below",!w),d.positioned&&d.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Rc}},{eventObservers:{scroll(){this.maybeMeasure()}}});function gb(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const CT=ae.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"}}}),jT={x:0,y:0},fg=pe.define({enables:[hg,CT]}),Yd=pe.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Wu{static create(e){return new Wu(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new P2(e,Yd,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let s=r[e];if(s!==void 0){if(n===void 0)n=s;else if(n!==s)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const NT=fg.compute([Yd],t=>{let e=t.facet(Yd);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:Wu.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class PT{constructor(e,n,r,s,i){this.view=e,this.source=n,this.field=r,this.setHover=s,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:n}=this,r=e.docView.tile.nearest(n.target);if(!r)return;let s,i=1;if(r.isWidget())s=r.posAtStart;else{if(s=e.posAtCoords(n),s==null)return;let a=e.coordsAtPos(s);if(!a||n.y<a.top||n.y>a.bottom||n.x<a.left-e.defaultCharacterWidth||n.x>a.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(s)).find(u=>u.from<=s&&u.to>=s),d=l&&l.dir==Je.RTL?-1:1;i=n.x<a.left?-d:d}let o=this.source(e,s,i);if(o?.then){let a=this.pending={pos:s};o.then(l=>{this.pending==a&&(this.pending=null,l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])}))},l=>dn(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(hg),n=e?e.manager.tooltips.findIndex(r=>r.create==Wu.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:i}=this;if(s.length&&i&&!OT(i.dom,e)||this.pending){let{pos:o}=s[0]||this.pending,a=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!ET(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 _c=4;function OT(t,e){let{left:n,right:r,top:s,bottom:i}=t.getBoundingClientRect(),o;if(o=t.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();s=Math.min(a.top,s),i=Math.max(a.bottom,i)}return e.clientX>=n-_c&&e.clientX<=r+_c&&e.clientY>=s-_c&&e.clientY<=i+_c}function ET(t,e,n,r,s,i){let o=t.scrollDOM.getBoundingClientRect(),a=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>r||o.right<r||o.top>s||Math.min(o.bottom,a)<s)return!1;let l=t.posAtCoords({x:r,y:s},!1);return l>=e&&l<=n}function DT(t,e={}){let n=Me.define(),r=zt.define({create(){return[]},update(s,i){if(s.length&&(e.hideOnChange&&(i.docChanged||i.selection)?s=[]:e.hideOn&&(s=s.filter(o=>!e.hideOn(i,o))),i.docChanged)){let o=[];for(let a of s){let l=i.changes.mapPos(a.pos,-1,Zt.TrackDel);if(l!=null){let d=Object.assign(Object.create(null),a);d.pos=l,d.end!=null&&(d.end=i.changes.mapPos(d.end)),o.push(d)}}s=o}for(let o of i.effects)o.is(n)&&(s=o.value),o.is(MT)&&(s=[]);return s},provide:s=>Yd.from(s)});return{active:r,extension:[r,pt.define(s=>new PT(s,t,r,n,e.hoverTime||300)),NT]}}function O2(t,e){let n=t.plugin(hg);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const MT=Me.define(),xb=pe.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 Ra(t,e){let n=t.plugin(E2),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const E2=pt.fromClass(class{constructor(t){this.input=t.state.facet(_a),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(xb);this.top=new Ic(t,!0,e.topContainer),this.bottom=new Ic(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(xb);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ic(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ic(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(_a);if(n!=this.input){let r=n.filter(l=>l),s=[],i=[],o=[],a=[];for(let l of r){let d=this.specs.indexOf(l),u;d<0?(u=l(t.view),a.push(u)):(u=this.panels[d],u.update&&u.update(t)),s.push(u),(u.top?i:o).push(u)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>ae.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Ic{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=bb(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=bb(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 bb(t){let e=t.nextSibling;return t.remove(),e}const _a=pe.define({enables:E2});class Gr extends ks{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Gr.prototype.elementClass="";Gr.prototype.toDOM=void 0;Gr.prototype.mapMode=Zt.TrackBefore;Gr.prototype.startSide=Gr.prototype.endSide=-1;Gr.prototype.point=!0;const xd=pe.define(),AT=pe.define(),TT={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ie.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},ua=pe.define();function LT(t){return[D2(),ua.of({...TT,...t})]}const yb=pe.define({combine:t=>t.some(e=>e)});function D2(t){return[RT]}const RT=pt.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(ua).map(e=>new wb(t,e)),this.fixed=!t.state.facet(yb);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(yb)!=!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=Ie.iter(this.view.state.facet(xd),this.view.viewport.from),r=[],s=this.gutters.map(i=>new _T(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let o=!0;for(let a of i.type)if(a.type==Bt.Text&&o){Gp(n,r,a.from);for(let l of s)l.line(this.view,a,r);o=!1}else if(a.widget)for(let l of s)l.widget(this.view,a)}else if(i.type==Bt.Text){Gp(n,r,i.from);for(let o of s)o.line(this.view,i,r)}else if(i.widget)for(let o of s)o.widget(this.view,i);for(let i of s)i.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(ua),n=t.state.facet(ua),r=t.docChanged||t.heightChanged||t.viewportChanged||!Ie.eq(t.startState.facet(xd),t.state.facet(xd),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let s of this.gutters)s.update(t)&&(r=!0);else{r=!0;let s=[];for(let i of n){let o=e.indexOf(i);o<0?s.push(new wb(this.view,i)):(this.gutters[o].update(t),s.push(this.gutters[o]))}for(let i of this.gutters)i.dom.remove(),s.indexOf(i)<0&&i.destroy();for(let i of s)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=s}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>ae.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,s=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Je.LTR?{left:r,right:s}:{right:r,left:s}})});function vb(t){return Array.isArray(t)?t:[t]}function Gp(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class _T{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=Ie.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:s}=this,i=(n.top-this.height)/e.scaleY,o=n.height/e.scaleY;if(this.i==s.elements.length){let a=new M2(e,o,i,r);s.elements.push(a),s.dom.appendChild(a.dom)}else s.elements[this.i].update(e,o,i,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];Gp(this.cursor,s,n.from),r.length&&(s=s.concat(r));let i=this.gutter.config.lineMarker(e,n,s);i&&s.unshift(i);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,n,s)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),s=r?[r]:null;for(let i of e.state.facet(AT)){let o=i(e,n.widget,n);o&&(s||(s=[])).push(o)}s&&this.addElement(e,n,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class wb{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,s=>{let i=s.target,o;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let l=i.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=s.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);n.domEventHandlers[r](e,a,s)&&s.preventDefault()});this.markers=vb(n.markers(e)),n.initialSpacer&&(this.spacer=new M2(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=vb(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let r=e.view.viewport;return!Ie.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 M2{constructor(e,n,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,s)}update(e,n,r,s){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),IT(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let i=0,o=0;;){let a=o,l=i<n.length?n[i++]:null,d=!1;if(l){let u=l.elementClass;u&&(r+=" "+u);for(let h=o;h<this.markers.length;h++)if(this.markers[h].compare(l)){a=h,d=!0;break}}else a=this.markers.length;for(;o<a;){let u=this.markers[o++];if(u.toDOM){u.destroy(s);let h=s.nextSibling;s.remove(),s=h}}if(!l)break;l.toDOM&&(d?s=s.nextSibling:this.dom.insertBefore(l.toDOM(e),s)),d&&o++}this.dom.className=r,this.markers=n}destroy(){this.setMarkers(null,[])}}function IT(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 $T=pe.define(),BT=pe.define(),Ei=pe.define({combine(t){return Er(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,n){let r=Object.assign({},e);for(let s in n){let i=r[s],o=n[s];r[s]=i?(a,l,d)=>i(a,l,d)||o(a,l,d):o}return r}})}});class Kh extends Gr{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Gh(t,e){return t.state.facet(Ei).formatNumber(e,t.state)}const FT=ua.compute([Ei],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet($T)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new Kh(Gh(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(BT)){let i=s(e,n,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Ei)!=e.state.facet(Ei),initialSpacer(e){return new Kh(Gh(e,kb(e.state.doc.lines)))},updateSpacer(e,n){let r=Gh(n.view,kb(n.view.state.doc.lines));return r==e.number?e:new Kh(r)},domEventHandlers:t.facet(Ei).domEventHandlers,side:"before"}));function zT(t={}){return[Ei.of(t),D2(),FT]}function kb(t){let e=9;for(;e<t;)e=e*10+9;return e}const VT=new class extends Gr{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},HT=xd.compute(["selection"],t=>{let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.head).from;s>n&&(n=s,e.push(VT.range(s)))}return Ie.of(e)});function WT(){return HT}var qh;const Di=new _e;function UT(t){return pe.define({combine:t?e=>e.concat(t):void 0})}const KT=new _e;class Zn{constructor(e,n,r=[],s=""){this.data=e,this.name=s,Fe.prototype.hasOwnProperty("tree")||Object.defineProperty(Fe.prototype,"tree",{get(){return Kt(this)}}),this.parser=n,this.extension=[Ns.of(this),Fe.languageData.of((i,o,a)=>{let l=Sb(i,o,a),d=l.type.prop(Di);if(!d)return[];let u=i.facet(d),h=l.type.prop(KT);if(h){let f=l.resolve(o-l.from,a);for(let p of h)if(p.test(f,i)){let m=i.facet(p.facet);return p.type=="replace"?m:m.concat(u)}}return u})].concat(r)}isActiveAt(e,n,r=-1){return Sb(e,n,r).type.prop(Di)==this.data}findRegions(e){let n=e.facet(Ns);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,o)=>{if(i.prop(Di)==this.data){r.push({from:o,to:o+i.length});return}let a=i.prop(_e.mounted);if(a){if(a.tree.prop(Di)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+o,to:l.to+o});else r.push({from:o,to:o+i.length});return}else if(a.overlay){let l=r.length;if(s(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;l<i.children.length;l++){let d=i.children[l];d instanceof ft&&s(d,i.positions[l]+o)}};return s(Kt(e),0),r}get allowsNesting(){return!0}}Zn.setState=Me.define();function Sb(t,e,n){let r=t.facet(Ns),s=Kt(t).topNode;if(!r||r.allowsNesting)for(let i=s;i;i=i.enter(e,n,dt.ExcludeBuffers|dt.EnterBracketed))i.type.isTop&&(s=i);return s}class Xd extends Zn{constructor(e,n,r){super(e,n,[],r),this.parser=n}static define(e){let n=UT(e.languageData);return new Xd(n,e.parser.configure({props:[Di.add(r=>r.isTop?n:void 0)]}),e.name)}configure(e,n){return new Xd(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Kt(t){let e=t.field(Zn.state,!1);return e?e.tree:ft.empty}class GT{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 Vo=null;class Zd{constructor(e,n,r=[],s,i,o,a,l){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new Zd(e,n,[],ft.empty,0,r,[],null)}startParse(){return this.parser.startParse(new GT(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=ft.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(Zs.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=s,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(Zs.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=Vo;Vo=this;try{return e()}finally{Vo=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=Cb(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:i,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((d,u,h,f)=>l.push({fromA:d,toA:u,fromB:h,toB:f})),r=Zs.applyChanges(r,l),s=ft.empty,i=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let d of this.skipped){let u=e.mapPos(d.from,1),h=e.mapPos(d.to,-1);u<h&&a.push({from:u,to:h})}}}return new Zd(this.parser,n,r,s,i,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let n=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:s,to:i}=this.skipped[r];s<e.to&&i>e.from&&(this.fragments=Cb(this.fragments,s,i),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends ok{createParse(n,r,s){let i=s[0].from,o=s[s.length-1].to;return{parsedPos:i,advance(){let l=Vo;if(l){for(let d of s)l.tempSkipped.push(d);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new ft(fn.none,[],[],o-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return Vo}}function Cb(t,e,n){return Zs.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class io{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 io(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=Zd.create(e.facet(Ns).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new io(r)}}Zn.state=zt.define({create:io.init,update(t,e){for(let n of e.effects)if(n.is(Zn.setState))return n.value;return e.startState.facet(Ns)!=e.state.facet(Ns)?io.init(e.state):t.apply(e)}});let A2=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(A2=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Yh=typeof navigator<"u"&&(!((qh=navigator.scheduling)===null||qh===void 0)&&qh.isInputPending)?()=>navigator.scheduling.isInputPending():null,qT=pt.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(Zn.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(Zn.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=A2(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:s}}=this.view,i=r.field(Zn.state);if(i.tree==i.context.tree&&i.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Yh?Math.max(25,e.timeRemaining()-5):1e9),a=i.context.treeLen<s&&r.doc.length>s+1e3,l=i.context.work(()=>Yh&&Yh()||Date.now()>o,s+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Zn.setState.of(new io(i.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>dn(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()}}}),Ns=pe.define({combine(t){return t.length?t[0]:null},enables:t=>[Zn.state,qT,ae.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class YT{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const XT=pe.define(),Uu=pe.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 Qd(t){let e=t.facet(Uu);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Ia(t,e){let n="",r=t.tabSize,s=t.facet(Uu)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let i=0;i<e;i++)n+=s;return n}function pg(t,e){t instanceof Fe&&(t=new Ku(t));for(let r of t.state.facet(XT)){let s=r(t,e);if(s!==void 0)return s}let n=Kt(t.state);return n.length>=e?ZT(t,n,e):null}class Ku{constructor(e,n={}){this.state=e,this.options=n,this.unit=Qd(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==e?{text:"",from:e}:(n<0?s<e:s<=e)?{text:r.text.slice(s-r.from),from:s}:{text:r.text.slice(0,s-r.from),from:r.from}:r}textAfterPos(e,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:s}=this.lineAt(e,n);return r.slice(e-s,Math.min(r.length,e+100-s))}column(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.countColumn(r,e-s),o=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return o>-1&&(i+=o-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return vo(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.options.overrideIndentation;if(i){let o=i(s);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const T2=new _e;function ZT(t,e,n){let r=e.resolveStack(n),s=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let o=s;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)i.push(o);for(let o=i.length-1;o>=0;o--)r={node:i[o],next:r}}return L2(r,t,n)}function L2(t,e,n){for(let r=t;r;r=r.next){let s=JT(r.node);if(s)return s(mg.create(e,n,r))}return 0}function QT(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function JT(t){let e=t.type.prop(T2);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(_e.closedBy))){let s=t.lastChild,i=s&&r.indexOf(s.name)>-1;return o=>r6(o,!0,1,void 0,i&&!QT(o)?s.from:void 0)}return t.parent==null?e6:null}function e6(){return 0}class mg extends Ku{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 mg(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(t6(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return L2(this.context.next,this.base,this.pos)}}function t6(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function n6(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let s=t.options.simulateBreak,i=t.state.doc.lineAt(n.from),o=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let a=n.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let d=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+d}}a=l.to}}function r6(t,e,n,r,s){let i=t.textAfter,o=i.match(/^\s*/)[0].length,a=r&&i.slice(o,o+r.length)==r||s==t.pos+o,l=n6(t);return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*n)}function jb({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const s6=200;function i6(){return Fe.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,s=n.lineAt(r);if(r>s.from+s6)return t;let i=n.sliceString(s.from,r);if(!e.some(d=>d.test(i)))return t;let{state:o}=t,a=-1,l=[];for(let{head:d}of o.selection.ranges){let u=o.doc.lineAt(d);if(u.from==a)continue;a=u.from;let h=pg(o,u.from);if(h==null)continue;let f=/^\s*/.exec(u.text)[0],p=Ia(o,h);f!=p&&l.push({from:u.from,to:u.from+f.length,insert:p})}return l.length?[t,{changes:l,sequential:!0}]:t})}const o6=pe.define(),R2=new _e;function a6(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 l6(t,e,n){let r=Kt(t);if(r.length<n)return null;let s=r.resolveStack(n,1),i=null;for(let o=s;o;o=o.next){let a=o.node;if(a.to<=n||a.from>n)continue;if(i&&a.from<e)break;let l=a.type.prop(R2);if(l&&(a.to<r.length-50||r.length==t.doc.length||!c6(a))){let d=l(a,t);d&&d.from<=n&&d.from>=e&&d.to>n&&(i=d)}}return i}function c6(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function Jd(t,e,n){for(let r of t.facet(o6)){let s=r(t,e,n);if(s)return s}return l6(t,e,n)}function _2(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 Gu=Me.define({map:_2}),Yl=Me.define({map:_2});function I2(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 si=zt.define({create(){return je.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=Nb(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(Gu)&&!d6(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(F2),s=r?je.replace({widget:new x6(r(e.state,n.value))}):Pb;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(Yl)&&(t=t.update({filter:(r,s)=>n.value.from!=r||n.value.to!=s,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=Nb(t,e.selection.main.head)),t},provide:t=>ae.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,s)=>{n.push(r,s)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n<t.length;){let r=t[n++],s=t[n++];if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid JSON for fold state");e.push(Pb.range(r,s))}return je.set(e,!0)}});function Nb(t,e,n=e){let r=!1;return t.between(e,n,(s,i)=>{s<n&&i>e&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(s,i)=>s>=n||i<=e}):t}function eu(t,e,n){var r;let s=null;return(r=t.field(si,!1))===null||r===void 0||r.between(e,n,(i,o)=>{(!s||s.from>i)&&(s={from:i,to:o})}),s}function d6(t,e,n){let r=!1;return t.between(e,e,(s,i)=>{s==e&&i==n&&(r=!0)}),r}function $2(t,e){return t.field(si,!1)?e:e.concat(Me.appendConfig.of(z2()))}const u6=t=>{for(let e of I2(t)){let n=Jd(t.state,e.from,e.to);if(n)return t.dispatch({effects:$2(t.state,[Gu.of(n),B2(t,n)])}),!0}return!1},h6=t=>{if(!t.state.field(si,!1))return!1;let e=[];for(let n of I2(t)){let r=eu(t.state,n.from,n.to);r&&e.push(Yl.of(r),B2(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function B2(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return ae.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const f6=t=>{let{state:e}=t,n=[];for(let r=0;r<e.doc.length;){let s=t.lineBlockAt(r),i=Jd(e,s.from,s.to);i&&n.push(Gu.of(i)),r=(i?t.lineBlockAt(i.to):s).to+1}return n.length&&t.dispatch({effects:$2(t.state,n)}),!!n.length},p6=t=>{let e=t.state.field(si,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,s)=>{n.push(Yl.of({from:r,to:s}))}),t.dispatch({effects:n}),!0},m6=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:u6},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:h6},{key:"Ctrl-Alt-[",run:f6},{key:"Ctrl-Alt-]",run:p6}],g6={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},F2=pe.define({combine(t){return Er(t,g6)}});function z2(t){return[si,v6]}function V2(t,e){let{state:n}=t,r=n.facet(F2),s=o=>{let a=t.lineBlockAt(t.posAtDOM(o.target)),l=eu(t.state,a.from,a.to);l&&t.dispatch({effects:Yl.of(l)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,s,e);let i=document.createElement("span");return i.textContent=r.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=s,i}const Pb=je.replace({widget:new class extends Dr{toDOM(t){return V2(t,null)}}});class x6 extends Dr{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return V2(e,this.value)}}const b6={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Xh extends Gr{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 y6(t={}){let e={...b6,...t},n=new Xh(e,!0),r=new Xh(e,!1),s=pt.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Ns)!=o.state.facet(Ns)||o.startState.field(si,!1)!=o.state.field(si,!1)||Kt(o.startState)!=Kt(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Ur;for(let l of o.viewportLineBlocks){let d=eu(o.state,l.from,l.to)?r:Jd(o.state,l.from,l.to)?n:null;d&&a.add(l.from,l.from,d)}return a.finish()}}),{domEventHandlers:i}=e;return[s,LT({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(s))===null||a===void 0?void 0:a.markers)||Ie.empty},initialSpacer(){return new Xh(e,!1)},domEventHandlers:{...i,click:(o,a,l)=>{if(i.click&&i.click(o,a,l))return!0;let d=eu(o.state,a.from,a.to);if(d)return o.dispatch({effects:Yl.of(d)}),!0;let u=Jd(o.state,a.from,a.to);return u?(o.dispatch({effects:Gu.of(u)}),!0):!1}}}),z2()]}const v6=ae.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 wo{constructor(e,n){this.specs=e;let r;function s(a){let l=Ss.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,o=n.scope;this.scope=o instanceof Zn?a=>a.prop(Di)==o.data:o?a=>a==o:void 0,this.style=ck(e.map(a=>({tag:a.tag,class:a.class||s(Object.assign({},a,{tag:null}))})),{all:i}).style,this.module=r?new Ss(r):null,this.themeType=n.themeType}static define(e,n){return new wo(e,n||{})}}const qp=pe.define(),H2=pe.define({combine(t){return t.length?[t[0]]:null}});function Zh(t){let e=t.facet(qp);return e.length?e:t.facet(H2)}function gg(t,e){let n=[k6],r;return t instanceof wo&&(t.module&&n.push(ae.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(H2.of(t)):r?n.push(qp.computeN([ae.darkTheme],s=>s.facet(ae.darkTheme)==(r=="dark")?[t]:[])):n.push(qp.of(t)),n}class w6{constructor(e){this.markCache=Object.create(null),this.tree=Kt(e.state),this.decorations=this.buildDeco(e,Zh(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=Kt(e.state),r=Zh(e.state),s=r!=Zh(e.startState),{viewport:i}=e.view,o=e.changes.mapPos(this.decoratedTo,1);n.length<i.to&&!s&&n.type==this.tree.type&&o>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(n!=this.tree||e.viewportChanged||s)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return je.none;let r=new Ur;for(let{from:s,to:i}of e.visibleRanges)MD(this.tree,n,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=je.mark({class:l})))},s,i);return r.finish()}}const k6=hi.high(pt.fromClass(w6,{decorations:t=>t.decorations})),S6=wo.define([{tag:W.meta,color:"#404740"},{tag:W.link,textDecoration:"underline"},{tag:W.heading,textDecoration:"underline",fontWeight:"bold"},{tag:W.emphasis,fontStyle:"italic"},{tag:W.strong,fontWeight:"bold"},{tag:W.strikethrough,textDecoration:"line-through"},{tag:W.keyword,color:"#708"},{tag:[W.atom,W.bool,W.url,W.contentSeparator,W.labelName],color:"#219"},{tag:[W.literal,W.inserted],color:"#164"},{tag:[W.string,W.deleted],color:"#a11"},{tag:[W.regexp,W.escape,W.special(W.string)],color:"#e40"},{tag:W.definition(W.variableName),color:"#00f"},{tag:W.local(W.variableName),color:"#30a"},{tag:[W.typeName,W.namespace],color:"#085"},{tag:W.className,color:"#167"},{tag:[W.special(W.variableName),W.macroName],color:"#256"},{tag:W.definition(W.propertyName),color:"#00c"},{tag:W.comment,color:"#940"},{tag:W.invalid,color:"#f00"}]),C6=ae.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),W2=1e4,U2="()[]{}",K2=pe.define({combine(t){return Er(t,{afterCursor:!0,brackets:U2,maxScanDistance:W2,renderMatch:P6})}}),j6=je.mark({class:"cm-matchingBracket"}),N6=je.mark({class:"cm-nonmatchingBracket"});function P6(t){let e=[],n=t.matched?j6:N6;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 O6=zt.define({create(){return je.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(K2);for(let s of e.state.selection.ranges){if(!s.empty)continue;let i=yr(e.state,s.head,-1,r)||s.head>0&&yr(e.state,s.head-1,1,r)||r.afterCursor&&(yr(e.state,s.head,1,r)||s.head<e.state.doc.length&&yr(e.state,s.head+1,-1,r));i&&(n=n.concat(r.renderMatch(i,e.state)))}return je.set(n,!0)},provide:t=>ae.decorations.from(t)}),E6=[O6,C6];function D6(t={}){return[K2.of(t),E6]}const M6=new _e;function Yp(t,e,n){let r=t.prop(e<0?_e.openedBy:_e.closedBy);if(r)return r;if(t.name.length==1){let s=n.indexOf(t.name);if(s>-1&&s%2==(e<0?1:0))return[n[s+e]]}return null}function Xp(t){let e=t.type.prop(M6);return e?e(t.node):t}function yr(t,e,n,r={}){let s=r.maxScanDistance||W2,i=r.brackets||U2,o=Kt(t),a=o.resolveInner(e,n);for(let l=a;l;l=l.parent){let d=Yp(l.type,n,i);if(d&&l.from<l.to){let u=Xp(l);if(u&&(n>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return A6(t,e,n,l,u,d,i)}}return T6(t,e,n,o,a.type,s,i)}function A6(t,e,n,r,s,i,o){let a=r.parent,l={from:s.from,to:s.to},d=0,u=a?.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(d==0&&i.indexOf(u.type.name)>-1&&u.from<u.to){let h=Xp(u);return{start:l,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(Yp(u.type,n,o))d++;else if(Yp(u.type,-n,o)){if(d==0){let h=Xp(u);return{start:l,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}d--}}while(n<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}function T6(t,e,n,r,s,i,o){let a=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=n>0)return null;let d={from:n<0?e-1:e,to:n>0?e+1:e},u=t.doc.iterRange(e,n>0?t.doc.length:0),h=0;for(let f=0;!u.next().done&&f<=i;){let p=u.value;n<0&&(f+=p.length);let m=e+f*n;for(let x=n>0?0:p.length-1,b=n>0?p.length:-1;x!=b;x+=n){let y=o.indexOf(p[x]);if(!(y<0||r.resolveInner(m+x,1).type!=s))if(y%2==0==n>0)h++;else{if(h==1)return{start:d,end:{from:m+x,to:m+x+1},matched:y>>1==l>>1};h--}}n>0&&(f+=p.length)}return u.done?{start:d,matched:!1}:null}const L6=Object.create(null),Ob=[fn.none],Eb=[],Db=Object.create(null),R6=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"]])R6[t]=_6(L6,e);function Qh(t,e){Eb.indexOf(t)>-1||(Eb.push(t),console.warn(e))}function _6(t,e){let n=[];for(let a of e.split(" ")){let l=[];for(let d of a.split(".")){let u=t[d]||W[d];u?typeof u=="function"?l.length?l=l.map(u):Qh(d,`Modifier ${d} used at start of tag`):l.length?Qh(d,`Tag ${d} used as modifier`):l=Array.isArray(u)?u:[u]:Qh(d,`Unknown highlighting tag ${d}`)}for(let d of l)n.push(d)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(a=>a.id),i=Db[s];if(i)return i.id;let o=Db[s]=fn.define({id:Ob.length,name:r,props:[ak({[r]:n})]});return Ob.push(o),o.id}Je.RTL,Je.LTR;const I6=Xd.define({name:"json",parser:RD.configure({props:[T2.add({Object:jb({except:/^\s*\}/}),Array:jb({except:/^\s*\]/})}),R2.add({"Object Array":a6})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function $6(){return new YT(I6)}function Zp(){return Zp=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},Zp.apply(null,arguments)}function B6(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 F6=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=bg(t.state,n.from);return r.line?z6(t):r.block?H6(t):!1};function xg(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=t(e,n);return s?(r(n.update(s)),!0):!1}}const z6=xg(K6,0),V6=xg(G2,0),H6=xg((t,e)=>G2(t,e,U6(e)),0);function bg(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Ho=50;function W6(t,{open:e,close:n},r,s){let i=t.sliceDoc(r-Ho,r),o=t.sliceDoc(s,s+Ho),a=/\s*$/.exec(i)[0].length,l=/^\s*/.exec(o)[0].length,d=i.length-a;if(i.slice(d-e.length,d)==e&&o.slice(l,l+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:s+l,margin:l&&1}};let u,h;s-r<=2*Ho?u=h=t.sliceDoc(r,s):(u=t.sliceDoc(r,r+Ho),h=t.sliceDoc(s-Ho,s));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(h)[0].length,m=h.length-p-n.length;return u.slice(f,f+e.length)==e&&h.slice(m,m+n.length)==n?{open:{pos:r+f+e.length,margin:/\s/.test(u.charAt(f+e.length))?1:0},close:{pos:s-p-n.length,margin:/\s/.test(h.charAt(m-1))?1:0}}:null}function U6(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),s=n.to<=r.to?r:t.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let i=e.length-1;i>=0&&e[i].to>r.from?e[i].to=s.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return e}function G2(t,e,n=e.selection.ranges){let r=n.map(i=>bg(e,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,o)=>W6(e,r[o],i.from,i.to));if(t!=2&&!s.every(i=>i))return{changes:e.changes(n.map((i,o)=>s[o]?[]:[{from:i.from,insert:r[o].open+" "},{from:i.to,insert:" "+r[o].close}]))};if(t!=1&&s.some(i=>i)){let i=[];for(let o=0,a;o<s.length;o++)if(a=s[o]){let l=r[o],{open:d,close:u}=a;i.push({from:d.pos-l.open.length,to:d.pos+d.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:i}}return null}function K6(t,e,n=e.selection.ranges){let r=[],s=-1;for(let{from:i,to:o}of n){let a=r.length,l=1e9,d=bg(e,i).line;if(d){for(let u=i;u<=o;){let h=e.doc.lineAt(u);if(h.from>s&&(i==o||o>h.from)){s=h.from;let f=/^\s*/.exec(h.text)[0].length,p=f==h.length,m=h.text.slice(f,f+d.length)==d?f:-1;f<h.text.length&&f<l&&(l=f),r.push({line:h,comment:m,token:d,indent:f,empty:p,single:!1})}u=h.to+1}if(l<1e9)for(let u=a;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=l);r.length==a+1&&(r[a].single=!0)}}if(t!=2&&r.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:a,token:l,indent:d,empty:u,single:h}of r)(h||!u)&&i.push({from:a.from+d,insert:l+" "});let o=e.changes(i);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let d=o.from+a,u=d+l.length;o.text[u-o.from]==" "&&u++,i.push({from:d,to:u})}return{changes:i}}return null}const Qp=Or.define(),G6=Or.define(),q6=pe.define(),q2=pe.define({combine(t){return Er(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,s)=>e(r,s)||n(r,s)})}}),Y2=zt.define({create(){return vr.empty},update(t,e){let n=e.state.facet(q2),r=e.annotation(Qp);if(r){let l=un.fromTransaction(e,r.selection),d=r.side,u=d==0?t.undone:t.done;return l?u=tu(u,u.length,n.minDepth,l):u=Q2(u,e.startState.selection),new vr(d==0?r.rest:u,d==0?u:r.rest)}let s=e.annotation(G6);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(jt.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=un.fromTransaction(e),o=e.annotation(jt.time),a=e.annotation(jt.userEvent);return i?t=t.addChanges(i,o,a,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,n.newGroupDelay)),(s=="full"||s=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new vr(t.done.map(un.fromJSON),t.undone.map(un.fromJSON))}});function Y6(t={}){return[Y2,q2.of(t),ae.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?X2:e.inputType=="historyRedo"?Jp:null;return r?(e.preventDefault(),r(n)):!1}})]}function qu(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(Y2,!1);if(!s)return!1;let i=s.pop(t,n,e);return i?(r(i),!0):!1}}const X2=qu(0,!1),Jp=qu(1,!1),X6=qu(0,!0),Z6=qu(1,!0);class un{constructor(e,n,r,s,i){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=i}setSelAfter(e){return new un(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new un(e.changes&&kt.fromJSON(e.changes),[],e.mapped&&Sr.fromJSON(e.mapped),e.startSelection&&q.fromJSON(e.startSelection),e.selectionsAfter.map(q.fromJSON))}static fromTransaction(e,n){let r=Ln;for(let s of e.startState.facet(q6)){let i=s(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new un(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,Ln)}static selection(e){return new un(void 0,Ln,void 0,void 0,e)}}function tu(t,e,n,r){let s=e+1>n+20?e-n-1:0,i=t.slice(s,e);return i.push(r),i}function Q6(t,e){let n=[],r=!1;return t.iterChangedRanges((s,i)=>n.push(s,i)),e.iterChangedRanges((s,i,o,a)=>{for(let l=0;l<n.length;){let d=n[l++],u=n[l++];a>=d&&o<=u&&(r=!0)}}),r}function J6(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function Z2(t,e){return t.length?e.length?t.concat(e):t:e}const Ln=[],eL=200;function Q2(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-eL));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),tu(t,t.length-1,1e9,n.setSelAfter(r)))}else return[un.selection([e])]}function tL(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 Jh(t,e){if(!t.length)return t;let n=t.length,r=Ln;for(;n;){let s=nL(t[n-1],e,r);if(s.changes&&!s.changes.empty||s.effects.length){let i=t.slice(0,n);return i[n-1]=s,i}else e=s.mapped,n--,r=s.selectionsAfter}return r.length?[un.selection(r)]:Ln}function nL(t,e,n){let r=Z2(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):Ln,n);if(!t.changes)return un.selection(r);let s=t.changes.map(e),i=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(i):i;return new un(s,Me.mapEffects(t.effects,e),o,t.startSelection.map(i),r)}const rL=/^(input\.type|delete)($|\.)/;class vr{constructor(e,n,r=0,s=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new vr(this.done,this.undone):this}addChanges(e,n,r,s,i){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||rL.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(i,Q6(a.changes,e.changes))||r=="input.type.compose")?o=tu(o,o.length-1,s.minDepth,new un(e.changes.compose(a.changes),Z2(Me.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,Ln)):o=tu(o,o.length,s.minDepth,e),new vr(o,Ln,n,r)}addSelection(e,n,r,s){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:Ln;return i.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&J6(i[i.length-1],e)?this:new vr(Q2(this.done,e),this.undone,n,r)}addMapping(e){return new vr(Jh(this.done,e),Jh(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,r){let s=e==0?this.done:this.undone;if(s.length==0)return null;let i=s[s.length-1],o=i.selectionsAfter[0]||n.selection;if(r&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:Qp.of({side:e,rest:tL(s),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let a=s.length==1?Ln:s.slice(0,s.length-1);return i.mapped&&(a=Jh(a,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:Qp.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}vr.empty=new vr(Ln,Ln);const sL=[{key:"Mod-z",run:X2,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Jp,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Jp,preventDefault:!0},{key:"Mod-u",run:X6,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Z6,preventDefault:!0}];function ko(t,e){return q.create(t.ranges.map(e),t.mainIndex)}function ir(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function or({state:t,dispatch:e},n){let r=ko(t.selection,n);return r.eq(t.selection,!0)?!1:(e(ir(t,r)),!0)}function Yu(t,e){return q.cursor(e?t.to:t.from)}function J2(t,e){return or(t,n=>n.empty?t.moveByChar(n,e):Yu(n,e))}function Gt(t){return t.textDirectionAt(t.state.selection.main.head)==Je.LTR}const eS=t=>J2(t,!Gt(t)),tS=t=>J2(t,Gt(t));function nS(t,e){return or(t,n=>n.empty?t.moveByGroup(n,e):Yu(n,e))}const iL=t=>nS(t,!Gt(t)),oL=t=>nS(t,Gt(t));function aL(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 Xu(t,e,n){let r=Kt(t).resolveInner(e.head),s=n?_e.closedBy:_e.openedBy;for(let l=e.head;;){let d=n?r.childAfter(l):r.childBefore(l);if(!d)break;aL(t,d,s)?r=d:l=n?d.to:d.from}let i=r.type.prop(s),o,a;return i&&(o=n?yr(t,r.from,1):yr(t,r.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?r.to:r.from,q.cursor(a,n?-1:1)}const lL=t=>or(t,e=>Xu(t.state,e,!Gt(t))),cL=t=>or(t,e=>Xu(t.state,e,Gt(t)));function rS(t,e){return or(t,n=>{if(!n.empty)return Yu(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const sS=t=>rS(t,!1),iS=t=>rS(t,!0);function oS(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,s;if(e){for(let i of t.state.facet(ae.scrollMargins)){let o=i(t);o?.top&&(n=Math.max(o?.top,n)),o?.bottom&&(r=Math.max(o?.bottom,r))}s=t.scrollDOM.clientHeight-n-r}else s=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,s-5)}}function aS(t,e){let n=oS(t),{state:r}=t,s=ko(r.selection,o=>o.empty?t.moveVertically(o,e,n.height):Yu(o,e));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let o=t.coordsAtPos(r.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+n.marginTop,d=a.bottom-n.marginBottom;o&&o.top>l&&o.bottom<d&&(i=ae.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-l}))}return t.dispatch(ir(r,s),{effects:i}),!0}const Mb=t=>aS(t,!1),em=t=>aS(t,!0);function Ds(t,e,n){let r=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,n);if(s.head==e.head&&s.head!=(n?r.to:r.from)&&(s=t.moveToLineBoundary(e,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&e.head!=r.from+i&&(s=q.cursor(r.from+i))}return s}const dL=t=>or(t,e=>Ds(t,e,!0)),uL=t=>or(t,e=>Ds(t,e,!1)),hL=t=>or(t,e=>Ds(t,e,!Gt(t))),fL=t=>or(t,e=>Ds(t,e,Gt(t))),pL=t=>or(t,e=>q.cursor(t.lineBlockAt(e.head).from,1)),mL=t=>or(t,e=>q.cursor(t.lineBlockAt(e.head).to,-1));function gL(t,e,n){let r=!1,s=ko(t.selection,i=>{let o=yr(t,i.head,-1)||yr(t,i.head,1)||i.head>0&&yr(t,i.head-1,1)||i.head<t.doc.length&&yr(t,i.head+1,-1);if(!o||!o.end)return i;r=!0;let a=o.start.from==i.head?o.end.to:o.end.from;return q.cursor(a)});return r?(e(ir(t,s)),!0):!1}const xL=({state:t,dispatch:e})=>gL(t,e);function Hn(t,e){let n=ko(t.state.selection,r=>{let s=e(r);return q.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(ir(t.state,n)),!0)}function lS(t,e){return Hn(t,n=>t.moveByChar(n,e))}const cS=t=>lS(t,!Gt(t)),dS=t=>lS(t,Gt(t));function uS(t,e){return Hn(t,n=>t.moveByGroup(n,e))}const bL=t=>uS(t,!Gt(t)),yL=t=>uS(t,Gt(t)),vL=t=>Hn(t,e=>Xu(t.state,e,!Gt(t))),wL=t=>Hn(t,e=>Xu(t.state,e,Gt(t)));function hS(t,e){return Hn(t,n=>t.moveVertically(n,e))}const fS=t=>hS(t,!1),pS=t=>hS(t,!0);function mS(t,e){return Hn(t,n=>t.moveVertically(n,e,oS(t).height))}const Ab=t=>mS(t,!1),Tb=t=>mS(t,!0),kL=t=>Hn(t,e=>Ds(t,e,!0)),SL=t=>Hn(t,e=>Ds(t,e,!1)),CL=t=>Hn(t,e=>Ds(t,e,!Gt(t))),jL=t=>Hn(t,e=>Ds(t,e,Gt(t))),NL=t=>Hn(t,e=>q.cursor(t.lineBlockAt(e.head).from)),PL=t=>Hn(t,e=>q.cursor(t.lineBlockAt(e.head).to)),Lb=({state:t,dispatch:e})=>(e(ir(t,{anchor:0})),!0),Rb=({state:t,dispatch:e})=>(e(ir(t,{anchor:t.doc.length})),!0),_b=({state:t,dispatch:e})=>(e(ir(t,{anchor:t.selection.main.anchor,head:0})),!0),Ib=({state:t,dispatch:e})=>(e(ir(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),OL=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),EL=({state:t,dispatch:e})=>{let n=Zu(t).map(({from:r,to:s})=>q.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:q.create(n),userEvent:"select"})),!0},DL=({state:t,dispatch:e})=>{let n=ko(t.selection,r=>{let s=Kt(t),i=s.resolveStack(r.from,1);if(r.empty){let o=s.resolveStack(r.from,-1);o.node.from>=i.node.from&&o.node.to<=i.node.to&&(i=o)}for(let o=i;o;o=o.next){let{node:a}=o;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&o.next)return q.range(a.to,a.from)}return r});return n.eq(t.selection)?!1:(e(ir(t,n)),!0)};function gS(t,e){let{state:n}=t,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let o=n.doc.lineAt(i.head);if(e?o.to<t.state.doc.length:o.from>0)for(let a=i;;){let l=t.moveVertically(a,e);if(l.head<o.from||l.head>o.to){s.some(d=>d.head==l.head)||s.push(l);break}else{if(l.head==a.head)break;a=l}}}return s.length==r.ranges.length?!1:(t.dispatch(ir(n,q.create(s,s.length-1))),!0)}const ML=t=>gS(t,!1),AL=t=>gS(t,!0),TL=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=q.create([n.main]):n.main.empty||(r=q.create([q.cursor(n.main.head)])),r?(e(ir(t,r)),!0):!1};function Xl(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(i=>{let{from:o,to:a}=i;if(o==a){let l=e(i);l<o?(n="delete.backward",l=$c(t,l,!1)):l>o&&(n="delete.forward",l=$c(t,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=$c(t,o,!1),a=$c(t,a,!0);return o==a?{range:i}:{changes:{from:o,to:a},range:q.cursor(o,o<i.head?-1:1)}});return s.changes.empty?!1:(t.dispatch(r.update(s,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?ae.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function $c(t,e,n){if(t instanceof ae)for(let r of t.state.facet(ae.atomicRanges).map(s=>s(t)))r.between(e,e,(s,i)=>{s<e&&i>e&&(e=n?i:s)});return e}const xS=(t,e,n)=>Xl(t,r=>{let s=r.from,{state:i}=t,o=i.doc.lineAt(s),a,l;if(n&&!e&&s>o.from&&s<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,s-o.from))){if(a[a.length-1]==" ")return s-1;let d=vo(a,i.tabSize),u=d%Qd(i)||Qd(i);for(let h=0;h<u&&a[a.length-1-h]==" ";h++)s--;l=s}else l=Ct(o.text,s-o.from,e,e)+o.from,l==s&&o.number!=(e?i.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,s-o.from))&&(l=Ct(o.text,l-o.from,!1,!1)+o.from);return l}),tm=t=>xS(t,!1,!0),bS=t=>xS(t,!0,!1),yS=(t,e)=>Xl(t,n=>{let r=n.head,{state:s}=t,i=s.doc.lineAt(r),o=s.charCategorizer(r);for(let a=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let l=Ct(i.text,r-i.from,e)+i.from,d=i.text.slice(Math.min(r,l)-i.from,Math.max(r,l)-i.from),u=o(d);if(a!=null&&u!=a)break;(d!=" "||r!=n.head)&&(a=u),r=l}return r}),vS=t=>yS(t,!1),LL=t=>yS(t,!0),RL=t=>Xl(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),_L=t=>Xl(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),IL=t=>Xl(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),$L=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Ge.of(["",""])},range:q.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},BL=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let s=r.from,i=t.doc.lineAt(s),o=s==i.from?s-1:Ct(i.text,s-i.from,!1)+i.from,a=s==i.to?s+1:Ct(i.text,s-i.from,!0)+i.from;return{changes:{from:o,to:a,insert:t.doc.slice(s,a).append(t.doc.slice(o,s))},range:q.cursor(a)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Zu(t){let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.from),i=t.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=t.doc.lineAt(r.to-1)),n>=s.number){let o=e[e.length-1];o.to=i.to,o.ranges.push(r)}else e.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return e}function wS(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let i of Zu(t)){if(n?i.to==t.doc.length:i.from==0)continue;let o=t.doc.lineAt(n?i.to+1:i.from-1),a=o.length+1;if(n){r.push({from:i.to,to:o.to},{from:i.from,insert:o.text+t.lineBreak});for(let l of i.ranges)s.push(q.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{r.push({from:o.from,to:i.from},{from:i.to,insert:t.lineBreak+o.text});for(let l of i.ranges)s.push(q.range(l.anchor-a,l.head-a))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:q.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const FL=({state:t,dispatch:e})=>wS(t,e,!1),zL=({state:t,dispatch:e})=>wS(t,e,!0);function kS(t,e,n){if(t.readOnly)return!1;let r=[];for(let i of Zu(t))n?r.push({from:i.from,insert:t.doc.slice(i.from,i.to)+t.lineBreak}):r.push({from:i.to,insert:t.lineBreak+t.doc.slice(i.from,i.to)});let s=t.changes(r);return e(t.update({changes:s,selection:t.selection.map(s,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const VL=({state:t,dispatch:e})=>kS(t,e,!1),HL=({state:t,dispatch:e})=>kS(t,e,!0),WL=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(Zu(e).map(({from:s,to:i})=>(s>0?s--:i<e.doc.length&&i++,{from:s,to:i}))),r=ko(e.selection,s=>{let i;if(t.lineWrapping){let o=t.lineBlockAt(s.head),a=t.coordsAtPos(s.head,s.assoc||1);a&&(i=o.bottom+t.documentTop-a.bottom+t.defaultLineHeight/2)}return t.moveVertically(s,!0,i)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function UL(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=Kt(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e),i;return r&&s&&r.to<=e&&s.from>=e&&(i=r.type.prop(_e.closedBy))&&i.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const $b=SS(!1),KL=SS(!0);function SS(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:i,to:o}=s,a=e.doc.lineAt(i),l=!t&&i==o&&UL(e,i);t&&(i=o=(o<=a.to?a:e.doc.lineAt(o)).to);let d=new Ku(e,{simulateBreak:i,simulateDoubleBreak:!!l}),u=pg(d,i);for(u==null&&(u=vo(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:i,to:o}=l:i>a.from&&i<a.from+100&&!/\S/.test(a.text.slice(0,i))&&(i=a.from);let h=["",Ia(e,u)];return l&&h.push(Ia(e,d.lineIndent(a.from,-1))),{changes:{from:i,to:o,insert:Ge.of(h)},range:q.cursor(i+1+h[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function yg(t,e){let n=-1;return t.changeByRange(r=>{let s=[];for(let o=r.from;o<=r.to;){let a=t.doc.lineAt(o);a.number>n&&(r.empty||r.to>a.from)&&(e(a,s,r),n=a.number),o=a.to+1}let i=t.changes(s);return{changes:s,range:q.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const GL=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Ku(t,{overrideIndentation:i=>{let o=n[i];return o??-1}}),s=yg(t,(i,o,a)=>{let l=pg(r,i.from);if(l==null)return;/\S/.test(i.text)||(l=0);let d=/^\s*/.exec(i.text)[0],u=Ia(t,l);(d!=u||a.from<i.from+d.length)&&(n[i.from]=l,o.push({from:i.from,to:i.from+d.length,insert:u}))});return s.changes.empty||e(t.update(s,{userEvent:"indent"})),!0},CS=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(yg(t,(n,r)=>{r.push({from:n.from,insert:t.facet(Uu)})}),{userEvent:"input.indent"})),!0),jS=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(yg(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=vo(s,t.tabSize),o=0,a=Ia(t,Math.max(0,i-Qd(t)));for(;o<s.length&&o<a.length&&s.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+s.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),qL=t=>(t.setTabFocusMode(),!0),YL=[{key:"Ctrl-b",run:eS,shift:cS,preventDefault:!0},{key:"Ctrl-f",run:tS,shift:dS},{key:"Ctrl-p",run:sS,shift:fS},{key:"Ctrl-n",run:iS,shift:pS},{key:"Ctrl-a",run:pL,shift:NL},{key:"Ctrl-e",run:mL,shift:PL},{key:"Ctrl-d",run:bS},{key:"Ctrl-h",run:tm},{key:"Ctrl-k",run:RL},{key:"Ctrl-Alt-h",run:vS},{key:"Ctrl-o",run:$L},{key:"Ctrl-t",run:BL},{key:"Ctrl-v",run:em}],XL=[{key:"ArrowLeft",run:eS,shift:cS,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:iL,shift:bL,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:hL,shift:CL,preventDefault:!0},{key:"ArrowRight",run:tS,shift:dS,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:oL,shift:yL,preventDefault:!0},{mac:"Cmd-ArrowRight",run:fL,shift:jL,preventDefault:!0},{key:"ArrowUp",run:sS,shift:fS,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Lb,shift:_b},{mac:"Ctrl-ArrowUp",run:Mb,shift:Ab},{key:"ArrowDown",run:iS,shift:pS,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Rb,shift:Ib},{mac:"Ctrl-ArrowDown",run:em,shift:Tb},{key:"PageUp",run:Mb,shift:Ab},{key:"PageDown",run:em,shift:Tb},{key:"Home",run:uL,shift:SL,preventDefault:!0},{key:"Mod-Home",run:Lb,shift:_b},{key:"End",run:dL,shift:kL,preventDefault:!0},{key:"Mod-End",run:Rb,shift:Ib},{key:"Enter",run:$b,shift:$b},{key:"Mod-a",run:OL},{key:"Backspace",run:tm,shift:tm,preventDefault:!0},{key:"Delete",run:bS,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:vS,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:LL,preventDefault:!0},{mac:"Mod-Backspace",run:_L,preventDefault:!0},{mac:"Mod-Delete",run:IL,preventDefault:!0}].concat(YL.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),ZL=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:lL,shift:vL},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:cL,shift:wL},{key:"Alt-ArrowUp",run:FL},{key:"Shift-Alt-ArrowUp",run:VL},{key:"Alt-ArrowDown",run:zL},{key:"Shift-Alt-ArrowDown",run:HL},{key:"Mod-Alt-ArrowUp",run:ML},{key:"Mod-Alt-ArrowDown",run:AL},{key:"Escape",run:TL},{key:"Mod-Enter",run:KL},{key:"Alt-l",mac:"Ctrl-l",run:EL},{key:"Mod-i",run:DL,preventDefault:!0},{key:"Mod-[",run:jS},{key:"Mod-]",run:CS},{key:"Mod-Alt-\\",run:GL},{key:"Shift-Mod-k",run:WL},{key:"Shift-Mod-\\",run:xL},{key:"Mod-/",run:F6},{key:"Alt-A",run:V6},{key:"Ctrl-m",mac:"Shift-Alt-m",run:qL}].concat(XL),QL={key:"Tab",run:CS,shift:jS},Bb=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class oo{constructor(e,n,r=0,s=e.length,i,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,s),this.bufferStart=r,this.normalize=i?a=>i(Bb(a)):Bb,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 an(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=Zm(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=xr(e);let s=this.normalize(n);if(s.length)for(let i=0,o=r;;i++){let a=s.charCodeAt(i),l=this.match(a,o,this.bufferPos+this.bufferStart);if(i==s.length-1){if(l)return this.value=l,this;break}o==r&&i<n.length&&n.charCodeAt(i)==a&&o++}}}match(e,n,r){let s=null;for(let i=0;i<this.matches.length;i+=2){let o=this.matches[i],a=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?s={from:this.matches[i+1],to:r}:(this.matches[i]++,a=!0)),a||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:n,to:r}:this.matches.push(1,n)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(oo.prototype[Symbol.iterator]=function(){return this});const NS={from:-1,to:-1,match:/.*/.exec("")},vg="gm"+(/x/.unicode==null?"":"u");class PS{constructor(e,n,r,s=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=NS,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new OS(e,n,r,s,i);this.re=new RegExp(n,vg+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=e.iter();let o=e.lineAt(s);this.curLineStart=o.from,this.matchPos=nu(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=nu(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<s||r>this.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const ef=new WeakMap;class Vi{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let s=ef.get(e);if(!s||s.from>=r||s.to<=n){let a=new Vi(n,e.sliceString(n,r));return ef.set(e,a),a}if(s.from==n&&s.to==r)return s;let{text:i,from:o}=s;return o>n&&(i=e.sliceString(n,o)+i,o=n),s.to<r&&(i+=e.sliceString(s.to,r)),ef.set(e,new Vi(o,i)),new Vi(n,i.slice(n-o,r-o))}}class OS{constructor(e,n,r,s,i){this.text=e,this.to=i,this.done=!1,this.value=NS,this.matchPos=nu(e,s),this.re=new RegExp(n,vg+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=Vi.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this.matchPos=nu(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Vi.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(PS.prototype[Symbol.iterator]=OS.prototype[Symbol.iterator]=function(){return this});function JL(t){try{return new RegExp(t,vg),!0}catch{return!1}}function nu(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 nm(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=Xe("input",{class:"cm-textfield",name:"line",value:e}),r=Xe("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),t.dispatch({effects:ha.of(!1)}),t.focus()):i.keyCode==13&&(i.preventDefault(),s())},onsubmit:i=>{i.preventDefault(),s()}},Xe("label",t.state.phrase("Go to line"),": ",n)," ",Xe("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),Xe("button",{name:"close",onclick:()=>{t.dispatch({effects:ha.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]));function s(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!i)return;let{state:o}=t,a=o.doc.lineAt(o.selection.main.head),[,l,d,u,h]=i,f=u?+u.slice(1):0,p=d?+d:a.number;if(d&&h){let b=p/100;l&&(b=b*(l=="-"?-1:1)+a.number/o.doc.lines),p=Math.round(o.doc.lines*b)}else d&&l&&(p=p*(l=="-"?-1:1)+a.number);let m=o.doc.line(Math.max(1,Math.min(o.doc.lines,p))),x=q.cursor(m.from+Math.max(0,Math.min(f,m.length)));t.dispatch({effects:[ha.of(!1),ae.scrollIntoView(x.from,{y:"center"})],selection:x}),t.focus()}return{dom:r}}const ha=Me.define(),Fb=zt.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(ha)&&(t=n.value);return t},provide:t=>_a.from(t,e=>e?nm:null)}),eR=t=>{let e=Ra(t,nm);if(!e){let n=[ha.of(!0)];t.state.field(Fb,!1)==null&&n.push(Me.appendConfig.of([Fb,tR])),t.dispatch({effects:n}),e=Ra(t,nm)}return e&&e.dom.querySelector("input").select(),!0},tR=ae.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"}}}),nR={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},rR=pe.define({combine(t){return Er(t,nR,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function sR(t){return[cR,lR]}const iR=je.mark({class:"cm-selectionMatch"}),oR=je.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function zb(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=st.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=st.Word)}function aR(t,e,n,r){return t(e.sliceDoc(n,n+1))==st.Word&&t(e.sliceDoc(r-1,r))==st.Word}const lR=pt.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(rR),{state:n}=t,r=n.selection;if(r.ranges.length>1)return je.none;let s=r.main,i,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return je.none;let l=n.wordAt(s.head);if(!l)return je.none;o=n.charCategorizer(s.head),i=n.sliceDoc(l.from,l.to)}else{let l=s.to-s.from;if(l<e.minSelectionLength||l>200)return je.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),o=n.charCategorizer(s.head),!(zb(o,n,s.from,s.to)&&aR(o,n,s.from,s.to)))return je.none}else if(i=n.sliceDoc(s.from,s.to),!i)return je.none}let a=[];for(let l of t.visibleRanges){let d=new oo(n.doc,i,l.from,l.to);for(;!d.next().done;){let{from:u,to:h}=d.value;if((!o||zb(o,n,u,h))&&(s.empty&&u<=s.from&&h>=s.to?a.push(oR.range(u,h)):(u>=s.to||h<=s.from)&&a.push(iR.range(u,h)),a.length>e.maxMatches))return je.none}}return je.set(a)}},{decorations:t=>t.decorations}),cR=ae.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),dR=({state:t,dispatch:e})=>{let{selection:n}=t,r=q.create(n.ranges.map(s=>t.wordAt(s.head)||q.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function uR(t,e){let{main:n,ranges:r}=t.selection,s=t.wordAt(n.head),i=s&&s.from==n.from&&s.to==n.to;for(let o=!1,a=new oo(t.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new oo(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(l=>l.from==a.value.from))continue;if(i){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const hR=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return dR({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=r))return!1;let s=uR(t,r);return s?(e(t.update({selection:t.selection.addRange(q.range(s.from,s.to),!1),effects:ae.scrollIntoView(s.to)})),!0):!1},So=pe.define({combine(t){return Er(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new CR(e),scrollToMatch:e=>ae.scrollIntoView(e)})}});class ES{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||JL(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"?`
|
|
270
|
+
`: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 gR(this):new pR(this)}getCursor(e,n=0,r){let s=e.doc?e:Fe.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?Ni(this,s,n,r):ji(this,s,n,r)}}class DS{constructor(e){this.spec=e}}function ji(t,e,n,r){return new oo(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),t.wholeWord?fR(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function fR(t,e){return(n,r,s,i)=>((i>n||i+s.length<r)&&(i=Math.max(0,n-2),s=t.sliceString(i,Math.min(t.length,r+2))),(e(ru(s,n-i))!=st.Word||e(su(s,n-i))!=st.Word)&&(e(su(s,r-i))!=st.Word||e(ru(s,r-i))!=st.Word))}class pR extends DS{constructor(e){super(e)}nextMatch(e,n,r){let s=ji(this.spec,e,r,e.doc.length).nextOverlapping();if(s.done){let i=Math.min(e.doc.length,n+this.spec.unquoted.length);s=ji(this.spec,e,0,i).nextOverlapping()}return s.done||s.value.from==n&&s.value.to==r?null:s.value}prevMatchInRange(e,n,r){for(let s=r;;){let i=Math.max(n,s-1e4-this.spec.unquoted.length),o=ji(this.spec,e,i,s),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(i==n)return null;s-=1e4}}prevMatch(e,n,r){let s=this.prevMatchInRange(e,0,n);return s||(s=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=n||s.to!=r)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let r=ji(this.spec,e,0,e.doc.length),s=[];for(;!r.next().done;){if(s.length>=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=ji(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}function Ni(t,e,n,r){return new PS(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?mR(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function ru(t,e){return t.slice(Ct(t,e,!1),e)}function su(t,e){return t.slice(e,Ct(t,e))}function mR(t){return(e,n,r)=>!r[0].length||(t(ru(r.input,r.index))!=st.Word||t(su(r.input,r.index))!=st.Word)&&(t(su(r.input,r.index+r[0].length))!=st.Word||t(ru(r.input,r.index+r[0].length))!=st.Word)}class gR extends DS{nextMatch(e,n,r){let s=Ni(this.spec,e,r,e.doc.length).next();return s.done&&(s=Ni(this.spec,e,0,n).next()),s.done?null:s.value}prevMatchInRange(e,n,r){for(let s=1;;s++){let i=Math.max(n,r-s*1e4),o=Ni(this.spec,e,i,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(i==n||a.from>i+10))return a;if(i==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i<e.match.length)return e.match[i]+r.slice(s)}return n})}matchAll(e,n){let r=Ni(this.spec,e,0,e.doc.length),s=[];for(;!r.next().done;){if(s.length>=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=Ni(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}const $a=Me.define(),wg=Me.define(),xs=zt.define({create(t){return new tf(rm(t).create(),null)},update(t,e){for(let n of e.effects)n.is($a)?t=new tf(n.value.create(),t.panel):n.is(wg)&&(t=new tf(t.query,n.value?kg:null));return t},provide:t=>_a.from(t,e=>e.panel)});class tf{constructor(e,n){this.query=e,this.panel=n}}const xR=je.mark({class:"cm-searchMatch"}),bR=je.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yR=pt.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(xs))}update(t){let e=t.state.field(xs);(e!=t.startState.field(xs)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return je.none;let{view:n}=this,r=new Ur;for(let s=0,i=n.visibleRanges,o=i.length;s<o;s++){let{from:a,to:l}=i[s];for(;s<o-1&&l>i[s+1].from-2*250;)l=i[++s].to;t.highlight(n.state,a,l,(d,u)=>{let h=n.state.selection.ranges.some(f=>f.from==d&&f.to==u);r.add(d,u,h?bR:xR)})}return r.finish()}},{decorations:t=>t.decorations});function Zl(t){return e=>{let n=e.state.field(xs,!1);return n&&n.query.spec.valid?t(e,n):TS(e)}}const iu=Zl((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=q.single(r.from,r.to),i=t.state.facet(So);return t.dispatch({selection:s,effects:[Sg(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),AS(t),!0}),ou=Zl((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=q.single(s.from,s.to),o=t.state.facet(So);return t.dispatch({selection:i,effects:[Sg(t,s),o.scrollToMatch(i.main,t)],userEvent:"select.search"}),AS(t),!0}),vR=Zl((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:q.create(n.map(r=>q.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),wR=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,i=[],o=0;for(let a=new oo(t.doc,t.sliceDoc(r,s));!a.next().done;){if(i.length>1e3)return!1;a.value.from==r&&(o=i.length),i.push(q.range(a.value.from,a.value.to))}return e(t.update({selection:q.create(i,o),userEvent:"select.search.matches"})),!0},Vb=Zl((t,{query:e})=>{let{state:n}=t,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,r,r);if(!i)return!1;let o=i,a=[],l,d,u=[];o.from==r&&o.to==s&&(d=n.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:d}),o=e.nextMatch(n,o.from,o.to),u.push(ae.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let h=t.state.changes(a);return o&&(l=q.single(o.from,o.to).map(h),u.push(Sg(t,o)),u.push(n.facet(So).scrollToMatch(l.main,t))),t.dispatch({changes:h,selection:l,effects:u,userEvent:"input.replace"}),!0}),kR=Zl((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(s=>{let{from:i,to:o}=s;return{from:i,to:o,insert:e.getReplacement(s)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:ae.announce.of(r),userEvent:"input.replace.all"}),!0});function kg(t){return t.state.facet(So).createPanel(t)}function rm(t,e){var n,r,s,i,o;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let d=t.facet(So);return new ES({search:((n=e?.literal)!==null&&n!==void 0?n:d.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:d.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:d.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:d.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:d.wholeWord})}function MS(t){let e=Ra(t,kg);return e&&e.dom.querySelector("[main-field]")}function AS(t){let e=MS(t);e&&e==t.root.activeElement&&e.select()}const TS=t=>{let e=t.state.field(xs,!1);if(e&&e.panel){let n=MS(t);if(n&&n!=t.root.activeElement){let r=rm(t.state,e.query.spec);r.valid&&t.dispatch({effects:$a.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[wg.of(!0),e?$a.of(rm(t.state,e.query.spec)):Me.appendConfig.of(NR)]});return!0},LS=t=>{let e=t.state.field(xs,!1);if(!e||!e.panel)return!1;let n=Ra(t,kg);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:wg.of(!1)}),!0},SR=[{key:"Mod-f",run:TS,scope:"editor search-panel"},{key:"F3",run:iu,shift:ou,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:iu,shift:ou,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:LS,scope:"editor search-panel"},{key:"Mod-Shift-l",run:wR},{key:"Mod-Alt-g",run:eR},{key:"Mod-d",run:hR,preventDefault:!0}];class CR{constructor(e){this.view=e;let n=this.query=e.state.field(xs).query.spec;this.commit=this.commit.bind(this),this.searchField=Xe("input",{value:n.search,placeholder:gn(e,"Find"),"aria-label":gn(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Xe("input",{value:n.replace,placeholder:gn(e,"Replace"),"aria-label":gn(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Xe("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Xe("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Xe("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,o){return Xe("button",{class:"cm-button",name:s,onclick:i,type:"button"},o)}this.dom=Xe("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>iu(e),[gn(e,"next")]),r("prev",()=>ou(e),[gn(e,"previous")]),r("select",()=>vR(e),[gn(e,"all")]),Xe("label",null,[this.caseField,gn(e,"match case")]),Xe("label",null,[this.reField,gn(e,"regexp")]),Xe("label",null,[this.wordField,gn(e,"by word")]),...e.state.readOnly?[]:[Xe("br"),this.replaceField,r("replace",()=>Vb(e),[gn(e,"replace")]),r("replaceAll",()=>kR(e),[gn(e,"replace all")])],Xe("button",{name:"close",onclick:()=>LS(e),"aria-label":gn(e,"close"),type:"button"},["×"])])}commit(){let e=new ES({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:$a.of(e)}))}keydown(e){VA(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?ou:iu)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Vb(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is($a)&&!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(So).top}}function gn(t,e){return t.state.phrase(e)}const Bc=30,Fc=/[\s\.,:;?!]/;function Sg(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),s=t.state.doc.lineAt(n).to,i=Math.max(r.from,e-Bc),o=Math.min(s,n+Bc),a=t.state.sliceDoc(i,o);if(i!=r.from){for(let l=0;l<Bc;l++)if(!Fc.test(a[l+1])&&Fc.test(a[l])){a=a.slice(l);break}}if(o!=s){for(let l=a.length-1;l>a.length-Bc;l--)if(!Fc.test(a[l-1])&&Fc.test(a[l])){a=a.slice(0,l);break}}return ae.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${r.number}.`)}const jR=ae.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"}}),NR=[xs,hi.low(yR),jR];class RS{constructor(e,n,r,s){this.state=e,this.pos=n,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=Kt(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),s=n.text.slice(r-n.from,this.pos-n.from),i=s.search(_S(e,!1));return i<0?null:{from:r+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function Hb(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 PR(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;i<s.length;i++)n[s[i]]=!0}let r=Hb(e)+Hb(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function OR(t){let e=t.map(s=>typeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:PR(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}class Wb{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}}function Qs(t){return t.selection.main.from}function _S(t,e){var n;let{source:r}=t,s=e&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?t:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const IS=Or.define();function ER(t,e,n,r){let{main:s}=t.selection,i=n-s.from,o=r-s.from;return{...t.changeByRange(a=>{if(a!=s&&n!=r&&t.sliceDoc(a.from+i,a.from+o)!=t.sliceDoc(n,r))return{range:a};let l=t.toText(e);return{changes:{from:a.from+i,to:r==s.from?a.to:a.from+o,insert:l},range:q.cursor(a.from+i+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Ub=new WeakMap;function DR(t){if(!Array.isArray(t))return t;let e=Ub.get(t);return e||Ub.set(t,e=OR(t)),e}const au=Me.define(),Ba=Me.define();class MR{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=an(e,n),s=xr(r);this.chars.push(r);let i=e.slice(n,n+s),o=i.toUpperCase();this.folded.push(an(o==i?i.toLowerCase():o,0)),n+=s}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:s,precise:i,byWord:o}=this;if(n.length==1){let k=an(e,0),v=xr(k),w=v==e.length?0:-100;if(k!=n[0])if(k==r[0])w+=-200;else return null;return this.ret(w,[0,v])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,d=0;if(a<0){for(let k=0,v=Math.min(e.length,200);k<v&&d<l;){let w=an(e,k);(w==n[d]||w==r[d])&&(s[d++]=k),k+=xr(w)}if(d<l)return null}let u=0,h=0,f=!1,p=0,m=-1,x=-1,b=/[a-z]/.test(e),y=!0;for(let k=0,v=Math.min(e.length,200),w=0;k<v&&h<l;){let C=an(e,k);a<0&&(u<l&&C==n[u]&&(i[u++]=k),p<l&&(C==n[p]||C==r[p]?(p==0&&(m=k),x=k+1,p++):p=0));let j,S=C<255?C>=48&&C<=57||C>=97&&C<=122?2:C>=65&&C<=90?1:0:(j=Zm(C))!=j.toLowerCase()?1:j!=j.toUpperCase()?2:0;(!k||S==1&&b||w==0&&S!=0)&&(n[h]==C||r[h]==C&&(f=!0)?o[h++]=k:o.length&&(y=!1)),w=S,k+=xr(C)}return h==l&&o[0]==0&&y?this.result(-100+(f?-200:0),o,e):p==l&&m==0?this.ret(-200-e.length+(x==e.length?0:-100),[0,x]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):p==l?this.ret(-900-e.length,[m,x]):h==l?this.result(-100+(f?-200:0)+-700+(y?0:-1100),o,e):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,n,r){let s=[],i=0;for(let o of n){let a=o+(this.astral?xr(an(r,o)):1);i&&s[i-1]==o?s[i-1]=a:(s[i++]=o,s[i++]=a)}return this.ret(e-r.length,s)}}class AR{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 Dt=pe.define({combine(t){return Er(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:TR,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=>Kb(e(r),n(r)),optionClass:(e,n)=>r=>Kb(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function Kb(t,e){return t?e?t+" "+e:t:e}function TR(t,e,n,r,s,i){let o=t.textDirection==Je.RTL,a=o,l=!1,d="top",u,h,f=e.left-s.left,p=s.right-e.right,m=r.right-r.left,x=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))u=Math.max(s.top,Math.min(n.top,s.bottom-x))-e.top,h=Math.min(400,a?f:p);else{l=!0,h=Math.min(400,(o?e.right:s.right-e.left)-30);let k=s.bottom-e.bottom;k>=x||k>e.top?u=n.bottom-e.top:(d="bottom",u=e.bottom-n.top)}let b=(e.bottom-e.top)/i.offsetHeight,y=(e.right-e.left)/i.offsetWidth;return{style:`${d}: ${u/b}px; max-width: ${h/y}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function LR(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,s,i){let o=document.createElement("span");o.className="cm-completionLabel";let a=n.displayLabel||n.label,l=0;for(let d=0;d<i.length;){let u=i[d++],h=i[d++];u>l&&o.appendChild(document.createTextNode(a.slice(l,u)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(a.slice(u,h))),f.className="cm-completionMatchedText",l=h}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 nf(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let s=Math.floor(e/n);return{from:s*n,to:(s+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class RR{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:o}=s.open,a=e.state.facet(Dt);this.optionContent=LR(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=nf(i.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:d}=e.state.field(n).open;for(let u=l.target,h;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(h=/-(\d+)$/.exec(u.id))&&+h[1]<d.length){this.applyCompletion(e,d[+h[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let d=e.state.field(this.stateField,!1);d&&d.tooltip&&e.state.facet(Dt).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Ba.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:i,selected:o,disabled:a}=r.open;(!s.open||s.open.options!=i)&&(this.range=nf(i.length,o,e.state.facet(Dt).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),a!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=nf(n.options.length,n.selected,this.view.state.facet(Dt).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(s);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,s)}).catch(a=>dn(this.view.state,a,"completion info")):(this.addInfoPane(o,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&IR(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let o=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom<Math.max(i.top,n.top)+10?null:this.view.state.facet(Dt).positionInfo(this.view,n,s,r,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,n,r){const s=document.createElement("ul");s.id=n,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",o=>{o.target==s&&o.preventDefault()});let i=null;for(let o=r.from;o<r.to;o++){let{completion:a,match:l}=e[o],{section:d}=a;if(d){let f=typeof d=="string"?d:d.name;if(f!=i&&(o>r.from||r.from==0))if(i=f,typeof d!="string"&&d.header)s.appendChild(d.header(d));else{let p=s.appendChild(document.createElement("completion-section"));p.textContent=f}}const u=s.appendChild(document.createElement("li"));u.id=n+"-"+o,u.setAttribute("role","option");let h=this.optionClass(a);h&&(u.className=h);for(let f of this.optionContent){let p=f(a,this.view.state,this.view,l);p&&u.appendChild(p)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function _R(t,e){return n=>new RR(n,t,e)}function IR(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.top<n.top?t.scrollTop-=(n.top-r.top)/s:r.bottom>n.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function Gb(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function $R(t,e){let n=[],r=null,s=null,i=u=>{n.push(u);let{section:h}=u.completion;if(h){r||(r=[]);let f=typeof h=="string"?h:h.name;r.some(p=>p.name==f)||r.push(typeof h=="string"?{name:f}:h)}},o=e.facet(Dt);for(let u of t)if(u.hasResult()){let h=u.result.getMatch;if(u.result.filter===!1)for(let f of u.result.options)i(new Wb(f,u.source,h?h(f):[],1e9-n.length));else{let f=e.sliceDoc(u.from,u.to),p,m=o.filterStrict?new AR(f):new MR(f);for(let x of u.result.options)if(p=m.match(x.label)){let b=x.displayLabel?h?h(x,p.matched):[]:p.matched,y=p.score+(x.boost||0);if(i(new Wb(x,u.source,b,y)),typeof x.section=="object"&&x.section.rank==="dynamic"){let{name:k}=x.section;s||(s=Object.create(null)),s[k]=Math.max(y,s[k]||-1e9)}}}}if(r){let u=Object.create(null),h=0,f=(p,m)=>(p.rank==="dynamic"&&m.rank==="dynamic"?s[m.name]-s[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))h-=1e5,u[p.name]=h;for(let p of n){let{section:m}=p.completion;m&&(p.score+=u[typeof m=="string"?m:m.name])}}let a=[],l=null,d=o.compareCompletions;for(let u of n.sort((h,f)=>f.score-h.score||d(h.completion,f.completion))){let h=u.completion;!l||l.label!=h.label||l.detail!=h.detail||l.type!=null&&h.type!=null&&l.type!=h.type||l.apply!=h.apply||l.boost!=h.boost?a.push(u):Gb(u.completion)>Gb(l)&&(a[a.length-1]=u),l=u.completion}return a}class Mi{constructor(e,n,r,s,i,o){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new Mi(this.options,qb(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,o){if(s&&!o&&e.some(d=>d.isPending))return s.setDisabled();let a=$R(e,n);if(!a.length)return s&&e.some(d=>d.isPending)?s.setDisabled():null;let l=n.facet(Dt).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let d=s.options[s.selected].completion;for(let u=0;u<a.length;u++)if(a[u].completion==d){l=u;break}}return new Mi(a,qb(r,l),{pos:e.reduce((d,u)=>u.hasResult()?Math.min(d,u.from):d,1e8),create:WR,above:i.aboveCursor},s?s.timestamp:Date.now(),l,!1)}map(e){return new Mi(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Mi(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class lu{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new lu(VR,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(Dt),i=(r.override||n.languageDataAt("autocomplete",Qs(n)).map(DR)).map(l=>(this.active.find(u=>u.source==l)||new Rn(l,this.active.some(u=>u.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((l,d)=>l==this.active[d])&&(i=this.active);let o=this.open,a=e.effects.some(l=>l.is(Cg));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||i.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!BR(i,this.active)||a?o=Mi.build(i,n,this.id,o,r,a):o&&o.disabled&&!i.some(l=>l.isPending)&&(o=null),!o&&i.every(l=>!l.isPending)&&i.some(l=>l.hasResult())&&(i=i.map(l=>l.hasResult()?new Rn(l.source,0):l));for(let l of e.effects)l.is(BS)&&(o=o&&o.setSelected(l.value,this.id));return i==this.active&&o==this.open?this:new lu(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?FR:zR}}function BR(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;r<e.length&&!e[r].hasResult();)r++;let s=n==t.length,i=r==e.length;if(s||i)return s==i;if(t[n++].result!=e[r++].result)return!1}}const FR={"aria-autocomplete":"list"},zR={};function qb(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const VR=[];function $S(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(IS);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 Rn{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=$S(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new Rn(s.source,0)),r&4&&s.state==0&&(s=new Rn(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(au))s=new Rn(s.source,1,i.value);else if(i.is(Ba))s=new Rn(s.source,0);else if(i.is(Cg))for(let o of i.value)o.source==s.source&&(s=o);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Qs(e.state))}}class Hi extends Rn{constructor(e,n,r,s,i,o){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=o}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=Qs(e.state);if(a>o||!s||n&2&&(Qs(e.startState)==this.from||a<this.limit))return new Rn(this.source,n&4?1:0);let l=e.changes.mapPos(this.limit);return HR(s.validFor,e.state,i,o)?new Hi(this.source,this.explicit,l,s,i,o):s.update&&(s=s.update(s,i,o,new RS(e.state,a,!1)))?new Hi(this.source,this.explicit,l,s,s.from,(r=s.to)!==null&&r!==void 0?r:Qs(e.state)):new Rn(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Hi(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Rn(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function HR(t,e,n,r){if(!t)return!1;let s=e.sliceDoc(n,r);return typeof t=="function"?t(s,n,r,e):_S(t,!0).test(s)}const Cg=Me.define({map(t,e){return t.map(n=>n.map(e))}}),BS=Me.define(),ln=zt.define({create(){return lu.start()},update(t,e){return t.update(e)},provide:t=>[fg.from(t,e=>e.tooltip),ae.contentAttributes.from(t,e=>e.attrs)]});function jg(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(ln).active.find(s=>s.source==e.source);return r instanceof Hi?(typeof n=="string"?t.dispatch({...ER(t.state,n,r.from,r.to),annotations:IS.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const WR=_R(ln,jg);function zc(t,e="option"){return n=>{let r=n.state.field(ln,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(Dt).interactionDelay)return!1;let s=1,i;e=="page"&&(i=O2(n,r.open.tooltip))&&(s=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,a=r.open.selected>-1?r.open.selected+s*(t?1:-1):t?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),n.dispatch({effects:BS.of(a)}),!0}}const UR=t=>{let e=t.state.field(ln,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(Dt).interactionDelay?!1:jg(t,e.open.options[e.open.selected])},rf=t=>t.state.field(ln,!1)?(t.dispatch({effects:au.of(!0)}),!0):!1,KR=t=>{let e=t.state.field(ln,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Ba.of(null)}),!0)};class GR{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const qR=50,YR=1e3,XR=pt.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(ln).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(ln),n=t.state.facet(Dt);if(!t.selectionSet&&!t.docChanged&&t.startState.field(ln)==e)return;let r=t.transactions.some(i=>{let o=$S(i,n);return o&8||(i.selection||i.docChanged)&&!(o&3)});for(let i=0;i<this.running.length;i++){let o=this.running[i];if(r||o.context.abortOnDocChange&&t.docChanged||o.updates.length+t.transactions.length>qR&&Date.now()-o.time>YR){for(let a of o.context.abortListeners)try{a()}catch(l){dn(this.view.state,l)}o.context.abortListeners=null,this.running.splice(i--,1)}else o.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(o=>o.is(au)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(o=>o.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(ln);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(Dt).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=Qs(e),r=new RS(e,n,t.explicit,this.view),s=new GR(t,r);this.running.push(s),Promise.resolve(t.source(r)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:Ba.of(null)}),dn(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Dt).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Dt),r=this.view.state.field(ln);for(let s=0;s<this.running.length;s++){let i=this.running[s];if(i.done===void 0)continue;if(this.running.splice(s--,1),i.done){let a=Qs(i.updates.length?i.updates[0].startState:this.view.state),l=Math.min(a,i.done.from+(i.active.explicit?0:1)),d=new Hi(i.active.source,i.active.explicit,l,i.done,i.done.from,(t=i.done.to)!==null&&t!==void 0?t:a);for(let u of i.updates)d=d.update(u,n);if(d.hasResult()){e.push(d);continue}}let o=r.active.find(a=>a.source==i.active.source);if(o&&o.isPending)if(i.done==null){let a=new Rn(i.active.source,0);for(let l of i.updates)a=a.update(l,n);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:Cg.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(ln,!1);if(e&&e.tooltip&&this.view.state.facet(Dt).closeOnBlur){let n=e.open&&O2(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Ba.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:au.of(!1)}),20),this.composing=0}}}),ZR=typeof navigator=="object"&&/Win/.test(navigator.platform),QR=hi.highest(ae.domEventHandlers({keydown(t,e){let n=e.state.field(ln,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(ZR&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(o=>o.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&jg(e,r),!1}})),JR=ae.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"}}}),Fa={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ys=Me.define({map(t,e){let n=e.mapPos(t,-1,Zt.TrackAfter);return n??void 0}}),Ng=new class extends ks{};Ng.startSide=1;Ng.endSide=-1;const FS=zt.define({create(){return Ie.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(Ys)&&(t=t.update({add:[Ng.range(n.value,n.value+1)]}));return t}});function e7(){return[n7,FS]}const sf="()[]{}<>«»»«[]{}";function zS(t){for(let e=0;e<sf.length;e+=2)if(sf.charCodeAt(e)==t)return sf.charAt(e+1);return Zm(t<128?t:t+1)}function VS(t,e){return t.languageDataAt("closeBrackets",e)[0]||Fa}const t7=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),n7=ae.inputHandler.of((t,e,n,r)=>{if((t7?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&xr(an(r,0))==1||e!=s.from||n!=s.to)return!1;let i=i7(t.state,r);return i?(t.dispatch(i),!0):!1}),r7=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=VS(t,t.selection.main.head).brackets||Fa.brackets,s=null,i=t.changeByRange(o=>{if(o.empty){let a=o7(t.doc,o.head);for(let l of r)if(l==a&&Qu(t.doc,o.head)==zS(an(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:q.cursor(o.head-l.length)}}return{range:s=o}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},s7=[{key:"Backspace",run:r7}];function i7(t,e){let n=VS(t,t.selection.main.head),r=n.brackets||Fa.brackets;for(let s of r){let i=zS(an(s,0));if(e==s)return i==s?c7(t,s,r.indexOf(s+s+s)>-1,n):a7(t,s,i,n.before||Fa.before);if(e==i&&HS(t,t.selection.main.from))return l7(t,s,i)}return null}function HS(t,e){let n=!1;return t.field(FS).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function Qu(t,e){let n=t.sliceString(e,e+2);return n.slice(0,xr(an(n,0)))}function o7(t,e){let n=t.sliceString(e-2,e);return xr(an(n,0))==n.length?n:n.slice(1)}function a7(t,e,n,r){let s=null,i=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:n,from:o.to}],effects:Ys.of(o.to+e.length),range:q.range(o.anchor+e.length,o.head+e.length)};let a=Qu(t.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+n,from:o.head},effects:Ys.of(o.head+e.length),range:q.cursor(o.head+e.length)}:{range:s=o}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function l7(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&Qu(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:q.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function c7(t,e,n,r){let s=r.stringPrefixes||Fa.stringPrefixes,i=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Ys.of(a.to+e.length),range:q.range(a.anchor+e.length,a.head+e.length)};let l=a.head,d=Qu(t.doc,l),u;if(d==e){if(Yb(t,l))return{changes:{insert:e+e,from:l},effects:Ys.of(l+e.length),range:q.cursor(l+e.length)};if(HS(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:q.cursor(l+f.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(u=Xb(t,l-2*e.length,s))>-1&&Yb(t,u))return{changes:{insert:e+e+e+e,from:l},effects:Ys.of(l+e.length),range:q.cursor(l+e.length)};if(t.charCategorizer(l)(d)!=st.Word&&Xb(t,l,s)>-1&&!d7(t,l,e,s))return{changes:{insert:e+e,from:l},effects:Ys.of(l+e.length),range:q.cursor(l+e.length)}}return{range:i=a}});return i?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Yb(t,e){let n=Kt(t).resolveInner(e+1);return n.parent&&n.from==e}function d7(t,e,n,r){let s=Kt(t).resolveInner(e,-1),i=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),l=a.indexOf(n);if(!l||l>-1&&r.indexOf(a.slice(0,l))>-1){let u=s.firstChild;for(;u&&u.from==s.from&&u.to-u.from>n.length+l;){if(t.sliceDoc(u.to-n.length,u.to)==n)return!1;u=u.firstChild}return!0}let d=s.to==e&&s.parent;if(!d)break;s=d}return!1}function Xb(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=st.Word)return e;for(let s of n){let i=e-s.length;if(t.sliceDoc(i,e)==s&&r(t.sliceDoc(i-1,i))!=st.Word)return i}return-1}function u7(t={}){return[QR,ln,Dt.of(t),XR,h7,JR]}const WS=[{key:"Ctrl-Space",run:rf},{mac:"Alt-`",run:rf},{mac:"Alt-i",run:rf},{key:"Escape",run:KR},{key:"ArrowDown",run:zc(!0)},{key:"ArrowUp",run:zc(!1)},{key:"PageDown",run:zc(!0,"page")},{key:"PageUp",run:zc(!1,"page")},{key:"Enter",run:UR}],h7=hi.highest(Hu.computeN([Dt],t=>t.facet(Dt).defaultKeymap?[WS]:[]));class Zb{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class Vs{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let s=r.facet(za).markerFilter;s&&(e=s(e,r));let i=e.slice().sort((p,m)=>p.from-m.from||p.to-m.to),o=new Ur,a=[],l=0,d=r.doc.iter(),u=0,h=r.doc.length;for(let p=0;;){let m=p==i.length?null:i[p];if(!m&&!a.length)break;let x,b;if(a.length)x=l,b=a.reduce((v,w)=>Math.min(v,w.to),m&&m.from>x?m.from:1e8);else{if(x=m.from,x>h)break;b=m.to,a.push(m),p++}for(;p<i.length;){let v=i[p];if(v.from==x&&(v.to>v.from||v.to==x))a.push(v),p++,b=Math.min(v.to,b);else{b=Math.min(v.from,b);break}}b=Math.min(b,h);let y=!1;if(a.some(v=>v.from==x&&(v.to==b||b==h))&&(y=x==b,!y&&b-x<10)){let v=x-(u+d.value.length);v>0&&(d.next(v),u=x);for(let w=x;;){if(w>=b){y=!0;break}if(!d.lineBreak&&u+d.value.length>w)break;w=u+d.value.length,u+=d.value.length,d.next()}}let k=j7(a);if(y)o.add(x,x,je.widget({widget:new w7(k),diagnostics:a.slice()}));else{let v=a.reduce((w,C)=>C.markClass?w+" "+C.markClass:w,"");o.add(x,b,je.mark({class:"cm-lintRange cm-lintRange-"+k+v,diagnostics:a.slice(),inclusiveEnd:a.some(w=>w.to>b)}))}if(l=b,l==h)break;for(let v=0;v<a.length;v++)a[v].to<=l&&a.splice(v--,1)}let f=o.finish();return new Vs(f,n,ao(f))}}function ao(t,e=null,n=0){let r=null;return t.between(n,1e9,(s,i,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new Zb(s,i,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new Zb(r.from,i,r.diagnostic)}}),r}function f7(t,e){let n=e.pos,r=e.end||n,s=t.state.facet(za).hideOn(t,n,r);if(s!=null)return s;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(o=>o.is(US))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function p7(t,e){return t.field(wn,!1)?e:e.concat(Me.appendConfig.of(N7))}const US=Me.define(),Pg=Me.define(),KS=Me.define(),wn=zt.define({create(){return new Vs(je.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,s=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);r=ao(n,t.selected.diagnostic,i)||ao(n,null,i)}!n.size&&s&&e.state.facet(za).autoPanel&&(s=null),t=new Vs(n,s,r)}for(let n of e.effects)if(n.is(US)){let r=e.state.facet(za).autoPanel?n.value.length?Va.open:null:t.panel;t=Vs.init(n.value,r,e.state)}else n.is(Pg)?t=new Vs(t.diagnostics,n.value?Va.open:null,t.selected):n.is(KS)&&(t=new Vs(t.diagnostics,t.panel,n.value));return t},provide:t=>[_a.from(t,e=>e.panel),ae.decorations.from(t,e=>e.diagnostics)]}),m7=je.mark({class:"cm-lintRange cm-lintRange-active"});function g7(t,e,n){let{diagnostics:r}=t.state.field(wn),s,i=-1,o=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(l,d,{spec:u})=>{if(e>=l&&e<=d&&(l==d||(e>l||n>0)&&(e<d||n<0)))return s=u.diagnostics,i=l,o=d,!1});let a=t.state.facet(za).tooltipFilter;return s&&a&&(s=a(s,t.state)),s?{pos:i,end:o,above:t.state.doc.lineAt(i).to<o,create(){return{dom:x7(t,s)}}}:null}function x7(t,e){return Xe("ul",{class:"cm-tooltip-lint"},e.map(n=>qS(t,n,!1)))}const b7=t=>{let e=t.state.field(wn,!1);(!e||!e.panel)&&t.dispatch({effects:p7(t.state,[Pg.of(!0)])});let n=Ra(t,Va.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},Qb=t=>{let e=t.state.field(wn,!1);return!e||!e.panel?!1:(t.dispatch({effects:Pg.of(!1)}),!0)},y7=t=>{let e=t.state.field(wn,!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)},v7=[{key:"Mod-Shift-m",run:b7,preventDefault:!0},{key:"F8",run:y7}],za=pe.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...Er(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Jb,tooltipFilter:Jb,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,s,i)=>e(r,s,i)||n(r,s,i):e:n,autoPanel:(e,n)=>e||n})}}});function Jb(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function GS(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;r<n.length;r++){let s=n[r];if(/[a-zA-Z]/.test(s)&&!e.some(i=>i.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function qS(t,e,n){var r;let s=n?GS(e.actions):[];return Xe("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Xe("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((i,o)=>{let a=!1,l=p=>{if(p.preventDefault(),a)return;a=!0;let m=ao(t.state.field(wn).diagnostics,e);m&&i.apply(t,m.from,m.to)},{name:d}=i,u=s[o]?d.indexOf(s[o]):-1,h=u<0?d:[d.slice(0,u),Xe("u",d.slice(u,u+1)),d.slice(u+1)],f=i.markClass?" "+i.markClass:"";return Xe("button",{type:"button",class:"cm-diagnosticAction"+f,onclick:l,onmousedown:l,"aria-label":` Action: ${d}${u<0?"":` (access key "${s[o]})"`}.`},h)}),e.source&&Xe("div",{class:"cm-diagnosticSource"},e.source))}class w7 extends Dr{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Xe("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class ey{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=qS(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Va{constructor(e){this.view=e,this.items=[];let n=s=>{if(s.keyCode==27)Qb(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],o=GS(i.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==s.keyCode){let l=ao(this.view.state.field(wn).diagnostics,i);l&&i.actions[a].apply(e,l.from,l.to)}}else return;s.preventDefault()},r=s=>{for(let i=0;i<this.items.length;i++)this.items[i].dom.contains(s.target)&&this.moveSelection(i)};this.list=Xe("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=Xe("div",{class:"cm-panel-lint"},this.list,Xe("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Qb(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(wn).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(wn),r=0,s=!1,i=null,o=new Set;for(e.between(0,this.view.state.doc.length,(a,l,{spec:d})=>{for(let u of d.diagnostics){if(o.has(u))continue;o.add(u);let h=-1,f;for(let p=r;p<this.items.length;p++)if(this.items[p].diagnostic==u){h=p;break}h<0?(f=new ey(this.view,u),this.items.splice(r,0,f),s=!0):(f=this.items[h],h>r&&(this.items.splice(r,h-r),s=!0)),n&&f.diagnostic==n.diagnostic?f.dom.hasAttribute("aria-selected")||(f.dom.setAttribute("aria-selected","true"),i=f):f.dom.hasAttribute("aria-selected")&&f.dom.removeAttribute("aria-selected"),r++}});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new ey(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let d=l.height/this.list.offsetHeight;a.top<l.top?this.list.scrollTop-=(l.top-a.top)/d:a.bottom>l.bottom&&(this.list.scrollTop+=(a.bottom-l.bottom)/d)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(wn),r=ao(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:KS.of(r)})}static open(e){return new Va(e)}}function k7(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 Vc(t){return k7(`<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 S7=ae.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:Vc("#d11")},".cm-lintRange-warning":{backgroundImage:Vc("orange")},".cm-lintRange-info":{backgroundImage:Vc("#999")},".cm-lintRange-hint":{backgroundImage:Vc("#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 C7(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function j7(t){let e="hint",n=1;for(let r of t){let s=C7(r.severity);s>n&&(n=s,e=r.severity)}return e}const N7=[wn,ae.decorations.compute([wn],t=>{let{selected:e,panel:n}=t.field(wn);return!e||!n||e.from==e.to?je.none:je.set([m7.range(e.from,e.to)])}),DT(g7,{hideOn:f7}),S7];var ty=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(s7)),e.defaultKeymap!==!1&&(r=r.concat(ZL)),e.searchKeymap!==!1&&(r=r.concat(SR)),e.historyKeymap!==!1&&(r=r.concat(sL)),e.foldKeymap!==!1&&(r=r.concat(m6)),e.completionKeymap!==!1&&(r=r.concat(WS)),e.lintKeymap!==!1&&(r=r.concat(v7));var s=[];return e.lineNumbers!==!1&&s.push(zT()),e.highlightActiveLineGutter!==!1&&s.push(WT()),e.highlightSpecialChars!==!1&&s.push(iT()),e.history!==!1&&s.push(Y6()),e.foldGutter!==!1&&s.push(y6()),e.drawSelection!==!1&&s.push(qA()),e.dropCursor!==!1&&s.push(JA()),e.allowMultipleSelections!==!1&&s.push(Fe.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(i6()),e.syntaxHighlighting!==!1&&s.push(gg(S6,{fallback:!0})),e.bracketMatching!==!1&&s.push(D6()),e.closeBrackets!==!1&&s.push(e7()),e.autocompletion!==!1&&s.push(u7()),e.rectangularSelection!==!1&&s.push(yT()),n!==!1&&s.push(kT()),e.highlightActiveLine!==!1&&s.push(uT()),e.highlightSelectionMatches!==!1&&s.push(sR()),e.tabSize&&typeof e.tabSize=="number"&&s.push(Uu.of(" ".repeat(e.tabSize))),s.concat([Hu.of(r.flat())]).filter(Boolean)};const P7="#e5c07b",ny="#e06c75",O7="#56b6c2",E7="#ffffff",bd="#abb2bf",sm="#7d8799",D7="#61afef",M7="#98c379",ry="#d19a66",A7="#c678dd",T7="#21252b",sy="#2c313a",iy="#282c34",of="#353a42",L7="#3E4451",oy="#528bff",R7=ae.theme({"&":{color:bd,backgroundColor:iy},".cm-content":{caretColor:oy},".cm-cursor, .cm-dropCursor":{borderLeftColor:oy},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:L7},".cm-panels":{backgroundColor:T7,color:bd},".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:iy,color:sm,border:"none"},".cm-activeLineGutter":{backgroundColor:sy},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:of},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:of,borderBottomColor:of},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:sy,color:bd}}},{dark:!0}),_7=wo.define([{tag:W.keyword,color:A7},{tag:[W.name,W.deleted,W.character,W.propertyName,W.macroName],color:ny},{tag:[W.function(W.variableName),W.labelName],color:D7},{tag:[W.color,W.constant(W.name),W.standard(W.name)],color:ry},{tag:[W.definition(W.name),W.separator],color:bd},{tag:[W.typeName,W.className,W.number,W.changed,W.annotation,W.modifier,W.self,W.namespace],color:P7},{tag:[W.operator,W.operatorKeyword,W.url,W.escape,W.regexp,W.link,W.special(W.string)],color:O7},{tag:[W.meta,W.comment],color:sm},{tag:W.strong,fontWeight:"bold"},{tag:W.emphasis,fontStyle:"italic"},{tag:W.strikethrough,textDecoration:"line-through"},{tag:W.link,color:sm,textDecoration:"underline"},{tag:W.heading,fontWeight:"bold",color:ny},{tag:[W.atom,W.bool,W.special(W.variableName)],color:ry},{tag:[W.processingInstruction,W.string,W.inserted],color:M7},{tag:W.invalid,color:E7}]),I7=[R7,gg(_7)];var $7=ae.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),B7=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:s=!1,theme:i="light",placeholder:o="",basicSetup:a=!0}=e,l=[];switch(n&&l.unshift(Hu.of([QL])),a&&(typeof a=="boolean"?l.unshift(ty()):l.unshift(ty(a))),o&&l.unshift(mT(o)),i){case"light":l.push($7);break;case"dark":l.push(I7);break;case"none":break;default:l.push(i);break}return r===!1&&l.push(ae.editable.of(!1)),s&&l.push(Fe.readOnly.of(!0)),[...l]},F7=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 z7{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 ay{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 af=null,V7=()=>typeof window>"u"?new ay:(af||(af=new ay),af),ly=Or.define(),H7=200,W7=[];function U7(t){var{value:e,selection:n,onChange:r,onStatistics:s,onCreateEditor:i,onUpdate:o,extensions:a=W7,autoFocus:l,theme:d="light",height:u=null,minHeight:h=null,maxHeight:f=null,width:p=null,minWidth:m=null,maxWidth:x=null,placeholder:b="",editable:y=!0,readOnly:k=!1,indentWithTab:v=!0,basicSetup:w=!0,root:C,initialState:j}=t,[S,P]=g.useState(),[D,A]=g.useState(),[N,T]=g.useState(),I=g.useState(()=>({current:null}))[0],O=g.useState(()=>({current:null}))[0],E=ae.theme({"&":{height:u,minHeight:h,maxHeight:f,width:p,minWidth:m,maxWidth:x},"& .cm-scroller":{height:"100% !important"}}),M=ae.updateListener.of($=>{if($.docChanged&&typeof r=="function"&&!$.transactions.some(V=>V.annotation(ly))){I.current?I.current.reset():(I.current=new z7(()=>{if(O.current){var V=O.current;O.current=null,V()}I.current=null},H7),V7().add(I.current));var F=$.state.doc,z=F.toString();r(z,$)}s&&s(F7($))}),R=B7({theme:d,editable:y,readOnly:k,placeholder:b,indentWithTab:v,basicSetup:w}),_=[M,E,...R];return o&&typeof o=="function"&&_.push(ae.updateListener.of(o)),_=_.concat(a),g.useLayoutEffect(()=>{if(S&&!N){var $={doc:e,selection:n,extensions:_},F=j?Fe.fromJSON(j.json,$,j.fields):Fe.create($);if(T(F),!D){var z=new ae({state:F,parent:S,root:C});A(z),i&&i(z,F)}}return()=>{D&&(T(void 0),A(void 0))}},[S,N]),g.useEffect(()=>{t.container&&P(t.container)},[t.container]),g.useEffect(()=>()=>{D&&(D.destroy(),A(void 0)),I.current&&(I.current.cancel(),I.current=null)},[D]),g.useEffect(()=>{l&&D&&D.focus()},[l,D]),g.useEffect(()=>{D&&D.dispatch({effects:Me.reconfigure.of(_)})},[d,a,u,h,f,p,m,x,b,y,k,v,w,r,o]),g.useEffect(()=>{if(e!==void 0){var $=D?D.state.doc.toString():"";if(D&&e!==$){var F=I.current&&!I.current.isDone,z=()=>{D&&e!==D.state.doc.toString()&&D.dispatch({changes:{from:0,to:D.state.doc.toString().length,insert:e||""},annotations:[ly.of(!0)]})};F?O.current=z:z()}}},[e,D]),{state:N,setState:T,view:D,setView:A,container:S,setContainer:P}}var K7=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],YS=g.forwardRef((t,e)=>{var{className:n,value:r="",selection:s,extensions:i=[],onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:d,autoFocus:u,theme:h="light",height:f,minHeight:p,maxHeight:m,width:x,minWidth:b,maxWidth:y,basicSetup:k,placeholder:v,indentWithTab:w,editable:C,readOnly:j,root:S,initialState:P}=t,D=B6(t,K7),A=g.useRef(null),{state:N,view:T,container:I,setContainer:O}=U7({root:S,value:r,autoFocus:u,theme:h,height:f,minHeight:p,maxHeight:m,width:x,minWidth:b,maxWidth:y,basicSetup:k,placeholder:v,indentWithTab:w,editable:C,readOnly:j,selection:s,onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:d,extensions:i,initialState:P});g.useImperativeHandle(e,()=>({editor:A.current,state:N,view:T}),[A,I,N,T]);var E=g.useCallback(R=>{A.current=R,O(R)},[O]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var M=typeof h=="string"?"cm-theme-"+h:"cm-theme";return c.jsx("div",Zp({ref:E,className:""+M+(n?" "+n:"")},D))});YS.displayName="CodeMirror";const G7=()=>{const t=ae.theme({"&":{backgroundColor:"var(--dash-surface)",color:"var(--dash-text)",height:"100%"},".cm-editor":{height:"100% !important"},".cm-content":{color:"var(--dash-text)",caretColor:"var(--dash-accent)",fontFamily:"'JetBrains Mono', Menlo, monospace",padding:"1rem"},".cm-line":{color:"var(--dash-text)"},".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=wo.define([{tag:W.propertyName,color:"var(--dash-accent)"},{tag:W.string,color:"color-mix(in srgb, var(--dash-accent) 70%, var(--dash-text))"},{tag:W.number,color:"var(--dash-accent-hover)"},{tag:W.bool,color:"var(--dash-accent-hover)"},{tag:W.null,color:"var(--dash-text-muted)"},{tag:W.punctuation,color:"var(--dash-text-secondary)"},{tag:W.brace,color:"var(--dash-text-secondary)"},{tag:W.bracket,color:"var(--dash-text-secondary)"}]);return[t,gg(e)]},q7=({value:t,onChange:e,onCursorLineChange:n,onEditorFocus:r,height:s="100%",readOnly:i=!1,className:o})=>{const a=g.useMemo(()=>[$6(),ae.lineWrapping,...G7()],[]),l=g.useMemo(()=>{if(n)return d=>{const u=d.state.selection.main.head,h=d.view.state.doc.lineAt(u).number-1;n(h)}},[n]);return c.jsx("div",{className:`h-full [&_.cm-editor]:h-full [&_.cm-editor]:outline-none [&_.cm-focused]:outline-none ${o??""}`.trim(),children:c.jsx(YS,{value:t,height:s,extensions:a,onChange:e,onFocus:r,onUpdate:l,theme:"none",readOnly:i,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightActiveLine:!0,foldGutter:!1,dropCursor:!0,drawSelection:!1,allowMultipleSelections:!1,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!1,rectangularSelection:!1,crosshairCursor:!1,highlightSelectionMatches:!0}})})},Og=({width:t,isLoading:e,jsonText:n,cursorLine:r,syntaxError:s,onChange:i,onEditorFocus:o,onCursorLineChange:a,readOnly:l=!1,headerTitle:d,headerPath:u,headerActions:h})=>{const{t:f}=ee(),p=m=>{if(l||!m.target.closest(".cm-editor"))return;const b=m.currentTarget;b.scrollHeight<=b.clientHeight||(b.scrollTop+=m.deltaY)};return c.jsxs("div",{style:{width:`${t}%`},className:"bg-dash-surface border border-dash-border rounded-xl overflow-hidden flex flex-col shadow-sm min-w-0 h-full",children:[c.jsx("div",{className:"p-3 border-b border-dash-border bg-dash-surface-hover/50 shrink-0",children:c.jsxs("div",{className:"flex items-end justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("h3",{className:"text-xs font-bold text-dash-text-secondary uppercase tracking-widest",children:d??f("jsonTab")}),u&&c.jsx("p",{className:"mt-1 mono text-[11px] text-dash-text-muted truncate",children:u})]}),h&&c.jsx("div",{className:"flex items-center gap-2 shrink-0",children:h})]})}),c.jsx("div",{className:"flex-1 min-h-0 overflow-auto",onWheelCapture:p,children:e?c.jsx("div",{className:"h-full flex items-center justify-center",children:c.jsx("div",{className:"animate-pulse text-dash-text-muted text-sm",children:f("loading")})}):l?c.jsx("pre",{className:"h-full overflow-auto p-4 font-mono text-xs leading-4 text-dash-text whitespace-pre m-0",children:n}):c.jsx(q7,{value:n,onChange:i,onEditorFocus:o,onCursorLineChange:a,readOnly:l,className:"[&_.cm-content]:text-xs [&_.cm-content]:leading-4 [&_.cm-gutters]:text-xs [&_.cm-gutters]:leading-4"})}),c.jsxs("div",{className:"px-4 py-2 bg-dash-surface-hover/30 border-t border-dash-border text-[10px] text-dash-text-muted flex justify-between uppercase tracking-widest font-bold",children:[c.jsxs("div",{className:"flex gap-4",children:[c.jsx("span",{children:"UTF-8"}),c.jsx("span",{children:"JSON"}),c.jsxs("span",{children:["L:",r+1]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[l&&c.jsx("span",{children:f("readOnly")}),s?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),c.jsx("span",{className:"text-red-500 normal-case",children:s})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-dash-accent"}),f("syntaxValid")]})]})]})]})},cy=({label:t,value:e})=>c.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 bg-dash-bg border border-dash-border rounded-md",children:[c.jsxs("span",{className:"text-[9px] font-bold text-dash-text-muted uppercase",children:[t,":"]}),c.jsx("span",{className:"text-[10px] mono font-bold text-dash-text-secondary",children:e})]}),XS=({width:t,fieldDoc:e,activeFieldPath:n,extraContent:r,overrideBadge:s})=>{const{t:i,lang:o}=ee(),a=e??(n?Fw[n]??{path:n,type:"unknown",default:"n/a",description:"Help is being resolved for this field. Try editing the value or switching to the JSON view for schema-based details.",descriptionVi:"Đang tải trợ giúp cho trường này. Hãy thử chỉnh sửa giá trị hoặc chuyển sang chế độ JSON để xem mô tả suy ra từ schema."}:null);return c.jsxs("div",{style:{width:`${t}%`},className:"bg-dash-surface border border-dash-border rounded-xl flex flex-col shadow-sm overflow-hidden min-w-0",children:[c.jsx("div",{className:"p-3 border-b border-dash-border bg-dash-surface-hover/50 shrink-0",children:c.jsx("h3",{className:"text-xs font-bold text-dash-text-secondary uppercase tracking-widest",children:i("configurationHelp")})}),c.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:a?c.jsxs("div",{className:"space-y-5 animate-in fade-in duration-500",children:[c.jsxs("header",{children:[c.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[c.jsx("span",{className:"text-[10px] bg-dash-accent-subtle text-dash-accent px-1.5 py-0.5 rounded font-mono uppercase font-bold",children:i("field")}),c.jsx("h2",{className:"text-base font-bold text-dash-text mono break-all",children:a.path}),s]}),c.jsxs("div",{className:"flex flex-wrap gap-2 mt-2",children:[c.jsx(cy,{label:i("type"),value:a.type}),c.jsx(cy,{label:i("default"),value:a.default})]})]}),c.jsxs("section",{children:[c.jsx("h4",{className:"text-[10px] font-bold text-dash-text-muted uppercase tracking-widest mb-2",children:i("description")}),c.jsx("p",{className:"text-sm text-dash-text-secondary leading-relaxed italic",children:o==="vi"?a.descriptionVi:a.description})]}),a.validValues&&c.jsxs("section",{children:[c.jsx("h4",{className:"text-[10px] font-bold text-dash-text-muted uppercase tracking-widest mb-2",children:i("validValues")}),c.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.validValues.map(l=>c.jsx("span",{className:"px-2 py-0.5 bg-dash-bg border border-dash-border rounded text-[11px] mono text-dash-text",children:l},l))})]}),a.effect&&c.jsxs("section",{className:"bg-dash-accent-subtle/30 p-3 rounded-lg border border-dash-accent/10",children:[c.jsx("h4",{className:"text-[10px] font-bold text-dash-accent uppercase tracking-widest mb-1",children:i("systemEffect")}),c.jsx("p",{className:"text-[12px] text-dash-text-secondary leading-normal",children:o==="vi"&&a.effectVi?a.effectVi:a.effect})]}),a.example&&c.jsxs("section",{children:[c.jsx("h4",{className:"text-[10px] font-bold text-dash-text-muted uppercase tracking-widest mb-2",children:i("exampleUsage")}),c.jsx("div",{className:"bg-dash-bg p-3 rounded-lg border border-dash-border overflow-hidden",children:c.jsx("pre",{className:"text-[11px] mono text-dash-text-secondary whitespace-pre overflow-x-auto",children:a.example})})]}),r]}):c.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center opacity-40 space-y-4",children:[c.jsx("div",{className:"w-10 h-10 rounded-full bg-dash-bg border border-dash-border flex items-center justify-center text-lg",children:"?"}),c.jsxs("div",{className:"max-w-[180px]",children:[c.jsx("p",{className:"text-sm font-bold text-dash-text mb-1 italic",children:i("knowledgeBase")}),c.jsx("p",{className:"text-xs text-dash-text-secondary",children:i("clickToSeeHelp")})]})]})}),a&&c.jsx("div",{className:"p-3 bg-dash-surface-hover/20 border-t border-dash-border shrink-0",children:c.jsxs("p",{className:"text-[10px] text-dash-text-muted font-medium flex items-center gap-1.5 italic",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),i("extractedFrom")]})})]})},Y7=({variant:t="development"})=>{const{t:e}=ee(),n={development:e("developmentFeature"),beta:e("betaFeature"),experimental:e("experimentalFeature")};return c.jsx("span",{className:"text-[9px] bg-orange-500/10 text-orange-500 px-2 py-0.5 rounded-full font-bold border border-orange-500/30 uppercase tracking-wider",children:n[t]})},dy={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"}}},X7={codex:"Codex","gemini-cli":"Gemini CLI"},uy=["heavy","balanced","light"];function hy(t,e){return e.split(".").reduce((n,r)=>{if(n!=null&&typeof n=="object"&&r in n)return n[r]},t)}const fy="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",Z7=({config:t,onChange:e})=>{const{t:n}=ee(),[r,s]=g.useState(!1),i=(l,d,u,h)=>{const f=`modelTaxonomy.${l}.${d}.${u}`;e(f,h===""?void 0:h)},o=l=>{for(const d of uy)e(`modelTaxonomy.${l}.${d}.model`,void 0),dy[l]?.[d]?.effort!==void 0&&e(`modelTaxonomy.${l}.${d}.effort`,void 0)},a=l=>n(l==="heavy"?"taxonomyTierHeavy":l==="balanced"?"taxonomyTierBalanced":"taxonomyTierLight");return c.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-lg overflow-hidden flex flex-col h-full",children:[c.jsxs("button",{type:"button",onClick:()=>s(!r),className:"w-full flex items-center justify-between px-4 py-3 bg-dash-surface-hover/30 hover:bg-dash-surface-hover/50 transition-colors","aria-expanded":!r,"aria-controls":"section-model-taxonomy",children:[c.jsx("h3",{className:"text-sm font-bold text-dash-text uppercase tracking-wider",children:n("sectionModelTaxonomy")}),c.jsx("svg",{className:`w-4 h-4 text-dash-text-muted transition-transform duration-200 ${r?"":"rotate-180"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),!r&&c.jsx("div",{id:"section-model-taxonomy",className:"flex-1 overflow-y-auto min-h-0",children:c.jsxs("div",{className:"px-4 py-3 space-y-4",children:[c.jsx("p",{className:"text-xs text-dash-text-secondary",children:n("taxonomyDescription")}),Object.entries(dy).map(([l,d])=>{const u=Object.values(d).some(h=>h.effort!==void 0);return c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"text-xs font-semibold text-dash-text uppercase tracking-wider",children:X7[l]??l}),c.jsx("button",{type:"button",onClick:()=>o(l),className:"text-xs text-dash-text-muted hover:text-dash-text px-2 py-0.5 rounded border border-dash-border hover:border-dash-accent transition-colors",children:n("taxonomyResetProvider")})]}),c.jsx("div",{className:"overflow-hidden rounded border border-dash-border",children:c.jsxs("table",{className:"w-full text-xs",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"bg-dash-surface-hover/40 border-b border-dash-border",children:[c.jsx("th",{className:"text-left px-3 py-2 text-dash-text-secondary font-medium w-1/4",children:n("taxonomyTier")}),c.jsx("th",{className:"text-left px-3 py-2 text-dash-text-secondary font-medium",children:n("taxonomyModel")}),u&&c.jsx("th",{className:"text-left px-3 py-2 text-dash-text-secondary font-medium w-1/4",children:n("taxonomyEffort")})]})}),c.jsx("tbody",{children:uy.map(h=>{const f=d[h],p=hy(t,`modelTaxonomy.${l}.${h}.model`),m=hy(t,`modelTaxonomy.${l}.${h}.effort`);return c.jsxs("tr",{className:"border-b border-dash-border last:border-0",children:[c.jsx("td",{className:"px-3 py-2 text-dash-text-secondary",children:a(h)}),c.jsx("td",{className:"px-3 py-2",children:c.jsx("input",{type:"text",className:fy,placeholder:f?.model??"",value:p??"",onChange:x=>i(l,h,"model",x.target.value)})}),u&&c.jsx("td",{className:"px-3 py-2",children:f?.effort!==void 0?c.jsx("input",{type:"text",className:fy,placeholder:f.effort,value:m??"",onChange:x=>i(l,h,"effort",x.target.value)}):null})]},h)})})]})})]},l)})]})})]})},Q7=(t,e)=>{const[n,r]=g.useState(null);return g.useEffect(()=>{const s=t.split(`
|
|
271
|
+
`),i=[];let o=null;for(let a=0;a<=Math.min(e,s.length-1);a++){const l=s[a].trim(),d=l.match(/"([^"]+)"\s*:\s*{/);if(d){i.push(d[1]),a===e&&(o=i.join("."));continue}if(l==="}"||l==="},"){i.pop();continue}const u=l.match(/"([^"]+)"\s*:/);if(u){const h=u[1];if(a===e){o=i.length>0?`${i.join(".")}.${h}`:h;break}}}r(o)},[t,e]),n};function ZS(t){const{scope:e,fetchConfig:n,fetchSchema:r,saveConfig:s,onReset:i}=t,[o,a]=g.useState("{}"),[l,d]=g.useState(0),[u,h]=g.useState(null),[f,p]=g.useState(null),[m,x]=g.useState({}),[b,y]=g.useState({}),[k,v]=g.useState({}),[w,C]=g.useState(!0),[j,S]=g.useState(null),[P,D]=g.useState("idle"),[A,N]=g.useState(!1),[T,I]=g.useState(null),[O,E]=g.useState(null),M=Q7(o,l),R=fE(O,M),_=g.useMemo(()=>hE(R,f),[R,f]);g.useEffect(()=>{(async()=>{S(null);try{const[Q,se]=await Promise.all([n(),r()]),ce=Q.local??Q.config;x(ce),y(Q.global??{}),v(Q.sources),p(se),a(JSON.stringify(ce,null,2))}catch(Q){const se=Q instanceof Error?Q.message:String(Q);console.error("Failed to load config data:",Q),S(se)}finally{C(!1)}})()},[n,r]),g.useEffect(()=>{try{JSON.parse(o),h(null)}catch(U){h(U instanceof Error?U.message:"Invalid JSON")}},[o]),g.useEffect(()=>{if(T==="json")try{const U=JSON.parse(o);x(U)}catch{}},[o,T]);const $=g.useCallback(U=>{E(null),I("json"),a(U)},[]),F=g.useCallback(()=>{E(null)},[]),z=g.useCallback((U,Q)=>{E(U),I("form"),x(se=>{const ce=zw(se,U,Q);return a(JSON.stringify(ce,null,2)),ce}),v(se=>({...se,[U]:e}))},[e]),V=g.useCallback(async()=>{if(!u){D("saving");try{const U=JSON.parse(o),se=await s(U)??U;x(se),a(JSON.stringify(se,null,2)),D("saved"),setTimeout(()=>D("idle"),2e3)}catch{D("error"),setTimeout(()=>D("idle"),3e3)}}},[o,u,s]),Z=g.useCallback(async()=>{if(N(!1),i){C(!0);try{const U=await i(),Q=U.local??U.config;x(Q),v(U.sources),a(JSON.stringify(Q,null,2))}catch(U){console.error("Failed to reset:",U)}finally{C(!1)}}else{const U={};x(U),a(JSON.stringify(U,null,2))}},[i]);return{jsonText:o,config:m,globalConfig:b,sources:k,schema:f,isLoading:w,loadError:j,saveStatus:P,syntaxError:u,cursorLine:l,showResetConfirm:A,activeFieldPath:R,fieldDoc:_,handleJsonChange:$,handleJsonEditorFocus:F,handleFormChange:z,handleSave:V,handleReset:Z,setCursorLine:d,setFocusedFieldPath:E,setShowResetConfirm:N}}function Eg({storageKey:t,defaultSizes:e,minSizes:n}){const[r,s]=g.useState(()=>{if(typeof window>"u")return e;const d=localStorage.getItem(t);if(d)try{const u=JSON.parse(d);if(Array.isArray(u)&&u.length===e.length){const h=u.reduce((f,p)=>f+p,0);if(Math.abs(h-100)<1)return u}}catch{}return e}),[i,o]=g.useState(!1);g.useEffect(()=>{localStorage.setItem(t,JSON.stringify(r))},[r,t]);const a=g.useCallback((d,u)=>{u.preventDefault(),o(!0);let h=u.currentTarget.parentElement;for(;h&&getComputedStyle(h).display!=="flex";)h=h.parentElement;if(!h)return;const p=h.getBoundingClientRect().width,m=u.clientX,x=[...r],b=k=>{const w=(k.clientX-m)/p*100,C=[...x],j=d,S=d+1;let P=x[j]+w,D=x[S]-w;P<n[j]&&(P=n[j],D=x[j]+x[S]-P),D<n[S]&&(D=n[S],P=x[j]+x[S]-D),C[j]=P,C[S]=D,s(C)},y=()=>{o(!1),document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",y),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",b),document.addEventListener("mouseup",y),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[r,n]),l=g.useCallback(()=>{s(e)},[e]);return{sizes:r,isDragging:i,startDrag:a,reset:l}}function J7(t,e,n,r){const[s,i]=g.useState(()=>{if(typeof window>"u")return e;const d=localStorage.getItem(t);if(d){const u=Number.parseFloat(d);if(!Number.isNaN(u)&&u>=n&&u<=100-r)return u}return e}),[o,a]=g.useState(!1),l=g.useCallback(d=>{d.preventDefault(),a(!0);const u=d.target.closest("[data-vresize-container]");if(!u)return;const h=p=>{const m=u.getBoundingClientRect(),x=(p.clientY-m.top)/m.height*100;i(Math.max(n,Math.min(100-r,x)))},f=()=>{a(!1),document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",f),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",h),document.addEventListener("mouseup",f),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[n,r]);return g.useEffect(()=>{localStorage.setItem(t,String(s))},[t,s]),{topPct:s,isDragging:o,startDrag:l}}const e8=()=>{const{t}=ee(),e=Ft(),{sizes:n,isDragging:r,startDrag:s}=Eg({storageKey:"claudekit-global-config-panels",defaultSizes:[35,40,25],minSizes:[20,25,15]}),i=J7("claudekit-form-taxonomy-split",70,25,15),o=g.useCallback(async()=>await ux(),[]),a=g.useCallback(async f=>{await Ww({scope:"global",config:f})},[]),l=g.useCallback(async()=>await ux(),[]),d=ZS({scope:"global",fetchConfig:o,fetchSchema:Uw,saveConfig:a,onReset:l}),u=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")},{path:"paths.globalPlans",label:t("fieldGlobalPlansPath"),description:t("fieldGlobalPlansPathDesc")}]},{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.simplify-gate",label:t("fieldHookSimplifyGate"),description:t("fieldHookSimplifyGateDesc")}]},{id:"simplify",title:t("sectionSimplify"),defaultCollapsed:!0,fields:[{path:"simplify.threshold.locDelta",label:t("fieldSimplifyThresholdLocDelta"),description:t("fieldSimplifyThresholdLocDeltaDesc")},{path:"simplify.threshold.fileCount",label:t("fieldSimplifyThresholdFileCount"),description:t("fieldSimplifyThresholdFileCountDesc")},{path:"simplify.threshold.singleFileLoc",label:t("fieldSimplifyThresholdSingleFileLoc"),description:t("fieldSimplifyThresholdSingleFileLocDesc")},{path:"simplify.gate.enabled",label:t("fieldSimplifyGateEnabled"),description:t("fieldSimplifyGateEnabledDesc")},{path:"simplify.gate.hardVerbs",label:t("fieldSimplifyGateHardVerbs"),description:t("fieldSimplifyGateHardVerbsDesc")},{path:"simplify.gate.softVerbs",label:t("fieldSimplifyGateSoftVerbs"),description:t("fieldSimplifyGateSoftVerbsDesc")}]},{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]),h=d.showResetConfirm?c.jsxs("div",{className:"flex items-center gap-2 bg-red-500/10 border border-red-500/30 rounded-lg px-2 py-1 animate-in fade-in duration-200",children:[c.jsx("span",{className:"text-xs text-red-500 font-medium",children:t("confirmReset")}),c.jsx("button",{type:"button",onClick:d.handleReset,className:"px-2 py-0.5 rounded bg-red-500 text-white text-xs font-bold hover:bg-red-600 transition-colors",children:t("confirm")}),c.jsx("button",{type:"button",onClick:()=>d.setShowResetConfirm(!1),className:"px-2 py-0.5 rounded bg-dash-surface text-dash-text-secondary text-xs font-bold hover:bg-dash-surface-hover transition-colors border border-dash-border",children:t("cancel")})]}):c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>d.setShowResetConfirm(!0),className:"px-3 py-1.5 rounded-lg bg-dash-surface text-xs font-bold text-dash-text-secondary hover:bg-dash-surface-hover transition-colors border border-dash-border",children:t("resetToDefault")}),c.jsx("button",{type:"button",onClick:d.handleSave,disabled:!!d.syntaxError||d.saveStatus==="saving",className:`px-3 py-1.5 rounded-lg text-xs font-bold transition-all tracking-widest uppercase ${d.syntaxError?"bg-dash-surface text-dash-text-muted cursor-not-allowed border border-dash-border":d.saveStatus==="saved"?"bg-green-500 text-white shadow-lg shadow-green-500/20":d.saveStatus==="error"?"bg-red-500 text-white":"bg-dash-accent text-dash-bg hover:bg-dash-accent-hover shadow-lg shadow-dash-accent/20"}`,children:d.saveStatus==="saving"?t("saving"):d.saveStatus==="saved"?t("saved"):d.saveStatus==="error"?t("saveFailed"):t("saveChanges")})]});return c.jsxs("div",{className:"animate-in fade-in duration-300 w-full h-full flex flex-col transition-colors",children:[c.jsx(ek,{title:t("globalConfig"),filePath:"~/.claude/.ck.json",onBack:()=>e(-1),onSave:d.handleSave,onReset:d.handleReset,saveStatus:d.saveStatus,syntaxError:d.syntaxError,showResetConfirm:d.showResetConfirm,setShowResetConfirm:d.setShowResetConfirm,showActions:!1,showFilePath:!1}),!d.isLoading&&d.loadError&&c.jsxs("div",{className:"mx-4 mt-2 px-3 py-2 rounded-lg bg-red-500/10 border border-red-500/30 text-xs text-red-500",children:[c.jsx("p",{className:"font-medium",children:t("configLoadFailed")}),c.jsxs("p",{className:"mt-1 break-words",children:[t("configLoadFailedDetail")," ",d.loadError]})]}),c.jsx("div",{className:"flex-1 flex min-h-0",children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{"data-vresize-container":!0,style:{width:`${n[0]}%`},className:"flex flex-col min-w-0 min-h-0",children:[c.jsx("div",{style:{height:`${d.isLoading?100:i.topPct}%`},className:"min-h-0",children:c.jsx(tk,{width:100,isLoading:d.isLoading,schema:d.schema,config:d.config,sources:d.sources,sections:u,onChange:d.handleFormChange})}),!d.isLoading&&c.jsxs(c.Fragment,{children:[c.jsx(_n,{direction:"vertical",isDragging:i.isDragging,onMouseDown:i.startDrag}),c.jsx("div",{style:{height:`${100-i.topPct}%`},className:"min-h-0",children:c.jsx(Z7,{config:d.config,onChange:d.handleFormChange})})]})]}),c.jsx(_n,{direction:"horizontal",isDragging:r,onMouseDown:f=>s(0,f)}),c.jsx(Og,{width:n[1],isLoading:d.isLoading,jsonText:d.jsonText,cursorLine:d.cursorLine,syntaxError:d.syntaxError,onChange:d.handleJsonChange,onCursorLineChange:d.setCursorLine,headerPath:"~/.claude/.ck.json",headerActions:h}),c.jsx(_n,{direction:"horizontal",isDragging:r,onMouseDown:f=>s(1,f)}),c.jsx(XS,{width:n[2],fieldDoc:d.fieldDoc,activeFieldPath:d.activeFieldPath})]})})]})};function t8(t){const e=t.replace(/\\/g,"/"),n=e.split("/").filter(Boolean);return n.length<3?null:`${e.startsWith("/")?"/":""}${n.slice(0,-2).join("/")}`}function n8(){const[t]=Hl(),e=t.get("projectId"),n=t.get("file"),r=n?t8(n):null,s=new URLSearchParams;return r&&(s.set("dir",r),s.set("view","kanban"),e&&s.set("projectId",e)),c.jsx(gw,{replace:!0,to:r?`/plans?${s.toString()}`:"/plans"})}function r8(){const[t,e]=g.useState([]),[n,r]=g.useState(!0),[s,i]=g.useState(null),o=g.useCallback(async()=>{try{if(r(!0),i(null),nt()){const d=await gP();e(d.map(u=>({name:u.name,command:u.command,args:u.args,source:u.source,sourceLabel:u.sourceLabel})));return}const a=await fetch("/api/mcp-servers");if(!a.ok)throw new Error(`Failed to fetch MCP servers: ${a.status}`);const l=await a.json();e(l.servers??[])}catch(a){i(a instanceof Error?a.message:"Failed to load MCP servers"),e([])}finally{r(!1)}},[]);return g.useEffect(()=>{o()},[o]),{servers:t,loading:n,error:s,reload:o}}function s8(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3.5 h-3.5 shrink-0 text-dash-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 12h14M12 5l7 7-7 7"})})}function i8({label:t,count:e}){return c.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[c.jsx("span",{className:"text-xs font-bold text-dash-text-muted uppercase tracking-wider flex-1",children:t}),c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold",children:e})]})}function o8({server:t,selected:e,onClick:n}){return c.jsxs("button",{type:"button",onClick:n,className:["w-full flex items-start gap-2 px-3 py-2 rounded-md transition-colors text-left group",e?"bg-dash-accent/10 border border-dash-accent/30":"hover:bg-dash-surface-hover border border-transparent"].join(" "),children:[c.jsx(s8,{}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:"text-sm font-semibold text-dash-accent font-mono",children:t.name}),c.jsx("p",{className:"text-xs text-dash-text-muted mt-0.5 truncate font-mono",children:t.command})]})]})}function a8({server:t}){const{t:e}=ee();return c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("h2",{className:"text-base font-semibold text-dash-text font-mono truncate flex-1",children:t.name}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:e("sessionReadOnly")})]}),c.jsx("div",{className:"flex items-center gap-2 text-xs text-dash-text-muted",children:c.jsx("span",{className:"font-mono px-2 py-0.5 rounded bg-dash-surface border border-dash-border text-dash-accent",children:t.sourceLabel})}),c.jsx("div",{className:"rounded-lg border border-dash-border bg-dash-surface p-5 overflow-x-auto",children:c.jsx("table",{className:"w-full text-sm",children:c.jsxs("tbody",{children:[c.jsxs("tr",{className:"border-b border-dash-border",children:[c.jsx("td",{className:"py-2 pr-4 font-mono text-xs text-dash-text-muted w-28 shrink-0 align-top",children:e("mcpCommand")}),c.jsx("td",{className:"py-2 font-mono text-xs text-dash-text break-all",children:t.command})]}),t.args.length>0&&c.jsxs("tr",{className:"border-b border-dash-border",children:[c.jsx("td",{className:"py-2 pr-4 font-mono text-xs text-dash-text-muted w-28 align-top",children:e("mcpArgs")}),c.jsx("td",{className:"py-2 text-xs text-dash-text",children:c.jsx("div",{className:"flex flex-col gap-1",children:t.args.map((n,r)=>c.jsx("code",{className:"font-mono bg-dash-surface border border-dash-border rounded px-1.5 py-0.5 text-[11px] break-all",children:n},r))})})]}),t.env&&Object.keys(t.env).length>0&&c.jsxs("tr",{className:"border-b border-dash-border",children:[c.jsx("td",{className:"py-2 pr-4 font-mono text-xs text-dash-text-muted w-28 align-top",children:"env"}),c.jsx("td",{className:"py-2 text-xs text-dash-text",children:c.jsx("div",{className:"flex flex-col gap-1",children:Object.keys(t.env).map(n=>c.jsxs("code",{className:"font-mono bg-dash-surface border border-dash-border rounded px-1.5 py-0.5 text-[11px]",children:[n,"=",c.jsx("span",{className:"text-dash-text-muted",children:"***"})]},n))})})]}),c.jsxs("tr",{children:[c.jsx("td",{className:"py-2 pr-4 font-mono text-xs text-dash-text-muted w-28 align-top",children:e("mcpSource")}),c.jsx("td",{className:"py-2 text-xs text-dash-text font-mono",children:t.sourceLabel})]})]})})})]})}const l8=({message:t})=>c.jsx("div",{className:"flex items-center justify-center h-full text-sm text-dash-text-muted",children:t}),c8=()=>{const{t}=ee(),{servers:e,loading:n,error:r}=r8(),[s,i]=g.useState(""),[o,a]=g.useState(null),{size:l,isDragging:d,startDrag:u}=yo({storageKey:"ck-mcp-panel-width",defaultSize:380,minSize:260,maxSize:650}),h=x=>`${x.source}-${x.name}`,f=e.find(x=>h(x)===o)??null,p=g.useMemo(()=>{if(!s.trim())return e;const x=s.toLowerCase();return e.filter(b=>b.name.toLowerCase().includes(x)||b.command.toLowerCase().includes(x)||b.sourceLabel.toLowerCase().includes(x))},[e,s]),m=g.useMemo(()=>{const x=new Map;for(const b of p){const y=x.get(b.sourceLabel)??[];y.push(b),x.set(b.sourceLabel,y)}return x},[p]);return c.jsxs("div",{className:"flex h-full overflow-hidden",children:[c.jsxs("div",{style:{width:`${l}px`},className:"shrink-0 flex flex-col overflow-hidden border-r border-dash-border",children:[c.jsxs("div",{className:"shrink-0 px-4 pt-4 pb-3 border-b border-dash-border",children:[c.jsxs("div",{className:"flex items-start justify-between mb-3",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-base font-bold text-dash-text",children:t("mcpTitle")}),!n&&!r&&c.jsx("p",{className:"text-xs text-dash-text-muted mt-0.5",children:e.length===0?t("mcpNoServers"):`${e.length} ${e.length===1?"server":"servers"} configured`}),c.jsx("p",{className:"text-[11px] text-dash-text-muted font-mono mt-0.5",children:"~/.claude.json + settings.json + .mcp.json"})]}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:t("sessionReadOnly")})]}),c.jsxs("div",{className:"relative",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-dash-text-muted pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),c.jsx("input",{type:"text",value:s,onChange:x=>i(x.target.value),placeholder:t("mcpServerName"),className:"w-full pl-9 pr-4 py-2 text-sm bg-dash-surface border border-dash-border rounded-lg text-dash-text placeholder:text-dash-text-muted focus:outline-none focus:border-dash-accent/50 transition-colors"}),s&&c.jsx("button",{type:"button",onClick:()=>i(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-dash-text-muted hover:text-dash-text transition-colors",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-2 py-2",children:[n&&c.jsx("div",{className:"flex flex-1 items-center justify-center text-dash-text-muted text-sm p-8",children:t("loading")}),!n&&r&&c.jsx("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm m-2",children:r}),!n&&!r&&m.size===0&&c.jsx("div",{className:"flex items-center justify-center p-8 text-dash-text-muted text-sm",children:t("mcpNoServers")}),!n&&!r&&m.size>0&&c.jsx("div",{className:"flex flex-col gap-2 pb-4",children:Array.from(m.entries()).map(([x,b])=>c.jsxs("div",{children:[m.size>1&&c.jsx(i8,{label:x,count:b.length}),c.jsx("div",{className:"space-y-0.5",children:b.map(y=>{const k=h(y);return c.jsx(o8,{server:y,selected:o===k,onClick:()=>a(k)},k)})})]},x))})]})]}),c.jsx(_n,{onMouseDown:u,isDragging:d,direction:"horizontal"}),c.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:f?c.jsx(a8,{server:f}):c.jsx(l8,{message:t("selectToView")})})]})},Ju=({titleKey:t,descriptionKey:e,commandHintKey:n})=>{const{t:r}=ee();return c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsxs("div",{className:"max-w-xl rounded-2xl border border-dash-border bg-dash-surface p-8 text-center shadow-sm",children:[c.jsx("p",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-dash-accent",children:r("desktopModeLabel")}),c.jsx("h2",{className:"mt-3 text-xl font-semibold text-dash-text",children:r(t)}),c.jsx("p",{className:"mt-3 text-sm leading-relaxed text-dash-text-muted",children:r(e)}),n&&c.jsx("p",{className:"mt-4 rounded-lg border border-dash-border bg-dash-bg px-4 py-3 text-xs font-medium text-dash-text",children:r(n)})]})})};function Ha(t){return`${t.provider}::${t.type}::${t.item}::${String(t.global)}`}const d8=["agent","command","skill","config","rules","hooks"],u8={agent:"migrateTypeAgents",command:"migrateTypeCommands",skill:"migrateTypeSkills",config:"migrateTypeConfig",rules:"migrateTypeRules",hooks:"migrateTypeHooks"},h8={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"},f8=({type:t,candidates:e,selected:n,onToggleItem:r,onSelectAll:s,onDeselectAll:i})=>{const{t:o}=ee(),a=g.useMemo(()=>e.map(Ha),[e]),l=a.filter(f=>n.has(f)).length,d=l===a.length,u=h8[t],h=o(u8[t]);return c.jsxs("div",{className:"border border-dash-border rounded-lg bg-dash-surface overflow-hidden",children:[c.jsxs("div",{className:"px-4 py-2.5 flex items-center justify-between border-b border-dash-border bg-dash-bg",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("h4",{className:"text-sm font-semibold text-dash-text",children:h}),c.jsxs("span",{className:`px-2 py-0.5 text-xs rounded-md border ${u}`,children:[l,"/",e.length]})]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"button",onClick:()=>s(a),disabled:d,className:"dash-focus-ring px-2.5 py-1 text-[11px] rounded border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-40",children:o("migrateInstallSelectAll")}),c.jsx("button",{type:"button",onClick:()=>i(a),disabled:l===0,className:"dash-focus-ring px-2.5 py-1 text-[11px] rounded border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-40",children:o("migrateInstallDeselectAll")})]})]}),c.jsx("div",{className:"divide-y divide-dash-border/50",children:e.map(f=>{const p=Ha(f),m=n.has(p);return c.jsxs("label",{className:"flex items-center gap-3 px-4 py-2.5 hover:bg-dash-surface-hover cursor-pointer",children:[c.jsx("input",{type:"checkbox",checked:m,onChange:()=>r(p),className:"h-4 w-4 rounded border-dash-border accent-dash-accent","aria-label":`${f.item} from ${f.provider}`}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx("span",{className:"text-sm font-mono text-dash-text truncate",children:f.item}),f.isDirectoryItem&&c.jsx("span",{className:"text-[10px] uppercase px-1.5 py-0.5 rounded border border-purple-500/30 text-purple-400",children:o("migrateInstallDirItem")}),f.alreadyInstalled&&c.jsx("span",{className:"text-[10px] uppercase px-1.5 py-0.5 rounded border border-dash-border text-dash-text-muted",children:o("migrateInstallAlreadyInstalled")})]}),c.jsx("div",{className:"text-[11px] text-dash-text-muted mt-0.5",children:f.provider})]}),f.description&&c.jsx("p",{className:"hidden md:block text-xs text-dash-text-secondary max-w-[200px] truncate shrink-0",children:f.description})]},p)})})]})},p8=({candidates:t,selected:e,onSelectionChange:n,onInstall:r,isInstalling:s=!1})=>{const{t:i}=ee(),o=g.useMemo(()=>{const p=new Map;for(const m of t){const x=p.get(m.type)??[];x.push(m),p.set(m.type,x)}return d8.filter(m=>(p.get(m)?.length??0)>0).map(m=>({type:m,candidates:p.get(m)??[]}))},[t]),a=g.useMemo(()=>t.map(Ha),[t]),l=g.useCallback(p=>{const m=new Set(e);m.has(p)?m.delete(p):m.add(p),n(m)},[e,n]),d=g.useCallback(p=>{const m=new Set(e);for(const x of p)m.add(x);n(m)},[e,n]),u=g.useCallback(p=>{const m=new Set(e);for(const x of p)m.delete(x);n(m)},[e,n]),h=g.useCallback(()=>{n(new Set(a))},[a,n]),f=g.useCallback(()=>{n(new Set)},[n]);return t.length===0?c.jsx("div",{className:"dash-panel p-8 text-center",children:c.jsx("p",{className:"text-dash-text-muted text-sm",children:i("migrateInstallNoCandidates")})}):c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[c.jsx("p",{className:"text-sm text-dash-text-secondary",children:i("migrateInstallSelectedCount").replace("{count}",String(e.size)).replace("{total}",String(t.length))}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"button",onClick:h,disabled:e.size===t.length,className:"dash-focus-ring px-3 py-1.5 text-xs rounded-md border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-40",children:i("migrateInstallSelectAll")}),c.jsx("button",{type:"button",onClick:f,disabled:e.size===0,className:"dash-focus-ring px-3 py-1.5 text-xs rounded-md border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-40",children:i("migrateInstallDeselectAll")})]})]}),o.map(({type:p,candidates:m})=>c.jsx(f8,{type:p,candidates:m,selected:e,onToggleItem:l,onSelectAll:d,onDeselectAll:u},p)),c.jsx("div",{className:"flex items-center justify-end pt-2",children:c.jsx("button",{type:"button",disabled:e.size===0||s,onClick:()=>r(e),className:"dash-focus-ring px-6 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:s?i("migrateInstallInstalling"):i("migrateInstallCta").replace("{count}",String(e.size))})})]})};function m8(t){return new Set(t.map(Ha))}function g8(t,e){const n=t.filter(l=>e.has(Ha(l))),r=n.map(l=>({action:"install",item:l.item,type:l.type,provider:l.provider,global:l.global,targetPath:l.registryPath??l.sourcePath,reason:"User-selected install",reasonCode:"new-item",isDirectoryItem:l.isDirectoryItem})),s=l=>({agent:"agents",command:"commands",skill:"skills",config:"config",rules:"rules",hooks:"hooks"})[l],i={agents:!1,commands:!1,skills:!1,config:!1,rules:!1,hooks:!1},o={agents:[],commands:[],skills:[],config:[],rules:[],hooks:[]},a=new Set;for(const l of n){const d=s(l.type);i[d]=!0,o[d].push(l.item),a.add(l.provider)}return{actions:r,summary:{install:r.length,update:0,skip:0,conflict:0,delete:0},hasConflicts:!1,banners:[],meta:{include:i,providers:Array.from(a),items:o,mode:"install"}}}const py=[{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"}],x8=new Set([8203,8204,8205,8288,65279,8232,8233,8234,8235,8236,8237,8238,8294,8295,8296,8297]);function b8(t){return t===9||t===10||t===13?!0:t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159||x8.has(t)}function Hs(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(b8(r)||(e+=n))}return e}function my(t){if(!t)return"-";const e=t.replace(/\\/g,"/"),n=e.match(/.*\/(\.[^/]+\/)/);if(n?.[1]){const s=(n.index??0)+n[0].length-n[1].length;return e.slice(s)}const r=e.split("/");return r.length>3?`.../${r.slice(-3).join("/")}`:e}function Ai(t){return t.success?t.skipped?"skipped":"installed":"failed"}function y8(t){const e={installed:0,skipped:0,failed:0};for(const n of t){const r=Ai(n);r==="installed"?e.installed+=1:r==="skipped"?e.skipped+=1:e.failed+=1}return e}function QS(t){switch(t){case"agent":case"command":case"skill":case"config":case"rules":case"hooks":case"unknown":return t;default:return"unknown"}}function v8(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 w8(t){const e=new Map;for(const n of t){const r=QS(n.portableType),s=e.get(r)||[];s.push(n),e.set(r,s)}return e}function k8(t){return[QS(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 S8(t){if(t.length===0)return!0;const e=t[0].provider;return t.every(n=>n.provider===e)}const Wi=({label:t,count:e,className:n})=>e<=0?null:c.jsxs("span",{className:`inline-flex items-center gap-1 rounded-md border px-2.5 py-1 text-xs ${n}`,children:[c.jsx("span",{className:"font-semibold",children:e}),c.jsx("span",{children:t})]}),gy=({labelKey:t,badgeClass:e,items:n,isExpanded:r,onToggle:s,singleProvider:i})=>{const{t:o}=ee(),a=n.filter(f=>Ai(f)==="installed").length,l=n.filter(f=>Ai(f)==="skipped").length,d=n.filter(f=>Ai(f)==="failed").length,u=i?"md:grid-cols-[minmax(0,1.5fr)_minmax(0,1.35fr)_auto_minmax(0,1fr)]":"md:grid-cols-[minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,1.2fr)_auto_minmax(0,1fr)]",h=new Map;return c.jsxs("div",{className:"rounded-xl border border-dash-border bg-dash-surface overflow-hidden",children:[c.jsxs("button",{type:"button",onClick:s,className:"w-full flex flex-wrap items-center gap-2 px-4 py-3 text-left hover:bg-dash-surface-hover transition-colors",children:[c.jsx("svg",{className:`w-3.5 h-3.5 text-dash-text-muted transition-transform ${r?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:c.jsx("path",{d:"M9 5l7 7-7 7"})}),c.jsx("p",{className:"text-sm font-semibold text-dash-text",children:o(t)}),c.jsx("span",{className:`inline-flex items-center rounded-full border px-2 py-0.5 text-[11px] font-semibold ${e}`,children:n.length}),c.jsx("span",{className:"hidden sm:block flex-1"}),c.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[11px]",children:[c.jsx(Wi,{label:o("migrateStatusInstalled"),count:a,className:"border-green-500/30 bg-green-500/10 text-green-400"}),c.jsx(Wi,{label:o("migrateStatusSkipped"),count:l,className:"border-yellow-500/30 bg-yellow-500/10 text-yellow-400"}),c.jsx(Wi,{label:o("migrateStatusFailed"),count:d,className:"border-red-500/30 bg-red-500/10 text-red-400"})]})]}),r&&c.jsxs("div",{className:"border-t border-dash-border/80",children:[c.jsxs("div",{className:`hidden md:grid ${u} items-center gap-3 px-4 py-2 border-b border-dash-border/70 text-[10px] font-semibold uppercase tracking-wide text-dash-text-muted`,children:[c.jsx("p",{children:o("migrateItem")}),!i&&c.jsx("p",{children:o("migrateProvider")}),c.jsx("p",{children:o("migratePath")}),c.jsx("p",{children:o("migrateStatus")}),c.jsx("p",{children:o("migrateError")})]}),c.jsx("div",{className:"divide-y divide-dash-border/70",children:n.map(f=>{const p=k8(f),m=h.get(p)??0;h.set(p,m+1);const x=m===0?p:`${p}#${m}`,b=Ai(f),y=v8(b,o),k=Hs(f.itemName||my(f.path)),v=Hs(f.providerDisplayName||f.provider||""),w=Hs(f.path||""),C=Hs(my(f.path)),j=Hs(f.error||f.skipReason||"");return c.jsxs("div",{className:`grid gap-1.5 ${u} items-start px-4 py-2.5 hover:bg-dash-bg/60 transition-colors`,children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("p",{className:"text-xs font-semibold text-dash-text truncate",title:k,children:k}),c.jsxs("div",{className:"mt-0.5 space-y-0.5 md:hidden",children:[!i&&c.jsx("p",{className:"text-[11px] text-dash-text-secondary truncate",children:v}),c.jsx("p",{className:"font-mono text-[11px] text-dash-text-muted truncate",title:w,children:C}),j&&c.jsx("p",{className:"text-[11px] text-red-400/80 line-clamp-2",title:j,children:j})]})]}),!i&&c.jsx("p",{className:"hidden md:block text-[11px] text-dash-text-secondary truncate",children:v}),c.jsx("p",{className:"hidden md:block font-mono text-[11px] text-dash-text-muted truncate",title:w,children:C}),c.jsx("span",{className:`inline-flex w-fit items-center rounded-full border px-2 py-0.5 text-[11px] font-medium ${y.className}`,children:y.label}),c.jsx("p",{className:`hidden md:block text-[11px] truncate ${j?"text-red-400/80":"text-dash-text-muted"}`,title:j,children:j||"-"})]},x)})})]})]})},C8=({results:t,onReset:e})=>{const{t:n}=ee(),[r,s]=g.useState(""),i=g.useDeferredValue(r),[o,a]=g.useState("all"),[l,d]=g.useState(()=>new Set(py.map(w=>w.key))),u=g.useMemo(()=>{const w=i.trim().toLowerCase();return t.results.filter(C=>{if(o!=="all"&&Ai(C)!==o)return!1;if(!w)return!0;const j=(C.itemName||"").toLowerCase(),S=(C.path||"").toLowerCase(),P=(C.providerDisplayName||C.provider||"").toLowerCase();return j.includes(w)||S.includes(w)||P.includes(w)})},[t.results,i,o]),h=g.useMemo(()=>S8(u),[u]),f=g.useMemo(()=>{if(!h||u.length===0)return"";const w=Array.from(new Set(u.map(C=>C.providerDisplayName?.trim()||"").filter(C=>C.length>0)));return w.length===1?w[0]:u[0]?.provider||""},[u,h]),p=g.useMemo(()=>w8(u),[u]),m=g.useMemo(()=>y8(t.results),[t.results]),x=g.useMemo(()=>[...p.keys()],[p]),b=m.installed+m.skipped+m.failed,y=x.length>0&&x.every(w=>l.has(w)),k=w=>{d(C=>{const j=new Set(C);return j.has(w)?j.delete(w):j.add(w),j})},v=()=>{if(y){d(new Set);return}d(new Set(x))};return c.jsxs("div",{className:"dash-panel p-4 md:p-5 space-y-4",children:[c.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-start md:justify-between",children:[c.jsxs("div",{children:[c.jsxs("h2",{className:"text-base font-semibold text-dash-text",children:[n("migrateSummaryTitle"),h&&f&&c.jsxs("span",{className:"text-dash-text-muted font-normal",children:[" ","· ",Hs(f)]})]}),c.jsxs("p",{className:"text-xs text-dash-text-muted mt-1",children:[b," ",n("migrateSummarySubtitle")]})]}),c.jsx("button",{type:"button",onClick:e,className:"dash-focus-ring px-4 py-2 text-sm font-semibold rounded-md bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover",children:n("migrateSummaryNewMigration")})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[c.jsx(Wi,{label:n("migrateStatusInstalled"),count:m.installed,className:"border-green-500/30 bg-green-500/10 text-green-400"}),c.jsx(Wi,{label:n("migrateStatusSkipped"),count:m.skipped,className:"border-yellow-500/30 bg-yellow-500/10 text-yellow-400"}),c.jsx(Wi,{label:n("migrateStatusFailed"),count:m.failed,className:"border-red-500/30 bg-red-500/10 text-red-400"})]}),t.warnings.length>0&&c.jsx("div",{className:"space-y-2",children:t.warnings.map((w,C)=>c.jsx("div",{className:"px-3 py-2 border border-yellow-500/30 bg-yellow-500/10 rounded-md text-xs text-yellow-400",children:Hs(w)},C))}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("div",{className:"relative",children:[c.jsxs("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 stroke-dash-text-muted",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("circle",{cx:"11",cy:"11",r:"8"}),c.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),c.jsx("input",{type:"text",value:r,onChange:w=>s(w.target.value),placeholder:n("migrateSummarySearchPlaceholder"),className:"dash-focus-ring w-full pl-9 pr-3 py-2 bg-dash-bg border border-dash-border rounded-lg text-dash-text text-sm focus:border-dash-accent transition-colors"})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[["all","installed","skipped","failed"].map(w=>{const C=w==="all"?"migrateSummaryFilterAll":w==="installed"?"migrateStatusInstalled":w==="skipped"?"migrateStatusSkipped":"migrateStatusFailed";return c.jsx("button",{type:"button",onClick:()=>a(w),className:`dash-focus-ring px-3 py-1 text-xs font-medium rounded-full border transition-colors ${o===w?"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(C)},w)}),c.jsx("button",{type:"button",onClick:v,className:"dash-focus-ring ml-1 px-3 py-1 text-xs font-medium rounded-md border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover",children:n(y?"migrateSummaryCollapseAll":"migrateSummaryExpandAll")})]})]}),u.length===0?c.jsx("div",{className:"text-center py-8 text-sm text-dash-text-muted",children:n("migrateSummaryNoResults")}):c.jsxs("div",{className:"space-y-2.5",children:[py.map(w=>{const C=p.get(w.key);return!C||C.length===0?null:c.jsx(gy,{labelKey:w.labelKey,badgeClass:w.badgeClass,items:C,isExpanded:l.has(w.key),onToggle:()=>k(w.key),singleProvider:h},w.key)}),(()=>{const w=p.get("unknown");return!w||w.length===0?null:c.jsx(gy,{labelKey:"migrateTypeUnknown",badgeClass:"border-dash-border text-dash-text-muted",items:w,isExpanded:l.has("unknown"),onToggle:()=>k("unknown"),singleProvider:h})})()]})]})},j8=({pendingCount:t,nextMode:e,onConfirm:n,onCancel:r})=>{const{t:s}=ee(),i=g.useRef(null);g.useEffect(()=>{const a=i.current;if(!a)return;a.open||a.showModal();const l=d=>{d.preventDefault(),r()};return a.addEventListener("cancel",l),()=>{a.removeEventListener("cancel",l),a.open&&a.close()}},[r]);const o=s(e==="install"?"migrateModeInstall":"migrateModeReconcile");return c.jsxs("dialog",{ref:i,"aria-labelledby":"mode-confirm-title","aria-describedby":"mode-confirm-body",onClick:a=>{a.target===a.currentTarget&&r()},className:"fixed inset-0 z-50 m-auto h-auto max-w-sm rounded-xl border border-dash-border bg-dash-surface p-6 shadow-2xl backdrop:bg-black/50",children:[c.jsx("h2",{id:"mode-confirm-title",className:"mb-2 text-base font-semibold text-dash-text",children:s("migrateModeConfirmTitle")}),c.jsx("p",{id:"mode-confirm-body",className:"mb-5 text-sm text-dash-text-secondary",children:s("migrateModeConfirmBody").replace("{count}",String(t)).replace("{mode}",o)}),c.jsxs("div",{className:"flex justify-end gap-3",children:[c.jsx("button",{type:"button",onClick:r,className:"dash-focus-ring px-4 py-2 text-sm font-medium rounded-md border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover",children:s("cancel")}),c.jsx("button",{type:"button",autoFocus:!0,onClick:n,className:"dash-focus-ring px-4 py-2 text-sm font-semibold rounded-md bg-dash-accent text-white hover:bg-dash-accent/90",children:s("migrateModeConfirmSwitch")})]})]})},N8=({mode:t,pendingCount:e,disabled:n=!1,onModeChange:r})=>{const{t:s}=ee(),[i,o]=g.useState(null),a=g.useCallback(u=>{u===t||n||(e>0?o(u):r(u))},[t,n,e,r]),l=g.useCallback(()=>{i&&(r(i),o(null))},[i,r]),d=g.useCallback(()=>{o(null)},[]);return c.jsxs(c.Fragment,{children:[c.jsx("div",{role:"tablist","aria-label":s("migrateModeLabel"),className:"inline-flex rounded-lg border border-dash-border bg-dash-bg overflow-hidden",children:["reconcile","install"].map(u=>{const h=t===u,f=u==="reconcile"?"migrateModeReconcile":"migrateModeInstall",p=u==="reconcile"?"migrateModeReconcileDesc":"migrateModeInstallDesc";return c.jsxs("button",{type:"button",role:"tab","aria-selected":h,"aria-controls":`migrate-${u}-panel`,id:`migrate-${u}-tab`,disabled:n,onClick:()=>a(u),className:`px-4 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-dash-accent disabled:opacity-50 disabled:cursor-not-allowed ${h?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text"}`,children:[c.jsx("span",{className:"block",children:s(f)}),c.jsx("span",{className:"block text-[10px] font-normal opacity-70",children:s(p)})]},u)})}),i&&c.jsx(j8,{pendingCount:e,nextMode:i,onConfirm:l,onCancel:d})]})},P8=500;function O8(t){return t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159}function E8(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(O8(r)||(e+=n))}return e}const D8=({diff:t,className:e=""})=>{const n=t.split(`
|
|
272
|
+
`),r=n.slice(0,P8),s=n.length-r.length;return c.jsxs("pre",{className:`text-xs font-mono overflow-x-auto p-3 rounded bg-dash-bg border border-dash-border ${e}`,children:[r.map((i,o)=>{const a=E8(i);let l="text-dash-text";return a.startsWith("+")?l="text-green-400 bg-green-500/10":a.startsWith("-")?l="text-red-400 bg-red-500/10":a.startsWith("@@")&&(l="text-blue-400"),c.jsx("div",{className:l,children:a},`${o}:${a.slice(0,24)}`)}),s>0&&c.jsxs("div",{className:"text-dash-text-muted",children:["... truncated ",s," additional line(s)"]})]})};function M8(t){return t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159}function Wo(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(M8(r)||(e+=n))}return e}const JS=({action:t,resolution:e,onResolve:n})=>{const{t:r}=ee(),[s,i]=g.useState(!1),o=t.ownedSections&&t.ownedSections.length>0;return c.jsxs("div",{className:"border border-dash-border rounded-lg p-4 mb-3 bg-dash-surface",children:[c.jsxs("div",{className:"flex justify-between items-start gap-4",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"font-mono text-sm text-dash-text truncate",children:[Wo(t.provider),"/",Wo(t.type),"/",Wo(t.item)]}),c.jsx("p",{className:"text-xs text-dash-text-muted mt-1",children:Wo(t.reason)}),t.targetPath&&c.jsx("p",{className:"text-xs text-dash-text-secondary mt-1 font-mono truncate",children:Wo(t.targetPath)})]}),c.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[c.jsx("button",{type:"button",onClick:()=>n({type:"overwrite"}),className:`dash-focus-ring px-3 py-1.5 text-xs font-semibold rounded-md transition-colors ${e?.type==="overwrite"?"bg-dash-accent text-white":"bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover"}`,children:r("migrateConflictUseCK")}),c.jsx("button",{type:"button",onClick:()=>n({type:"keep"}),className:`dash-focus-ring px-3 py-1.5 text-xs font-semibold rounded-md transition-colors ${e?.type==="keep"?"bg-dash-accent text-white":"bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover"}`,children:r("migrateConflictKeepMine")}),o&&c.jsx("button",{type:"button",onClick:()=>n({type:"smart-merge"}),className:`dash-focus-ring px-3 py-1.5 text-xs font-semibold rounded-md transition-colors ${e?.type==="smart-merge"?"bg-dash-accent text-white":"bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover"}`,children:r("migrateConflictSmartMerge")}),t.diff&&c.jsx("button",{type:"button",onClick:()=>i(!s),className:"dash-focus-ring px-3 py-1.5 text-xs font-medium rounded-md border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover",children:r(s?"migrateConflictHideDiff":"migrateConflictShowDiff")})]})]}),s&&t.diff&&c.jsx(D8,{diff:t.diff,className:"mt-3"}),e&&c.jsxs("div",{className:"mt-2 text-xs text-green-400 flex items-center gap-1.5",children:[c.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 20 20",children:c.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),c.jsxs("span",{children:[r("migrateConflictResolved"),": ",A8(e.type,r)]})]})]})};function A8(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 T8=({banner:t,onRespectDeletionsOverride:e})=>{const{t:n}=ee(),r=t.kind==="empty-dir-respected";return c.jsxs("output",{"aria-live":"polite",className:`flex items-start gap-3 px-4 py-3 rounded-lg border ${r?"bg-dash-surface border-dash-border text-dash-text-secondary":"bg-blue-500/5 border-blue-500/20 text-blue-300"}`,children:[c.jsx("svg",{className:`w-4 h-4 mt-0.5 shrink-0 ${r?"text-dash-text-muted":"text-blue-400"}`,fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:c.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})}),c.jsx("div",{className:"flex-1 min-w-0",children:r?c.jsxs(c.Fragment,{children:[c.jsxs("p",{className:"text-xs font-medium",children:[n("migrateBanner_emptyDirRespected_title")," —"," ",c.jsx("span",{className:"font-mono",children:t.path})," ",n("migrateBanner_emptyDirRespected_body")]}),e&&c.jsxs("button",{type:"button",onClick:e,className:"dash-focus-ring mt-1.5 text-xs font-medium text-dash-accent hover:underline",children:[n("migrateBanner_reinstallCta")," →"]})]}):c.jsxs("p",{className:"text-xs font-medium",children:[n("migrateBanner_emptyDir_title")," — ",c.jsx("span",{className:"font-mono",children:t.path}),":"," ",c.jsx("span",{className:"font-semibold",children:t.itemCount})," ",n("migrateBanner_emptyDir_body")]})})]})},xy=[{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:"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"}],eC=["agent","command","skill","config","rules","hooks"],L8={agent:"migrateTypeAgents",command:"migrateTypeCommands",skill:"migrateTypeSkills",config:"migrateTypeConfig",rules:"migrateTypeRules",hooks:"migrateTypeHooks"},R8={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"},Ui=200,_8={install:["skip"],update:["skip"],delete:["skip"],skip:["install"]},I8=new Set(["user-deleted-respected","user-edits-preserved","target-state-unknown"]);function $8(t){return t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159}function Hc(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&($8(r)||(e+=n))}return e}function B8(t){return{"new-item":"migrateReason_newItem","new-provider-for-item":"migrateReason_newProviderForItem","target-deleted-source-changed":"migrateReason_targetDeletedSourceChanged","target-dir-empty-reinstall":"migrateReason_targetDirEmptyReinstall","force-reinstall":"migrateReason_forceReinstall","force-overwrite":"migrateReason_forceOverwrite","registry-upgrade-reinstall":"migrateReason_registryUpgradeReinstall","source-changed":"migrateReason_sourceChanged","registry-upgrade-heal":"migrateReason_registryUpgradeHeal","no-changes":"migrateReason_noChanges","user-edits-preserved":"migrateReason_userEditsPreserved","user-deleted-respected":"migrateReason_userDeletedRespected","target-up-to-date-backfill":"migrateReason_targetUpToDateBackfill","provider-checksum-unavailable":"migrateReason_providerChecksumUnavailable","target-state-unknown":"migrateReason_targetStateUnknown","source-removed-orphan":"migrateReason_sourceRemovedOrphan","renamed-cleanup":"migrateReason_renamedCleanup","path-migrated-cleanup":"migrateReason_pathMigratedCleanup","both-changed":"migrateReason_bothChanged","target-state-unknown-source-changed":"migrateReason_targetStateUnknownSourceChanged"}[t]??"migrateReason_targetStateUnknown"}function F8(t){const e={install:[],update:[],delete:[],skip:[],conflict:[]};for(const n of t)n.action==="conflict"?(e.install.push(n),e.conflict.push(n)):(n.action==="install"||n.action==="update"||n.action==="delete"||n.action==="skip")&&e[n.action].push(n);return e}function z8(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}function V8(t,e,n){return[...t].sort((r,s)=>{const i=e.get(n(r))==="skip"?1:0,o=e.get(n(s))==="skip"?1:0;return i-o})}const H8=({plan:t,resolutions:e,onResolve:n,actionKey:r,flips:s,onFlip:i,onRespectDeletionsOverride:o})=>{const{t:a}=ee(),l=g.useMemo(()=>F8(t.actions),[t.actions]),d=g.useMemo(()=>xy.filter(v=>l[v.key].length>0),[l]),[u,h]=g.useState(()=>{for(const v of xy)if(l[v.key].length>0)return v.key;return"install"});g.useEffect(()=>{l[u]?.length===0&&d.length>0&&h(d[0].key)},[l,u,d]);const[f,p]=g.useState(!1),m=g.useMemo(()=>V8(l[u]??[],s,r),[l,u,s,r]),x=g.useMemo(()=>z8(m),[m]),b=u==="skip",y=u==="update"&&(l.update.length??0)>10,k=!b&&!y;return c.jsxs("div",{className:"space-y-4",children:[t.banners.length>0&&c.jsx("div",{className:"space-y-2",children:t.banners.map((v,w)=>c.jsx(T8,{banner:v,onRespectDeletionsOverride:o},`banner-${w}`))}),l.conflict.length>0&&c.jsx(U8,{conflicts:l.conflict,resolutions:e,onResolve:n,actionKey:r,open:f,onToggle:()=>p(v=>!v)}),c.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[t.summary.install>0&&c.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-green-500/10 border border-green-500/30 text-green-400",children:[t.summary.install," ",a("migrateActionInstall")]}),t.summary.update>0&&c.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-yellow-500/10 border border-yellow-500/30 text-yellow-400",children:[t.summary.update," ",a("migrateActionUpdate")]}),t.summary.skip>0&&c.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-dash-bg border border-dash-border text-dash-text-muted",children:[t.summary.skip," ",a("migrateActionSkip")]}),t.summary.conflict>0&&c.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-red-500/10 border border-red-500/30 text-red-400",children:[t.summary.conflict," ",a("migrateActionConflict")]}),t.summary.delete>0&&c.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-dash-bg border border-dash-border text-dash-text-secondary",children:[t.summary.delete," ",a("migrateActionDelete")]})]}),d.length>1&&c.jsx("div",{className:"flex gap-1 border-b border-dash-border",role:"tablist",children:d.map(v=>{const w=u===v.key,C=l[v.key].length;return c.jsxs("button",{type:"button",role:"tab","aria-selected":w,onClick:()=>h(v.key),className:`px-3 py-2 text-xs font-medium border-b-2 transition-colors ${w?v.activeClass:"border-transparent text-dash-text-muted hover:text-dash-text-secondary"}`,children:[a(v.labelKey)," ",c.jsx("span",{className:`ml-1 px-1.5 py-0.5 rounded text-[10px] border ${v.badgeClass}`,"aria-label":`${C} items`,children:C})]},v.key)})}),b?c.jsx(W8,{typeGroups:x,activeTab:u,flips:s,onFlip:i,actionKey:r}):c.jsx("div",{className:"space-y-3",children:eC.map(v=>{const w=x.get(v);return!w||w.length===0?null:c.jsxs(tC,{type:v,count:w.length,defaultExpanded:k,children:[w.slice(0,Ui).map(C=>c.jsx(nC,{action:C,sourceTab:u,isFlippedToSkip:s.get(r(C))==="skip",onFlip:j=>i(C,j),hasConflict:C.action==="conflict",resolutions:e,onResolve:n,actionKey:r},r(C))),w.length>Ui&&c.jsxs("div",{className:"text-xs text-dash-text-muted px-1",children:["... ",w.length-Ui," more"]})]},`${u}:${v}`)})})]})},W8=({typeGroups:t,activeTab:e,flips:n,onFlip:r,actionKey:s})=>{const{t:i}=ee(),[o,a]=g.useState(!1),l=g.useMemo(()=>{let d=0;for(const u of t.values())d+=u.length;return d},[t]);return c.jsxs("div",{className:"border border-dash-border rounded-lg bg-dash-surface",children:[c.jsxs("button",{type:"button","aria-expanded":o,onClick:()=>a(d=>!d),className:"w-full px-4 py-3 flex items-center justify-between text-left hover:bg-dash-surface-hover transition-colors",children:[c.jsxs("span",{className:"text-sm text-dash-text-muted",children:[i(o?"migrateHideSkippedItems":"migrateShowSkippedItems"),c.jsxs("span",{className:"ml-2 text-xs text-dash-text-muted opacity-70",children:["(",l,")"]})]}),c.jsx("svg",{"aria-hidden":"true",className:`w-4 h-4 text-dash-text-muted transition-transform ${o?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),o&&c.jsx("div",{className:"px-4 pb-4 space-y-3",children:eC.map(d=>{const u=t.get(d);return!u||u.length===0?null:c.jsxs(tC,{type:d,count:u.length,defaultExpanded:!1,children:[u.slice(0,Ui).map(h=>c.jsx(nC,{action:h,sourceTab:e,isFlippedToSkip:n.get(s(h))==="skip",onFlip:f=>r(h,f),hasConflict:!1,resolutions:new Map,onResolve:()=>{},actionKey:s},s(h))),u.length>Ui&&c.jsxs("div",{className:"text-xs text-dash-text-muted px-1",children:["... ",u.length-Ui," more"]})]},`${e}:${d}`)})})]})},U8=({conflicts:t,resolutions:e,onResolve:n,actionKey:r,open:s,onToggle:i})=>{const{t:o}=ee(),a=g.useMemo(()=>t.filter(l=>e.has(r(l))).length,[t,e,r]);return c.jsxs("div",{className:"border border-red-500/30 rounded-lg bg-red-500/5",children:[c.jsxs("div",{className:"px-4 py-3 flex items-center justify-between gap-3",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("svg",{className:"w-4 h-4 text-red-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),c.jsxs("span",{className:"text-sm font-medium text-red-400",children:[o("migrateConflictBanner_title")," (",t.length,")"]}),a>0&&c.jsxs("span",{className:"text-xs text-green-400",children:[a,"/",t.length," resolved"]})]}),c.jsx("button",{type:"button",onClick:i,"aria-expanded":s,className:"dash-focus-ring px-3 py-1 text-xs font-medium rounded-md bg-red-500/10 border border-red-500/30 text-red-400 hover:bg-red-500/20 transition-colors",children:o(s?"migrateConflictBanner_hide":"migrateConflictBanner_cta")})]}),s&&c.jsx("div",{className:"px-4 pb-4 space-y-3",children:t.map(l=>c.jsx(JS,{action:l,resolution:e.get(r(l))??null,onResolve:d=>n(l,d)},r(l)))})]})},tC=({type:t,count:e,defaultExpanded:n=!0,children:r})=>{const{t:s}=ee(),[i,o]=g.useState(n),a=R8[t],l=s(L8[t]);return c.jsxs("div",{className:"border border-dash-border rounded-lg bg-dash-surface",children:[c.jsxs("button",{type:"button","aria-expanded":i,onClick:()=>o(d=>!d),className:"w-full px-4 py-2.5 flex items-center justify-between text-left hover:bg-dash-surface-hover transition-colors",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("h4",{className:"text-sm font-semibold text-dash-text",children:l}),c.jsx("span",{className:`px-2 py-0.5 text-xs rounded-md border ${a}`,children:e})]}),c.jsx("svg",{"aria-hidden":"true",className:`w-4 h-4 text-dash-text-muted transition-transform ${i?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),i&&c.jsx("div",{className:"px-4 pt-1 pb-4 space-y-2",children:r})]})},nC=({action:t,sourceTab:e,isFlippedToSkip:n,onFlip:r,hasConflict:s,resolutions:i,onResolve:o,actionKey:a})=>{const{t:l}=ee(),[d,u]=g.useState(!1),h=!n,f=`${Hc(t.provider)}/${Hc(t.item)}`,p=t.reasonCopy??(t.reasonCode?l(B8(t.reasonCode)):Hc(t.reason)),m=x=>{r(x.target.checked?"execute":"skip")};return c.jsx("div",{className:`px-3 py-2 bg-dash-bg rounded-md border border-dash-border transition-opacity ${n?"opacity-50":"opacity-100"}`,children:c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx("input",{type:"checkbox",checked:h,onChange:m,"aria-label":`${l("migrateFlip_toggleItem")}: ${f}`,className:"mt-0.5 shrink-0 accent-dash-accent cursor-pointer"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[c.jsx("span",{className:"font-mono text-xs text-dash-text truncate",children:f}),s&&c.jsx("button",{type:"button",onClick:()=>u(x=>!x),className:"dash-focus-ring shrink-0 px-1.5 py-0.5 text-[10px] font-medium rounded border border-red-500/40 bg-red-500/10 text-red-400 hover:bg-red-500/20 transition-colors",children:l("migrateConflictBadge")})]}),c.jsx("div",{className:"text-xs text-dash-text-muted mt-0.5",children:p}),t.targetPath&&c.jsx("div",{className:"text-xs text-dash-text-secondary mt-0.5 font-mono truncate",children:Hc(t.targetPath)}),s&&d&&c.jsx("div",{className:"mt-2",children:c.jsx(JS,{action:t,resolution:i.get(a(t))??null,onResolve:x=>o(t,x)})})]}),c.jsx(K8,{sourceTab:e,action:t,isFlippedToSkip:n,onFlip:r})]})})},K8=({sourceTab:t,action:e,isFlippedToSkip:n,onFlip:r})=>{const{t:s}=ee(),[i,o]=g.useState(!1),a=g.useRef(null);g.useEffect(()=>{if(!i)return;const h=f=>{a.current&&!a.current.contains(f.target)&&o(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[i]);const l=_8[t],d=t==="skip"&&l.includes("install")&&e.reasonCode!==void 0&&I8.has(e.reasonCode);return(n?d||t!=="skip":l.length>0)?c.jsxs("div",{ref:a,className:"relative shrink-0",children:[c.jsx("button",{type:"button",onClick:()=>o(h=>!h),"aria-label":"More actions","aria-haspopup":"true","aria-expanded":i,className:"dash-focus-ring p-1 rounded text-dash-text-muted hover:text-dash-text hover:bg-dash-surface-hover transition-colors",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 20 20",children:c.jsx("path",{d:"M10 6a2 2 0 110-4 2 2 0 010 4zm0 6a2 2 0 110-4 2 2 0 010 4zm0 6a2 2 0 110-4 2 2 0 010 4z"})})}),i&&c.jsxs("div",{className:"absolute right-0 top-6 z-10 min-w-[140px] bg-dash-surface border border-dash-border rounded-lg shadow-lg py-1",children:[n&&(d||t!=="skip")&&c.jsx("button",{type:"button",onClick:()=>{r("execute"),o(!1)},className:"w-full px-3 py-1.5 text-xs text-left text-dash-text hover:bg-dash-surface-hover",children:s("migrateFlip_moveToInstall")}),!n&&c.jsx("button",{type:"button",onClick:()=>{r("skip"),o(!1)},className:"w-full px-3 py-1.5 text-xs text-left text-dash-text hover:bg-dash-surface-hover",children:s("migrateFlip_moveToSkip")}),!n&&t==="skip"&&d&&c.jsx("button",{type:"button",onClick:()=>{r("execute"),o(!1)},className:"w-full px-3 py-1.5 text-xs text-left text-dash-text hover:bg-dash-surface-hover",children:s("migrateFlip_moveToInstall")})]})]}):null};var G8=function(e){return typeof window<"u"?matchMedia&&matchMedia("(prefers-color-scheme: ".concat(e,")")):{matches:!1}},lf,q8=g.createContext({appearance:"light",setAppearance:function(){},isDarkMode:!1,themeMode:"light",setThemeMode:function(){},browserPrefers:(lf=G8("dark"))!==null&&lf!==void 0&&lf.matches?"dark":"light"}),Y8=function(){return g.useContext(q8)};const rC=(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"}},X8=t=>{if(t)return["space-between","space-around","space-evenly"].includes(t)},Z8=(t,e)=>rC(t,e)==="row",wi=t=>typeof t=="number"?`${t}px`:t,Q8=({visible:t,flex:e,gap:n,direction:r,horizontal:s,align:i,justify:o,distribution:a,height:l,width:d,padding:u,paddingInline:h,paddingBlock:f,prefixCls:p,as:m="div",className:x,style:b,children:y,wrap:k,ref:v,...w})=>{const C=o||a,S=Z8(r,s)&&!d&&X8(C)?"100%":wi(d),P={...e!==void 0?{"--lobe-flex":String(e)}:{},...r||s?{"--lobe-flex-direction":rC(r,s)}:{},...k!==void 0?{"--lobe-flex-wrap":k}:{},...C!==void 0?{"--lobe-flex-justify":C}:{},...i!==void 0?{"--lobe-flex-align":i}:{},...S!==void 0?{"--lobe-flex-width":S}:{},...l!==void 0?{"--lobe-flex-height":wi(l)}:{},...u!==void 0?{"--lobe-flex-padding":wi(u)}:{},...h!==void 0?{"--lobe-flex-padding-inline":wi(h)}:{},...f!==void 0?{"--lobe-flex-padding-block":wi(f)}:{},...n!==void 0?{"--lobe-flex-gap":wi(n)}:{},...b},D="lobe-flex",A=[D,t===!1?`${D}--hidden`:void 0,p?`${p}-flex`:void 0,x].filter(Boolean).join(" ");return c.jsx(m,{ref:v,...w,className:A,style:P,children:y})};var sC=g.memo(Q8);const J8=({children:t,ref:e,...n})=>c.jsx(sC,{...n,align:"center",justify:"center",ref:e,children:t});var e_=J8;const t_=/\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;function n_(t){return Array.from(t.match(t_)??[])}function r_(t){return n_(t).map(n=>n.toLowerCase()).join("-")}var iC={exports:{}},oC={};/**
|
|
273
|
+
* @license React
|
|
274
|
+
* use-sync-external-store-shim.production.js
|
|
275
|
+
*
|
|
276
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
277
|
+
*
|
|
278
|
+
* This source code is licensed under the MIT license found in the
|
|
279
|
+
* LICENSE file in the root directory of this source tree.
|
|
280
|
+
*/var lo=g;function s_(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var i_=typeof Object.is=="function"?Object.is:s_,o_=lo.useState,a_=lo.useEffect,l_=lo.useLayoutEffect,c_=lo.useDebugValue;function d_(t,e){var n=e(),r=o_({inst:{value:n,getSnapshot:e}}),s=r[0].inst,i=r[1];return l_(function(){s.value=n,s.getSnapshot=e,cf(s)&&i({inst:s})},[t,n,e]),a_(function(){return cf(s)&&i({inst:s}),t(function(){cf(s)&&i({inst:s})})},[t]),c_(n),n}function cf(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!i_(t,n)}catch{return!0}}function u_(t,e){return e()}var h_=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u_:d_;oC.useSyncExternalStore=lo.useSyncExternalStore!==void 0?lo.useSyncExternalStore:h_;iC.exports=oC;var f_=iC.exports,aC={exports:{}},lC={};/**
|
|
281
|
+
* @license React
|
|
282
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
283
|
+
*
|
|
284
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
285
|
+
*
|
|
286
|
+
* This source code is licensed under the MIT license found in the
|
|
287
|
+
* LICENSE file in the root directory of this source tree.
|
|
288
|
+
*/var eh=g,p_=f_;function m_(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var g_=typeof Object.is=="function"?Object.is:m_,x_=p_.useSyncExternalStore,b_=eh.useRef,y_=eh.useEffect,v_=eh.useMemo,w_=eh.useDebugValue;lC.useSyncExternalStoreWithSelector=function(t,e,n,r,s){var i=b_(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=v_(function(){function l(p){if(!d){if(d=!0,u=p,p=r(p),s!==void 0&&o.hasValue){var m=o.value;if(s(m,p))return h=m}return h=p}if(m=h,g_(u,p))return m;var x=r(p);return s!==void 0&&s(m,x)?(u=p,m):(u=p,h=x)}var d=!1,u,h,f=n===void 0?null:n;return[function(){return l(e())},f===null?void 0:function(){return l(f())}]},[e,n,r,s]);var a=x_(t,i[0],i[1]);return y_(function(){o.hasValue=!0,o.value=a},[a]),w_(a),a};aC.exports=lC;var k_=aC.exports;const S_=u3(k_);function C_(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return g.useMemo(()=>r=>{e.forEach(s=>s(r))},e)}const th=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Co(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function Dg(t){return"nodeType"in t}function tn(t){var e,n;return t?Co(t)?t:Dg(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function Mg(t){const{Document:e}=tn(t);return t instanceof e}function Ql(t){return Co(t)?!1:t instanceof tn(t).HTMLElement}function cC(t){return t instanceof tn(t).SVGElement}function jo(t){return t?Co(t)?t.document:Dg(t)?Mg(t)?t:Ql(t)||cC(t)?t.ownerDocument:document:document:document}const nr=th?g.useLayoutEffect:g.useEffect;function nh(t){const e=g.useRef(t);return nr(()=>{e.current=t}),g.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return e.current==null?void 0:e.current(...r)},[])}function j_(){const t=g.useRef(null),e=g.useCallback((r,s)=>{t.current=setInterval(r,s)},[]),n=g.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function Wa(t,e){e===void 0&&(e=[t]);const n=g.useRef(t);return nr(()=>{n.current!==t&&(n.current=t)},e),n}function Jl(t,e){const n=g.useRef();return g.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function cu(t){const e=nh(t),n=g.useRef(null),r=g.useCallback(s=>{s!==n.current&&e?.(s,n.current),n.current=s},[]);return[n,r]}function du(t){const e=g.useRef();return g.useEffect(()=>{e.current=t},[t]),e.current}let df={};function ec(t,e){return g.useMemo(()=>{if(e)return e;const n=df[t]==null?0:df[t]+1;return df[t]=n,t+"-"+n},[t,e])}function dC(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((i,o)=>{const a=Object.entries(o);for(const[l,d]of a){const u=i[l];u!=null&&(i[l]=u+t*d)}return i},{...e})}}const Ki=dC(1),Ua=dC(-1);function N_(t){return"clientX"in t&&"clientY"in t}function rh(t){if(!t)return!1;const{KeyboardEvent:e}=tn(t.target);return e&&t instanceof e}function P_(t){if(!t)return!1;const{TouchEvent:e}=tn(t.target);return e&&t instanceof e}function uu(t){if(P_(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return N_(t)?{x:t.clientX,y:t.clientY}:null}const Ps=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[Ps.Translate.toString(t),Ps.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),by="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function O_(t){return t.matches(by)?t:t.querySelector(by)}const E_={display:"none"};function D_(t){let{id:e,value:n}=t;return Qe.createElement("div",{id:e,style:E_},n)}function M_(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Qe.createElement("div",{id:e,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function A_(){const[t,e]=g.useState("");return{announce:g.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const uC=g.createContext(null);function T_(t){const e=g.useContext(uC);g.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function L_(){const[t]=g.useState(()=>new Set),e=g.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[g.useCallback(r=>{let{type:s,event:i}=r;t.forEach(o=>{var a;return(a=o[s])==null?void 0:a.call(o,i)})},[t]),e]}const R_={draggable:`
|
|
289
|
+
To pick up a draggable item, press the space bar.
|
|
290
|
+
While dragging, use the arrow keys to move the item.
|
|
291
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
292
|
+
`},__={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function I_(t){let{announcements:e=__,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=R_}=t;const{announce:i,announcement:o}=A_(),a=ec("DndLiveRegion"),[l,d]=g.useState(!1);if(g.useEffect(()=>{d(!0)},[]),T_(g.useMemo(()=>({onDragStart(h){let{active:f}=h;i(e.onDragStart({active:f}))},onDragMove(h){let{active:f,over:p}=h;e.onDragMove&&i(e.onDragMove({active:f,over:p}))},onDragOver(h){let{active:f,over:p}=h;i(e.onDragOver({active:f,over:p}))},onDragEnd(h){let{active:f,over:p}=h;i(e.onDragEnd({active:f,over:p}))},onDragCancel(h){let{active:f,over:p}=h;i(e.onDragCancel({active:f,over:p}))}}),[i,e])),!l)return null;const u=Qe.createElement(Qe.Fragment,null,Qe.createElement(D_,{id:r,value:s.draggable}),Qe.createElement(M_,{id:a,announcement:o}));return n?Us.createPortal(u,n):u}var St;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(St||(St={}));function hu(){}function yy(t,e){return g.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function $_(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return g.useMemo(()=>[...e].filter(r=>r!=null),[...e])}const rr=Object.freeze({x:0,y:0});function hC(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function B_(t,e){const n=uu(t);if(!n)return"0 0";const r={x:(n.x-e.left)/e.width*100,y:(n.y-e.top)/e.height*100};return r.x+"% "+r.y+"%"}function fC(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function F_(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function vy(t){let{left:e,top:n,height:r,width:s}=t;return[{x:e,y:n},{x:e+s,y:n},{x:e,y:n+r},{x:e+s,y:n+r}]}function pC(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function wy(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+t.width*.5,y:n+t.height*.5}}const z_=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=wy(e,e.left,e.top),i=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const d=hC(wy(l),s);i.push({id:a,data:{droppableContainer:o,value:d}})}}return i.sort(fC)},V_=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=vy(e),i=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const d=vy(l),u=s.reduce((f,p,m)=>f+hC(d[m],p),0),h=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:h}})}}return i.sort(fC)};function H_(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),s=Math.min(e.left+e.width,t.left+t.width),i=Math.min(e.top+e.height,t.top+t.height),o=s-r,a=i-n;if(r<s&&n<i){const l=e.width*e.height,d=t.width*t.height,u=o*a,h=u/(l+d-u);return Number(h.toFixed(4))}return 0}const W_=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=[];for(const i of r){const{id:o}=i,a=n.get(o);if(a){const l=H_(a,e);l>0&&s.push({id:o,data:{droppableContainer:i,value:l}})}}return s.sort(F_)};function U_(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function mC(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:rr}function K_(t){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];return s.reduce((o,a)=>({...o,top:o.top+t*a.y,bottom:o.bottom+t*a.y,left:o.left+t*a.x,right:o.right+t*a.x}),{...n})}}const G_=K_(1);function gC(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function q_(t,e,n){const r=gC(e);if(!r)return t;const{scaleX:s,scaleY:i,x:o,y:a}=r,l=t.left-o-(1-s)*parseFloat(n),d=t.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=s?t.width/s:t.width,h=i?t.height/i:t.height;return{width:u,height:h,top:d,right:l+u,bottom:d+h,left:l}}const Y_={ignoreTransform:!1};function No(t,e){e===void 0&&(e=Y_);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:d,transformOrigin:u}=tn(t).getComputedStyle(t);d&&(n=q_(n,d,u))}const{top:r,left:s,width:i,height:o,bottom:a,right:l}=n;return{top:r,left:s,width:i,height:o,bottom:a,right:l}}function ky(t){return No(t,{ignoreTransform:!0})}function X_(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function Z_(t,e){return e===void 0&&(e=tn(t).getComputedStyle(t)),e.position==="fixed"}function Q_(t,e){e===void 0&&(e=tn(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=e[s];return typeof i=="string"?n.test(i):!1})}function sh(t,e){const n=[];function r(s){if(e!=null&&n.length>=e||!s)return n;if(Mg(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!Ql(s)||cC(s)||n.includes(s))return n;const i=tn(t).getComputedStyle(s);return s!==t&&Q_(s,i)&&n.push(s),Z_(s,i)?n:r(s.parentNode)}return t?r(t):n}function xC(t){const[e]=sh(t,1);return e??null}function uf(t){return!th||!t?null:Co(t)?t:Dg(t)?Mg(t)||t===jo(t).scrollingElement?window:Ql(t)?t:null:null}function bC(t){return Co(t)?t.scrollX:t.scrollLeft}function yC(t){return Co(t)?t.scrollY:t.scrollTop}function im(t){return{x:bC(t),y:yC(t)}}var Et;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Et||(Et={}));function vC(t){return!th||!t?!1:t===document.scrollingElement}function wC(t){const e={x:0,y:0},n=vC(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},s=t.scrollTop<=e.y,i=t.scrollLeft<=e.x,o=t.scrollTop>=r.y,a=t.scrollLeft>=r.x;return{isTop:s,isLeft:i,isBottom:o,isRight:a,maxScroll:r,minScroll:e}}const J_={x:.2,y:.2};function eI(t,e,n,r,s){let{top:i,left:o,right:a,bottom:l}=n;r===void 0&&(r=10),s===void 0&&(s=J_);const{isTop:d,isBottom:u,isLeft:h,isRight:f}=wC(t),p={x:0,y:0},m={x:0,y:0},x={height:e.height*s.y,width:e.width*s.x};return!d&&i<=e.top+x.height?(p.y=Et.Backward,m.y=r*Math.abs((e.top+x.height-i)/x.height)):!u&&l>=e.bottom-x.height&&(p.y=Et.Forward,m.y=r*Math.abs((e.bottom-x.height-l)/x.height)),!f&&a>=e.right-x.width?(p.x=Et.Forward,m.x=r*Math.abs((e.right-x.width-a)/x.width)):!h&&o<=e.left+x.width&&(p.x=Et.Backward,m.x=r*Math.abs((e.left+x.width-o)/x.width)),{direction:p,speed:m}}function tI(t){if(t===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}const{top:e,left:n,right:r,bottom:s}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:s,width:t.clientWidth,height:t.clientHeight}}function kC(t){return t.reduce((e,n)=>Ki(e,im(n)),rr)}function nI(t){return t.reduce((e,n)=>e+bC(n),0)}function rI(t){return t.reduce((e,n)=>e+yC(n),0)}function SC(t,e){if(e===void 0&&(e=No),!t)return;const{top:n,left:r,bottom:s,right:i}=e(t);xC(t)&&(s<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const sI=[["x",["left","right"],nI],["y",["top","bottom"],rI]];class Ag{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=sh(n),s=kC(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[i,o,a]of sI)for(const l of o)Object.defineProperty(this,l,{get:()=>{const d=a(r),u=s[i]-d;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class fa{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var s;(s=this.target)==null||s.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function iI(t){const{EventTarget:e}=tn(t);return t instanceof e?t:jo(t)}function hf(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var Dn;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Dn||(Dn={}));function Sy(t){t.preventDefault()}function oI(t){t.stopPropagation()}var Be;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(Be||(Be={}));const CC={start:[Be.Space,Be.Enter],cancel:[Be.Esc],end:[Be.Space,Be.Enter,Be.Tab]},aI=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case Be.Right:return{...n,x:n.x+25};case Be.Left:return{...n,x:n.x-25};case Be.Down:return{...n,y:n.y+25};case Be.Up:return{...n,y:n.y-25}}};class Tg{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new fa(jo(n)),this.windowListeners=new fa(tn(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Dn.Resize,this.handleCancel),this.windowListeners.add(Dn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Dn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&SC(r),n(rr)}handleKeyDown(e){if(rh(e)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:i=CC,coordinateGetter:o=aI,scrollBehavior:a="smooth"}=s,{code:l}=e;if(i.end.includes(l)){this.handleEnd(e);return}if(i.cancel.includes(l)){this.handleCancel(e);return}const{collisionRect:d}=r.current,u=d?{x:d.left,y:d.top}:rr;this.referenceCoordinates||(this.referenceCoordinates=u);const h=o(e,{active:n,context:r.current,currentCoordinates:u});if(h){const f=Ua(h,u),p={x:0,y:0},{scrollableAncestors:m}=r.current;for(const x of m){const b=e.code,{isTop:y,isRight:k,isLeft:v,isBottom:w,maxScroll:C,minScroll:j}=wC(x),S=tI(x),P={x:Math.min(b===Be.Right?S.right-S.width/2:S.right,Math.max(b===Be.Right?S.left:S.left+S.width/2,h.x)),y:Math.min(b===Be.Down?S.bottom-S.height/2:S.bottom,Math.max(b===Be.Down?S.top:S.top+S.height/2,h.y))},D=b===Be.Right&&!k||b===Be.Left&&!v,A=b===Be.Down&&!w||b===Be.Up&&!y;if(D&&P.x!==h.x){const N=x.scrollLeft+f.x,T=b===Be.Right&&N<=C.x||b===Be.Left&&N>=j.x;if(T&&!f.y){x.scrollTo({left:N,behavior:a});return}T?p.x=x.scrollLeft-N:p.x=b===Be.Right?x.scrollLeft-C.x:x.scrollLeft-j.x,p.x&&x.scrollBy({left:-p.x,behavior:a});break}else if(A&&P.y!==h.y){const N=x.scrollTop+f.y,T=b===Be.Down&&N<=C.y||b===Be.Up&&N>=j.y;if(T&&!f.x){x.scrollTo({top:N,behavior:a});return}T?p.y=x.scrollTop-N:p.y=b===Be.Down?x.scrollTop-C.y:x.scrollTop-j.y,p.y&&x.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(e,Ki(Ua(h,this.referenceCoordinates),p))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Tg.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=CC,onActivation:s}=e,{active:i}=n;const{code:o}=t.nativeEvent;if(r.start.includes(o)){const a=i.activatorNode.current;return a&&t.target!==a?!1:(t.preventDefault(),s?.({event:t.nativeEvent}),!0)}return!1}}];function Cy(t){return!!(t&&"distance"in t)}function jy(t){return!!(t&&"delay"in t)}class Lg{constructor(e,n,r){var s;r===void 0&&(r=iI(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:i}=e,{target:o}=i;this.props=e,this.events=n,this.document=jo(o),this.documentListeners=new fa(this.document),this.listeners=new fa(r),this.windowListeners=new fa(tn(o)),this.initialCoordinates=(s=uu(i))!=null?s:rr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Dn.Resize,this.handleCancel),this.windowListeners.add(Dn.DragStart,Sy),this.windowListeners.add(Dn.VisibilityChange,this.handleCancel),this.windowListeners.add(Dn.ContextMenu,Sy),this.documentListeners.add(Dn.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(jy(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Cy(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:r,onPending:s}=this.props;s(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(Dn.Click,oI,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Dn.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:a}}=i;if(!s)return;const l=(n=uu(e))!=null?n:rr,d=Ua(s,l);if(!r&&a){if(Cy(a)){if(a.tolerance!=null&&hf(d,a.tolerance))return this.handleCancel();if(hf(d,a.distance))return this.handleStart()}if(jy(a)&&hf(d,a.tolerance))return this.handleCancel();this.handlePending(a,d);return}e.cancelable&&e.preventDefault(),o(l)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===Be.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const lI={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Rg extends Lg{constructor(e){const{event:n}=e,r=jo(n.target);super(e,lI,r)}}Rg.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const cI={move:{name:"mousemove"},end:{name:"mouseup"}};var om;(function(t){t[t.RightClick=2]="RightClick"})(om||(om={}));class dI extends Lg{constructor(e){super(e,cI,jo(e.event.target))}}dI.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===om.RightClick?!1:(r?.({event:n}),!0)}}];const ff={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class uI extends Lg{constructor(e){super(e,ff)}static setup(){return window.addEventListener(ff.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(ff.move.name,e)};function e(){}}}uI.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:s}=n;return s.length>1?!1:(r?.({event:n}),!0)}}];var pa;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(pa||(pa={}));var fu;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(fu||(fu={}));function hI(t){let{acceleration:e,activator:n=pa.Pointer,canScroll:r,draggingRect:s,enabled:i,interval:o=5,order:a=fu.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:u,delta:h,threshold:f}=t;const p=pI({delta:h,disabled:!i}),[m,x]=j_(),b=g.useRef({x:0,y:0}),y=g.useRef({x:0,y:0}),k=g.useMemo(()=>{switch(n){case pa.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case pa.DraggableRect:return s}},[n,s,l]),v=g.useRef(null),w=g.useCallback(()=>{const j=v.current;if(!j)return;const S=b.current.x*y.current.x,P=b.current.y*y.current.y;j.scrollBy(S,P)},[]),C=g.useMemo(()=>a===fu.TreeOrder?[...d].reverse():d,[a,d]);g.useEffect(()=>{if(!i||!d.length||!k){x();return}for(const j of C){if(r?.(j)===!1)continue;const S=d.indexOf(j),P=u[S];if(!P)continue;const{direction:D,speed:A}=eI(j,P,k,e,f);for(const N of["x","y"])p[N][D[N]]||(A[N]=0,D[N]=0);if(A.x>0||A.y>0){x(),v.current=j,m(w,o),b.current=A,y.current=D;return}}b.current={x:0,y:0},y.current={x:0,y:0},x()},[e,w,r,x,i,o,JSON.stringify(k),JSON.stringify(p),m,d,C,u,JSON.stringify(f)])}const fI={x:{[Et.Backward]:!1,[Et.Forward]:!1},y:{[Et.Backward]:!1,[Et.Forward]:!1}};function pI(t){let{delta:e,disabled:n}=t;const r=du(e);return Jl(s=>{if(n||!r||!s)return fI;const i={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[Et.Backward]:s.x[Et.Backward]||i.x===-1,[Et.Forward]:s.x[Et.Forward]||i.x===1},y:{[Et.Backward]:s.y[Et.Backward]||i.y===-1,[Et.Forward]:s.y[Et.Forward]||i.y===1}}},[n,e,r])}function mI(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return Jl(s=>{var i;return e==null?null:(i=r??s)!=null?i:null},[r,e])}function gI(t,e){return g.useMemo(()=>t.reduce((n,r)=>{const{sensor:s}=r,i=s.activators.map(o=>({eventName:o.eventName,handler:e(o.handler,r)}));return[...n,...i]},[]),[t,e])}var Ka;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Ka||(Ka={}));var am;(function(t){t.Optimized="optimized"})(am||(am={}));const Ny=new Map;function xI(t,e){let{dragging:n,dependencies:r,config:s}=e;const[i,o]=g.useState(null),{frequency:a,measure:l,strategy:d}=s,u=g.useRef(t),h=b(),f=Wa(h),p=g.useCallback(function(y){y===void 0&&(y=[]),!f.current&&o(k=>k===null?y:k.concat(y.filter(v=>!k.includes(v))))},[f]),m=g.useRef(null),x=Jl(y=>{if(h&&!n)return Ny;if(!y||y===Ny||u.current!==t||i!=null){const k=new Map;for(let v of t){if(!v)continue;if(i&&i.length>0&&!i.includes(v.id)&&v.rect.current){k.set(v.id,v.rect.current);continue}const w=v.node.current,C=w?new Ag(l(w),w):null;v.rect.current=C,C&&k.set(v.id,C)}return k}return y},[t,i,n,h,l]);return g.useEffect(()=>{u.current=t},[t]),g.useEffect(()=>{h||p()},[n,h]),g.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),g.useEffect(()=>{h||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},a))},[a,h,p,...r]),{droppableRects:x,measureDroppableContainers:p,measuringScheduled:i!=null};function b(){switch(d){case Ka.Always:return!1;case Ka.BeforeDragging:return n;default:return!n}}}function _g(t,e){return Jl(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function bI(t,e){return _g(t,e)}function yI(t){let{callback:e,disabled:n}=t;const r=nh(e),s=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return g.useEffect(()=>()=>s?.disconnect(),[s]),s}function ih(t){let{callback:e,disabled:n}=t;const r=nh(e),s=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return g.useEffect(()=>()=>s?.disconnect(),[s]),s}function vI(t){return new Ag(No(t),t)}function Py(t,e,n){e===void 0&&(e=vI);const[r,s]=g.useState(null);function i(){s(l=>{if(!t)return null;if(t.isConnected===!1){var d;return(d=l??n)!=null?d:null}const u=e(t);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const o=yI({callback(l){if(t)for(const d of l){const{type:u,target:h}=d;if(u==="childList"&&h instanceof HTMLElement&&h.contains(t)){i();break}}}}),a=ih({callback:i});return nr(()=>{i(),t?(a?.observe(t),o?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),o?.disconnect())},[t]),r}function wI(t){const e=_g(t);return mC(t,e)}const Oy=[];function kI(t){const e=g.useRef(t),n=Jl(r=>t?r&&r!==Oy&&t&&e.current&&t.parentNode===e.current.parentNode?r:sh(t):Oy,[t]);return g.useEffect(()=>{e.current=t},[t]),n}function SI(t){const[e,n]=g.useState(null),r=g.useRef(t),s=g.useCallback(i=>{const o=uf(i.target);o&&n(a=>a?(a.set(o,im(o)),new Map(a)):null)},[]);return g.useEffect(()=>{const i=r.current;if(t!==i){o(i);const a=t.map(l=>{const d=uf(l);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,im(d)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=t}return()=>{o(t),o(i)};function o(a){a.forEach(l=>{const d=uf(l);d?.removeEventListener("scroll",s)})}},[s,t]),g.useMemo(()=>t.length?e?Array.from(e.values()).reduce((i,o)=>Ki(i,o),rr):kC(t):rr,[t,e])}function Ey(t,e){e===void 0&&(e=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},e),g.useEffect(()=>{const r=t!==rr;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?Ua(t,n.current):rr}function CI(t){g.useEffect(()=>{if(!th)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n?.()}},t.map(e=>{let{sensor:n}=e;return n}))}function jI(t,e){return g.useMemo(()=>t.reduce((n,r)=>{let{eventName:s,handler:i}=r;return n[s]=o=>{i(o,e)},n},{}),[t,e])}function jC(t){return g.useMemo(()=>t?X_(t):null,[t])}const Dy=[];function NI(t,e){e===void 0&&(e=No);const[n]=t,r=jC(n?tn(n):null),[s,i]=g.useState(Dy);function o(){i(()=>t.length?t.map(l=>vC(l)?r:new Ag(e(l),l)):Dy)}const a=ih({callback:o});return nr(()=>{a?.disconnect(),o(),t.forEach(l=>a?.observe(l))},[t]),s}function NC(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return Ql(e)?e:t}function PI(t){let{measure:e}=t;const[n,r]=g.useState(null),s=g.useCallback(d=>{for(const{target:u}of d)if(Ql(u)){r(h=>{const f=e(u);return h?{...h,width:f.width,height:f.height}:f});break}},[e]),i=ih({callback:s}),o=g.useCallback(d=>{const u=NC(d);i?.disconnect(),u&&i?.observe(u),r(u?e(u):null)},[e,i]),[a,l]=cu(o);return g.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const OI=[{sensor:Rg,options:{}},{sensor:Tg,options:{}}],EI={current:{}},yd={draggable:{measure:ky},droppable:{measure:ky,strategy:Ka.WhileDragging,frequency:am.Optimized},dragOverlay:{measure:No}};class ma extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const DI={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ma,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:hu},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:yd,measureDroppableContainers:hu,windowRect:null,measuringScheduled:!1},PC={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:hu,draggableNodes:new Map,over:null,measureDroppableContainers:hu},tc=g.createContext(PC),OC=g.createContext(DI);function MI(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ma}}}function AI(t,e){switch(e.type){case St.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case St.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case St.DragEnd:case St.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case St.RegisterDroppable:{const{element:n}=e,{id:r}=n,s=new ma(t.droppable.containers);return s.set(r,n),{...t,droppable:{...t.droppable,containers:s}}}case St.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const o=new ma(t.droppable.containers);return o.set(n,{...i,disabled:s}),{...t,droppable:{...t.droppable,containers:o}}}case St.UnregisterDroppable:{const{id:n,key:r}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const i=new ma(t.droppable.containers);return i.delete(n),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function TI(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:s}=g.useContext(tc),i=du(r),o=du(n?.id);return g.useEffect(()=>{if(!e&&!r&&i&&o!=null){if(!rh(i)||document.activeElement===i.target)return;const a=s.get(o);if(!a)return;const{activatorNode:l,node:d}=a;if(!l.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[l.current,d.current]){if(!u)continue;const h=O_(u);if(h){h.focus();break}}})}},[r,e,s,o,i]),null}function EC(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((s,i)=>i({transform:s,...r}),n):n}function LI(t){return g.useMemo(()=>({draggable:{...yd.draggable,...t?.draggable},droppable:{...yd.droppable,...t?.droppable},dragOverlay:{...yd.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function RI(t){let{activeNode:e,measure:n,initialRect:r,config:s=!0}=t;const i=g.useRef(!1),{x:o,y:a}=typeof s=="boolean"?{x:s,y:s}:s;nr(()=>{if(!o&&!a||!e){i.current=!1;return}if(i.current||!r)return;const d=e?.node.current;if(!d||d.isConnected===!1)return;const u=n(d),h=mC(u,r);if(o||(h.x=0),a||(h.y=0),i.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const f=xC(d);f&&f.scrollBy({top:h.y,left:h.x})}},[e,o,a,r,n])}const oh=g.createContext({...rr,scaleX:1,scaleY:1});var os;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(os||(os={}));const _I=g.memo(function(e){var n,r,s,i;let{id:o,accessibility:a,autoScroll:l=!0,children:d,sensors:u=OI,collisionDetection:h=W_,measuring:f,modifiers:p,...m}=e;const x=g.useReducer(AI,void 0,MI),[b,y]=x,[k,v]=L_(),[w,C]=g.useState(os.Uninitialized),j=w===os.Initialized,{draggable:{active:S,nodes:P,translate:D},droppable:{containers:A}}=b,N=S!=null?P.get(S):null,T=g.useRef({initial:null,translated:null}),I=g.useMemo(()=>{var ct;return S!=null?{id:S,data:(ct=N?.data)!=null?ct:EI,rect:T}:null},[S,N]),O=g.useRef(null),[E,M]=g.useState(null),[R,_]=g.useState(null),$=Wa(m,Object.values(m)),F=ec("DndDescribedBy",o),z=g.useMemo(()=>A.getEnabled(),[A]),V=LI(f),{droppableRects:Z,measureDroppableContainers:U,measuringScheduled:Q}=xI(z,{dragging:j,dependencies:[D.x,D.y],config:V.droppable}),se=mI(P,S),ce=g.useMemo(()=>R?uu(R):null,[R]),X=bi(),K=bI(se,V.draggable.measure);RI({activeNode:S!=null?P.get(S):null,config:X.layoutShiftCompensation,initialRect:K,measure:V.draggable.measure});const te=Py(se,V.draggable.measure,K),le=Py(se?se.parentElement:null),J=g.useRef({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:Z,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:A,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),de=A.getNodeFor((n=J.current.over)==null?void 0:n.id),Ce=PI({measure:V.dragOverlay.measure}),Te=(r=Ce.nodeRef.current)!=null?r:se,De=j?(s=Ce.rect)!=null?s:te:null,tt=!!(Ce.nodeRef.current&&Ce.rect),qt=wI(tt?null:te),Nt=jC(Te?tn(Te):null),mt=kI(j?de??se:null),nn=NI(mt),rn=EC(p,{transform:{x:D.x-qt.x,y:D.y-qt.y,scaleX:1,scaleY:1},activatorEvent:R,active:I,activeNodeRect:te,containerNodeRect:le,draggingNodeRect:De,over:J.current.over,overlayNodeRect:Ce.rect,scrollableAncestors:mt,scrollableAncestorRects:nn,windowRect:Nt}),jn=ce?Ki(ce,D):null,Vt=SI(mt),G=Ey(Vt),ie=Ey(Vt,[te]),Se=Ki(rn,G),Pe=De?G_(De,rn):null,Ye=I&&Pe?h({active:I,collisionRect:Pe,droppableRects:Z,droppableContainers:z,pointerCoordinates:jn}):null,Wn=pC(Ye,"id"),[Ht,Xr]=g.useState(null),To=tt?rn:Ki(rn,ie),pn=U_(To,(i=Ht?.rect)!=null?i:null,te),Zr=g.useRef(null),Ts=g.useCallback((ct,At)=>{let{sensor:Pt,options:Nn}=At;if(O.current==null)return;const Tt=P.get(O.current);if(!Tt)return;const gt=ct.nativeEvent,Lt=new Pt({active:O.current,activeNode:Tt,event:gt,options:Nn,context:J,onAbort(ut){if(!P.get(ut))return;const{onDragAbort:L}=$.current,B={id:ut};L?.(B),k({type:"onDragAbort",event:B})},onPending(ut,Pn,L,B){if(!P.get(ut))return;const{onDragPending:Y}=$.current,ne={id:ut,constraint:Pn,initialCoordinates:L,offset:B};Y?.(ne),k({type:"onDragPending",event:ne})},onStart(ut){const Pn=O.current;if(Pn==null)return;const L=P.get(Pn);if(!L)return;const{onDragStart:B}=$.current,H={activatorEvent:gt,active:{id:Pn,data:L.data,rect:T}};Us.unstable_batchedUpdates(()=>{B?.(H),C(os.Initializing),y({type:St.DragStart,initialCoordinates:ut,active:Pn}),k({type:"onDragStart",event:H}),M(Zr.current),_(gt)})},onMove(ut){y({type:St.DragMove,coordinates:ut})},onEnd:Un(St.DragEnd),onCancel:Un(St.DragCancel)});Zr.current=Lt;function Un(ut){return async function(){const{active:L,collisions:B,over:H,scrollAdjustedTranslate:Y}=J.current;let ne=null;if(L&&Y){const{cancelDrop:me}=$.current;ne={activatorEvent:gt,active:L,collisions:B,delta:Y,over:H},ut===St.DragEnd&&typeof me=="function"&&await Promise.resolve(me(ne))&&(ut=St.DragCancel)}O.current=null,Us.unstable_batchedUpdates(()=>{y({type:ut}),C(os.Uninitialized),Xr(null),M(null),_(null),Zr.current=null;const me=ut===St.DragEnd?"onDragEnd":"onDragCancel";if(ne){const he=$.current[me];he?.(ne),k({type:me,event:ne})}})}}},[P]),mi=g.useCallback((ct,At)=>(Pt,Nn)=>{const Tt=Pt.nativeEvent,gt=P.get(Nn);if(O.current!==null||!gt||Tt.dndKit||Tt.defaultPrevented)return;const Lt={active:gt};ct(Pt,At.options,Lt)===!0&&(Tt.dndKit={capturedBy:At.sensor},O.current=Nn,Ts(Pt,At))},[P,Ts]),gi=gI(u,mi);CI(u),nr(()=>{te&&w===os.Initializing&&C(os.Initialized)},[te,w]),g.useEffect(()=>{const{onDragMove:ct}=$.current,{active:At,activatorEvent:Pt,collisions:Nn,over:Tt}=J.current;if(!At||!Pt)return;const gt={active:At,activatorEvent:Pt,collisions:Nn,delta:{x:Se.x,y:Se.y},over:Tt};Us.unstable_batchedUpdates(()=>{ct?.(gt),k({type:"onDragMove",event:gt})})},[Se.x,Se.y]),g.useEffect(()=>{const{active:ct,activatorEvent:At,collisions:Pt,droppableContainers:Nn,scrollAdjustedTranslate:Tt}=J.current;if(!ct||O.current==null||!At||!Tt)return;const{onDragOver:gt}=$.current,Lt=Nn.get(Wn),Un=Lt&&Lt.rect.current?{id:Lt.id,rect:Lt.rect.current,data:Lt.data,disabled:Lt.disabled}:null,ut={active:ct,activatorEvent:At,collisions:Pt,delta:{x:Tt.x,y:Tt.y},over:Un};Us.unstable_batchedUpdates(()=>{Xr(Un),gt?.(ut),k({type:"onDragOver",event:ut})})},[Wn]),nr(()=>{J.current={activatorEvent:R,active:I,activeNode:se,collisionRect:Pe,collisions:Ye,droppableRects:Z,draggableNodes:P,draggingNode:Te,draggingNodeRect:De,droppableContainers:A,over:Ht,scrollableAncestors:mt,scrollAdjustedTranslate:Se},T.current={initial:De,translated:Pe}},[I,se,Ye,Pe,P,Te,De,Z,A,Ht,mt,Se]),hI({...X,delta:D,draggingRect:Pe,pointerCoordinates:jn,scrollableAncestors:mt,scrollableAncestorRects:nn});const xi=g.useMemo(()=>({active:I,activeNode:se,activeNodeRect:te,activatorEvent:R,collisions:Ye,containerNodeRect:le,dragOverlay:Ce,draggableNodes:P,droppableContainers:A,droppableRects:Z,over:Ht,measureDroppableContainers:U,scrollableAncestors:mt,scrollableAncestorRects:nn,measuringConfiguration:V,measuringScheduled:Q,windowRect:Nt}),[I,se,te,R,Ye,le,Ce,P,A,Z,Ht,U,mt,nn,V,Q,Nt]),Qr=g.useMemo(()=>({activatorEvent:R,activators:gi,active:I,activeNodeRect:te,ariaDescribedById:{draggable:F},dispatch:y,draggableNodes:P,over:Ht,measureDroppableContainers:U}),[R,gi,I,te,y,F,P,Ht,U]);return Qe.createElement(uC.Provider,{value:v},Qe.createElement(tc.Provider,{value:Qr},Qe.createElement(OC.Provider,{value:xi},Qe.createElement(oh.Provider,{value:pn},d)),Qe.createElement(TI,{disabled:a?.restoreFocus===!1})),Qe.createElement(I_,{...a,hiddenTextDescribedById:F}));function bi(){const ct=E?.autoScrollEnabled===!1,At=typeof l=="object"?l.enabled===!1:l===!1,Pt=j&&!ct&&!At;return typeof l=="object"?{...l,enabled:Pt}:{enabled:Pt}}}),II=g.createContext(null),My="button",$I="Draggable";function BI(t){let{id:e,data:n,disabled:r=!1,attributes:s}=t;const i=ec($I),{activators:o,activatorEvent:a,active:l,activeNodeRect:d,ariaDescribedById:u,draggableNodes:h,over:f}=g.useContext(tc),{role:p=My,roleDescription:m="draggable",tabIndex:x=0}=s??{},b=l?.id===e,y=g.useContext(b?oh:II),[k,v]=cu(),[w,C]=cu(),j=jI(o,e),S=Wa(n);nr(()=>(h.set(e,{id:e,key:i,node:k,activatorNode:w,data:S}),()=>{const D=h.get(e);D&&D.key===i&&h.delete(e)}),[h,e]);const P=g.useMemo(()=>({role:p,tabIndex:x,"aria-disabled":r,"aria-pressed":b&&p===My?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,x,b,m,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:d,attributes:P,isDragging:b,listeners:r?void 0:j,node:k,over:f,setNodeRef:v,setActivatorNodeRef:C,transform:y}}function DC(){return g.useContext(OC)}const FI="Droppable",zI={timeout:25};function MC(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:s}=t;const i=ec(FI),{active:o,dispatch:a,over:l,measureDroppableContainers:d}=g.useContext(tc),u=g.useRef({disabled:n}),h=g.useRef(!1),f=g.useRef(null),p=g.useRef(null),{disabled:m,updateMeasurementsFor:x,timeout:b}={...zI,...s},y=Wa(x??r),k=g.useCallback(()=>{if(!h.current){h.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{d(Array.isArray(y.current)?y.current:[y.current]),p.current=null},b)},[b]),v=ih({callback:k,disabled:m||!o}),w=g.useCallback((P,D)=>{v&&(D&&(v.unobserve(D),h.current=!1),P&&v.observe(P))},[v]),[C,j]=cu(w),S=Wa(e);return g.useEffect(()=>{!v||!C.current||(v.disconnect(),h.current=!1,v.observe(C.current))},[C,v]),g.useEffect(()=>(a({type:St.RegisterDroppable,element:{id:r,key:i,disabled:n,node:C,rect:f,data:S}}),()=>a({type:St.UnregisterDroppable,key:i,id:r})),[r]),g.useEffect(()=>{n!==u.current.disabled&&(a({type:St.SetDroppableDisabled,id:r,key:i,disabled:n}),u.current.disabled=n)},[r,i,n,a]),{active:o,rect:f,isOver:l?.id===r,node:C,over:l,setNodeRef:j}}function VI(t){let{animation:e,children:n}=t;const[r,s]=g.useState(null),[i,o]=g.useState(null),a=du(n);return!n&&!r&&a&&s(a),nr(()=>{if(!i)return;const l=r?.key,d=r?.props.id;if(l==null||d==null){s(null);return}Promise.resolve(e(d,i)).then(()=>{s(null)})},[e,r,i]),Qe.createElement(Qe.Fragment,null,n,r?g.cloneElement(r,{ref:o}):null)}const HI={x:0,y:0,scaleX:1,scaleY:1};function WI(t){let{children:e}=t;return Qe.createElement(tc.Provider,{value:PC},Qe.createElement(oh.Provider,{value:HI},e))}const UI={position:"fixed",touchAction:"none"},KI=t=>rh(t)?"transform 250ms ease":void 0,GI=g.forwardRef((t,e)=>{let{as:n,activatorEvent:r,adjustScale:s,children:i,className:o,rect:a,style:l,transform:d,transition:u=KI}=t;if(!a)return null;const h=s?d:{...d,scaleX:1,scaleY:1},f={...UI,width:a.width,height:a.height,top:a.top,left:a.left,transform:Ps.Transform.toString(h),transformOrigin:s&&r?B_(r,a):void 0,transition:typeof u=="function"?u(r):u,...l};return Qe.createElement(n,{className:o,style:f,ref:e},i)}),qI=t=>e=>{let{active:n,dragOverlay:r}=e;const s={},{styles:i,className:o}=t;if(i!=null&&i.active)for(const[a,l]of Object.entries(i.active))l!==void 0&&(s[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(i!=null&&i.dragOverlay)for(const[a,l]of Object.entries(i.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(const[l,d]of Object.entries(s))n.node.style.setProperty(l,d);o!=null&&o.active&&n.node.classList.remove(o.active)}},YI=t=>{let{transform:{initial:e,final:n}}=t;return[{transform:Ps.Transform.toString(e)},{transform:Ps.Transform.toString(n)}]},XI={duration:250,easing:"ease",keyframes:YI,sideEffects:qI({styles:{active:{opacity:"0"}}})};function ZI(t){let{config:e,draggableNodes:n,droppableContainers:r,measuringConfiguration:s}=t;return nh((i,o)=>{if(e===null)return;const a=n.get(i);if(!a)return;const l=a.node.current;if(!l)return;const d=NC(o);if(!d)return;const{transform:u}=tn(o).getComputedStyle(o),h=gC(u);if(!h)return;const f=typeof e=="function"?e:QI(e);return SC(l,s.draggable.measure),f({active:{id:i,data:a.data,node:l,rect:s.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:o,rect:s.dragOverlay.measure(d)},droppableContainers:r,measuringConfiguration:s,transform:h})})}function QI(t){const{duration:e,easing:n,sideEffects:r,keyframes:s}={...XI,...t};return i=>{let{active:o,dragOverlay:a,transform:l,...d}=i;if(!e)return;const u={x:a.rect.left-o.rect.left,y:a.rect.top-o.rect.top},h={scaleX:l.scaleX!==1?o.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?o.rect.height*l.scaleY/a.rect.height:1},f={x:l.x-u.x,y:l.y-u.y,...h},p=s({...d,active:o,dragOverlay:a,transform:{initial:l,final:f}}),[m]=p,x=p[p.length-1];if(JSON.stringify(m)===JSON.stringify(x))return;const b=r?.({active:o,dragOverlay:a,...d}),y=a.node.animate(p,{duration:e,easing:n,fill:"forwards"});return new Promise(k=>{y.onfinish=()=>{b?.(),k()}})}}let Ay=0;function JI(t){return g.useMemo(()=>{if(t!=null)return Ay++,Ay},[t])}const e9=Qe.memo(t=>{let{adjustScale:e=!1,children:n,dropAnimation:r,style:s,transition:i,modifiers:o,wrapperElement:a="div",className:l,zIndex:d=999}=t;const{activatorEvent:u,active:h,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:x,dragOverlay:b,over:y,measuringConfiguration:k,scrollableAncestors:v,scrollableAncestorRects:w,windowRect:C}=DC(),j=g.useContext(oh),S=JI(h?.id),P=EC(o,{activatorEvent:u,active:h,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:b.rect,over:y,overlayNodeRect:b.rect,scrollableAncestors:v,scrollableAncestorRects:w,transform:j,windowRect:C}),D=_g(f),A=ZI({config:r,draggableNodes:m,droppableContainers:x,measuringConfiguration:k}),N=D?b.setRef:void 0;return Qe.createElement(WI,null,Qe.createElement(VI,{animation:A},h&&S?Qe.createElement(GI,{key:S,id:h.id,ref:N,as:a,activatorEvent:u,adjustScale:e,className:l,transition:i,rect:D,style:{zIndex:d,...s},transform:P},n):null))});function Ig(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function t9(t,e){return t.reduce((n,r,s)=>{const i=e.get(r);return i&&(n[s]=i),n},Array(t.length))}function Wc(t){return t!==null&&t>=0}function n9(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function r9(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const Uc={scaleX:1,scaleY:1},s9=t=>{var e;let{rects:n,activeNodeRect:r,activeIndex:s,overIndex:i,index:o}=t;const a=(e=n[s])!=null?e:r;if(!a)return null;const l=i9(n,o,s);if(o===s){const d=n[i];return d?{x:s<i?d.left+d.width-(a.left+a.width):d.left-a.left,y:0,...Uc}:null}return o>s&&o<=i?{x:-a.width-l,y:0,...Uc}:o<s&&o>=i?{x:a.width+l,y:0,...Uc}:{x:0,y:0,...Uc}};function i9(t,e,n){const r=t[e],s=t[e-1],i=t[e+1];return!r||!s&&!i?0:n<e?s?r.left-(s.left+s.width):i.left-(r.left+r.width):i?i.left-(r.left+r.width):r.left-(s.left+s.width)}const AC=t=>{let{rects:e,activeIndex:n,overIndex:r,index:s}=t;const i=Ig(e,r,n),o=e[s],a=i[s];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},TC="Sortable",LC=Qe.createContext({activeIndex:-1,containerId:TC,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:AC,disabled:{draggable:!1,droppable:!1}});function o9(t){let{children:e,id:n,items:r,strategy:s=AC,disabled:i=!1}=t;const{active:o,dragOverlay:a,droppableRects:l,over:d,measureDroppableContainers:u}=DC(),h=ec(TC,n),f=a.rect!==null,p=g.useMemo(()=>r.map(j=>typeof j=="object"&&"id"in j?j.id:j),[r]),m=o!=null,x=o?p.indexOf(o.id):-1,b=d?p.indexOf(d.id):-1,y=g.useRef(p),k=!n9(p,y.current),v=b!==-1&&x===-1||k,w=r9(i);nr(()=>{k&&m&&u(p)},[k,p,m,u]),g.useEffect(()=>{y.current=p},[p]);const C=g.useMemo(()=>({activeIndex:x,containerId:h,disabled:w,disableTransforms:v,items:p,overIndex:b,useDragOverlay:f,sortedRects:t9(p,l),strategy:s}),[x,h,w.draggable,w.droppable,v,p,b,l,f,s]);return Qe.createElement(LC.Provider,{value:C},e)}const a9=t=>{let{id:e,items:n,activeIndex:r,overIndex:s}=t;return Ig(n,r,s).indexOf(e)},l9=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:s,items:i,newIndex:o,previousItems:a,previousContainerId:l,transition:d}=t;return!d||!r||a!==i&&s===o?!1:n?!0:o!==s&&e===l},c9={duration:200,easing:"ease"},RC="transform",d9=Ps.Transition.toString({property:RC,duration:0,easing:"linear"}),u9={roleDescription:"sortable"};function h9(t){let{disabled:e,index:n,node:r,rect:s}=t;const[i,o]=g.useState(null),a=g.useRef(n);return nr(()=>{if(!e&&n!==a.current&&r.current){const l=s.current;if(l){const d=No(r.current,{ignoreTransform:!0}),u={x:l.left-d.left,y:l.top-d.top,scaleX:l.width/d.width,scaleY:l.height/d.height};(u.x||u.y)&&o(u)}}n!==a.current&&(a.current=n)},[e,n,r,s]),g.useEffect(()=>{i&&o(null)},[i]),i}function f9(t){let{animateLayoutChanges:e=l9,attributes:n,disabled:r,data:s,getNewIndex:i=a9,id:o,strategy:a,resizeObserverConfig:l,transition:d=c9}=t;const{items:u,containerId:h,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:x,overIndex:b,useDragOverlay:y,strategy:k}=g.useContext(LC),v=p9(r,p),w=u.indexOf(o),C=g.useMemo(()=>({sortable:{containerId:h,index:w,items:u},...s}),[h,s,w,u]),j=g.useMemo(()=>u.slice(u.indexOf(o)),[u,o]),{rect:S,node:P,isOver:D,setNodeRef:A}=MC({id:o,data:C,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:j,...l}}),{active:N,activatorEvent:T,activeNodeRect:I,attributes:O,setNodeRef:E,listeners:M,isDragging:R,over:_,setActivatorNodeRef:$,transform:F}=BI({id:o,data:C,attributes:{...u9,...n},disabled:v.draggable}),z=C_(A,E),V=!!N,Z=V&&!m&&Wc(f)&&Wc(b),U=!y&&R,Q=U&&Z?F:null,ce=Z?Q??(a??k)({rects:x,activeNodeRect:I,activeIndex:f,overIndex:b,index:w}):null,X=Wc(f)&&Wc(b)?i({id:o,items:u,activeIndex:f,overIndex:b}):w,K=N?.id,te=g.useRef({activeId:K,items:u,newIndex:X,containerId:h}),le=u!==te.current.items,J=e({active:N,containerId:h,isDragging:R,isSorting:V,id:o,index:w,items:u,newIndex:te.current.newIndex,previousItems:te.current.items,previousContainerId:te.current.containerId,transition:d,wasDragging:te.current.activeId!=null}),de=h9({disabled:!J,index:w,node:P,rect:S});return g.useEffect(()=>{V&&te.current.newIndex!==X&&(te.current.newIndex=X),h!==te.current.containerId&&(te.current.containerId=h),u!==te.current.items&&(te.current.items=u)},[V,X,h,u]),g.useEffect(()=>{if(K===te.current.activeId)return;if(K!=null&&te.current.activeId==null){te.current.activeId=K;return}const Te=setTimeout(()=>{te.current.activeId=K},50);return()=>clearTimeout(Te)},[K]),{active:N,activeIndex:f,attributes:O,data:C,rect:S,index:w,newIndex:X,items:u,isOver:D,isSorting:V,isDragging:R,listeners:M,node:P,overIndex:b,over:_,setNodeRef:z,setActivatorNodeRef:$,setDroppableNodeRef:A,setDraggableNodeRef:E,transform:de??ce,transition:Ce()};function Ce(){if(de||le&&te.current.newIndex===w)return d9;if(!(U&&!rh(T)||!d)&&(V||J))return Ps.Transition.toString({...d,property:RC})}}function p9(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t?.draggable)!=null?n:e.draggable,droppable:(r=t?.droppable)!=null?r:e.droppable}}function pu(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const m9=[Be.Down,Be.Right,Be.Up,Be.Left],g9=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:a}}=e;if(m9.includes(t.code)){if(t.preventDefault(),!n||!r)return;const l=[];i.getEnabled().forEach(h=>{if(!h||h!=null&&h.disabled)return;const f=s.get(h.id);if(f)switch(t.code){case Be.Down:r.top<f.top&&l.push(h);break;case Be.Up:r.top>f.top&&l.push(h);break;case Be.Left:r.left>f.left&&l.push(h);break;case Be.Right:r.left<f.left&&l.push(h);break}});const d=V_({collisionRect:r,droppableRects:s,droppableContainers:l});let u=pC(d,"id");if(u===o?.id&&d.length>1&&(u=d[1].id),u!=null){const h=i.get(n.id),f=i.get(u),p=f?s.get(f.id):null,m=f?.node.current;if(m&&p&&h&&f){const b=sh(m).some((j,S)=>a[S]!==j),y=_C(h,f),k=x9(h,f),v=b||!y?{x:0,y:0}:{x:k?r.width-p.width:0,y:k?r.height-p.height:0},w={x:p.left,y:p.top};return v.x&&v.y?w:Ua(w,v)}}}};function _C(t,e){return!pu(t)||!pu(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function x9(t,e){return!pu(t)||!pu(e)||!_C(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}g.createContext(null);var b9=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 Ga(t){"@babel/helpers - typeof";return Ga=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},Ga(t)}var y9=["shape","color","background","size","style","iconMultiple","Icon","iconStyle","iconClassName"];function Ty(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Kc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ty(Object(n),!0).forEach(function(r){v9(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ty(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function v9(t,e,n){return e=w9(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function w9(t){var e=k9(t,"string");return Ga(e)=="symbol"?e:String(e)}function k9(t,e){if(Ga(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ga(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function S9(t,e){if(t==null)return{};var n=C9(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function C9(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var Ms=g.memo(function(t){var e=t.shape,n=e===void 0?"circle":e,r=t.color,s=r===void 0?"#fff":r,i=t.background,o=t.size,a=t.style,l=t.iconMultiple,d=l===void 0?.75:l,u=t.Icon,h=t.iconStyle,f=t.iconClassName,p=S9(t,y9),m=Y8(),x=m.isDarkMode;return c.jsx(e_,Kc(Kc({flex:"none",style:Kc({background:i,borderRadius:n==="circle"?"50%":Math.floor(o*.1),boxShadow:b9(x,i),color:s,height:o,width:o},a)},p),{},{children:u&&c.jsx(u,{className:f,color:s,size:o,style:Kc({transform:"scale(".concat(d,")")},h)})}))});function qa(t){"@babel/helpers - typeof";return qa=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},qa(t)}var j9=["Icon","style","Text","color","size","spaceMultiple","textMultiple","extra","extraStyle","showText","showLogo","extraClassName","iconProps","inverse"];function Ly(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function es(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ly(Object(n),!0).forEach(function(r){N9(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ly(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function N9(t,e,n){return e=P9(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function P9(t){var e=O9(t,"string");return qa(e)=="symbol"?e:String(e)}function O9(t,e){if(qa(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(qa(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function E9(t,e){if(t==null)return{};var n=D9(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function D9(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var As=g.memo(function(t){var e=t.Icon,n=t.style,r=t.Text,s=t.color,i=t.size,o=i===void 0?24:i,a=t.spaceMultiple,l=a===void 0?1:a,d=t.textMultiple,u=d===void 0?1:d,h=t.extra,f=t.extraStyle,p=t.showText,m=p===void 0?!0:p,x=t.showLogo,b=x===void 0?!0:x,y=t.extraClassName,k=t.iconProps,v=t.inverse,w=E9(t,j9),C=e&&b&&c.jsx(e,es(es({size:o},k),{},{style:es(v?{marginLeft:o*l}:{marginRight:o*l},k?.style)})),j=m&&r&&c.jsx(r,{size:o*u});return c.jsxs(sC,es(es({align:"center",flex:"none",horizontal:!0,justify:"flex-start",style:es({color:s},n)},w),{},{children:[v?c.jsxs(c.Fragment,{children:[j,C]}):c.jsxs(c.Fragment,{children:[C,j]}),h&&c.jsx("span",{className:y,style:es({fontSize:o*u*.95,lineHeight:1},f),children:h})]}))}),M9=function(e,n){return g.useMemo(function(){var r=Array.from({length:n},function(s,i){var o="lobe-icons-".concat(r_(e),"-fill-").concat(i);return{fill:"url(#".concat(o,")"),id:o}});return r},[e,n])},Po="Claude",A9=.8,T9=.1,IC="#D97757",L9=IC,R9="#fff",_9=.75;function Ya(t){"@babel/helpers - typeof";return Ya=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},Ya(t)}var I9=["size","style"];function Ry(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function pf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ry(Object(n),!0).forEach(function(r){$9(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ry(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function $9(t,e,n){return e=B9(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function B9(t){var e=F9(t,"string");return Ya(e)=="symbol"?e:String(e)}function F9(t,e){if(Ya(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ya(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function z9(t,e){if(t==null)return{};var n=V9(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function V9(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var $g=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=z9(t,I9);return c.jsxs("svg",pf(pf({fill:"currentColor",fillRule:"evenodd",height:n,style:pf({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Po}),c.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"})]}))});function Xa(t){"@babel/helpers - typeof";return Xa=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},Xa(t)}function _y(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function H9(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?_y(Object(n),!0).forEach(function(r){W9(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_y(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function W9(t,e,n){return e=U9(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function U9(t){var e=K9(t,"string");return Xa(e)=="symbol"?e:String(e)}function K9(t,e){if(Xa(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Xa(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function G9(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var q9=g.memo(function(t){var e=Object.assign({},(G9(t),t));return c.jsx(Ms,H9({Icon:$g,"aria-label":Po,background:L9,color:R9,iconMultiple:_9},e))});function Za(t){"@babel/helpers - typeof";return Za=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},Za(t)}var Y9=["size","style"];function Iy(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function mf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Iy(Object(n),!0).forEach(function(r){X9(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Iy(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function X9(t,e,n){return e=Z9(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Z9(t){var e=Q9(t,"string");return Za(e)=="symbol"?e:String(e)}function Q9(t,e){if(Za(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Za(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function J9(t,e){if(t==null)return{};var n=e$(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function e$(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var $C=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=J9(t,Y9);return c.jsxs("svg",mf(mf({height:n,style:mf({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Po}),c.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z",fill:"#D97757",fillRule:"nonzero"})]}))});function Qa(t){"@babel/helpers - typeof";return Qa=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},Qa(t)}var t$=["size","style"];function $y(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function gf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?$y(Object(n),!0).forEach(function(r){n$(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$y(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function n$(t,e,n){return e=r$(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r$(t){var e=s$(t,"string");return Qa(e)=="symbol"?e:String(e)}function s$(t,e){if(Qa(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Qa(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function i$(t,e){if(t==null)return{};var n=o$(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function o$(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var BC=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=i$(t,t$);return c.jsxs("svg",gf(gf({fill:"currentColor",fillRule:"nonzero",height:n,style:gf({flex:"none",lineHeight:1},r),viewBox:"0 0 97 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Po}),c.jsx("path",{d:"M13.623 20.222c-3.417 0-5.753-1.901-6.855-4.827a12.992 12.992 0 01-.838-4.772c0-4.907 2.206-8.315 7.08-8.315 3.275 0 5.297 1.425 6.448 4.826h1.402l-.19-4.69C18.709 1.18 16.258.543 13.276.543c-4.2 0-7.775 1.874-9.763 5.254a11.357 11.357 0 00-1.511 5.872c0 3.753 1.777 7.08 5.113 8.926a11.95 11.95 0 005.943 1.398c3.254 0 5.835-.617 8.122-1.697l.593-5.172h-1.43c-.858 2.362-1.88 3.78-3.574 4.534-.831.373-1.88.564-3.146.564zm14.74-17.914L28.499 0h-.967L23.23 1.29v.699l1.907.882v16.142c0 1.1-.565 1.344-2.043 1.528v1.18h7.319v-1.18c-1.484-.184-2.042-.428-2.042-1.528V2.315l-.007-.007zm29.104 19.685h.565l4.95-.937v-1.208l-.695-.054c-1.157-.109-1.457-.346-1.457-1.29V9.897l.137-2.763h-.783l-4.678.672v1.181l.457.082c1.266.183 1.64.536 1.64 1.419v7.67c-1.212.937-2.369 1.527-3.744 1.527-1.525 0-2.471-.774-2.471-2.58V9.905l.136-2.763h-.804l-4.684.672v1.181l.484.082c1.266.183 1.64.536 1.64 1.418v7.08c0 3 1.703 4.426 4.412 4.426 2.07 0 3.765-1.1 5.038-2.627L57.474 22l-.007-.007zm-13.602-9.55c0-3.836-2.043-5.309-5.733-5.309-3.254 0-5.616 1.344-5.616 3.57 0 .666.238 1.175.721 1.528l2.478-.326c-.109-.746-.163-1.201-.163-1.391 0-1.263.674-1.901 2.042-1.901 2.022 0 3.044 1.419 3.044 3.7v.746l-5.106 1.527c-1.702.462-2.67.863-3.316 1.8a3.386 3.386 0 00-.476 1.9c0 2.172 1.497 3.706 4.057 3.706 1.852 0 3.493-.835 4.922-2.416.51 1.581 1.294 2.416 2.69 2.416 1.13 0 2.15-.455 3.063-1.344l-.272-.937a4.363 4.363 0 01-1.178.163c-.783 0-1.157-.617-1.157-1.826v-5.607zm-6.536 7.378c-1.396 0-2.26-.808-2.26-2.226 0-.964.456-1.528 1.43-1.854l4.139-1.31v3.965c-1.321.997-2.097 1.425-3.31 1.425zm43.095 1.235v-1.208l-.701-.054c-1.158-.109-1.45-.346-1.45-1.29V2.308L78.409 0h-.974l-4.302 1.29v.699l1.906.882V8.18a6.024 6.024 0 00-3.656-1.046c-4.276 0-7.612 3.245-7.612 8.098 0 3.998 2.397 6.761 6.346 6.761 2.042 0 3.819-.99 4.922-2.525l-.136 2.525h.571l4.95-.937zm-8.96-12.313c2.043 0 3.575 1.181 3.575 3.353v6.11a4.91 4.91 0 01-3.547 1.425c-2.928 0-4.412-2.308-4.412-5.39 0-3.462 1.695-5.498 4.385-5.498zm19.424 3.055c-.381-1.792-1.484-2.81-3.016-2.81-2.288 0-3.874 1.717-3.874 4.18 0 3.646 1.934 6.008 5.059 6.008a5.858 5.858 0 005.03-2.953l.913.245c-.408 3.163-3.281 5.525-6.808 5.525-4.14 0-6.992-3.054-6.992-7.399 0-4.378 3.098-7.46 7.237-7.46 3.09 0 5.27 1.853 5.97 5.07l-10.783 3.3V14.05l7.264-2.247v-.006z"})]}))});function Ja(t){"@babel/helpers - typeof";return Ja=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},Ja(t)}var a$=["type"];function By(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function l$(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?By(Object(n),!0).forEach(function(r){c$(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):By(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function c$(t,e,n){return e=d$(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function d$(t){var e=u$(t,"string");return Ja(e)=="symbol"?e:String(e)}function u$(t,e){if(Ja(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ja(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function h$(t,e){if(t==null)return{};var n=f$(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function f$(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var p$=g.memo(function(t){var e=t.type,n=e===void 0?"mono":e,r=h$(t,a$),s=n==="color"?$C:$g;return c.jsx(As,l$({Icon:s,Text:BC,"aria-label":Po,spaceMultiple:T9,textMultiple:A9},r))}),fi=$g;fi.Color=$C;fi.Text=BC;fi.Combine=p$;fi.Avatar=q9;fi.colorPrimary=IC;fi.title=Po;var nc="OpenAI",m$=.75,g$=.1,FC="#000",zC="#19C37D",VC="#AB68FF",HC="#F86AA4",Bg="#F9C322",WC="#0099FF",UC="#0000FE",x$=FC,b$="#fff",y$=.75;function el(t){"@babel/helpers - typeof";return el=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},el(t)}var v$=["size","style"];function Fy(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function xf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Fy(Object(n),!0).forEach(function(r){w$(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Fy(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function w$(t,e,n){return e=k$(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function k$(t){var e=S$(t,"string");return el(e)=="symbol"?e:String(e)}function S$(t,e){if(el(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(el(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function C$(t,e){if(t==null)return{};var n=j$(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function j$(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var Fg=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=C$(t,v$);return c.jsxs("svg",xf(xf({fill:"currentColor",fillRule:"evenodd",height:n,style:xf({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:nc}),c.jsx("path",{d:"M21.55 10.004a5.416 5.416 0 00-.478-4.501c-1.217-2.09-3.662-3.166-6.05-2.66A5.59 5.59 0 0010.831 1C8.39.995 6.224 2.546 5.473 4.838A5.553 5.553 0 001.76 7.496a5.487 5.487 0 00.691 6.5 5.416 5.416 0 00.477 4.502c1.217 2.09 3.662 3.165 6.05 2.66A5.586 5.586 0 0013.168 23c2.443.006 4.61-1.546 5.361-3.84a5.553 5.553 0 003.715-2.66 5.488 5.488 0 00-.693-6.497v.001zm-8.381 11.558a4.199 4.199 0 01-2.675-.954c.034-.018.093-.05.132-.074l4.44-2.53a.71.71 0 00.364-.623v-6.176l1.877 1.069c.02.01.033.029.036.05v5.115c-.003 2.274-1.87 4.118-4.174 4.123zM4.192 17.78a4.059 4.059 0 01-.498-2.763c.032.02.09.055.131.078l4.44 2.53c.225.13.504.13.73 0l5.42-3.088v2.138a.068.068 0 01-.027.057L9.9 19.288c-1.999 1.136-4.552.46-5.707-1.51h-.001zM3.023 8.216A4.15 4.15 0 015.198 6.41l-.002.151v5.06a.711.711 0 00.364.624l5.42 3.087-1.876 1.07a.067.067 0 01-.063.005l-4.489-2.559c-1.995-1.14-2.679-3.658-1.53-5.63h.001zm15.417 3.54l-5.42-3.088L14.896 7.6a.067.067 0 01.063-.006l4.489 2.557c1.998 1.14 2.683 3.662 1.529 5.633a4.163 4.163 0 01-2.174 1.807V12.38a.71.71 0 00-.363-.623zm1.867-2.773a6.04 6.04 0 00-.132-.078l-4.44-2.53a.731.731 0 00-.729 0l-5.42 3.088V7.325a.068.068 0 01.027-.057L14.1 4.713c2-1.137 4.555-.46 5.707 1.513.487.833.664 1.809.499 2.757h.001zm-11.741 3.81l-1.877-1.068a.065.065 0 01-.036-.051V6.559c.001-2.277 1.873-4.122 4.181-4.12.976 0 1.92.338 2.671.954-.034.018-.092.05-.131.073l-4.44 2.53a.71.71 0 00-.365.623l-.003 6.173v.002zm1.02-2.168L12 9.25l2.414 1.375v2.75L12 14.75l-2.415-1.375v-2.75z"})]}))}),ii="Gemini",N$=.8,P$=.2,KC="#fff",O$=KC,E$="#fff",D$=.8;function tl(t){"@babel/helpers - typeof";return tl=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},tl(t)}var M$=["size","style"];function zy(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function bf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?zy(Object(n),!0).forEach(function(r){A$(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):zy(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function A$(t,e,n){return e=T$(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function T$(t){var e=L$(t,"string");return tl(e)=="symbol"?e:String(e)}function L$(t,e){if(tl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(tl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function R$(t,e){return B$(t)||$$(t,e)||I$(t,e)||_$()}function _$(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
293
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function I$(t,e){if(t){if(typeof t=="string")return Vy(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 Vy(t,e)}}function Vy(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 $$(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,a=[],l=!0,d=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(u){d=!0,s=u}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw s}}return a}}function B$(t){if(Array.isArray(t))return t}function F$(t,e){if(t==null)return{};var n=z$(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function z$(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var zg=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=F$(t,M$),i=M9(ii,3),o=R$(i,3),a=o[0],l=o[1],d=o[2];return c.jsxs("svg",bf(bf({height:n,style:bf({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:ii}),c.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"#3186FF"}),c.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:a.fill}),c.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:l.fill}),c.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:d.fill}),c.jsxs("defs",{children:[c.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:a.id,x1:"7",x2:"11",y1:"15.5",y2:"12",children:[c.jsx("stop",{stopColor:"#08B962"}),c.jsx("stop",{offset:"1",stopColor:"#08B962",stopOpacity:"0"})]}),c.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:l.id,x1:"8",x2:"11.5",y1:"5.5",y2:"11",children:[c.jsx("stop",{stopColor:"#F94543"}),c.jsx("stop",{offset:"1",stopColor:"#F94543",stopOpacity:"0"})]}),c.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:d.id,x1:"3.5",x2:"17.5",y1:"13.5",y2:"12",children:[c.jsx("stop",{stopColor:"#FABC12"}),c.jsx("stop",{offset:".46",stopColor:"#FABC12",stopOpacity:"0"})]})]})]}))});function nl(t){"@babel/helpers - typeof";return nl=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},nl(t)}function Hy(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function V$(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Hy(Object(n),!0).forEach(function(r){H$(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Hy(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function H$(t,e,n){return e=W$(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function W$(t){var e=U$(t,"string");return nl(e)=="symbol"?e:String(e)}function U$(t,e){if(nl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(nl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function K$(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var G$=g.memo(function(t){var e=Object.assign({},(K$(t),t));return c.jsx(Ms,V$({Icon:zg,"aria-label":ii,background:O$,color:E$,iconMultiple:D$},e))});function rl(t){"@babel/helpers - typeof";return rl=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},rl(t)}var q$=["size","style"];function Wy(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function yf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Wy(Object(n),!0).forEach(function(r){Y$(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Wy(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Y$(t,e,n){return e=X$(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function X$(t){var e=Z$(t,"string");return rl(e)=="symbol"?e:String(e)}function Z$(t,e){if(rl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(rl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Q$(t,e){if(t==null)return{};var n=J$(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function J$(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var GC=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=Q$(t,q$);return c.jsxs("svg",yf(yf({fill:"currentColor",fillRule:"evenodd",height:n,style:yf({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:ii}),c.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z"})]}))});function sl(t){"@babel/helpers - typeof";return sl=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},sl(t)}var eB=["size","style"];function Uy(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function vf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Uy(Object(n),!0).forEach(function(r){tB(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Uy(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function tB(t,e,n){return e=nB(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function nB(t){var e=rB(t,"string");return sl(e)=="symbol"?e:String(e)}function rB(t,e){if(sl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(sl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function sB(t,e){if(t==null)return{};var n=iB(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function iB(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var qC=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=sB(t,eB);return c.jsxs("svg",vf(vf({fill:"currentColor",fillRule:"evenodd",height:n,style:vf({flex:"none",lineHeight:1},r),viewBox:"0 0 98 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:ii}),c.jsx("path",{d:"M21.186 12.67c0 2.649-.786 4.759-2.359 6.33-1.766 1.87-4.09 2.806-6.969 2.806-2.756 0-5.088-.953-6.996-2.86C2.954 17.04 2 14.693 2 11.904c0-2.789.954-5.137 2.862-7.043C6.77 2.953 9.102 2 11.858 2c1.396 0 2.712.247 3.949.741 1.236.495 2.252 1.192 3.047 2.092l-1.749 1.748c-.583-.706-1.338-1.258-2.266-1.655a7.49 7.49 0 00-2.981-.596c-2.067 0-3.816.715-5.247 2.145-1.413 1.448-2.12 3.257-2.12 5.428s.707 3.98 2.12 5.428c1.431 1.43 3.18 2.145 5.247 2.145 1.89 0 3.463-.53 4.717-1.588 1.254-1.06 1.979-2.516 2.173-4.37h-6.89v-2.277h9.196c.088.495.132.971.132 1.43m7.652-4.633c1.946 0 3.494.629 4.645 1.886 1.15 1.257 1.726 3.018 1.726 5.282l-.027.268H24.877c.036 1.284.464 2.318 1.285 3.102.82.785 1.802 1.177 2.944 1.177 1.57 0 2.802-.784 3.694-2.354l2.195 1.07a6.54 6.54 0 01-2.45 2.595C31.503 21.688 30.32 22 29 22c-1.927 0-3.516-.66-4.765-1.98-1.249-1.319-1.873-2.986-1.873-5.001 0-1.997.606-3.66 1.82-4.988 1.213-1.329 2.766-1.993 4.657-1.993m-.053 2.247c-.928 0-1.727.285-2.396.856-.67.57-1.11 1.337-1.325 2.3h7.522c-.071-.91-.442-1.663-1.111-2.26-.67-.598-1.566-.896-2.69-.896M39.247 21.53h-2.455V8.465h2.348v1.813h.107c.374-.64.947-1.173 1.721-1.6.774-.427 1.544-.64 2.309-.64.96 0 1.806.222 2.535.667a3.931 3.931 0 011.601 1.84c1.085-1.671 2.589-2.507 4.51-2.507 1.513 0 2.678.462 3.496 1.387.819.924 1.228 2.24 1.228 3.946v8.16h-2.455v-7.786c0-1.227-.223-2.112-.668-2.654-.444-.542-1.192-.813-2.241-.813-.943 0-1.735.4-2.375 1.2-.64.8-.961 1.742-.961 2.826v7.227h-2.455v-7.786c0-1.227-.223-2.112-.668-2.654-.444-.542-1.191-.813-2.241-.813-.943 0-1.735.4-2.375 1.2-.64.8-.961 1.742-.961 2.826v7.227zM61.911 3.93c0 .48-.17.89-.508 1.228a1.675 1.675 0 01-1.23.508c-.48 0-.89-.17-1.229-.508a1.673 1.673 0 01-.508-1.228c0-.481.17-.89.508-1.229a1.675 1.675 0 011.23-.508c.48 0 .89.17 1.23.508.338.338.507.748.507 1.228m-.11 4.514v13.088h-2.857V8.443h2.857zM80 3.93c0 .48-.17.89-.508 1.228a1.675 1.675 0 01-1.23.508c-.48 0-.89-.17-1.229-.508a1.673 1.673 0 01-.508-1.228c0-.481.17-.89.508-1.229a1.675 1.675 0 011.23-.508c.48 0 .89.17 1.23.508.338.338.507.748.507 1.228m-.11 4.514v13.088h-2.857V8.443h2.857zm-16.343.022h2.349v1.813h.107c.373-.64.947-1.173 1.721-1.6a4.935 4.935 0 012.415-.64c1.601 0 2.833.458 3.696 1.373.863.916 1.294 2.218 1.294 3.907v8.213h-2.455v-8.053c-.053-2.133-1.13-3.2-3.229-3.2-.978 0-1.797.395-2.455 1.187-.658.79-.987 1.737-.987 2.84v7.226h-2.456V8.465z"})]}))});function il(t){"@babel/helpers - typeof";return il=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},il(t)}var oB=["type"];function Ky(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function aB(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ky(Object(n),!0).forEach(function(r){lB(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ky(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function lB(t,e,n){return e=cB(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function cB(t){var e=dB(t,"string");return il(e)=="symbol"?e:String(e)}function dB(t,e){if(il(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(il(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function uB(t,e){if(t==null)return{};var n=hB(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function hB(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var fB=g.memo(function(t){var e=t.type,n=e===void 0?"mono":e,r=uB(t,oB),s=n==="color"?zg:GC;return c.jsx(As,aB({Icon:s,Text:qC,"aria-label":ii,spaceMultiple:P$,textMultiple:N$},r))}),pi=GC;pi.Color=zg;pi.Text=qC;pi.Combine=fB;pi.Avatar=G$;pi.colorPrimary=KC;pi.title=ii;function ol(t){"@babel/helpers - typeof";return ol=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},ol(t)}var pB=["type"];function Gy(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function mB(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Gy(Object(n),!0).forEach(function(r){gB(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Gy(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function gB(t,e,n){return e=xB(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xB(t){var e=bB(t,"string");return ol(e)=="symbol"?e:String(e)}function bB(t,e){if(ol(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ol(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function yB(t,e){if(t==null)return{};var n=vB(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function vB(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var wB=g.memo(function(t){var e=t.type,n=e===void 0?"normal":e,r=yB(t,pB),s=g.useMemo(function(){switch(n){case"gpt3":return zC;case"gpt4":return VC;case"gpt5":return HC;case"o3":case"o1":return Bg;case"oss":return WC;case"platform":return UC;default:return x$}},[n]);return c.jsx(Ms,mB({Icon:Fg,"aria-label":nc,background:s,color:b$,iconMultiple:y$},r))});function al(t){"@babel/helpers - typeof";return al=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},al(t)}var kB=["size","style"];function qy(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function wf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?qy(Object(n),!0).forEach(function(r){SB(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):qy(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function SB(t,e,n){return e=CB(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function CB(t){var e=jB(t,"string");return al(e)=="symbol"?e:String(e)}function jB(t,e){if(al(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(al(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function NB(t,e){if(t==null)return{};var n=PB(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function PB(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var YC=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=NB(t,kB);return c.jsxs("svg",wf(wf({fill:"currentColor",fillRule:"evenodd",height:n,style:wf({flex:"none",lineHeight:1},r),viewBox:"0 0 84 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:nc}),c.jsx("path",{d:"M2 10.955c0 5.276 3.376 8.955 8.054 8.955 4.678 0 8.054-3.679 8.054-8.955S14.732 2 10.054 2C5.423 2 2.068 5.606 2 10.797L2 10.955zm13.021 0c0 3.775-2.05 6.22-4.967 6.22-2.918 0-4.968-2.445-4.968-6.22 0-3.776 2.05-6.22 4.968-6.22 2.917 0 4.967 2.444 4.967 6.22zm11.778 8.955c3.545 0 5.57-3.001 5.57-6.607 0-3.607-2.025-6.608-5.57-6.608-1.64 0-2.845.654-3.64 1.598V6.937h-2.894V24h2.893v-5.688c.796.944 2.002 1.598 3.641 1.598zm-3.713-6.97c0-2.397 1.35-3.703 3.135-3.703 2.097 0 3.23 1.645 3.23 4.066 0 2.42-1.133 4.066-3.23 4.066-1.785 0-3.135-1.332-3.135-3.68v-.75zM40.2 19.91c2.532 0 4.533-1.331 5.425-3.558l-2.483-.944c-.386 1.307-1.52 2.033-2.942 2.033-1.857 0-3.159-1.331-3.376-3.51h8.874v-.967c0-3.485-1.953-6.269-5.619-6.269-3.665 0-6.028 2.88-6.028 6.608 0 3.92 2.532 6.607 6.15 6.607zm-.145-10.77c1.833 0 2.701 1.21 2.725 2.614H36.97c.434-1.719 1.591-2.614 3.086-2.614zm7.814 10.504h2.894v-7.455c0-1.815 1.326-2.783 2.628-2.783 1.591 0 2.218 1.137 2.218 2.71v7.528h2.894V11.27c0-2.735-1.592-4.575-4.244-4.575-1.64 0-2.773.75-3.496 1.598V6.937h-2.894v12.707zM66.978 2.266l-6.56 17.378h3.063l1.471-3.97h7.475l1.495 3.97h3.11L70.475 2.266h-3.496zm1.687 3.437l2.75 7.26h-5.45l2.7-7.26zM82 2.317h-3.086v17.377H82V2.317z"})]}))});function ll(t){"@babel/helpers - typeof";return ll=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},ll(t)}var OB=["extraStyle"];function Yy(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Xy(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Yy(Object(n),!0).forEach(function(r){EB(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Yy(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function EB(t,e,n){return e=DB(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function DB(t){var e=MB(t,"string");return ll(e)=="symbol"?e:String(e)}function MB(t,e){if(ll(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ll(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function AB(t,e){if(t==null)return{};var n=TB(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function TB(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var LB=g.memo(function(t){var e=t.extraStyle,n=AB(t,OB);return c.jsx(As,Xy({Icon:Fg,Text:YC,"aria-label":nc,extraStyle:Xy({fontWeight:600},e),spaceMultiple:g$,textMultiple:m$},n))}),Cn=Fg;Cn.Text=YC;Cn.Combine=LB;Cn.Avatar=wB;Cn.colorPrimary=FC;Cn.colorGpt3=zC;Cn.colorGpt4=VC;Cn.colorGpt5=HC;Cn.colorO1=Bg;Cn.colorO3=Bg;Cn.colorOss=WC;Cn.colorPlatform=UC;Cn.title=nc;var rc="GithubCopilot",RB=.75,_B=.3,XC="#000",IB=XC,$B="#fff",BB=.75;function cl(t){"@babel/helpers - typeof";return cl=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},cl(t)}var FB=["size","style"];function Zy(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function kf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Zy(Object(n),!0).forEach(function(r){zB(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Zy(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function zB(t,e,n){return e=VB(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function VB(t){var e=HB(t,"string");return cl(e)=="symbol"?e:String(e)}function HB(t,e){if(cl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(cl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function WB(t,e){if(t==null)return{};var n=UB(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function UB(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var Vg=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=WB(t,FB);return c.jsxs("svg",kf(kf({fill:"currentColor",fillRule:"evenodd",height:n,style:kf({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:rc}),c.jsx("path",{d:"M19.245 5.364c1.322 1.36 1.877 3.216 2.11 5.817.622 0 1.2.135 1.592.654l.73.964c.21.278.323.61.323.955v2.62c0 .339-.173.669-.453.868C20.239 19.602 16.157 21.5 12 21.5c-4.6 0-9.205-2.583-11.547-4.258-.28-.2-.452-.53-.453-.868v-2.62c0-.345.113-.679.321-.956l.73-.963c.392-.517.974-.654 1.593-.654l.029-.297c.25-2.446.81-4.213 2.082-5.52 2.461-2.54 5.71-2.851 7.146-2.864h.198c1.436.013 4.685.323 7.146 2.864zm-7.244 4.328c-.284 0-.613.016-.962.05-.123.447-.305.85-.57 1.108-1.05 1.023-2.316 1.18-2.994 1.18-.638 0-1.306-.13-1.851-.464-.516.165-1.012.403-1.044.996a65.882 65.882 0 00-.063 2.884l-.002.48c-.002.563-.005 1.126-.013 1.69.002.326.204.63.51.765 2.482 1.102 4.83 1.657 6.99 1.657 2.156 0 4.504-.555 6.985-1.657a.854.854 0 00.51-.766c.03-1.682.006-3.372-.076-5.053-.031-.596-.528-.83-1.046-.996-.546.333-1.212.464-1.85.464-.677 0-1.942-.157-2.993-1.18-.266-.258-.447-.661-.57-1.108-.32-.032-.64-.049-.96-.05zm-2.525 4.013c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zm5 0c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zM7.635 5.087c-1.05.102-1.935.438-2.385.906-.975 1.037-.765 3.668-.21 4.224.405.394 1.17.657 1.995.657h.09c.649-.013 1.785-.176 2.73-1.11.435-.41.705-1.433.675-2.47-.03-.834-.27-1.52-.63-1.813-.39-.336-1.275-.482-2.265-.394zm6.465.394c-.36.292-.6.98-.63 1.813-.03 1.037.24 2.06.675 2.47.968.957 2.136 1.104 2.776 1.11h.044c.825 0 1.59-.263 1.995-.657.555-.556.765-3.187-.21-4.224-.45-.468-1.335-.804-2.385-.906-.99-.088-1.875.058-2.265.394zM12 7.615c-.24 0-.525.015-.84.044.03.16.045.336.06.526l-.001.159a2.94 2.94 0 01-.014.25c.225-.022.425-.027.612-.028h.366c.187 0 .387.006.612.028-.015-.146-.015-.277-.015-.409.015-.19.03-.365.06-.526a9.29 9.29 0 00-.84-.044z"})]}))});function dl(t){"@babel/helpers - typeof";return dl=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},dl(t)}function Qy(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function KB(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Qy(Object(n),!0).forEach(function(r){GB(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Qy(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function GB(t,e,n){return e=qB(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qB(t){var e=YB(t,"string");return dl(e)=="symbol"?e:String(e)}function YB(t,e){if(dl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(dl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function XB(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var ZB=g.memo(function(t){var e=Object.assign({},(XB(t),t));return c.jsx(Ms,KB({Icon:Vg,"aria-label":rc,background:IB,color:$B,iconMultiple:BB},e))});function ul(t){"@babel/helpers - typeof";return ul=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},ul(t)}var QB=["size","style"];function Jy(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Sf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Jy(Object(n),!0).forEach(function(r){JB(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Jy(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function JB(t,e,n){return e=eF(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eF(t){var e=tF(t,"string");return ul(e)=="symbol"?e:String(e)}function tF(t,e){if(ul(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ul(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function nF(t,e){if(t==null)return{};var n=rF(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function rF(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var ZC=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=nF(t,QB);return c.jsxs("svg",Sf(Sf({fill:"currentColor",fillRule:"evenodd",height:n,style:Sf({flex:"none",lineHeight:1},r),viewBox:"0 0 154 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:rc}),c.jsx("path",{d:"M2 11.875c0 5.256 3.013 8.506 8.19 8.506 4.76 0 8.027-2.72 8.027-7.722v-1.545h-7.982v2.928h4.095c-.161 1.96-1.68 3.25-4.049 3.25-2.6 0-4.347-1.498-4.347-4.334V10.7c0-2.582 1.518-4.31 4.186-4.31 1.91 0 3.267.922 3.68 2.374h3.865c-.437-3.366-3.427-5.625-7.499-5.625C5.29 3.138 2 6.366 2 11.875zm17.308-5.44h3.496V3h-3.496v3.435zm0 13.715h3.496V7.795h-3.496V20.15zm10.544-9.52h2.438V7.795h-2.438V3.922h-3.496v3.873H24.17v2.835h2.186v6.8c0 1.637.69 2.72 2.76 2.72h3.174v-2.766h-2.438V10.63zm3.994 9.52h3.727v-7.076h7.568v7.076h3.726V3.346h-3.726v6.777h-7.568V3.346h-3.727V20.15zM62.385 7.795h-3.497v6.523c0 1.868-1.012 3.205-2.668 3.205-1.38 0-2.162-.83-2.162-2.56V7.796h-3.52v7.722c0 2.95 1.357 4.864 4.118 4.864 1.955 0 3.29-.945 4.002-2.49h.207l.46 2.26h3.06V7.794zm1.698 12.355h3.06l.436-2.213h.207c.713 1.591 2.3 2.444 4.072 2.444 3.174 0 5.015-2.374 5.015-6.385 0-4.057-1.887-6.432-5.084-6.432-1.978 0-3.428 1.014-4.003 2.49h-.207V3h-3.496v17.15zm3.496-5.624v-1.06c0-1.845 1.173-3.043 2.99-3.043 1.657 0 2.738.853 2.738 2.581v1.983c0 1.521-.874 2.559-2.714 2.559-1.864 0-3.014-1.222-3.014-3.02zm21.8 5.855c4.21 0 7.177-2.351 7.683-6.063h-3.151c-.46 2.098-2.186 3.389-4.486 3.389-2.852 0-4.67-1.867-4.67-4.518v-2.743c0-2.882 1.887-4.634 4.716-4.634 2.53 0 4.072 1.36 4.44 3.366h3.151c-.368-3.665-3.243-6.063-7.499-6.063-5.038 0-7.982 3.274-7.982 8.668 0 5.348 2.898 8.598 7.798 8.598zm8.533-6.34c0 3.92 2.346 6.34 5.98 6.34 3.796 0 6.004-2.536 6.004-6.34 0-4.056-2.484-6.338-6.003-6.338-3.635 0-5.981 2.397-5.981 6.339zm2.898.992V13.12c0-1.89 1.22-3.066 3.083-3.066 1.817 0 3.082 1.152 3.082 3.066v1.913c0 1.96-1.288 2.997-3.082 2.997-1.749 0-3.083-1.015-3.083-2.997zM111.018 24h2.853v-6.132h.184c.667 1.453 2.116 2.398 4.186 2.398 3.083 0 4.992-2.26 4.992-6.293 0-3.942-1.863-6.27-4.992-6.27-1.863 0-3.427.852-4.186 2.397h-.184l-.345-2.167h-2.508V24zm6.211-6.063c-2.024 0-3.358-1.314-3.358-3.342v-1.222c0-2.005 1.31-3.342 3.381-3.342 2.002 0 3.037 1.152 3.037 2.881v2.144c0 1.815-1.16 2.849-2.973 2.88l-.087.001zm7.1-11.733h2.83V3.115h-2.83v3.09zm0 13.946h2.83V7.933h-2.83V20.15zm4.338 0h2.83V3.115h-2.83V20.15zm9.927-12.447c3.52 0 6.004 2.282 6.004 6.339 0 3.803-2.208 6.339-6.004 6.339-3.634 0-5.98-2.42-5.98-6.34 0-3.941 2.346-6.338 5.98-6.338zm10.922-3.689v3.919H152v2.328h-2.484v7.607H152v2.282h-2.99c-1.749 0-2.324-.922-2.324-2.282v-7.607h-2.185V7.933h2.185V4.014h2.83zm-10.922 6.04c-1.863 0-3.082 1.175-3.082 3.066v1.913c0 1.982 1.334 2.997 3.082 2.997 1.795 0 3.083-1.038 3.083-2.997V13.12c0-1.914-1.265-3.066-3.083-3.066z"})]}))});function hl(t){"@babel/helpers - typeof";return hl=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},hl(t)}function ev(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function sF(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ev(Object(n),!0).forEach(function(r){iF(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ev(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function iF(t,e,n){return e=oF(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function oF(t){var e=aF(t,"string");return hl(e)=="symbol"?e:String(e)}function aF(t,e){if(hl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(hl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function lF(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var cF=g.memo(function(t){var e=Object.assign({},(lF(t),t));return c.jsx(As,sF({Icon:Vg,Text:ZC,"aria-label":rc,spaceMultiple:_B,textMultiple:RB},e))}),Oo=Vg;Oo.Text=ZC;Oo.Combine=cF;Oo.Avatar=ZB;Oo.colorPrimary=XC;Oo.title=rc;var sc="Cline",dF=.7,uF=.2,QC="#323B43",hF=QC,fF="#fff",pF=.6;function fl(t){"@babel/helpers - typeof";return fl=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},fl(t)}var mF=["size","style"];function tv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Cf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?tv(Object(n),!0).forEach(function(r){gF(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function gF(t,e,n){return e=xF(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xF(t){var e=bF(t,"string");return fl(e)=="symbol"?e:String(e)}function bF(t,e){if(fl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(fl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function yF(t,e){if(t==null)return{};var n=vF(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function vF(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var Hg=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=yF(t,mF);return c.jsxs("svg",Cf(Cf({fill:"currentColor",fillRule:"evenodd",height:n,style:Cf({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:sc}),c.jsx("path",{d:"M17.035 3.991c2.75 0 4.98 2.24 4.98 5.003v1.667l1.45 2.896a1.01 1.01 0 01-.002.909l-1.448 2.864v1.668c0 2.762-2.23 5.002-4.98 5.002H7.074c-2.751 0-4.98-2.24-4.98-5.002V17.33l-1.48-2.855a1.01 1.01 0 01-.003-.927l1.482-2.887V8.994c0-2.763 2.23-5.003 4.98-5.003h9.962zM8.265 9.6a2.274 2.274 0 00-2.274 2.274v4.042a2.274 2.274 0 004.547 0v-4.042A2.274 2.274 0 008.265 9.6zm7.326 0a2.274 2.274 0 00-2.274 2.274v4.042a2.274 2.274 0 104.548 0v-4.042A2.274 2.274 0 0015.59 9.6z"}),c.jsx("path",{d:"M12.054 5.558a2.779 2.779 0 100-5.558 2.779 2.779 0 000 5.558z"})]}))});function pl(t){"@babel/helpers - typeof";return pl=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},pl(t)}function nv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function wF(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?nv(Object(n),!0).forEach(function(r){kF(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):nv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function kF(t,e,n){return e=SF(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function SF(t){var e=CF(t,"string");return pl(e)=="symbol"?e:String(e)}function CF(t,e){if(pl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(pl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function jF(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var NF=g.memo(function(t){var e=Object.assign({},(jF(t),t));return c.jsx(Ms,wF({Icon:Hg,"aria-label":sc,background:hF,color:fF,iconMultiple:pF},e))});function ml(t){"@babel/helpers - typeof";return ml=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},ml(t)}var PF=["size","style"];function rv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function jf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?rv(Object(n),!0).forEach(function(r){OF(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):rv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function OF(t,e,n){return e=EF(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function EF(t){var e=DF(t,"string");return ml(e)=="symbol"?e:String(e)}function DF(t,e){if(ml(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ml(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function MF(t,e){if(t==null)return{};var n=AF(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function AF(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var JC=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=MF(t,PF);return c.jsxs("svg",jf(jf({fill:"currentColor",fillRule:"evenodd",height:n,style:jf({flex:"none",lineHeight:1},r),viewBox:"0 0 88 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:sc}),c.jsx("path",{d:"M79.558 21.986c-1.13 0-2.167-.189-3.108-.565a7.128 7.128 0 01-2.403-1.569 6.933 6.933 0 01-1.554-2.331 7.876 7.876 0 01-.537-2.925v-.58c0-1.196.189-2.279.566-3.25.376-.97.894-1.798 1.554-2.486a6.84 6.84 0 012.289-1.582 7.005 7.005 0 012.797-.566c1.103 0 2.078.189 2.925.566.848.367 1.56.88 2.134 1.54.575.668 1.008 1.464 1.3 2.388.292.923.438 1.93.438 3.023v1.456H75.362v.07c.103.67.263 1.23.48 1.682.217.452.513.857.89 1.215.377.377.82.669 1.328.876.518.207 1.084.31 1.696.31.838 0 1.62-.16 2.346-.48a4.71 4.71 0 001.794-1.398l1.808 1.752c-.508.734-1.29 1.394-2.345 1.978-1.046.584-2.313.876-3.8.876zm-.41-13.113c-.48 0-.927.09-1.342.269-.405.17-.768.414-1.088.735-.32.33-.589.725-.805 1.187a6.25 6.25 0 00-.48 1.568h7.191v-.226c0-.443-.08-.88-.24-1.314a3.545 3.545 0 00-.678-1.159 3.004 3.004 0 00-1.074-.763c-.424-.198-.919-.297-1.484-.297zM55.043 21.703V6.415h3.052l.212 2.176c.207-.292.433-.56.678-.805.255-.255.523-.48.806-.679a5.555 5.555 0 013.179-.975 6.5 6.5 0 012.148.34 4.11 4.11 0 011.667 1.073c.461.49.82 1.117 1.074 1.88.254.753.381 1.667.381 2.74v9.538h-3.377v-9.48c0-.632-.07-1.16-.212-1.583-.141-.424-.348-.763-.621-1.018a2.3 2.3 0 00-.99-.537 4.736 4.736 0 00-1.328-.17c-.414 0-.8.057-1.158.17a3.421 3.421 0 00-1.611 1.004 4.282 4.282 0 00-.523.706v10.908h-3.377zM38.44 6.415h8.111v12.49h4.493v2.798H38.441v-2.797h4.705v-9.68H38.44V6.416zm4.395-3.956c0-.274.047-.523.141-.75a1.69 1.69 0 01.41-.607c.17-.16.372-.282.607-.367.245-.094.519-.141.82-.141.509 0 .918.131 1.23.395.32.254.503.584.55.99.066.414-.004.776-.212 1.087-.207.302-.508.504-.904.608a1.48 1.48 0 01-.706.353c-.273.057-.575.033-.905-.07a1.396 1.396 0 01-.777-.552 1.758 1.758 0 01-.254-.946zM20.934 0h8.238v18.906h4.634v2.797H20.934v-2.797h4.832V2.812h-4.832V0zM16.71 15.373c-.095.999-.33 1.908-.707 2.727a6.672 6.672 0 01-1.484 2.077 6.542 6.542 0 01-2.218 1.357c-.848.31-1.79.466-2.826.466-.848 0-1.63-.113-2.346-.339a6.467 6.467 0 01-1.893-.99 6.55 6.55 0 01-1.413-1.426 9.438 9.438 0 01-1.003-1.851c-.274-.66-.48-1.375-.622-2.148A14.34 14.34 0 012 12.83v-2.812c0-.8.066-1.573.198-2.317.132-.744.33-1.446.593-2.106A8.284 8.284 0 013.88 3.603a7.296 7.296 0 011.555-1.54 6.953 6.953 0 011.836-.904A7.256 7.256 0 019.49.834c1.083 0 2.049.16 2.896.48.858.32 1.588.773 2.19 1.357a6.337 6.337 0 011.442 2.147c.358.839.588 1.771.692 2.798h-3.391a6.568 6.568 0 00-.353-1.653c-.17-.5-.405-.923-.707-1.272a2.977 2.977 0 00-1.144-.791c-.453-.188-.994-.283-1.625-.283-.443 0-.843.062-1.201.184-.349.122-.66.297-.933.523a3.385 3.385 0 00-.947 1.074 7.033 7.033 0 00-.607 1.455c-.123.471-.217.975-.283 1.512a15.25 15.25 0 00-.084 1.625v2.84c0 .688.037 1.333.113 1.936.084.602.212 1.154.381 1.653.132.414.297.791.495 1.13.207.34.452.631.734.876.292.264.627.466 1.004.608.386.132.824.198 1.314.198.584 0 1.102-.085 1.554-.255.452-.17.838-.419 1.159-.749.31-.32.56-.72.748-1.2.189-.481.311-1.032.368-1.654h3.405z"})]}))});function gl(t){"@babel/helpers - typeof";return gl=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},gl(t)}function sv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function TF(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?sv(Object(n),!0).forEach(function(r){LF(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):sv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function LF(t,e,n){return e=RF(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function RF(t){var e=_F(t,"string");return gl(e)=="symbol"?e:String(e)}function _F(t,e){if(gl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(gl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function IF(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var $F=g.memo(function(t){var e=Object.assign({},(IF(t),t));return c.jsx(As,TF({Icon:Hg,Text:JC,"aria-label":sc,iconProps:{shape:"square"},spaceMultiple:uF,textMultiple:dF},e))}),Eo=Hg;Eo.Text=JC;Eo.Combine=$F;Eo.Avatar=NF;Eo.colorPrimary=QC;Eo.title=sc;var ic="Cursor",BF=.7,FF=.1,ej="#000",zF=ej,VF="#fff",HF=.6;function xl(t){"@babel/helpers - typeof";return xl=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},xl(t)}var WF=["size","style"];function iv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Nf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?iv(Object(n),!0).forEach(function(r){UF(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):iv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function UF(t,e,n){return e=KF(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function KF(t){var e=GF(t,"string");return xl(e)=="symbol"?e:String(e)}function GF(t,e){if(xl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(xl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function qF(t,e){if(t==null)return{};var n=YF(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function YF(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var Wg=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=qF(t,WF);return c.jsxs("svg",Nf(Nf({fill:"currentColor",fillRule:"evenodd",height:n,style:Nf({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:ic}),c.jsx("path",{d:"M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z"})]}))});function bl(t){"@babel/helpers - typeof";return bl=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},bl(t)}function ov(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function XF(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ov(Object(n),!0).forEach(function(r){ZF(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ov(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ZF(t,e,n){return e=QF(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function QF(t){var e=JF(t,"string");return bl(e)=="symbol"?e:String(e)}function JF(t,e){if(bl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(bl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ez(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var tz=g.memo(function(t){var e=Object.assign({},(ez(t),t));return c.jsx(Ms,XF({Icon:Wg,"aria-label":ic,background:zF,color:VF,iconMultiple:HF},e))});function yl(t){"@babel/helpers - typeof";return yl=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},yl(t)}var nz=["size","style"];function av(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Pf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?av(Object(n),!0).forEach(function(r){rz(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):av(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function rz(t,e,n){return e=sz(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function sz(t){var e=iz(t,"string");return yl(e)=="symbol"?e:String(e)}function iz(t,e){if(yl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(yl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function oz(t,e){if(t==null)return{};var n=az(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function az(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var tj=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=oz(t,nz);return c.jsxs("svg",Pf(Pf({fill:"currentColor",fillRule:"evenodd",height:n,style:Pf({flex:"none",lineHeight:1},r),viewBox:"0 0 123 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:ic}),c.jsx("path",{d:"M11.995 2.33h6.516v3.582h-6.295C8.82 5.912 6.169 7.868 6.169 12c0 4.133 2.65 6.089 6.047 6.089h6.295v3.581H11.72C6.03 21.67 2 18.336 2 12c0-6.337 4.307-9.67 9.995-9.67zm9.829 0h4.03V14.15c0 2.947 1.354 4.325 4.53 4.325 3.175 0 4.528-1.377 4.528-4.325V2.33h4.03v12.644c0 4.297-2.733 7.025-8.559 7.025-5.826 0-8.56-2.755-8.56-7.052V2.33zm38.185 5.483c0 2.149-1.243 3.801-2.9 4.518v.055c1.74.248 2.624 1.488 2.65 3.169l.084 6.115h-4.031l-.083-5.454c-.027-1.212-.745-1.956-2.181-1.956h-6.71v7.41h-4.03V2.33h11.127c3.644 0 6.074 1.846 6.074 5.483zm-4.059.55c0-1.652-.883-2.561-2.54-2.561H46.84v5.123h6.626c1.518 0 2.485-.909 2.485-2.562zm19.3 7.66c0-1.378-.884-1.957-2.209-2.067l-4.473-.413c-3.866-.358-5.881-1.873-5.881-5.537 0-3.664 2.485-5.675 6.046-5.675h9.885V5.8h-9.609c-1.38 0-2.263.717-2.263 2.094 0 1.378.91 2.039 2.291 2.15l4.556.385c3.452.303 5.715 1.874 5.715 5.565 0 3.691-2.402 5.675-5.798 5.675H63.184V18.2h9.94c1.297 0 2.126-.882 2.126-2.177zM91.097 2c6.074 0 9.912 3.884 9.912 9.972C101.01 18.061 97.006 22 90.932 22s-9.912-3.94-9.912-10.028C81.02 5.884 85.024 2 91.098 2zm5.743 10c0-4.077-2.374-6.474-5.826-6.474-3.451 0-5.826 2.397-5.826 6.474s2.375 6.473 5.826 6.473c3.452 0 5.826-2.396 5.826-6.473zM121 7.813c0 2.149-1.242 3.801-2.899 4.518v.055c1.739.248 2.623 1.488 2.65 3.169l.083 6.115h-4.031l-.083-5.454c-.027-1.212-.745-1.956-2.181-1.956h-6.709v7.41h-4.031V2.33h11.127c3.645 0 6.074 1.846 6.074 5.483zm-4.059.55c0-1.652-.883-2.561-2.54-2.561h-6.571v5.123h6.626c1.518 0 2.485-.909 2.485-2.562z"})]}))});function vl(t){"@babel/helpers - typeof";return vl=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},vl(t)}function lv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function lz(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?lv(Object(n),!0).forEach(function(r){cz(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):lv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function cz(t,e,n){return e=dz(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function dz(t){var e=uz(t,"string");return vl(e)=="symbol"?e:String(e)}function uz(t,e){if(vl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(vl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function hz(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var fz=g.memo(function(t){var e=Object.assign({},(hz(t),t));return c.jsx(As,lz({Icon:Wg,Text:tj,"aria-label":ic,spaceMultiple:FF,textMultiple:BF},e))}),Do=Wg;Do.Text=tj;Do.Combine=fz;Do.Avatar=tz;Do.colorPrimary=ej;Do.title=ic;var oc="Goose",pz=.7,mz=.2,nj="#fff",gz=nj,xz="#000",bz=.65;function wl(t){"@babel/helpers - typeof";return wl=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},wl(t)}var yz=["size","style"];function cv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Of(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?cv(Object(n),!0).forEach(function(r){vz(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):cv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function vz(t,e,n){return e=wz(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function wz(t){var e=kz(t,"string");return wl(e)=="symbol"?e:String(e)}function kz(t,e){if(wl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(wl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Sz(t,e){if(t==null)return{};var n=Cz(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Cz(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var Ug=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=Sz(t,yz);return c.jsxs("svg",Of(Of({fill:"currentColor",fillRule:"evenodd",height:n,style:Of({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:oc}),c.jsx("path",{d:"M21.595 23.61c1.167-.254 2.405-.944 2.405-.944l-2.167-1.784a12.124 12.124 0 01-2.695-3.131 12.127 12.127 0 00-3.97-4.049l-.794-.462a1.115 1.115 0 01-.488-.815.844.844 0 01.154-.575c.413-.582 2.548-3.115 2.94-3.44.503-.416 1.065-.762 1.586-1.159.074-.056.148-.112.221-.17.003-.002.007-.004.009-.007.167-.131.325-.272.45-.438.453-.524.563-.988.59-1.193-.061-.197-.244-.639-.753-1.148.319.02.705.272 1.056.569.235-.376.481-.773.727-1.171.165-.266-.08-.465-.086-.471h-.001V3.22c-.007-.007-.206-.25-.471-.086-.567.35-1.134.702-1.639 1.021 0 0-.597-.012-1.305.599a2.464 2.464 0 00-.438.45l-.007.009c-.058.072-.114.147-.17.221-.397.521-.743 1.083-1.16 1.587-.323.391-2.857 2.526-3.44 2.94a.842.842 0 01-.574.153 1.115 1.115 0 01-.815-.488l-.462-.794a12.123 12.123 0 00-4.049-3.97 12.133 12.133 0 01-3.13-2.695L1.332 0S.643 1.238.39 2.405c.352.428 1.27 1.49 2.34 2.302C1.58 4.167.73 3.75.06 3.4c-.103.765-.063 1.92.043 2.816.726.317 1.961.806 3.219 1.066-1.006.236-2.11.278-2.961.262.15.554.358 1.119.64 1.688.119.263.25.52.39.77.452.125 2.222.383 3.164.171l-2.51.897a27.776 27.776 0 002.544 2.726c2.031-1.092 2.494-1.241 4.018-2.238-2.467 2.008-3.108 2.828-3.8 3.67l-.483.678c-.25.351-.469.725-.65 1.117-.61 1.31-1.47 4.1-1.47 4.1-.154.486.202.842.674.674 0 0 2.79-.861 4.1-1.47.392-.182.766-.4 1.118-.65l.677-.483c.227-.187.453-.37.701-.586 0 0 1.705 2.02 3.458 3.349l.896-2.511c-.211.942.046 2.712.17 3.163.252.142.509.272.772.392.569.28 1.134.49 1.688.64-.016-.853.026-1.956.261-2.962.26 1.258.75 2.493 1.067 3.219.895.106 2.051.146 2.816.043a73.87 73.87 0 01-1.308-2.67c.811 1.07 1.874 1.988 2.302 2.34h-.001z"})]}))});function kl(t){"@babel/helpers - typeof";return kl=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},kl(t)}function dv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function jz(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?dv(Object(n),!0).forEach(function(r){Nz(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):dv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Nz(t,e,n){return e=Pz(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Pz(t){var e=Oz(t,"string");return kl(e)=="symbol"?e:String(e)}function Oz(t,e){if(kl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(kl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ez(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var Dz=g.memo(function(t){var e=Object.assign({},(Ez(t),t));return c.jsx(Ms,jz({Icon:Ug,"aria-label":oc,background:gz,color:xz,iconMultiple:bz},e))});function Sl(t){"@babel/helpers - typeof";return Sl=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},Sl(t)}var Mz=["size","style"];function uv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Ef(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?uv(Object(n),!0).forEach(function(r){Az(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):uv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Az(t,e,n){return e=Tz(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Tz(t){var e=Lz(t,"string");return Sl(e)=="symbol"?e:String(e)}function Lz(t,e){if(Sl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Sl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Rz(t,e){if(t==null)return{};var n=_z(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function _z(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var rj=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=Rz(t,Mz);return c.jsxs("svg",Ef(Ef({fill:"currentColor",fillRule:"evenodd",height:n,style:Ef({flex:"none",lineHeight:1},r),viewBox:"0 0 87 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:oc}),c.jsx("path",{d:"M17.122 16.607c0 4.696-3.219 7.393-7.774 7.393-3.674 0-6.255-1.546-7.257-4.637l3.401-1.21c.486 1.786 1.852 2.907 3.856 2.907 2.46 0 4.13-1.211 4.13-4.12v-1.122c-.85 1.121-2.46 2-4.494 2C4.61 17.818 2 14.273 2 9.909 2 5.546 4.611 2 8.984 2c2.004 0 3.644.879 4.494 2V2.303h3.644v14.303zm-3.583-6.85c0-2.908-1.58-4.575-3.857-4.575-2.52 0-4.008 1.757-4.008 4.727 0 2.94 1.488 4.727 4.008 4.727 2.278 0 3.857-1.666 3.857-4.515v-.363zM35.546 10.273c0 4.94-3.188 8.273-7.683 8.273-4.494 0-7.682-3.334-7.682-8.273C20.181 5.333 23.37 2 27.863 2c4.495 0 7.683 3.333 7.683 8.273zm-11.69 0c0 3.242 1.548 5.212 4.007 5.212 2.46 0 4.009-1.97 4.009-5.212 0-3.243-1.549-5.212-4.009-5.212-2.46 0-4.008 1.97-4.008 5.212zM52.957 10.273c0 4.94-3.188 8.273-7.682 8.273s-7.682-3.334-7.682-8.273C37.593 5.333 40.78 2 45.275 2s7.682 3.333 7.682 8.273zm-11.69 0c0 3.242 1.548 5.212 4.008 5.212s4.008-1.97 4.008-5.212c0-3.243-1.549-5.212-4.008-5.212-2.46 0-4.008 1.97-4.008 5.212zM54.336 15.182L57.069 13c.941 1.546 2.763 2.576 4.615 2.576 1.549 0 2.976-.546 2.976-1.97 0-1.364-1.336-1.515-3.856-2.03-2.52-.515-5.405-1.152-5.405-4.546 0-2.909 2.55-5.03 6.224-5.03 2.794 0 5.284 1.242 6.438 3L65.6 7.212c-.91-1.424-2.429-2.242-4.19-2.242-1.488 0-2.46.666-2.46 1.727 0 1.152 1.154 1.364 3.158 1.788 2.703.576 6.104 1.151 6.104 4.788 0 3.211-2.946 5.273-6.56 5.273-2.945 0-5.89-1.182-7.317-3.364zM77.965 18.546c-4.555 0-7.743-3.364-7.743-8.273 0-4.667 3.157-8.273 7.59-8.273 4.616 0 7.076 3.485 7.076 7.849v1.212H73.713c.274 2.727 1.913 4.394 4.252 4.394 1.791 0 3.218-.91 3.704-2.546l3.128 1.182c-1.124 2.787-3.644 4.455-6.832 4.455zm-.183-13.485c-1.882 0-3.34 1.12-3.886 3.272h7.318c-.03-1.757-1.124-3.272-3.432-3.272z"})]}))});function Cl(t){"@babel/helpers - typeof";return Cl=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},Cl(t)}function hv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Iz(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?hv(Object(n),!0).forEach(function(r){$z(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):hv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function $z(t,e,n){return e=Bz(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Bz(t){var e=Fz(t,"string");return Cl(e)=="symbol"?e:String(e)}function Fz(t,e){if(Cl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Cl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function zz(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var Vz=g.memo(function(t){var e=Object.assign({},(zz(t),t));return c.jsx(As,Iz({Icon:Ug,Text:rj,"aria-label":oc,iconProps:{shape:"square"},spaceMultiple:mz,textMultiple:pz},e))}),Mo=Ug;Mo.Text=rj;Mo.Combine=Vz;Mo.Avatar=Dz;Mo.colorPrimary=nj;Mo.title=oc;var ac="Windsurf",Hz=.7,Wz=.2,sj="#fff",Uz=sj,Kz="#000",Gz=.75;function jl(t){"@babel/helpers - typeof";return jl=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},jl(t)}var qz=["size","style"];function fv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Df(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?fv(Object(n),!0).forEach(function(r){Yz(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):fv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Yz(t,e,n){return e=Xz(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Xz(t){var e=Zz(t,"string");return jl(e)=="symbol"?e:String(e)}function Zz(t,e){if(jl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(jl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Qz(t,e){if(t==null)return{};var n=Jz(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Jz(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var Kg=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=Qz(t,qz);return c.jsxs("svg",Df(Df({fill:"currentColor",fillRule:"evenodd",height:n,style:Df({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:ac}),c.jsx("path",{clipRule:"evenodd",d:"M23.78 5.004h-.228a2.187 2.187 0 00-2.18 2.196v4.912c0 .98-.804 1.775-1.76 1.775a1.818 1.818 0 01-1.472-.773L13.168 5.95a2.197 2.197 0 00-1.81-.95c-1.134 0-2.154.972-2.154 2.173v4.94c0 .98-.797 1.775-1.76 1.775-.57 0-1.136-.289-1.472-.773L.408 5.098C.282 4.918 0 5.007 0 5.228v4.284c0 .216.066.426.188.604l5.475 7.889c.324.466.8.812 1.351.938 1.377.316 2.645-.754 2.645-2.117V11.89c0-.98.787-1.775 1.76-1.775h.002c.586 0 1.135.288 1.472.773l4.972 7.163a2.15 2.15 0 001.81.95c1.158 0 2.151-.973 2.151-2.173v-4.939c0-.98.787-1.775 1.76-1.775h.194c.122 0 .22-.1.22-.222V5.225a.221.221 0 00-.22-.222z"})]}))});function Nl(t){"@babel/helpers - typeof";return Nl=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},Nl(t)}function pv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function eV(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?pv(Object(n),!0).forEach(function(r){tV(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):pv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function tV(t,e,n){return e=nV(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function nV(t){var e=rV(t,"string");return Nl(e)=="symbol"?e:String(e)}function rV(t,e){if(Nl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Nl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function sV(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var iV=g.memo(function(t){var e=Object.assign({},(sV(t),t));return c.jsx(Ms,eV({Icon:Kg,"aria-label":ac,background:Uz,color:Kz,iconMultiple:Gz},e))});function Pl(t){"@babel/helpers - typeof";return Pl=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},Pl(t)}var oV=["size","style"];function mv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Mf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?mv(Object(n),!0).forEach(function(r){aV(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):mv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function aV(t,e,n){return e=lV(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function lV(t){var e=cV(t,"string");return Pl(e)=="symbol"?e:String(e)}function cV(t,e){if(Pl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Pl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dV(t,e){if(t==null)return{};var n=uV(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function uV(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var ij=g.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,s=dV(t,oV);return c.jsxs("svg",Mf(Mf({fill:"currentColor",fillRule:"evenodd",height:n,style:Mf({flex:"none",lineHeight:1},r),viewBox:"0 0 111 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:ac}),c.jsx("path",{clipRule:"evenodd",d:"M33.412 7.182h-1.715a.316.316 0 00-.315.316v13.79c0 .174.14.316.315.316h1.715a.316.316 0 00.316-.317V7.498a.316.316 0 00-.316-.316zm-1.772-5.18h1.828c.174 0 .315.141.315.316V4.57a.316.316 0 01-.315.316H31.64a.316.316 0 01-.315-.316V2.318c0-.175.141-.317.315-.317zM43.676 6.79c-1.927 0-3.324.671-4.218 1.653a.457.457 0 01-.782-.322v-.623a.316.316 0 00-.316-.316h-1.686a.316.316 0 00-.316.316v13.79c0 .174.142.316.316.316h1.687a.316.316 0 00.316-.317v-8.729c0-3.025.587-3.697 3.8-3.697s3.742.533 3.742 3.557v8.868c0 .175.142.317.316.317h1.715a.316.316 0 00.316-.317v-9.513c0-3.445-1.956-4.986-4.889-4.986v.003h-.001zm17.518 1.849a.457.457 0 00.782-.322V2.319c0-.175.142-.316.316-.316h1.687c.174 0 .316.141.316.316v18.97a.316.316 0 01-.316.316h-1.687a.316.316 0 01-.316-.316v-.819c.017-.418-.489-.62-.782-.322-.81 1.008-2.374 1.848-4.47 1.848-3.685 0-6.088-2.632-6.088-7.533 0-5.18 2.68-7.673 6.172-7.673 2.095 0 3.604.84 4.386 1.849zm-8.018 5.767c0 4.733.587 5.434 4.414 5.434 3.8 0 4.386-.701 4.386-5.434 0-4.733-.559-5.461-4.386-5.461s-4.414.728-4.414 5.461zm20.924-.894l-2.763-.476c-2.04-.364-2.404-.98-2.404-2.045.028-1.457.587-2.184 3.296-2.184 2.538 0 3.35.752 3.525 2.376.017.16.152.284.313.284h1.677c.18 0 .326-.151.316-.333-.163-2.788-2.709-4.346-5.746-4.346-3.408 0-5.67 1.82-5.67 4.426 0 2.38 1.844 3.417 4.05 3.837l3.046.56c1.676.31 2.235.87 2.235 1.933 0 1.709-.587 2.437-3.464 2.437s-3.673-.832-3.858-2.518a.315.315 0 00-.313-.282h-1.687a.318.318 0 00-.317.325c.08 3.004 2.797 4.493 6.034 4.493 3.52 0 5.949-1.82 5.949-4.566 0-2.408-1.845-3.501-4.219-3.921zm12.21 6.414c3.128 0 3.715-.672 3.715-3.697V7.502c0-.174.141-.316.316-.316h1.714c.175 0 .316.142.316.316v13.79a.316.316 0 01-.316.316h-1.714a.316.316 0 01-.316-.317v-.6c-.007-.429-.45-.642-.755-.343-.892.98-2.289 1.652-4.161 1.652-2.877 0-4.833-1.54-4.833-4.986V7.501c0-.175.142-.317.316-.317h1.715c.174 0 .316.142.316.317v8.868c0 3.024.558 3.557 3.687 3.557zm19.782-12.744v-1.85c0-.727.588-1.316 1.314-1.316h1.276a.316.316 0 00.315-.317V2.317a.316.316 0 00-.315-.317h-.885c-2.514 0-4.051 1.4-4.051 3.81v1.372h-1.859c-1.647.002-2.94.229-3.803 1.26-.317.302-.755.076-.755-.36V7.5a.316.316 0 00-.315-.317h-1.715a.316.316 0 00-.316.317v13.789c0 .174.141.316.316.316h1.715a.316.316 0 00.315-.316v-8.645c0-2.857.727-3.528 3.855-3.528h2.562V21.29c0 .175.141.317.316.317h1.715a.316.316 0 00.315-.317V9.116h2.593a.316.316 0 00.315-.317V7.501a.316.316 0 00-.315-.317h-2.593v-.002zM21.834 18.008a.561.561 0 001.091.005l3.933-15.772A.318.318 0 0127.166 2h1.963c.21 0 .363.199.31.403l-4.947 18.972a.305.305 0 01-.295.228h-3.502a.31.31 0 01-.3-.234L16.285 5.5a.56.56 0 00-.543-.42h-.036a.562.562 0 00-.542.42l-4.11 15.87a.31.31 0 01-.299.234H7.253a.304.304 0 01-.295-.228L2.011 2.403A.321.321 0 012.32 2h1.963c.145 0 .272.1.308.241l3.932 15.772a.56.56 0 001.09-.005l3.78-15.764A.316.316 0 0113.7 2h4.047c.146 0 .273.1.307.244l3.779 15.764z"})]}))});function Ol(t){"@babel/helpers - typeof";return Ol=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},Ol(t)}function gv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function hV(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?gv(Object(n),!0).forEach(function(r){fV(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):gv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function fV(t,e,n){return e=pV(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function pV(t){var e=mV(t,"string");return Ol(e)=="symbol"?e:String(e)}function mV(t,e){if(Ol(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ol(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function gV(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var xV=g.memo(function(t){var e=Object.assign({},(gV(t),t));return c.jsx(As,hV({Icon:Kg,Text:ij,"aria-label":ac,iconProps:{shape:"square"},spaceMultiple:Wz,textMultiple:Hz},e))}),Ao=Kg;Ao.Text=ij;Ao.Combine=xV;Ao.Avatar=iV;Ao.colorPrimary=sj;Ao.title=ac;const bV={"claude-code":fi.Avatar,cursor:Do.Avatar,codex:Cn.Avatar,"gemini-cli":pi.Avatar,goose:Mo.Avatar,"github-copilot":Oo.Avatar,windsurf:Ao.Avatar,cline:Eo.Avatar},yV={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 vV(t){return t.split(/\s+/).map(e=>e[0]).join("").toUpperCase().slice(0,2)}const oj=({agentName:t,displayName:e,size:n=20})=>{const r=bV[t];if(r)return c.jsx(r,{size:n});const s=yV[t];return s?c.jsx("img",{src:s,alt:e,className:"rounded object-contain",style:{width:n,height:n}}):c.jsx("div",{className:"flex items-center justify-center rounded bg-dash-surface-hover text-dash-text-muted font-semibold",style:{width:n,height:n,fontSize:n*.45},children:vV(e)})};function Af(t){return JSON.stringify([t.provider,t.type,t.item,t.global])}function wV(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 Tf(t,e){const r=(await t.text().catch(()=>"")).trim();if(!r)return e;try{const s=JSON.parse(r);return wV(s)||e}catch{return r}}function kV(){const[t,e]=g.useState("idle"),[n,r]=g.useState(null),[s,i]=g.useState(new Map),[o,a]=g.useState(null),[l,d]=g.useState(null),[u,h]=g.useState(null),[f,p]=g.useState(null),m=g.useRef(0),x=g.useRef(0),b=g.useRef(null),y=g.useRef(null),k=g.useCallback(async P=>{e("reconciling"),d(null),a(null),m.current+=1;const D=m.current;b.current?.abort();const A=new AbortController;b.current=A;try{const N=new URLSearchParams({providers:P.providers.join(","),global:String(P.global),agents:String(P.include.agents??!0),commands:String(P.include.commands??!0),skills:String(P.include.skills??!0),config:String(P.include.config??!0),rules:String(P.include.rules??!0),hooks:String(P.include.hooks??!0)});P.source&&N.set("source",P.source),P.reinstallEmptyDirs!==void 0&&N.set("reinstallEmptyDirs",String(P.reinstallEmptyDirs)),P.respectDeletions!==void 0&&N.set("respectDeletions",String(P.respectDeletions));const T=await fetch(`/api/migrate/reconcile?${N.toString()}`,{signal:A.signal});if(!T.ok){const O=await Tf(T,"Failed to reconcile migration plan");throw new Error(O)}const I=await T.json();if(D!==m.current)return;r(I.plan),(I.suggestedMode==="reconcile"||I.suggestedMode==="install")&&h(I.suggestedMode),i(new Map),e("reviewing")}catch(N){if(A.signal.aborted||N instanceof DOMException&&N.name==="AbortError"||D!==m.current)return;d(N instanceof Error?N.message:"Failed to reconcile"),e("error")}},[]),v=g.useCallback(async P=>{e("reconciling"),d(null),a(null),m.current+=1;const D=m.current;b.current?.abort();const A=new AbortController;b.current=A;try{const N=new URLSearchParams({providers:P.providers.join(","),global:String(P.global),agents:String(P.include.agents??!0),commands:String(P.include.commands??!0),skills:String(P.include.skills??!0),config:String(P.include.config??!0),rules:String(P.include.rules??!0),hooks:String(P.include.hooks??!0)});P.source&&N.set("source",P.source);const T=await fetch(`/api/migrate/install-discovery?${N.toString()}`,{signal:A.signal});if(!T.ok){const O=await Tf(T,"Failed to fetch install candidates");throw new Error(O)}const I=await T.json();if(D!==m.current)return;p(I.candidates??[]),e("reviewing")}catch(N){if(A.signal.aborted||N instanceof DOMException&&N.name==="AbortError"||D!==m.current)return;d(N instanceof Error?N.message:"Failed to fetch candidates"),e("error")}},[]),w=g.useCallback((P,D)=>{i(A=>{const N=new Map(A);return N.set(Af(P),D),N})},[]),C=g.useCallback(async(P,D)=>{const A=P??n;if(!A)return d("No plan to execute"),e("error"),!1;e("executing"),d(null),x.current+=1;const N=x.current;y.current?.abort();const T=new AbortController;y.current=T;try{const I=Object.fromEntries(s.entries()),O={plan:A,resolutions:I};D&&(O.mode=D);const E=await fetch("/api/migrate/execute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(O),signal:T.signal});if(N!==x.current)return!1;if(!E.ok){const R=await Tf(E,"Failed to execute migration");if(E.status===501)return d(R||"Plan execution is not available in this server build"),e("reviewing"),!1;throw new Error(R)}const M=await E.json();return N!==x.current?!1:(a({results:M.results,counts:M.counts,warnings:M.warnings??[],discovery:M.discovery}),e("complete"),!0)}catch(I){return T.signal.aborted||I instanceof DOMException&&I.name==="AbortError"||N!==x.current||(d(I instanceof Error?I.message:"Failed to execute migration"),e("error")),!1}},[n,s]),j=g.useCallback(()=>{b.current?.abort(),y.current?.abort(),e("idle"),r(null),i(new Map),a(null),d(null),p(null)},[]),S=g.useMemo(()=>n?n.actions.filter(P=>P.action==="conflict").every(P=>s.has(Af(P))):!0,[n,s]);return{phase:t,plan:n,resolutions:s,results:o,error:l,suggestedMode:u,installCandidates:f,reconcile:k,fetchCandidates:v,resolve:w,execute:C,reset:j,allConflictsResolved:S,actionKey:Af}}const SV={agents:!0,commands:!0,skills:!0,config:!0,rules:!0,hooks:!0},Mn=["agents","commands","skills","config","rules","hooks"],Ws={agents:"migrateTypeAgents",commands:"migrateTypeCommands",skills:"migrateTypeSkills",config:"migrateTypeConfig",rules:"migrateTypeRules",hooks:"migrateTypeHooks"},xv={detected:"#D4A574","not-detected":"#8B9DC3"},sn=({label:t,value:e,tone:n="default"})=>{const r=n==="accent"?"text-dash-accent":n==="success"?"text-green-400":"text-dash-text";return c.jsxs("div",{className:"rounded-lg border border-dash-border bg-dash-bg/70 px-3 py-2.5",children:[c.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-dash-text-muted",children:t}),c.jsx("p",{className:`mt-1 text-lg font-semibold ${r}`,children:e})]})};function bv(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 CV=new Set([8203,8204,8205,8288,65279,8232,8233,8234,8235,8236,8237,8238,8294,8295,8296,8297]);function jV(t){return t===9||t===10||t===13?!0:t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159||CV.has(t)}function yv(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(jV(r)||(e+=n))}return e}const NV=({provider:t,include:e,isSelected:n,cardClickToggles:r,onToggleSelect:s,onOpenDetails:i,t:o})=>{const a=Mn.filter(d=>t.capabilities[d]).length,l=Mn.some(d=>e[d]&&!t.capabilities[d]);return c.jsxs("div",{className:`relative rounded-xl border px-4 py-3 cursor-pointer transition-all ${n?"bg-dash-accent-subtle border-dash-accent/30 shadow-sm shadow-dash-accent/10":l?"bg-dash-surface border-yellow-500/25 hover:bg-dash-surface-hover hover:border-yellow-500/40":"bg-dash-surface border-dash-border hover:bg-dash-surface-hover hover:border-dash-accent/25"}`,children:[c.jsx("button",{type:"button",onClick:()=>r?s(t.name):i(t.name),"aria-label":r?`${t.displayName} deselect`:`${t.displayName} details`,className:"absolute inset-0 z-10 rounded-xl dash-focus-ring"}),c.jsxs("div",{className:"relative flex flex-col gap-3 lg:grid lg:grid-cols-[minmax(0,1.25fr)_140px_minmax(0,220px)_auto] lg:items-center lg:gap-4",children:[c.jsxs("div",{className:"min-w-0 space-y-1.5",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(oj,{agentName:t.name,displayName:t.displayName,size:18}),c.jsx("span",{className:"text-sm font-semibold text-dash-text truncate",children:t.displayName}),t.recommended&&c.jsx("span",{className:"text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded border border-dash-accent/30 text-dash-accent",children:o("migrateFilterRecommended")}),t.commandsGlobalOnly&&c.jsx("span",{className:"text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded border border-yellow-500/30 text-yellow-400",children:o("migrateGlobalOnlyCommandsShort")})]}),c.jsxs("div",{className:"text-xs text-dash-text-muted truncate",children:[t.name," · ",a,"/",Mn.length," ",o("migrateCapabilitiesLabel")]})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[11px] lg:flex-col lg:items-start lg:gap-1",children:[c.jsx("span",{className:t.detected?"text-dash-accent":"text-dash-text-muted",children:t.detected?o("migrateDetectedTag"):o("migrateNotDetectedTag")}),c.jsx("span",{className:"text-dash-text-muted",children:t.recommended?o("migrateFilterRecommended"):"-"})]}),c.jsx("div",{className:"flex flex-wrap gap-1",children:Mn.map(d=>{const u=t.capabilities[d],h=e[d];return c.jsx("span",{className:`text-[10px] uppercase px-1.5 py-0.5 rounded border ${u&&h?"border-dash-accent/45 text-dash-accent":u?"border-dash-border text-dash-text-secondary":"border-dash-border text-dash-text-muted opacity-60"}`,children:o(Ws[d])},d)})}),c.jsx("div",{className:"relative z-20 flex justify-start lg:justify-end",children:c.jsx("button",{type:"button",onClick:d=>{d.stopPropagation(),s(t.name)},className:`dash-focus-ring px-4 py-1.5 text-xs font-semibold rounded-md transition-colors ${n?"bg-transparent text-dash-text-secondary border border-dash-border hover:bg-dash-surface-hover":"bg-dash-accent text-white hover:bg-dash-accent/90"}`,children:o(n?"migrateSelectedButton":"migrateSelectButton")})})]})]})},PV=({provider:t,include:e,isSelected:n,latestResult:r,onToggleSelect:s,onClose:i,t:o})=>{const a=g.useRef(null),l=g.useRef(null),d=g.useCallback(()=>{const f=l.current;l.current=null,f&&document.contains(f)&&f.focus()},[]),u=g.useCallback(()=>{i(),d()},[i,d]),h=g.useCallback(()=>{const f=a.current;if(f?.open){f.close();return}i(),d()},[i,d]);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{d(),i()}}return()=>{if(f.open){f.close();return}d()}}},[i,d]),c.jsx("dialog",{ref:a,"aria-label":t.displayName,onClose:u,onCancel:f=>{f.preventDefault(),h()},onClick:f=>{f.target===f.currentTarget&&h()},className:"fixed inset-0 z-50 m-0 h-full max-h-none w-full max-w-none overflow-hidden border-0 bg-transparent p-0 backdrop:bg-black/50",children:c.jsxs("div",{className:"ml-auto h-full w-full sm:w-[460px] bg-dash-surface border-l border-dash-border shadow-2xl flex flex-col animate-slide-in",children:[c.jsx("div",{className:"px-6 py-5 border-b border-dash-border",children:c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2.5",children:[c.jsx(oj,{agentName:t.name,displayName:t.displayName,size:22}),c.jsx("h2",{className:"text-xl font-bold text-dash-text truncate",children:t.displayName})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mt-2",children:[c.jsx("span",{className:"text-[11px] text-dash-text-muted font-mono",children:t.name}),c.jsx("span",{className:`text-[10px] uppercase tracking-wide px-2 py-0.5 rounded border ${t.detected?"border-dash-accent/30 text-dash-accent":"border-dash-border text-dash-text-muted"}`,children:t.detected?o("migrateDetectedTag"):o("migrateNotDetectedTag")}),t.recommended&&c.jsx("span",{className:"text-[10px] uppercase tracking-wide px-2 py-0.5 rounded border border-dash-accent/30 text-dash-accent",children:o("migrateFilterRecommended")})]})]}),c.jsx("button",{type:"button",onClick:h,"aria-label":o("detailPanelClose"),className:"w-8 h-8 flex items-center justify-center rounded-md text-dash-text-muted hover:bg-dash-surface-hover hover:text-dash-text transition-colors",children:c.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[c.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18",strokeWidth:2}),c.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18",strokeWidth:2})]})})]})}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-6",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wide text-dash-text-muted mb-2.5",children:o("migrateCapabilitiesSection")}),c.jsx("div",{className:"space-y-1.5",children:Mn.map(f=>{const p=t.capabilities[f],m=e[f];return c.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-dash-bg rounded-md",children:[c.jsx("span",{className:"text-sm text-dash-text",children:o(Ws[f])}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:`text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded border ${m?"border-dash-accent/35 text-dash-accent":"border-dash-border text-dash-text-muted"}`,children:o(m?"migrateIncludedEnabled":"migrateIncludedDisabled")}),c.jsx("span",{className:`text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded border ${p?"border-green-500/35 text-green-400":"border-red-500/30 text-red-400"}`,children:o(p?"migrateSupported":"migrateUnsupportedShort")})]})]},f)})})]}),t.commandsGlobalOnly&&e.commands&&c.jsx("div",{className:"px-3 py-2 border border-yellow-500/30 bg-yellow-500/10 rounded text-xs text-yellow-400",children:o("migrateGlobalForced")}),c.jsxs("div",{children:[c.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wide text-dash-text-muted mb-2.5",children:o("migrateLatestTarget")}),r?c.jsxs("div",{className:"px-3 py-2 bg-dash-bg rounded-md border border-dash-border space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"text-xs text-dash-text-muted",children:o("migrateStatus")}),c.jsx("span",{className:`text-xs font-semibold ${bv(r,o).className}`,children:bv(r,o).label})]}),c.jsx("p",{className:"text-xs font-mono text-dash-text break-all",children:yv(r.path||"-")}),(r.error||r.skipReason)&&c.jsx("p",{className:"text-xs text-red-400 break-words",children:yv(r.error||r.skipReason||"-")})]}):c.jsx("p",{className:"text-sm text-dash-text-muted",children:o("migrateNoResultForProvider")})]})]}),c.jsxs("div",{className:"px-6 py-4 border-t border-dash-border flex items-center justify-between gap-2",children:[c.jsx("button",{type:"button",onClick:()=>s(t.name),className:`px-4 py-2 text-sm font-semibold rounded-md transition-colors ${n?"bg-transparent text-dash-text-secondary border border-dash-border hover:bg-dash-surface-hover":"bg-dash-accent text-white hover:bg-dash-accent/90"}`,children:o(n?"migrateUnselectProvider":"migrateSelectProviderAction")}),c.jsx("button",{type:"button",onClick:h,"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")})]})]})})},OV=()=>{const{t}=ee(),e=kV(),[n,r]=g.useState([]),[s,i]=g.useState(null),[o,a]=g.useState([]),[l,d]=g.useState(SV),[u,h]=g.useState(!0),[f,p]=g.useState(!0),[m,x]=g.useState(!1),[b,y]=g.useState(null),[k,v]=g.useState(""),w=g.useDeferredValue(k),[C,j]=g.useState("all"),[S,P]=g.useState(null),D=g.useRef(0),[A,N]=g.useState("reconcile"),T=g.useRef(!1),[I,O]=g.useState(new Map),[E,M]=g.useState(new Set);g.useEffect(()=>{if(T.current||!e.suggestedMode)return;if(e.suggestedMode===A){T.current=!0;return}const G=e.plan?.summary;if(G?G.install+G.update+G.delete+G.conflict>0:!1){T.current=!0;return}T.current=!0,N(e.suggestedMode)},[e.suggestedMode,e.plan,A]),g.useEffect(()=>{e.installCandidates&&M(m8(e.installCandidates))},[e.installCandidates]);const R=I.size,_=g.useCallback((G,ie)=>{const Se=e.actionKey(G);O(Pe=>{const Ye=new Map(Pe);return Ye.set(Se,ie),Ye})},[e]),$=g.useCallback(G=>{N(G),O(new Map),e.reset()},[e]),F=g.useCallback(async(G=!1)=>{D.current+=1;const ie=D.current;try{G?x(!0):p(!0),y(null);const[Se,Pe]=await Promise.all([zP(),Ph()]);if(ie!==D.current)return;r(Se.providers),i(Pe),a(Ye=>{if(Ye.length===0)return[];const Wn=Se.providers.map(Ht=>Ht.name);return Ye.filter(Ht=>Wn.includes(Ht))})}catch(Se){if(ie!==D.current)return;y(Se instanceof Error?Se.message:t("migrateDetectFailed"))}finally{ie===D.current&&(p(!1),x(!1))}},[t]);g.useEffect(()=>{F()},[F]);const z=g.useMemo(()=>{const G=new Map;for(const ie of n)G.set(ie.name,ie);return G},[n]),V=g.useMemo(()=>S&&z.get(S)||null,[S,z]);g.useEffect(()=>{S&&!z.has(S)&&P(null)},[S,z]);const Z=g.useCallback(()=>{P(null)},[]),U=g.useMemo(()=>new Set(o),[o]),Q=g.useMemo(()=>n.filter(G=>G.detected).length,[n]),se=o.length,ce=g.useMemo(()=>n.filter(G=>G.recommended).length,[n]),X=g.useMemo(()=>Mn.filter(G=>l[G]).length,[l]),K=g.useMemo(()=>{const G=[];l.commands&&o.includes("codex")&&!u&&z.get("codex")?.commandsGlobalOnly&&G.push(t("migrateGlobalForced"));for(const ie of Mn){if(!l[ie])continue;const Se=o.filter(Pe=>!z.get(Pe)?.capabilities[ie]).map(Pe=>z.get(Pe)?.displayName||Pe);Se.length>0&&G.push(`${t("migrateUnsupported")}: ${t(Ws[ie])} -> ${Se.join(", ")}`)}return G},[l,u,z,o,t]),te=g.useCallback(G=>{if(G==="codex"){a(["codex"]);return}if(G==="antigravity"){a(["antigravity"]);return}if(G==="core"){const Se=["codex","antigravity","droid"].filter(Pe=>n.some(Ye=>Ye.name===Pe));a(Se);return}const ie=n.filter(Se=>Se.detected).map(Se=>Se.name);a(ie)},[n]),le=g.useCallback(G=>{a(ie=>ie.includes(G)?ie.filter(Se=>Se!==G):[...ie,G])},[]),J=g.useCallback(G=>{d(ie=>({...ie,[G]:!ie[G]}))},[]),de=g.useMemo(()=>{const G=[...n];return G.sort((ie,Se)=>{const Pe=U.has(ie.name),Ye=U.has(Se.name);return Pe!==Ye?Pe?-1:1:ie.detected!==Se.detected?ie.detected?-1:1:ie.recommended!==Se.recommended?ie.recommended?-1:1:ie.displayName.localeCompare(Se.displayName)}),G},[n,U]),Ce=g.useMemo(()=>{const G=w.trim().toLowerCase();return de.filter(ie=>{if(C==="selected"&&!U.has(ie.name)||C==="detected"&&!ie.detected||C==="recommended"&&!ie.recommended||C==="not-detected"&&ie.detected)return!1;if(!G)return!0;const Se=Mn.filter(Pe=>ie.capabilities[Pe]).map(Pe=>t(Ws[Pe]).toLowerCase());return ie.displayName.toLowerCase().includes(G)||ie.name.toLowerCase().includes(G)||Se.some(Pe=>Pe.includes(G))})},[w,C,U,de,t]),Te=g.useMemo(()=>{const G=Ce.filter(Pe=>Pe.detected),ie=Ce.filter(Pe=>!Pe.detected),Se=[];return G.length>0&&Se.push({key:"detected",label:t("migrateDetectedTag"),providers:G}),ie.length>0&&Se.push({key:"not-detected",label:t("migrateNotDetectedTag"),providers:ie}),Se},[Ce,t]),De=g.useMemo(()=>({all:n.length,selected:se,detected:n.filter(G=>G.detected).length,recommended:n.filter(G=>G.recommended).length,"not-detected":n.filter(G=>!G.detected).length}),[n,se]),tt=g.useMemo(()=>Ce.map(G=>G.name),[Ce]),qt=g.useCallback(()=>{a(G=>{const ie=new Set(G);for(const Se of tt)ie.add(Se);return Array.from(ie)})},[tt]),Nt=g.useCallback(()=>{a([])},[]),mt=g.useCallback(async()=>{if(o.length===0){y(t("migrateSelectProvider"));return}if(X===0){y(t("migrateNoTypesEnabled"));return}const G={providers:o,global:u,include:l};A==="install"?await e.fetchCandidates(G):await e.reconcile(G)},[X,l,u,A,o,t,e]),nn=g.useCallback(async()=>{if(y(null),!!await e.execute())try{const ie=await Ph();i(ie)}catch(ie){console.error("Failed to refresh discovery:",ie)}},[e]),rn=g.useCallback(async G=>{if(!e.installCandidates)return;y(null);const ie=g8(e.installCandidates,G);if(await e.execute(ie,"install"))try{const Pe=await Ph();i(Pe)}catch(Pe){console.error("Failed to refresh discovery:",Pe)}},[e]),jn=g.useMemo(()=>{const G=new Map;if(!e.results)return G;for(const ie of e.results.results)G.set(ie.provider,ie);return G},[e.results]);g.useEffect(()=>{const G=ie=>{const Se=ie.target,Pe=!!(Se&&(Se instanceof HTMLInputElement||Se instanceof HTMLTextAreaElement||Se.isContentEditable||Se.closest('[contenteditable="true"], [role="textbox"]'))),Ye=ie.metaKey||ie.ctrlKey||ie.altKey;ie.key==="/"&&!Pe&&!Ye&&(ie.preventDefault(),document.getElementById("migrate-search")?.focus())};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[]);const Vt=e.phase==="idle"&&o.length>0&&X>0;return f?c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsxs("div",{className:"text-center",children:[c.jsx("div",{className:"w-8 h-8 border-4 border-dash-accent border-t-transparent rounded-full animate-spin mx-auto mb-3"}),c.jsx("p",{className:"text-dash-text-muted",children:t("migrateDiscovering")})]})}):c.jsxs("div",{className:"relative h-full overflow-hidden",children:[c.jsxs("div",{className:"pointer-events-none absolute inset-0 -z-10 overflow-hidden",children:[c.jsx("div",{className:"absolute -top-24 -right-8 h-64 w-64 rounded-full bg-dash-accent/10 blur-3xl"}),c.jsx("div",{className:"absolute -bottom-28 -left-10 h-72 w-72 rounded-full bg-dash-accent/5 blur-3xl"})]}),c.jsxs("div",{className:"h-full overflow-y-auto space-y-4 pb-8",children:[c.jsx("section",{className:"dash-panel dash-sticky-glass sticky top-0 z-20 px-4 py-4 md:px-6 md:py-5",children:c.jsxs("div",{className:"flex flex-col gap-4 xl:flex-row xl:items-end xl:justify-between",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsx("p",{className:"mono text-[10px] uppercase tracking-[0.16em] text-dash-text-muted",children:t("migrate")}),c.jsx("h1",{className:"text-xl md:text-2xl font-semibold text-dash-text",children:t("migrateTitle")}),c.jsx("p",{className:"text-sm text-dash-text-secondary max-w-3xl",children:t("migrateSubtitle")})]}),e.phase==="complete"&&e.results?c.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:[c.jsx(sn,{label:t("migrateInstalled"),value:e.results.counts.installed,tone:"success"}),c.jsx(sn,{label:t("migrateSkipped"),value:e.results.counts.skipped}),c.jsx(sn,{label:t("migrateFailed"),value:e.results.counts.failed})]}):c.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[c.jsx(sn,{label:t("migrateTypeAgents"),value:s?.counts.agents??0}),c.jsx(sn,{label:t("migrateDetectedProviders"),value:Q,tone:"success"}),c.jsx(sn,{label:t("migrateSelectedProviders"),value:se,tone:"accent"}),c.jsx(sn,{label:t("migrateTypes"),value:X})]})]})}),b&&c.jsx("div",{className:"px-4 py-3 border border-red-500/30 bg-red-500/10 rounded-lg text-sm text-red-400",children:b}),c.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1.55fr)_minmax(0,340px)]",children:[c.jsxs("section",{className:"order-2 xl:order-1 space-y-4",children:[(e.phase==="idle"||e.phase==="reviewing"||e.phase==="reconciling")&&o.length>0&&c.jsxs("div",{className:"dash-panel p-4 flex items-center gap-4 flex-wrap",children:[c.jsx(N8,{mode:A,pendingCount:R,disabled:e.phase==="reconciling",onModeChange:$}),c.jsx("p",{className:"text-xs text-dash-text-muted",children:t(A==="install"?"migrateModeInstallDesc":"migrateModeReconcileDesc")})]}),e.phase==="reviewing"&&e.plan&&A==="reconcile"&&c.jsxs("div",{className:"dash-panel flex flex-col max-h-[calc(100vh-200px)]",children:[c.jsxs("div",{className:"flex items-center justify-between p-5 pb-4",children:[c.jsx("h2",{className:"text-lg font-semibold text-dash-text",children:t("migrateReviewPlan")}),c.jsx("button",{type:"button",onClick:()=>e.reset(),className:"dash-focus-ring px-3 py-1.5 text-xs font-medium rounded-md border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover",children:t("cancel")})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-5 pb-4",children:[e.plan.banners&&e.plan.banners.length>0&&c.jsx("div",{className:"mb-4 space-y-2",children:e.plan.banners.map((G,ie)=>c.jsx("div",{className:"px-3 py-2 border border-yellow-500/30 bg-yellow-500/10 rounded text-xs text-yellow-400",children:c.jsx("strong",{children:G.message})},`${G.kind}-${G.provider}-${G.type}-${ie}`))}),c.jsx(H8,{plan:e.plan,resolutions:e.resolutions,onResolve:e.resolve,actionKey:e.actionKey,flips:I,onFlip:_}),e.error&&c.jsx("div",{className:"mt-4 px-3 py-2 border border-red-500/30 bg-red-500/10 rounded text-xs text-red-400",children:e.error})]}),c.jsxs("div",{className:"flex items-center justify-end gap-3 px-5 py-4 border-t border-dash-border bg-dash-surface rounded-b-xl",children:[e.plan.hasConflicts&&!e.allConflictsResolved&&c.jsx("p",{className:"text-xs text-yellow-400",children:t("migrateResolveConflicts")}),c.jsx("button",{type:"button",onClick:nn,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==="reviewing"||e.phase==="executing")&&e.installCandidates!==null&&A==="install"&&c.jsxs("div",{className:"dash-panel p-4 md:p-5",children:[c.jsxs("div",{className:"flex items-center justify-between mb-4",children:[c.jsx("h2",{className:"text-lg font-semibold text-dash-text",children:t("migrateModeInstall")}),c.jsx("button",{type:"button",onClick:()=>e.reset(),disabled:e.phase==="executing",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 disabled:opacity-50",children:t("cancel")})]}),c.jsx(p8,{candidates:e.installCandidates,selected:E,onSelectionChange:M,onInstall:rn,isInstalling:e.phase==="executing"}),e.error&&c.jsx("div",{className:"mt-4 px-3 py-2 border border-red-500/30 bg-red-500/10 rounded text-xs text-red-400",children:e.error})]}),e.phase==="complete"&&e.results&&c.jsx(C8,{results:e.results,onReset:e.reset}),e.phase==="error"&&e.error&&c.jsxs("div",{className:"dash-panel p-5",children:[c.jsx("div",{className:"px-4 py-3 border border-red-500/30 bg-red-500/10 rounded-lg text-sm text-red-400",children:e.error}),c.jsx("button",{type:"button",onClick:e.reset,className:"mt-4 dash-focus-ring px-4 py-2 bg-dash-bg border border-dash-border rounded-md text-sm text-dash-text-secondary hover:bg-dash-surface-hover",children:t("tryAgain")})]}),(e.phase==="reconciling"||e.phase==="executing")&&c.jsx("div",{className:"dash-panel p-5",children:c.jsx("div",{className:"flex items-center justify-center py-8",children:c.jsxs("div",{className:"text-center",children:[c.jsx("div",{className:"w-8 h-8 border-4 border-dash-accent border-t-transparent rounded-full animate-spin mx-auto mb-3"}),c.jsx("p",{className:"text-dash-text-muted",children:e.phase==="reconciling"?t("migrateReconciling"):t("migrateExecuting")})]})})}),e.phase==="idle"&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"dash-panel p-4 md:p-5 space-y-4",children:[c.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center",children:[c.jsxs("div",{className:"relative flex-1",children:[c.jsxs("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 stroke-dash-text-muted",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("circle",{cx:"11",cy:"11",r:"8"}),c.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),c.jsx("input",{id:"migrate-search",type:"text",value:k,onChange:G=>v(G.target.value),placeholder:t("migrateSearchProviders"),className:"dash-focus-ring w-full pl-9 pr-12 py-2 bg-dash-bg border border-dash-border rounded-lg text-dash-text text-sm focus:border-dash-accent transition-colors"}),c.jsx("span",{className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-[11px] text-dash-text-muted bg-dash-surface-hover border border-dash-border px-1.5 py-0.5 rounded",children:t("searchShortcut")})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("button",{type:"button",onClick:()=>F(!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")}),c.jsx("button",{type:"button",onClick:qt,disabled:tt.length===0,className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-50 whitespace-nowrap",children:t("migrateSelectVisible")}),c.jsx("button",{type:"button",onClick:Nt,disabled:se===0,className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-50 whitespace-nowrap",children:t("migrateClearSelection")})]})]}),c.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{key:"all",label:t("categoryAll")},{key:"selected",label:t("migrateSelectedProviders")},{key:"detected",label:t("migrateDetectedProviders")},{key:"recommended",label:t("migrateFilterRecommended")},{key:"not-detected",label:t("migrateNotDetectedTag")}].map(G=>c.jsxs("button",{type:"button",onClick:()=>j(G.key),className:`dash-focus-ring px-3 py-1 text-xs font-medium rounded-full border transition-all whitespace-nowrap ${C===G.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:[G.label,c.jsx("span",{className:"opacity-60 ml-1 text-[10px]",children:De[G.key]})]},G.key))}),c.jsxs("div",{children:[c.jsx("p",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wide text-dash-text-muted",children:t("migrateTypes")}),c.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Mn.map(G=>c.jsx("button",{type:"button",onClick:()=>J(G),className:`dash-focus-ring px-2.5 py-1 text-[11px] uppercase tracking-wide rounded-md border transition-colors ${l[G]?"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(Ws[G])},G))})]})]}),c.jsxs("div",{className:"dash-panel p-4 md:p-5",children:[c.jsx("h2",{className:"text-sm font-semibold text-dash-text mb-4",children:t("migrateSourceSummary")}),c.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 xl:grid-cols-6 gap-3",children:Mn.map(G=>c.jsxs("div",{className:"px-3 py-2 bg-dash-bg border border-dash-border rounded-md text-center",children:[c.jsx("p",{className:"text-[11px] uppercase tracking-wide text-dash-text-muted",children:t(Ws[G])}),c.jsx("p",{className:"text-lg font-semibold text-dash-text",children:s?.counts[G]??0})]},G))})]}),c.jsxs("div",{className:"dash-panel p-4 md:p-5",children:[c.jsxs("div",{className:"flex items-center justify-between mb-4",children:[c.jsx("h2",{className:"text-sm font-semibold text-dash-text",children:t("migrateProvidersHeading")}),c.jsxs("p",{className:"text-xs text-dash-text-muted",children:[Ce.length," ",t("migrateProvidersCountSuffix")]})]}),n.length===0?c.jsx("div",{className:"text-sm text-dash-text-muted",children:t("migrateNoProviders")}):Ce.length===0?c.jsx("div",{className:"text-sm text-dash-text-muted",children:t("migrateNoProvidersMatch")}):c.jsx("div",{className:"space-y-5",children:Te.map(G=>c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-2.5 mb-3",children:[c.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:xv[G.key]}}),c.jsx("h2",{className:"text-[13px] font-semibold uppercase tracking-wide",style:{color:xv[G.key]},children:G.label}),c.jsxs("span",{className:"text-[11px] text-dash-text-muted ml-auto",children:[G.providers.length," ",t("migrateProvidersCountSuffix")]}),c.jsx("div",{className:"flex-1 h-px bg-dash-border ml-3"})]}),c.jsx("div",{className:"space-y-2",children:G.providers.map(ie=>c.jsx(NV,{provider:ie,include:l,isSelected:U.has(ie.name),cardClickToggles:C==="selected",onToggleSelect:le,onOpenDetails:P,t},ie.name))})]},G.key))})]})]})]}),c.jsx("aside",{className:"order-1 xl:order-2 space-y-4 self-start xl:sticky xl:top-[84px]",children:e.phase==="complete"&&e.results?c.jsxs("div",{className:"dash-panel p-4 md:p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-semibold text-dash-text",children:t("migrateSummaryTitle")}),c.jsxs("p",{className:"text-xs text-dash-text-muted mt-1",children:[e.results.counts.installed+e.results.counts.skipped+e.results.counts.failed," ",t("migrateSummarySubtitle")]})]}),c.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[c.jsx(sn,{label:t("migrateInstalled"),value:e.results.counts.installed,tone:"success"}),c.jsx(sn,{label:t("migrateSkipped"),value:e.results.counts.skipped}),c.jsx(sn,{label:t("migrateFailed"),value:e.results.counts.failed})]}),e.results.discovery&&c.jsxs("div",{className:"space-y-1.5",children:[c.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-dash-text-muted",children:t("migrateTypes")}),Mn.map(G=>{const ie=e.results?.discovery?.[G]??0;return ie===0?null:c.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-dash-bg rounded-md text-xs",children:[c.jsx("span",{className:"text-dash-text-secondary",children:t(Ws[G])}),c.jsx("span",{className:"font-semibold text-dash-text",children:ie})]},G)})]}),o.length>0&&c.jsxs("div",{className:"space-y-1.5",children:[c.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-dash-text-muted",children:t("migrateSummaryProviders")}),c.jsx("div",{className:"flex flex-wrap gap-1.5",children:o.map(G=>{const ie=z.get(G);return c.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded border border-dash-accent/30 text-dash-accent",children:ie?.displayName||G},G)})})]}),c.jsx("div",{className:"text-[10px] px-3 py-1.5 bg-dash-bg rounded-md text-dash-text-muted",children:t(u?"migrateScopeGlobal":"migrateScopeProject")}),c.jsx("button",{type:"button",onClick:e.reset,className:"dash-focus-ring w-full px-4 py-2.5 bg-dash-accent text-white rounded-md text-sm font-semibold hover:bg-dash-accent/90 transition-colors",children:t("migrateSummaryNewMigration")})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"dash-panel p-4 md:p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-semibold text-dash-text",children:t("migrateActionSummaryTitle")}),c.jsxs("p",{className:"text-xs text-dash-text-muted mt-1",children:[se," ",t("migrateProvidersCountSuffix")," ·"," ",X,"/",Mn.length," ",t("migrateTypes")]})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[c.jsx(sn,{label:t("migrateSelectedProviders"),value:se,tone:"accent"}),c.jsx(sn,{label:t("migrateDetectedProviders"),value:Q}),c.jsx(sn,{label:t("migrateTypes"),value:X}),c.jsx(sn,{label:t("migrateFilterRecommended"),value:ce,tone:"success"})]}),c.jsxs("div",{className:"inline-flex w-full rounded-md border border-dash-border overflow-hidden",children:[c.jsx("button",{type:"button",onClick:()=>h(!1),className:`dash-focus-ring flex-1 px-3 py-2 text-sm ${u?"bg-dash-bg text-dash-text-secondary":"bg-dash-accent-subtle text-dash-accent"}`,children:t("migrateScopeProject")}),c.jsx("button",{type:"button",onClick:()=>h(!0),className:`dash-focus-ring flex-1 px-3 py-2 text-sm border-l border-dash-border ${u?"bg-dash-accent-subtle text-dash-accent":"bg-dash-bg text-dash-text-secondary"}`,children:t("migrateScopeGlobal")})]}),c.jsx("button",{type:"button",onClick:mt,disabled:!Vt,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")}),K.length>0&&c.jsx("div",{className:"space-y-2",children:K.map((G,ie)=>c.jsx("p",{className:"text-xs px-3 py-2 border border-yellow-500/30 bg-yellow-500/10 rounded text-yellow-400",children:G},`${G}-${ie}`))})]}),c.jsxs("div",{className:"dash-panel-muted p-4",children:[c.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-wide text-dash-text-muted",children:t("migrateSelectProviderAction")}),c.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[c.jsx("button",{type:"button",onClick:()=>te("codex"),className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover",children:t("migratePresetCodex")}),c.jsx("button",{type:"button",onClick:()=>te("antigravity"),className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover",children:t("migratePresetAntigravity")}),c.jsx("button",{type:"button",onClick:()=>te("core"),className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover",children:t("migratePresetCore")}),c.jsx("button",{type:"button",onClick:()=>te("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")})]})]})]})})]})]}),V&&c.jsx(PV,{provider:V,include:l,isSelected:U.has(V.name),latestResult:jn.get(V.name)||null,onToggleSelect:le,onClose:Z,t})]})},EV=()=>nt()?c.jsx(Ju,{titleKey:"desktopModeMigrateTitle",descriptionKey:"desktopModeMigrateDescription",commandHintKey:"desktopModeMigrateHint"}):c.jsx(OV,{}),DV=({featureId:t,name:e,description:n,included:r})=>{const{t:s}=ee();return c.jsxs("div",{"data-testid":`feature-card-${t}`,className:`p-4 rounded-lg border transition-all ${r?"border-[var(--dash-accent)] bg-[var(--dash-surface)] shadow-sm":"border-[var(--dash-border)] bg-[var(--dash-bg)] opacity-50"}`,children:[c.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r?c.jsx("svg",{className:"w-5 h-5 text-[var(--dash-accent)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):c.jsx("svg",{className:"w-5 h-5 text-[var(--dash-text-muted)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),c.jsx("h4",{className:"font-medium text-[var(--dash-text)]",children:s(e)})]}),c.jsx("p",{className:"text-sm text-[var(--dash-text-muted)] leading-relaxed",children:s(n)})]})},MV=({selectedKit:t,onKitSelect:e,onInstall:n,installing:r})=>{const{t:s}=ee(),[i,o]=g.useState(1);return c.jsxs("div",{className:"space-y-6","data-testid":"install-wizard",children:[c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx(Lf,{number:1,active:i===1,label:s("stepChooseKit")}),c.jsx("div",{className:"flex-1 h-px bg-[var(--dash-border)]"}),c.jsx(Lf,{number:2,active:i===2,label:s("stepConfigure")}),c.jsx("div",{className:"flex-1 h-px bg-[var(--dash-border)]"}),c.jsx(Lf,{number:3,active:i===3,label:s("stepInstall")})]}),c.jsxs("div",{className:"min-h-[200px]",children:[i===1&&c.jsx(AV,{onSelect:e,selected:t}),i===2&&t&&c.jsx(TV,{kit:t}),i===3&&c.jsx(LV,{installing:r})]}),c.jsxs("div",{className:"flex justify-between pt-4 border-t border-[var(--dash-border)]",children:[i>1?c.jsx("button",{onClick:()=>o(a=>a-1),className:"px-4 py-2 text-sm font-medium text-[var(--dash-text)] bg-[var(--dash-surface)] border border-[var(--dash-border)] rounded-lg hover:bg-[var(--dash-surface-hover)] transition-colors","data-testid":"wizard-back",children:s("back")}):c.jsx("div",{}),i<3&&t&&c.jsx("button",{onClick:()=>o(a=>a+1),className:"px-4 py-2 text-sm font-medium text-white bg-[var(--dash-accent)] rounded-lg hover:opacity-90 transition-opacity","data-testid":"wizard-next",children:s("next")}),i===3&&c.jsx("button",{onClick:n,disabled:r,className:"px-4 py-2 text-sm font-medium text-white bg-[var(--dash-accent)] rounded-lg hover:opacity-90 transition-opacity disabled:opacity-50 disabled:cursor-not-allowed","data-testid":"wizard-install",children:s("install")})]})]})},Lf=({number:t,active:e,label:n})=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold transition-colors ${e?"bg-[var(--dash-accent)] text-white":"bg-[var(--dash-surface)] text-[var(--dash-text-muted)] border border-[var(--dash-border)]"}`,children:t}),c.jsx("span",{className:`text-sm font-medium ${e?"text-[var(--dash-text)]":"text-[var(--dash-text-muted)]"}`,children:n})]}),AV=({onSelect:t,selected:e})=>{const{t:n}=ee();return c.jsxs("div",{className:"space-y-4",children:[c.jsx("p",{className:"text-[var(--dash-text-muted)]",children:e?`Selected: ${e===Gn.ENGINEER?n("kitEngineerName"):n("kitMarketingName")}`:"Please select a kit above"}),e&&c.jsxs("button",{type:"button",onClick:()=>t(e===Gn.ENGINEER?Gn.MARKETING:Gn.ENGINEER),className:"text-sm text-[var(--dash-accent)] hover:underline",children:["Switch to ",e===Gn.ENGINEER?n("kitMarketingName"):n("kitEngineerName")]})]})},TV=()=>c.jsx("div",{className:"text-[var(--dash-text-muted)]",children:"Configuration preview placeholder"}),LV=({installing:t})=>c.jsx("div",{className:"text-[var(--dash-text-muted)]",children:t?"Installing...":"Ready to install"}),RV=({kit:t,onGetStarted:e})=>{const{t:n}=ee(),r=Ft(),s=t===Gn.ENGINEER?"kitEngineerName":t===Gn.MARKETING?"kitMarketingName":"kitEngineerName";return c.jsxs("div",{className:"text-center py-12 space-y-6","data-testid":"success-screen",children:[c.jsx("div",{className:"w-16 h-16 mx-auto bg-green-100 rounded-full flex items-center justify-center",children:c.jsx("svg",{className:"w-10 h-10 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})}),c.jsx("h2",{className:"text-2xl font-bold text-[var(--dash-text)]",children:n("installSuccess")}),c.jsx("p",{className:"text-[var(--dash-text-muted)] max-w-md mx-auto",children:n("installSuccessDesc").replace("{kit}",n(s))}),c.jsxs("div",{className:"flex gap-4 justify-center pt-4",children:[c.jsx("button",{onClick:e,className:"px-6 py-2.5 text-sm font-medium text-white bg-[var(--dash-accent)] rounded-lg hover:opacity-90 transition-opacity","data-testid":"get-started-btn",children:n("getStarted")}),c.jsx("button",{onClick:()=>r("/"),className:"px-6 py-2.5 text-sm font-medium text-[var(--dash-text)] bg-[var(--dash-surface)] border border-[var(--dash-border)] rounded-lg hover:bg-[var(--dash-surface-hover)] transition-colors","data-testid":"dashboard-btn",children:n("goToDashboard")})]})]})},_V=[{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}],aj={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 IV(t){const e=aj[t];return e?_V.filter(n=>e.features.includes(n.id)):(console.warn(`Unknown kit type: ${t}`),[])}function $V(t){return[{rootPath:t,maxDepth:1},{rootPath:_i(t,"projects"),maxDepth:3},{rootPath:_i(t,"code"),maxDepth:3},{rootPath:_i(t,"dev"),maxDepth:3}]}function BV(t){const e=new Map;for(const n of t)e.has(n.path)||e.set(n.path,n);return Array.from(e.values()).sort((n,r)=>n.path.localeCompare(r.path))}const FV=({projects:t,selectedPaths:e,onToggle:n})=>{const{t:r}=ee();return c.jsx("div",{className:"space-y-3",children:t.map(s=>{const i=e.has(s.path);return c.jsxs("label",{className:`flex cursor-pointer items-start gap-3 rounded-xl border p-4 transition-colors ${i?"border-dash-accent bg-dash-accent-subtle/60":"border-dash-border bg-dash-surface hover:border-dash-accent/40"}`,children:[c.jsx("input",{type:"checkbox",checked:i,onChange:()=>n(s.path),className:"mt-1 h-4 w-4 accent-[var(--dash-accent)]"}),c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("p",{className:"text-sm font-semibold text-dash-text",children:s.name}),s.hasCkConfig?c.jsx("span",{className:"rounded-full border border-dash-accent/40 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-dash-accent",children:r("desktopOnboardingKitDetected")}):null]}),c.jsx("p",{className:"mt-1 break-all text-xs text-dash-text-muted",children:s.path})]})]},s.path)})})};function zV(t){return(t instanceof Error?t.message:String(t)).includes("does not exist")}const VV=()=>{const{t}=ee(),e=Ft(),{reloadProjects:n,dismissDesktopOnboarding:r}=fw(),[s,i]=g.useState("welcome"),[o,a]=g.useState([]),[l,d]=g.useState(new Set),[u,h]=g.useState(null),[f,p]=g.useState(null),[m,x]=g.useState(!1),[b,y]=g.useState(null),[k,v]=g.useState(0),w=l.size,C=o.length,j=g.useMemo(()=>b?`/project/${b}`:"/",[b]),S=A=>{d(N=>{const T=new Set(N);return T.has(A)?T.delete(A):T.add(A),T})},P=async()=>{h(null),p(null),v(0),i("discovering");try{const A=await $m(),N=$V(A),T=await Promise.allSettled(N.map(E=>lP(E.rootPath,E.maxDepth))),I=T.filter(E=>E.status==="rejected"&&!zV(E.reason)).length,O=BV(T.flatMap(E=>E.status==="fulfilled"?E.value:[]));a(O),d(new Set(O.map(E=>E.path))),I>0&&p(t("desktopOnboardingScanPartialWarning").replace("{count}",String(I))),i("selection")}catch(A){h(A instanceof Error?A.message:t("desktopOnboardingScanFailed")),i("selection")}},D=async A=>{x(!0),h(null),v(0);try{const N=await Promise.allSettled(A.map(O=>Aw({path:O}))),T=N.flatMap(O=>O.status==="fulfilled"?[O.value]:[]),I=N.length-T.length;if(A.length>0&&T.length===0)throw new Error(t("desktopOnboardingAddFailed"));A.length>0&&await n?.(),await NE(!0),r?.(),y(T[0]?.id??null),v(I),i("done")}catch(N){h(N instanceof Error?N.message:t("desktopOnboardingAddFailed"))}finally{x(!1)}};return c.jsx("div",{className:"mx-auto flex h-full w-full max-w-4xl flex-col justify-center px-4 py-8",children:c.jsxs("div",{className:"rounded-[2rem] border border-dash-border bg-dash-surface p-8 shadow-sm",children:[c.jsxs("div",{className:"mb-8 text-center",children:[c.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-dash-accent-subtle text-3xl",children:"CK"}),c.jsx("p",{className:"mt-4 text-[10px] font-bold uppercase tracking-[0.3em] text-dash-accent",children:t("desktopOnboardingEyebrow")}),c.jsx("h1",{className:"mt-3 text-3xl font-bold text-dash-text",children:t("desktopOnboardingTitle")}),c.jsx("p",{className:"mt-3 text-sm leading-relaxed text-dash-text-muted",children:t(s==="done"?"desktopOnboardingDoneDescription":"desktopOnboardingDescription")})]}),u?c.jsx("div",{className:"mb-6 rounded-xl border border-red-500/30 bg-red-500/10 px-4 py-3 text-sm text-red-300",children:u}):null,f?c.jsx("div",{className:"mb-6 rounded-xl border border-amber-500/30 bg-amber-500/10 px-4 py-3 text-sm text-amber-200",children:f}):null,s==="welcome"?c.jsxs("div",{className:"space-y-6 text-center",children:[c.jsx("p",{className:"text-sm text-dash-text-muted",children:t("desktopOnboardingWelcomeBody")}),c.jsxs("div",{className:"flex flex-wrap justify-center gap-3",children:[c.jsx("button",{type:"button",onClick:()=>void D([]),className:"rounded-xl border border-dash-border px-5 py-3 text-sm font-medium text-dash-text-secondary transition hover:bg-dash-bg",children:t("desktopOnboardingSkip")}),c.jsx("button",{type:"button",onClick:()=>void P(),className:"rounded-xl bg-dash-accent px-5 py-3 text-sm font-semibold text-white transition hover:bg-dash-accent/90",children:t("desktopOnboardingStart")})]})]}):null,s==="discovering"?c.jsxs("div",{className:"space-y-4 text-center",children:[c.jsx("div",{className:"mx-auto h-12 w-12 animate-spin rounded-full border-2 border-dash-accent border-t-transparent"}),c.jsx("p",{className:"text-sm font-medium text-dash-text",children:t("desktopOnboardingScanning")}),c.jsx("p",{className:"text-xs text-dash-text-muted",children:t("desktopOnboardingScanningHint")})]}):null,s==="selection"?c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-lg font-semibold text-dash-text",children:t("desktopOnboardingSelectTitle")}),c.jsx("p",{className:"mt-1 text-sm text-dash-text-muted",children:C>0?t("desktopOnboardingSelectDescription"):t("desktopOnboardingNoProjects")})]}),c.jsx("span",{className:"rounded-full border border-dash-border px-3 py-1 text-xs font-semibold text-dash-text-secondary",children:t("desktopOnboardingSelectedCount").replace("{count}",String(w))})]}),C>0?c.jsx(FV,{projects:o,selectedPaths:l,onToggle:S}):null,c.jsxs("div",{className:"flex flex-wrap justify-end gap-3",children:[c.jsx("button",{type:"button",onClick:()=>void D([]),className:"rounded-xl border border-dash-border px-4 py-2 text-sm font-medium text-dash-text-secondary transition hover:bg-dash-bg",children:t("desktopOnboardingSkip")}),c.jsx("button",{type:"button",onClick:()=>void D(Array.from(l)),disabled:m||C>0&&w===0,className:"rounded-xl bg-dash-accent px-4 py-2 text-sm font-semibold text-white transition hover:bg-dash-accent/90 disabled:cursor-not-allowed disabled:opacity-50",children:t(m?"desktopOnboardingSaving":"desktopOnboardingContinue")})]})]}):null,s==="done"?c.jsxs("div",{className:"space-y-4 text-center",children:[c.jsx("p",{className:"text-lg font-semibold text-dash-text",children:t("desktopOnboardingDoneTitle")}),k>0?c.jsx("p",{className:"text-sm text-amber-300",children:t("desktopOnboardingPartialAddWarning").replace("{failed}",String(k)).replace("{total}",String(w))}):null,c.jsx("button",{type:"button",onClick:()=>e(j,{replace:!0}),className:"rounded-xl bg-dash-accent px-5 py-3 text-sm font-semibold text-white transition hover:bg-dash-accent/90",children:t("desktopOnboardingOpenDashboard")})]}):null]})})},HV=({kit:t,selected:e,onSelect:n,features:r})=>{const{t:s}=ee();return c.jsxs("button",{type:"button",onClick:n,className:`p-6 rounded-lg border-2 text-left transition-all w-full ${e?"border-[var(--dash-accent)] bg-[var(--dash-surface)] shadow-md":"border-[var(--dash-border)] hover:border-[var(--dash-accent)]/50"}`,children:[c.jsx("h3",{className:`text-xl font-bold ${t.primaryColor}`,children:s(t.name)}),c.jsx("p",{className:"text-[var(--dash-text-muted)] mt-1",children:s(t.tagline)}),c.jsx("div",{className:"mt-4 space-y-2",children:r.slice(0,3).map(i=>c.jsx(DV,{featureId:i.id,name:i.name,description:i.description,included:!0},i.id))})]})},WV=()=>{const{t}=ee(),e=Ft(),[n,r]=g.useState(null),[s,i]=g.useState(!1),[o,a]=g.useState(!1),[l,d]=g.useState(null),u=async()=>{if(n){i(!0),d(null);try{const f=await fetch("/api/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kit:n})});if(!f.ok)throw new Error(`Installation failed: ${f.statusText}`);a(!0)}catch(f){const p=f instanceof Error?f.message:"Unknown error occurred";d(p),console.error("Install failed:",f)}finally{i(!1)}}};if(o&&n)return c.jsx(RV,{kit:n,onGetStarted:()=>e("/")});const h=f=>f==="engineer"?Gn.ENGINEER:Gn.MARKETING;return c.jsxs("div",{className:"max-w-4xl mx-auto py-8 px-4",children:[c.jsxs("header",{className:"text-center mb-8",children:[c.jsx("h1",{className:"text-3xl font-bold text-[var(--dash-text)]",children:t("onboardingTitle")}),c.jsx("p",{className:"mt-2 text-[var(--dash-text-muted)]",children:t("onboardingSubtitle")})]}),c.jsx("section",{className:"grid md:grid-cols-2 gap-6 mb-8",children:Object.values(aj).map(f=>{const p=h(f.id);return c.jsx(HV,{kit:f,selected:n===p,onSelect:()=>r(p),features:IV(f.id)},f.id)})}),l&&c.jsxs("div",{className:"mb-6 p-4 rounded-lg bg-red-100 border border-red-300 text-red-800",children:[c.jsx("p",{className:"font-medium",children:"Installation Error"}),c.jsx("p",{className:"text-sm mt-1",children:l}),c.jsx("button",{type:"button",onClick:()=>d(null),className:"mt-2 text-sm underline hover:no-underline",children:"Dismiss"})]}),n&&c.jsx(MV,{selectedKit:n,onKitSelect:r,onInstall:u,installing:s})]})},UV=()=>nt()?c.jsx(VV,{}):c.jsx(WV,{}),KV={0:"bg-dash-bg",1:"bg-emerald-500/20",2:"bg-emerald-500/50",3:"bg-emerald-400"};function GV({cells:t}){const{t:e}=ee(),n=[{label:e("plansHeatmapMon"),index:1},{label:e("plansHeatmapWed"),index:3},{label:e("plansHeatmapFri"),index:5}];return c.jsxs("div",{className:"flex w-fit items-start gap-3",children:[c.jsx("div",{className:"grid grid-rows-7 gap-1 pt-[1px] text-[10px] uppercase tracking-tighter text-dash-text-muted",children:Array.from({length:7},(r,s)=>{const i=n.find(o=>o.index===s);return c.jsx("div",{className:"flex h-3.5 items-center justify-end pr-1",children:i?.label??""},s)})}),c.jsx("div",{className:"grid grid-cols-12 gap-1",children:Array.from({length:12},(r,s)=>c.jsx("div",{className:"grid grid-rows-7 gap-1",children:t.filter(i=>i.weekIndex===s).map(i=>c.jsx("div",{title:e("plansHeatmapChanges").replace("{date}",new Date(i.date).toLocaleDateString()).replace("{count}",String(i.totalActivity)),className:`h-3.5 w-3.5 rounded-sm transition-colors duration-300 ${KV[i.level]}`},i.date))},s))})]})}function qV({planDir:t,projectId:e}){const{t:n}=ee(),[r,s]=g.useState("both"),[i,o]=g.useState(null),[a,l]=g.useState(null);return g.useEffect(()=>{let d=!1;async function u(){l(null);try{const h=new URLSearchParams({dir:t,source:r});e&&h.set("projectId",e);const f=await fetch(`/api/plan/heatmap?${h.toString()}`);if(!f.ok)throw new Error(n("plansHeatmapLoadError"));const p=await f.json();d||o(p)}catch(h){d||l(h instanceof Error?h.message:n("plansHeatmapLoadError"))}}return u(),()=>{d=!0}},[t,e,r,n]),c.jsxs("section",{className:"rounded-xl border border-dash-border bg-dash-surface p-5",children:[c.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-lg font-semibold text-dash-text",children:n("plansActivity")}),c.jsx("p",{className:"text-sm text-dash-text-muted",children:n("plansActivitySubtitle")})]}),c.jsxs("select",{value:r,onChange:d=>s(d.target.value),className:"rounded-lg border border-dash-border bg-dash-bg px-3 py-2 text-sm text-dash-text",children:[c.jsx("option",{value:"both",children:n("plansActivityCombined")}),c.jsx("option",{value:"git",children:n("plansActivityCommits")}),c.jsx("option",{value:"mtime",children:n("plansActivityFiles")})]})]}),i?.cells?.length?c.jsx(GV,{cells:i.cells}):c.jsx("p",{className:"text-sm text-dash-text-muted",children:a??i?.error??n("plansActivityEmpty")})]})}function YV({planDir:t,phaseId:e,status:n,actions:r,onSuccess:s}){const{t:i}=ee(),o=async a=>{await r.trigger({action:a,planDir:t,phaseId:e}),s()};return c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx("button",{type:"button",onClick:()=>void o("start"),disabled:r.loading,className:"rounded border border-dash-border px-2 py-1 text-xs text-dash-text disabled:cursor-not-allowed disabled:opacity-50",children:i(n==="in-progress"?"plansRestart":"plansStart")}),c.jsx("button",{type:"button",onClick:()=>void o("complete"),disabled:r.loading,className:"rounded border border-dash-border px-2 py-1 text-xs text-dash-text disabled:cursor-not-allowed disabled:opacity-50",children:i("plansComplete")}),c.jsx("button",{type:"button",onClick:()=>void o("reset"),disabled:r.loading,className:"rounded border border-dash-border px-2 py-1 text-xs text-dash-text-muted disabled:cursor-not-allowed disabled:opacity-50",children:i("plansReset")})]})}const XV={pending:"bg-amber-500","in-progress":"bg-sky-500",completed:"bg-emerald-500"},ZV={pending:"kanbanStatus_pending","in-progress":"kanbanStatus_in-progress",completed:"kanbanStatus_completed"};function QV({planDir:t,phases:e,actions:n,onRead:r,onRefresh:s}){const{t:i}=ee();return c.jsx("div",{className:"rounded-[2rem] bg-dash-border/20 p-1",style:{animation:"fade-in-up 0.8s cubic-bezier(0.32,0.72,0,1) 0.4s both"},children:c.jsxs("section",{className:"rounded-[calc(2rem-0.25rem)] border border-white/5 bg-dash-surface p-6 shadow-2xl",children:[c.jsxs("div",{className:"mb-6 flex items-center justify-between px-2",children:[c.jsx("h2",{className:"text-xl font-bold tracking-tight text-dash-text",children:i("plansPhases")}),c.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-dash-text-muted bg-dash-bg px-2 py-1 rounded-md border border-white/5",children:i("plansPhaseCount").replace("{count}",String(e.length))})]}),c.jsx("div",{className:"space-y-4",children:e.map((o,a)=>c.jsx("div",{className:"group relative rounded-[1.5rem] bg-dash-border/10 p-1 transition-all duration-500 hover:bg-dash-accent/5",style:{animation:`fade-in-up 0.6s cubic-bezier(0.32,0.72,0,1) ${.5+a*.1}s both`},children:c.jsxs("div",{className:"flex flex-col gap-4 rounded-[calc(1.5rem-0.25rem)] border border-white/5 bg-dash-bg p-4 transition-colors duration-500 hover:bg-dash-bg/80 lg:flex-row lg:items-center lg:justify-between",children:[c.jsxs("div",{className:"flex items-start gap-4",children:[c.jsxs("div",{className:"mt-1 flex flex-col items-center gap-2",children:[c.jsx("div",{className:`h-3 w-3 rounded-full ${XV[o.status]} shadow-[0_0_8px_currentColor]`}),c.jsx("div",{className:"h-full w-px flex-1 bg-dash-border/30"})]}),c.jsxs("div",{children:[c.jsx("div",{className:"flex items-center gap-2",children:c.jsx("span",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-dash-accent/80",children:o.phaseId})}),c.jsx("h3",{className:"text-sm font-semibold text-dash-text group-hover:text-dash-accent transition-colors",children:o.name}),c.jsx("p",{className:"mt-0.5 text-[10px] font-bold uppercase tracking-widest text-dash-text-muted",children:i(ZV[o.status])})]})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[c.jsx("button",{type:"button",onClick:()=>r(o.file),className:"flex h-8 items-center rounded-full border border-white/10 bg-dash-surface px-4 text-[11px] font-bold uppercase tracking-widest text-dash-text transition-all duration-300 hover:bg-dash-accent hover:text-white active:scale-95",children:i("plansRead")}),c.jsx("div",{className:"p-0.5 bg-dash-border/20 rounded-full border border-white/5",children:c.jsx(YV,{planDir:t,phaseId:o.phaseId,status:o.status,actions:n,onSuccess:s})})]})]})},o.phaseId))})]})})}function JV({planDir:t,actions:e,onSuccess:n}){const{t:r}=ee(),s=async i=>{await e.trigger({action:i,planDir:t}),n()};return c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx("button",{type:"button",onClick:()=>void s("validate"),disabled:e.loading,className:"rounded-lg border border-dash-border px-3 py-2 text-sm text-dash-text disabled:cursor-not-allowed disabled:opacity-50",children:r("plansValidate")}),c.jsx("button",{type:"button",onClick:()=>void s("start-next"),disabled:e.loading,className:"rounded-lg bg-dash-accent px-3 py-2 text-sm font-medium text-dash-bg disabled:cursor-not-allowed disabled:opacity-50",children:r("plansStartNext")})]})}const eH={pending:"plansStatusPending","in-progress":"plansStatusInProgress","in-review":"plansStatusInReview",done:"plansStatusDone",cancelled:"plansStatusCancelled"};function tH({plan:t,planDir:e,actions:n,onActionSuccess:r}){const{t:s}=ee(),i=t.status??"pending";return c.jsx("div",{className:"rounded-[2rem] bg-dash-border/20 p-1 transition-all duration-700 ease-[cubic-bezier(0.32,0.72,0,1)]",style:{animation:"fade-in-up 0.8s cubic-bezier(0.32,0.72,0,1) both"},children:c.jsxs("section",{className:"rounded-[calc(2rem-0.25rem)] border border-white/5 bg-dash-surface p-6 shadow-2xl",children:[c.jsxs("div",{className:"flex flex-col gap-6 lg:flex-row lg:items-start lg:justify-between",children:[c.jsxs("div",{className:"flex-1",children:[c.jsxs("div",{className:"mb-2 flex items-center gap-3",children:[c.jsx("span",{className:"rounded-full bg-dash-accent/10 border border-dash-accent/20 px-3 py-0.5 text-[10px] font-bold uppercase tracking-widest text-dash-accent",children:s(eH[i])}),c.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.2em] text-dash-text-muted",children:s("plansLabel")})]}),c.jsx("h1",{className:"text-3xl font-bold tracking-tight text-dash-text lg:text-4xl text-balance",children:t.title}),t.description&&c.jsx("p",{className:"mt-4 max-w-3xl text-sm leading-relaxed text-dash-text-muted",children:t.description})]}),c.jsx("div",{className:"shrink-0 p-1 bg-dash-border/10 rounded-2xl border border-white/5",children:c.jsx(JV,{planDir:e,actions:n,onSuccess:r})})]}),c.jsxs("div",{className:"mt-8",children:[c.jsxs("div",{className:"flex items-center justify-between mb-2",children:[c.jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-dash-text-muted",children:s("kanbanProgress")}),c.jsxs("span",{className:"text-sm font-bold text-dash-accent",children:[t.progressPct,"%"]})]}),c.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-dash-bg shadow-inner",children:c.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-dash-accent/40 via-dash-accent to-dash-accent shadow-[0_0_12px_theme(colors.dash-accent/0.3)] transition-all duration-1000 ease-[cubic-bezier(0.32,0.72,0,1)]",style:{width:`${t.progressPct}%`}})})]}),c.jsxs("div",{className:"mt-8 flex flex-wrap gap-6 border-t border-white/5 pt-6",children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{className:"text-[10px] uppercase tracking-widest text-dash-text-muted",children:s("plansPhase")}),c.jsx("span",{className:"text-sm font-semibold text-dash-text",children:s("plansPhaseCount").replace("{count}",String(t.totalPhases))})]}),c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{className:"text-[10px] uppercase tracking-widest text-dash-text-muted",children:s("plansPriority")}),c.jsx("span",{className:"text-sm font-semibold text-dash-text",children:t.priority??"—"})]}),c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{className:"text-[10px] uppercase tracking-widest text-dash-text-muted",children:s("plansLastUpdated")}),c.jsx("span",{className:"text-sm font-semibold text-dash-text",children:t.lastModified?new Date(t.lastModified).toLocaleDateString():"—"})]})]})]})})}function nH(t){return new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric"})}const vv={pending:"from-amber-500/40 to-amber-500/20 border-amber-500/30 text-amber-100","in-progress":"from-sky-500/40 to-sky-500/20 border-sky-500/30 text-sky-100",completed:"from-emerald-500/40 to-emerald-500/20 border-emerald-500/30 text-emerald-100"},rH={pending:"kanbanStatus_pending","in-progress":"kanbanStatus_in-progress",completed:"kanbanStatus_completed"};function sH({timeline:t,onOpenPhase:e}){const{t:n}=ee(),r=Array.from({length:7},(s,i)=>{const o=new Date(t.rangeEnd).getTime()-new Date(t.rangeStart).getTime(),a=new Date(new Date(t.rangeStart).getTime()+o/6*i);return nH(a.toISOString())});return c.jsx("div",{className:"group rounded-[2rem] bg-dash-border/20 p-1 transition-all duration-700 ease-[cubic-bezier(0.32,0.72,0,1)] hover:bg-dash-accent/5",style:{animation:"fade-in-up 0.8s cubic-bezier(0.32,0.72,0,1) 0.2s both"},children:c.jsxs("section",{className:"rounded-[calc(2rem-0.25rem)] border border-white/5 bg-dash-surface p-6 shadow-2xl",children:[c.jsxs("div",{className:"mb-6 flex items-end justify-between px-2",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-xl font-bold tracking-tight text-dash-text",children:n("plansTimeline")}),c.jsx("p",{className:"text-xs uppercase tracking-widest text-dash-text-muted mt-1",children:n("plansTimelineAvgDays").replace("{count}",t.summary.avgDurationDays.toFixed(1))})]}),c.jsx("div",{className:"flex gap-4",children:Object.entries(vv).map(([s,i])=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:`h-1.5 w-6 rounded-full bg-gradient-to-r ${i.split(" ").slice(0,2).join(" ")}`}),c.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-dash-text-muted",children:n(rH[s])})]},s))})]}),c.jsxs("div",{className:"relative mt-8",children:[c.jsx("div",{className:"grid grid-cols-7 gap-2 px-1 text-[10px] font-bold uppercase tracking-widest text-dash-text-muted/60",children:r.map(s=>c.jsx("span",{children:s},s))}),c.jsxs("div",{className:"relative mt-4 min-h-[160px] overflow-hidden rounded-2xl border border-white/5 bg-dash-bg/30 p-4 transition-all duration-500 group-hover:bg-dash-bg/50",style:{height:`${Math.max(160,t.layerCount*40+64)}px`},children:[c.jsx("div",{className:"absolute inset-0 grid grid-cols-7 pointer-events-none",children:Array.from({length:7}).map((s,i)=>c.jsx("div",{className:"h-full border-r border-white-[0.02] last:border-0"},i))}),c.jsx("div",{className:"absolute bottom-0 top-0 z-10 w-px bg-dash-accent/40",style:{left:`${t.todayPct}%`},children:c.jsx("div",{className:"absolute -top-1 -left-1 h-2.5 w-2.5 rounded-full bg-dash-accent shadow-[0_0_8px_theme(colors.dash-accent)]"})}),t.phases.map(s=>c.jsx("button",{type:"button",onClick:()=>e(s.file),title:`${s.name} • ${s.effort??n("plansNoEffort")}`,className:`absolute flex h-7 items-center rounded-lg border px-3 text-[11px] font-semibold text-white backdrop-blur-md shadow-sm transition-all duration-300 hover:scale-[1.02] hover:shadow-lg hover:brightness-110 active:scale-[0.98] bg-gradient-to-r ${vv[s.status]}`,style:{top:`${s.layer*38+20}px`,left:`${s.leftPct}%`,width:`${s.widthPct}%`},children:c.jsxs("span",{className:"truncate drop-shadow-sm",children:[s.phaseId," · ",s.name]})},s.phaseId))]})]})]})})}function lm(t,e){const n=e.replace(/\\/g,"/").replace(/\/$/,""),r=t.replace(/\\/g,"/");return r.startsWith(`${n}/`)?r.slice(n.length+1):r.split("/").slice(-1)[0]??r}function cm(t){return t.split("/").filter(Boolean).map(e=>encodeURIComponent(e)).join("/")}function iH(t){const[e,n]=g.useState(null),[r,s]=g.useState(!1),[i,o]=g.useState(null);return{pendingId:e,loading:r,error:i,trigger:async a=>{s(!0),o(null);try{const l=await fetch("/api/plan/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,...t?{projectId:t}:{}})});if(!l.ok)throw new Error(`Failed to run action (${l.status})`);const d=await l.json();if(n(d.id),d.status==="failed")throw new Error(d.error??"Action failed");return d}catch(l){const d=l instanceof Error?l.message:"Action failed";throw o(d),l}finally{n(null),s(!1)}}}}const oH={pending:"plansStatusPending","in-progress":"plansStatusInProgress","in-review":"plansStatusInReview",done:"plansStatusDone",cancelled:"plansStatusCancelled"};function aH(){const{t}=ee(),e=Ft(),{planSlug:n=""}=zl(),[r]=Hl(),s=r.get("dir")??"plans",i=r.get("projectId"),o=r.get("origin"),a=iH(i),[l,d]=g.useState(null),[u,h]=g.useState(!0),[f,p]=g.useState(null),m=`${s}/${n}`,x=g.useCallback(async()=>{h(!0),p(null);try{const b=new URLSearchParams({dir:m});i&&b.set("projectId",i);const y=await fetch(`/api/plan/timeline?${b.toString()}`);if(!y.ok)throw new Error(t("plansLoadPlanFailed").replace("{status}",String(y.status)));d(await y.json())}catch(b){p(b instanceof Error?b.message:t("plansLoadPlanFallback"))}finally{h(!1)}},[m,i,t]);return g.useEffect(()=>{x()},[x]),u?c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsxs("div",{className:"flex flex-col items-center gap-4 animate-pulse",children:[c.jsx("div",{className:"h-12 w-12 rounded-full border-2 border-dash-accent border-t-transparent animate-spin"}),c.jsx("p",{className:"text-[10px] font-bold uppercase tracking-[0.3em] text-dash-accent/60",children:t("plansLoadingPlan")})]})}):f||!l?c.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-4 p-8 text-center",children:c.jsxs("div",{className:"rounded-2xl border border-red-500/20 bg-red-500/5 p-6 backdrop-blur-md",children:[c.jsx("h2",{className:"text-sm font-bold uppercase tracking-widest text-red-400",children:t("error")}),c.jsx("p",{className:"mt-2 text-sm text-red-300/80",children:f??t("plansNotFound")}),c.jsx("button",{type:"button",onClick:()=>void x(),className:"mt-6 rounded-full bg-red-500 px-6 py-2 text-xs font-bold uppercase tracking-widest text-white transition-all hover:scale-105 active:scale-95",children:t("refresh")})]})}):c.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-dash-bg",children:[c.jsxs("div",{className:"flex items-center gap-4 border-b border-white/5 bg-dash-surface/30 px-6 py-3 backdrop-blur-xl",children:[c.jsxs("button",{type:"button",onClick:()=>e(o==="global"?"/plans":`/plans?dir=${encodeURIComponent(s)}${i?`&projectId=${encodeURIComponent(i)}`:""}`),className:"group flex items-center gap-2 rounded-full border border-white/5 bg-dash-surface px-4 py-1.5 text-[10px] font-bold uppercase tracking-widest text-dash-text transition-all hover:bg-dash-accent hover:text-white",children:[c.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",className:"h-3 w-3 transition-transform group-hover:-translate-x-1",children:c.jsx("polyline",{points:"15 18 9 12 15 6"})}),t("plansBackToPlans")]}),c.jsx("div",{className:"h-4 w-px bg-dash-border/50"}),c.jsx("span",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-dash-text-muted",children:l.plan.title??n.toUpperCase()})]}),c.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden scrollbar-hide",children:c.jsxs("div",{className:"mx-auto max-w-[1600px] p-6 lg:p-10",children:[a.error&&c.jsxs("div",{className:"mb-6 rounded-[1.5rem] border border-red-500/20 bg-red-500/10 px-5 py-4 text-sm text-red-200 backdrop-blur-md",children:[c.jsx("p",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-red-300",children:t("actionFailed")}),c.jsx("p",{className:"mt-2 leading-relaxed",children:a.error})]}),c.jsxs("div",{className:"grid gap-10 lg:grid-cols-12 lg:items-start",children:[c.jsxs("div",{className:"space-y-10 lg:col-span-8",children:[c.jsx(tH,{plan:l.plan,planDir:m,actions:a,onActionSuccess:()=>void x()}),c.jsx(sH,{timeline:l.timeline,onOpenPhase:b=>e(`/plans/${encodeURIComponent(n)}/read/${cm(lm(b,m))}?dir=${encodeURIComponent(s)}${i?`&projectId=${encodeURIComponent(i)}`:""}${o?`&origin=${encodeURIComponent(o)}`:""}`)}),c.jsx(QV,{planDir:m,phases:l.plan.phases,actions:a,onRead:b=>e(`/plans/${encodeURIComponent(n)}/read/${cm(lm(b,m))}?dir=${encodeURIComponent(s)}${i?`&projectId=${encodeURIComponent(i)}`:""}${o?`&origin=${encodeURIComponent(o)}`:""}`),onRefresh:()=>void x()})]}),c.jsxs("div",{className:"space-y-10 lg:col-span-4 lg:sticky lg:top-0",children:[c.jsx("div",{className:"rounded-[2.5rem] bg-dash-accent/5 p-1 backdrop-blur-3xl",style:{animation:"fade-in 1s cubic-bezier(0.32,0.72,0,1) 0.6s both"},children:c.jsx(qV,{planDir:m,projectId:i})}),c.jsxs("div",{className:"rounded-[2rem] border border-white/5 bg-dash-surface/50 p-6 backdrop-blur-md",style:{animation:"fade-in 1s cubic-bezier(0.32,0.72,0,1) 0.8s both"},children:[c.jsx("h3",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-dash-accent",children:t("plansQuickInfoTitle")}),c.jsxs("div",{className:"mt-4 space-y-4",children:[c.jsx("p",{className:"text-xs leading-relaxed text-dash-text-muted",children:t("plansQuickInfoDescription")}),c.jsxs("div",{className:"flex items-center gap-3 rounded-2xl bg-dash-bg/50 p-4 border border-white/5",children:[c.jsx("div",{className:"h-10 w-10 flex items-center justify-center rounded-full bg-dash-accent/10 border border-dash-accent/20",children:c.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:"h-5 w-5 text-dash-accent",strokeWidth:"2.5",children:c.jsx("path",{d:"M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"})})}),c.jsxs("div",{children:[c.jsx("p",{className:"text-[9px] uppercase tracking-widest text-dash-text-muted",children:t("plansCurrentStatus")}),c.jsx("p",{className:"text-sm font-bold text-dash-text",children:l.plan.status?t(oH[l.plan.status]):t("plansStatusUnknown")})]})]})]})]})]})]})]})})]})}function lH(){return nt()?c.jsx(Ju,{titleKey:"desktopModePlanDetailTitle",descriptionKey:"desktopModePlanDetailDescription",commandHintKey:"desktopModePlanDetailHint"}):c.jsx(aH,{})}function wv({label:t,item:e,onClick:n}){return c.jsx("button",{type:"button",onClick:n,disabled:!e,className:"rounded-lg border border-dash-border px-3 py-2 text-sm text-dash-text transition hover:border-dash-accent/50 disabled:cursor-not-allowed disabled:opacity-40",title:e?.name,children:t})}function cH(t){const{t:e}=ee();return c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(wv,{label:e("plansPrevious"),item:t.prev,onClick:()=>t.prev&&t.onNavigate(t.prev.file)}),c.jsx(wv,{label:e("plansNext"),item:t.next,onClick:()=>t.next&&t.onNavigate(t.next.file)})]})}function dH(t){const{t:e}=ee();return c.jsxs("header",{className:"flex flex-col gap-4 rounded-xl border border-dash-border bg-dash-surface p-4 lg:flex-row lg:items-center lg:justify-between",children:[c.jsxs("div",{children:[c.jsx("button",{type:"button",onClick:t.onBack,className:"text-sm text-dash-accent",children:e("plansBackToPlan")}),c.jsx("p",{className:"mt-2 text-xs uppercase tracking-[0.2em] text-dash-text-muted",children:e("plansNav")}),c.jsxs("h1",{className:"text-lg font-semibold text-dash-text",children:[t.planTitle,t.phaseTitle?` / ${t.phaseTitle}`:""]})]}),c.jsx(cH,{prev:t.prev,next:t.next,onNavigate:t.onNavigate})]})}function uH({content:t}){const{t:e}=ee(),n=DE(t).filter(r=>r.level<=3);return n.length===0?null:c.jsxs("aside",{className:"rounded-xl border border-dash-border bg-dash-surface p-4",children:[c.jsx("h2",{className:"mb-3 text-sm font-semibold text-dash-text",children:e("plansContents")}),c.jsx("nav",{className:"space-y-2",children:n.map(r=>c.jsx("a",{href:`#${r.id}`,className:"block text-sm text-dash-text-muted transition hover:text-dash-accent",style:{paddingLeft:`${(r.level-1)*12}px`},children:r.text},r.id))})]})}function hH(t,e){return`${t}/${e}/plan.md`}function fH(t,e,n,r){const s=`${t}/${e}`,[i,o]=g.useState({planTitle:e,phases:[],currentIndex:-1,prev:null,next:null,loading:!0,error:null}),a=g.useCallback(async()=>{o(l=>({...l,loading:!0,error:null}));try{const l=new URLSearchParams({file:hH(t,e)});r&&l.set("projectId",r);const d=await fetch(`/api/plan/parse?${l.toString()}`);if(!d.ok)throw new Error(`Failed to load navigation (${d.status})`);const u=await d.json();o({planTitle:typeof u.frontmatter.title=="string"?u.frontmatter.title:e,phases:u.phases.map(h=>({phaseId:h.phaseId,name:h.name,file:lm(h.file,s)})),currentIndex:-1,prev:null,next:null,loading:!1,error:null})}catch(l){o(d=>({...d,loading:!1,error:l instanceof Error?l.message:"Failed to load navigation"}))}},[s,e,r,t]);return g.useEffect(()=>{a()},[a]),g.useMemo(()=>{const l=n?i.phases.findIndex(d=>d.file===n):-1;return{...i,currentIndex:l,prev:l>0?i.phases[l-1]:null,next:l>=0?i.phases[l+1]??null:i.phases.length>0?i.phases[0]:null}},[n,i])}function pH(){const{t}=ee(),e=Ft(),{planSlug:n="*","*":r}=zl(),[s]=Hl(),i=s.get("dir")??"plans",o=s.get("projectId"),a=s.get("origin"),l=fH(i,n,r,o),[d,u]=g.useState(null),[h,f]=g.useState(null),p=(l.currentIndex>=0?l.phases[l.currentIndex]?.name??null:null)??(typeof d?.frontmatter.title=="string"?d.frontmatter.title:null),m=g.useCallback(async()=>{f(null);try{const b=`${i}/${n}`,y=r?`${b}/${r}`:`${b}/plan.md`,k=new URLSearchParams({file:y,dir:b});o&&k.set("projectId",o);const v=await fetch(`/api/plan/file?${k.toString()}`);if(!v.ok)throw new Error(t("plansLoadFileFailed").replace("{status}",String(v.status)));u(await v.json())}catch(b){f(b instanceof Error?b.message:t("plansLoadFileFallback"))}},[r,n,o,i,t]);g.useEffect(()=>{m()},[m]);const x=b=>e(`/plans/${encodeURIComponent(n)}/read/${cm(b)}?dir=${encodeURIComponent(i)}${o?`&projectId=${encodeURIComponent(o)}`:""}${a?`&origin=${encodeURIComponent(a)}`:""}`);return c.jsxs("div",{className:"flex h-full flex-col gap-4 overflow-auto",children:[c.jsx(dH,{planTitle:l.planTitle,phaseTitle:p,prev:l.prev,next:l.next,onBack:()=>e(`/plans/${encodeURIComponent(n)}?dir=${encodeURIComponent(i)}${o?`&projectId=${encodeURIComponent(o)}`:""}${a?`&origin=${encodeURIComponent(a)}`:""}`),onNavigate:x}),h&&c.jsx("p",{className:"text-sm text-red-300",children:h}),d&&c.jsxs("div",{className:"grid gap-4 xl:grid-cols-[280px_minmax(0,1fr)]",children:[c.jsx(uH,{content:d.content}),c.jsx("div",{className:"rounded-xl border border-dash-border bg-dash-surface p-5",children:c.jsx(ui,{content:d.raw})})]}),!d&&!h&&c.jsx("p",{className:"text-sm text-dash-text-muted",children:t("plansLoadingReader")})]})}function kv(){return nt()?c.jsx(Ju,{titleKey:"desktopModePlanReaderTitle",descriptionKey:"desktopModePlanReaderDescription",commandHintKey:"desktopModePlanReaderHint"}):c.jsx(pH,{})}const mH={pending:"bg-amber-500/10 text-amber-400/90 border border-amber-500/20","in-progress":"bg-sky-500/10 text-sky-400/90 border border-sky-500/20","in-review":"bg-violet-500/10 text-violet-400/90 border border-violet-500/20",done:"bg-emerald-500/10 text-emerald-400/90 border border-emerald-500/20",cancelled:"bg-rose-500/10 text-rose-400/90 border border-rose-500/20"},gH={pending:"plansStatusPending","in-progress":"plansStatusInProgress","in-review":"plansStatusInReview",done:"plansStatusDone",cancelled:"plansStatusCancelled"};function xH(t){return t?new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric"}):"—"}function mu({plan:t,onClick:e,compact:n=!1}){const{t:r}=ee(),s=t.summary,i=s.status??"pending",o=s.tags??[];return c.jsx("button",{type:"button",onClick:e,className:"group relative w-full rounded-[2rem] bg-dash-border/20 p-1 transition-all duration-500 ease-[cubic-bezier(0.32,0.72,0,1)] hover:bg-dash-accent/10 active:scale-[0.98]",children:c.jsxs("div",{className:"flex h-full flex-col rounded-[calc(2rem-0.25rem)] border border-white/5 bg-dash-surface p-5 shadow-[inset_0_1px_1px_rgba(255,255,255,0.05)] transition-colors duration-500 group-hover:bg-dash-surface-hover",children:[c.jsxs("div",{className:"mb-4 flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"flex-1",children:[c.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[c.jsx("span",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-dash-accent/80",children:t.slug.split("-")[0]}),c.jsx("span",{className:"h-1 w-1 rounded-full bg-dash-border"}),c.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em] text-dash-text-muted",children:r("plansPhaseCountCompact").replace("{count}",String(s.totalPhases))})]}),t.projectName&&c.jsx("div",{className:"mb-2",children:c.jsx("span",{className:"inline-flex rounded-full border border-dash-accent/20 bg-dash-accent/10 px-2 py-0.5 text-[10px] font-medium text-dash-accent",children:t.projectName})}),c.jsx("h3",{className:"text-base font-semibold tracking-tight text-dash-text group-hover:text-dash-accent transition-colors",children:s.title??t.name}),s.description&&!n&&c.jsx("p",{className:"mt-2 text-xs leading-relaxed text-dash-text-muted line-clamp-2",children:s.description})]}),c.jsxs("div",{className:"flex flex-col items-end gap-2",children:[c.jsx("span",{className:`rounded-full px-2.5 py-0.5 text-[10px] font-bold uppercase tracking-wider ${mH[i]}`,children:r(gH[i])}),c.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-dash-bg/50 border border-white/5 text-dash-text-muted transition-all duration-500 group-hover:translate-x-1 group-hover:-translate-y-1 group-hover:bg-dash-accent group-hover:text-white",children:c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"h-4 w-4",children:[c.jsx("line",{x1:"7",y1:"17",x2:"17",y2:"7"}),c.jsx("polyline",{points:"7 7 17 7 17 17"})]})})]})]}),c.jsxs("div",{className:"mt-auto space-y-4",children:[c.jsxs("div",{className:"group/progress relative",children:[c.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[c.jsx("span",{className:"text-[10px] font-medium text-dash-text-muted uppercase tracking-wider",children:r("kanbanProgress")}),c.jsxs("span",{className:"text-[10px] font-bold text-dash-text",children:[s.progressPct,"%"]})]}),c.jsx("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-dash-bg shadow-[inset_0_1px_2px_rgba(0,0,0,0.2)]",children:c.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-dash-accent/80 to-dash-accent transition-all duration-1000 ease-[cubic-bezier(0.32,0.72,0,1)]",style:{width:`${s.progressPct}%`}})})]}),c.jsxs("div",{className:"flex items-center justify-between border-t border-white/5 pt-4",children:[c.jsxs("div",{className:"flex gap-4",children:[c.jsxs("div",{className:"flex flex-col",children:[c.jsx("span",{className:"text-[9px] uppercase tracking-widest text-dash-text-muted",children:r("plansPriority")}),c.jsx("span",{className:"text-xs font-semibold text-dash-text",children:s.priority??"—"})]}),c.jsxs("div",{className:"flex flex-col",children:[c.jsx("span",{className:"text-[9px] uppercase tracking-widest text-dash-text-muted",children:r("plansUpdated")}),c.jsx("span",{className:"text-xs font-semibold text-dash-text",children:xH(s.lastModified)})]})]}),!n&&o.length>0&&c.jsx("div",{className:"flex -space-x-2",children:o.slice(0,3).map((a,l)=>c.jsx("div",{className:"flex h-5 items-center rounded-full border border-dash-border bg-dash-surface px-2 text-[9px] font-medium text-dash-text-muted ring-2 ring-dash-surface",style:{zIndex:10-l},children:a},a))})]})]})]})})}const bH=[{status:"pending",color:"bg-amber-400/80",labelKey:"plansStatusPending"},{status:"in-progress",color:"bg-sky-400/80",labelKey:"plansStatusInProgress"},{status:"in-review",color:"bg-violet-400/80",labelKey:"plansStatusInReview"},{status:"done",color:"bg-emerald-400/80",labelKey:"plansStatusDone"},{status:"cancelled",color:"bg-rose-400/80",labelKey:"plansStatusCancelled"}];function yH({plans:t,onSelect:e}){const{t:n}=ee();return c.jsx("div",{className:"grid h-full w-full gap-6 lg:grid-cols-3 xl:grid-cols-5",children:bH.map((r,s)=>{const i=t.filter(o=>(o.summary.status??"pending")===r.status);return c.jsx("div",{className:"group/col flex flex-col rounded-[2.5rem] bg-dash-border/10 p-2 transition-all duration-700 ease-[cubic-bezier(0.32,0.72,0,1)] hover:bg-dash-border/20",style:{animation:`fade-in-up 0.8s cubic-bezier(0.32,0.72,0,1) ${s*.1}s both`},children:c.jsxs("section",{className:"flex flex-1 flex-col rounded-[calc(2.5rem-0.5rem)] border border-white/5 bg-dash-bg/40 p-3 shadow-2xl backdrop-blur-sm",children:[c.jsxs("header",{className:"mb-6 flex items-center justify-between px-2 pt-2",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:`h-2.5 w-2.5 rounded-full ${r.color} shadow-[0_0_12px_rgba(255,255,255,0.1)]`}),c.jsx("h2",{className:"text-xs font-bold uppercase tracking-[0.15em] text-dash-text",children:n(r.labelKey)})]}),c.jsx("div",{className:"flex h-6 min-w-[1.5rem] items-center justify-center rounded-full bg-dash-border px-2 text-[10px] font-bold text-dash-text-muted transition-colors group-hover/col:bg-dash-accent group-hover/col:text-white",children:i.length})]}),c.jsx("div",{className:"space-y-4 overflow-y-auto px-1 pb-4 scrollbar-hide",children:i.length>0?i.map(o=>c.jsx(mu,{plan:o,compact:!0,onClick:()=>e(o)},`${o.projectId??"plan"}:${o.slug}`)):c.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center opacity-20",children:[c.jsx("div",{className:"mb-2 h-1 w-8 rounded-full bg-dash-border"}),c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-widest text-dash-text-muted",children:n("plansKanbanEmpty")})]})})]})},r.status)})})}function vH(t){const{t:e}=ee(),n=!!t.projectOptions?.length&&!!t.onProjectFilterChange;return c.jsxs("div",{className:["grid gap-3 rounded-xl border border-dash-border bg-dash-surface p-4",n?"lg:grid-cols-[minmax(0,1fr)_auto_auto_auto_auto]":"lg:grid-cols-[minmax(0,1fr)_auto_auto_auto]"].join(" "),children:[c.jsx("input",{type:"search",value:t.searchQuery,onChange:r=>t.onSearchQueryChange(r.target.value),placeholder:e("plansSearch"),"aria-label":e("plansSearch"),className:"rounded-lg border border-dash-border bg-dash-bg px-3 py-2 text-sm text-dash-text outline-none transition focus:border-dash-accent/60"}),n&&c.jsxs("select",{value:t.projectFilter??"all",onChange:r=>t.onProjectFilterChange?.(r.target.value),"aria-label":e("plansProjectFilter"),className:"rounded-lg border border-dash-border bg-dash-bg px-3 py-2 text-sm text-dash-text",children:[c.jsx("option",{value:"all",children:e("plansAllProjects")}),t.projectOptions?.map(r=>c.jsx("option",{value:r.id,children:r.name},r.id))]}),c.jsxs("select",{value:t.statusFilter,onChange:r=>t.onStatusFilterChange(r.target.value),"aria-label":e("plansFilterAll"),className:"rounded-lg border border-dash-border bg-dash-bg px-3 py-2 text-sm text-dash-text",children:[c.jsx("option",{value:"all",children:e("plansFilterAll")}),c.jsx("option",{value:"pending",children:e("plansStatusPending")}),c.jsx("option",{value:"in-progress",children:e("plansStatusInProgress")}),c.jsx("option",{value:"in-review",children:e("plansStatusInReview")}),c.jsx("option",{value:"done",children:e("plansStatusDone")}),c.jsx("option",{value:"cancelled",children:e("plansStatusCancelled")})]}),c.jsxs("select",{value:t.sortBy,onChange:r=>t.onSortByChange(r.target.value),"aria-label":e("plansSortBy"),className:"rounded-lg border border-dash-border bg-dash-bg px-3 py-2 text-sm text-dash-text",children:[c.jsx("option",{value:"date-desc",children:e("plansSortDateDesc")}),c.jsx("option",{value:"date-asc",children:e("plansSortDateAsc")}),c.jsx("option",{value:"name-asc",children:e("plansSortNameAsc")}),c.jsx("option",{value:"name-desc",children:e("plansSortNameDesc")}),c.jsx("option",{value:"progress-desc",children:e("plansSortProgress")})]}),c.jsx("div",{className:"inline-flex rounded-lg border border-dash-border bg-dash-bg p-1",children:["grid","kanban"].map(r=>c.jsx("button",{type:"button",onClick:()=>t.onViewModeChange(r),className:["rounded-md px-3 py-1.5 text-sm transition",t.viewMode===r?"bg-dash-accent text-dash-bg":"text-dash-text-muted hover:text-dash-text"].join(" "),children:e(r==="grid"?"plansViewGrid":"plansViewKanban")},r))})]})}function wH(t){const{t:e}=ee(),n=t.activePlans.length+t.completedPlans.length;return c.jsxs("section",{className:"space-y-4 rounded-[2rem] border border-dash-border bg-dash-surface/70 p-5",children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-lg font-semibold text-dash-text",children:t.projectName}),c.jsx("p",{className:"text-xs text-dash-text-muted",children:e("plansProjectPlans").replace("{count}",String(n))})]}),c.jsx("div",{className:"rounded-full border border-dash-border bg-dash-bg px-3 py-1 text-xs font-semibold text-dash-text-muted",children:n})]}),c.jsx("div",{className:"grid gap-4 xl:grid-cols-3",children:t.activePlans.map(r=>c.jsx(mu,{plan:r,onClick:()=>t.onPlanClick(r)},r.slug))}),t.completedPlans.length>0&&c.jsxs("details",{className:"rounded-[1.5rem] border border-dash-border/80 bg-dash-bg/40 p-4",children:[c.jsx("summary",{className:"cursor-pointer select-none text-sm font-medium text-dash-text-muted",children:e("plansCompletedCount").replace("{count}",String(t.completedPlans.length))}),c.jsx("div",{className:"mt-4 grid gap-4 xl:grid-cols-3",children:t.completedPlans.map(r=>c.jsx("div",{className:"opacity-60",children:c.jsx(mu,{plan:r,onClick:()=>t.onPlanClick(r)})},r.slug))})]})]})}function kH(t){return t.projects.flatMap(e=>e.plans.map(n=>({...n,projectId:e.id,projectName:e.name,plansDir:e.plansDir})))}function SH(t,e){const[n,r]=g.useState([]),[s,i]=g.useState([]),[o,a]=g.useState([]),[l,d]=g.useState(!0),[u,h]=g.useState(null),f=g.useCallback(async()=>{d(!0),h(null);try{if(!e){const b=await fetch("/api/plan/list-all");if(!b.ok)throw new Error(`Failed to load plans (${b.status})`);const y=await b.json();i(y.projects.map(k=>({id:k.id,name:k.name}))),a(y.projects.flatMap(k=>k.error?[{id:k.id,name:k.name,error:k.error}]:[])),r(kH(y));return}const p=new URLSearchParams({dir:t,limit:"500",offset:"0",projectId:e}),m=await fetch(`/api/plan/list?${p.toString()}`);if(!m.ok)throw new Error(`Failed to load plans (${m.status})`);const x=await m.json();i([]),a([]),r(x.plans??[])}catch(p){h(p instanceof Error?p.message:"Failed to load plans")}finally{d(!1)}},[e,t]);return g.useEffect(()=>{f()},[f]),{plans:n,projectOptions:s,projectErrors:o,loading:l,error:u,reload:f}}function CH(t){return t.summary.status==="done"||t.summary.status==="cancelled"}function jH(){const t=localStorage.getItem("ck-plans-view");return t==="kanban"||t==="grid"?t:"grid"}function Sv(t){const e=t.get("view");return e==="kanban"||e==="grid"?e:jH()}function NH(){const{t}=ee(),e=Ft(),[n,r]=Hl(),s=n.get("dir")??"plans",i=n.get("projectId"),o=!i,{plans:a,projectOptions:l,projectErrors:d,loading:u,error:h}=SH(s,i),[f,p]=g.useState(""),[m,x]=g.useState(()=>Sv(n)),[b,y]=g.useState("date-desc"),[k,v]=g.useState("all"),[w,C]=g.useState("all");g.useEffect(()=>{x(Sv(n))},[n]);const j=g.useMemo(()=>{const A=f.trim().toLowerCase();return[...a].filter(N=>w==="all"?!0:N.projectId===w).filter(N=>k==="all"?!0:(N.summary.status??"pending")===k).filter(N=>A?[N.summary.title,N.summary.description,N.projectName,N.slug,(N.summary.tags??[]).join(" ")].filter(Boolean).join(" ").toLowerCase().includes(A):!0).sort((N,T)=>{switch(b){case"name-asc":return(N.summary.title??N.name).localeCompare(T.summary.title??T.name);case"name-desc":return(T.summary.title??T.name).localeCompare(N.summary.title??N.name);case"date-asc":return(N.summary.lastModified??"").localeCompare(T.summary.lastModified??"");case"progress-desc":return T.summary.progressPct-N.summary.progressPct;default:return(T.summary.lastModified??"").localeCompare(N.summary.lastModified??"")}})},[a,w,f,b,k]),S=g.useMemo(()=>{const A=new Map;for(const N of j){const T=N.projectId??N.projectName??"current-project",I=N.projectName??t("plansTitle"),O=A.get(T)??{key:T,projectName:I,activePlans:[],completedPlans:[]};CH(N)?O.completedPlans.push(N):O.activePlans.push(N),A.set(T,O)}return Array.from(A.values())},[j,t]),P=A=>{const N=A.plansDir??s,T=A.projectId??i;e(`/plans/${encodeURIComponent(A.slug)}?dir=${encodeURIComponent(N)}${T?`&projectId=${encodeURIComponent(T)}`:""}${o?"&origin=global":""}`)},D=A=>{localStorage.setItem("ck-plans-view",A),x(A);const N=new URLSearchParams(n);A==="grid"?N.delete("view"):N.set("view",A),r(N,{replace:!0})};return c.jsxs("div",{className:"flex h-full flex-col gap-4 overflow-auto",children:[c.jsxs("header",{children:[c.jsx("p",{className:"text-xs uppercase tracking-[0.2em] text-dash-text-muted",children:t("toolsSection")}),c.jsx("h1",{className:"mt-2 text-2xl font-semibold text-dash-text",children:t(o?"plansGlobalTitle":"plansTitle")}),c.jsx("p",{className:"mt-2 text-sm text-dash-text-muted",children:t("plansSubtitle")})]}),c.jsx(vH,{searchQuery:f,viewMode:m,sortBy:b,statusFilter:k,projectFilter:o?w:void 0,projectOptions:o?l:void 0,onSearchQueryChange:p,onViewModeChange:D,onSortByChange:y,onStatusFilterChange:v,onProjectFilterChange:o?C:void 0}),u&&c.jsx("p",{className:"text-sm text-dash-text-muted",children:t("loading")}),h&&c.jsx("p",{className:"rounded-lg border border-red-500/30 bg-red-500/10 p-4 text-sm text-red-300",children:h}),!u&&!h&&d.length>0&&c.jsxs("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm text-amber-100",children:[c.jsx("p",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-amber-200",children:t("plansProjectLoadIssues")}),c.jsx("div",{className:"mt-2 space-y-1",children:d.map(A=>c.jsxs("p",{children:[c.jsx("span",{className:"font-semibold",children:A.name}),": ",A.error]},A.id))})]}),!u&&!h&&j.length===0&&c.jsx("p",{className:"rounded-xl border border-dash-border bg-dash-surface p-8 text-sm text-dash-text-muted",children:t("plansEmpty")}),!u&&!h&&j.length>0&&m==="grid"&&!o&&c.jsx("div",{className:"grid gap-4 xl:grid-cols-3",children:j.map(A=>c.jsx(mu,{plan:A,onClick:()=>P(A)},A.slug))}),!u&&!h&&j.length>0&&m==="grid"&&o&&c.jsx("div",{className:"space-y-6",children:S.map(A=>c.jsx(wH,{projectName:A.projectName,activePlans:A.activePlans,completedPlans:A.completedPlans,onPlanClick:P},A.key))}),!u&&!h&&j.length>0&&m==="kanban"&&c.jsx(yH,{plans:j,onSelect:P})]})}function PH(){return nt()?c.jsx(Ju,{titleKey:"desktopModePlansTitle",descriptionKey:"desktopModePlansDescription",commandHintKey:"desktopModePlansHint"}):c.jsx(NH,{})}const OH=()=>{const{t}=ee(),e=Ft(),{projectId:n}=zl(),[r,s]=g.useState(null),{sizes:i,isDragging:o,startDrag:a}=Eg({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[x,b,y]=await Promise.all([Ld("project",n),Ld("global"),Dw()]),k=y.find(v=>v.id===n);return k&&s(k.path),{...x,global:b.config??{}}},[n]),d=g.useCallback(async x=>n?(await Ww({scope:"project",projectId:n,config:x})).config:void 0,[n]),u=ZS({scope:"project",fetchConfig:l,fetchSchema:Uw,saveConfig:d}),h=g.useCallback(x=>{const b=ap(u.config,x),y=ap(u.globalConfig,x);return b!==void 0&&y!==void 0&&b!==y},[u.config,u.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")},{path:"paths.globalPlans",label:t("fieldGlobalPlansPath"),description:t("fieldGlobalPlansPathDesc")}]},{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=u.activeFieldPath&&h(u.activeFieldPath)?c.jsx("span",{className:"text-[9px] bg-orange-500/10 text-orange-500 px-1.5 py-0.5 rounded font-bold border border-orange-500/30",children:t("localOverride")}):null,m=u.fieldDoc?c.jsxs("section",{className:"bg-blue-500/5 p-3 rounded-lg border border-blue-500/20",children:[c.jsx("h4",{className:"text-[10px] font-bold text-blue-500 uppercase tracking-widest mb-1",children:t("inheritedFromGlobal")}),c.jsxs("p",{className:"text-[12px] text-dash-text-secondary leading-normal",children:[t("viewGlobalConfig")," ",c.jsx("button",{onClick:()=>e("/config/global"),className:"text-dash-accent hover:underline font-medium",children:t("globalConfig")})]})]}):null;return c.jsxs("div",{className:"animate-in fade-in duration-300 w-full h-full flex flex-col transition-colors",children:[c.jsx(ek,{title:t("projectConfig"),filePath:r?`${r}/.claude/.ck.json`:".claude/.ck.json",onBack:()=>e(`/project/${n}`),onSave:u.handleSave,onReset:u.handleReset,saveStatus:u.saveStatus,syntaxError:u.syntaxError,showResetConfirm:u.showResetConfirm,setShowResetConfirm:u.setShowResetConfirm}),c.jsxs("div",{className:"flex-1 flex min-h-0",children:[c.jsx(tk,{width:i[0],isLoading:u.isLoading,schema:u.schema,config:u.config,sources:u.sources,sections:f,onChange:u.handleFormChange,onFieldFocus:u.setFocusedFieldPath}),c.jsx(_n,{direction:"horizontal",isDragging:o,onMouseDown:x=>a(0,x)}),c.jsx(Og,{width:i[1],isLoading:u.isLoading,jsonText:u.jsonText,cursorLine:u.cursorLine,syntaxError:u.syntaxError,onChange:u.handleJsonChange,onEditorFocus:u.handleJsonEditorFocus,onCursorLineChange:u.setCursorLine}),c.jsx(_n,{direction:"horizontal",isDragging:o,onMouseDown:x=>a(1,x)}),c.jsx(XS,{width:i[2],fieldDoc:u.fieldDoc,activeFieldPath:u.activeFieldPath,overrideBadge:p,extraContent:m})]})]})},on="__global__",EH="desktopModeActionsMessage",DH="desktopModePlansMessage",MH=({project:t})=>{const{t:e}=ee(),n=Ft(),r=nt(),{sessions:s,loading:i}=KP(t.id),[o,a]=g.useState(null),[l,d]=g.useState(!0),[u,h]=g.useState(null),[f,p]=g.useState(on),[m,x]=g.useState(on),b=async(E,M)=>{try{await TP(E,t.path,M,t.id)}catch(R){alert(`${e("actionFailed")}: ${R instanceof Error?R.message:E}`)}},y=g.useCallback(()=>{const E=new AbortController;return r?(a(null),p(on),x(on),h(e(EH)),d(!1),E):(d(!0),h(null),AP(t.id,E.signal).then(M=>{a(M),p(M.preferences.project.terminalApp||on),x(M.preferences.project.editorApp||on)}).catch(M=>{M instanceof DOMException&&M.name==="AbortError"||(a(null),p(on),x(on),h(M instanceof Error&&M.message?M.message:e("actionOptionsLoadFailed")))}).finally(()=>{E.signal.aborted||d(!1)}),E)},[r,t.id,e]);g.useEffect(()=>{const E=y();return()=>{E.abort()}},[y]);const k=o?.terminals||[],v=o?.editors||[],w=k.find(E=>E.id===o?.defaults.terminalApp)?.label||o?.defaults.terminalApp,C=v.find(E=>E.id===o?.defaults.editorApp)?.label||o?.defaults.editorApp,j=g.useMemo(()=>k.find(E=>f===on?E.id===o?.defaults.terminalApp:E.id===f),[k,f,o?.defaults.terminalApp]),S=g.useMemo(()=>v.find(E=>m===on?E.id===o?.defaults.editorApp:E.id===m),[v,m,o?.defaults.editorApp]),P=async(E,M)=>{if(!t.id.startsWith("discovered-"))try{await Tw(t.id,{preferences:{[E]:M===on?null:M}})}catch(R){const _=R instanceof Error?R.message:e("projectPreferenceSaveFailed");alert(`${e("actionFailed")}: ${_}`)}},D=t.activePlans??[],A=t.planSettings?.plansDir||"plans",N=new URLSearchParams({dir:A,projectId:t.id}).toString(),T=E=>{if(r)return;const M=E.split(/[\\/]/).filter(Boolean).pop()??"plan";n(`/plans/${encodeURIComponent(M)}?${N}`)},I=()=>{r||n(`/plans?${N}&view=kanban`)},O=()=>{r||n(`/plans?${N}`)};return c.jsxs("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-500 transition-colors flex flex-col h-full",children:[c.jsx("section",{className:"mb-6 shrink-0",children:c.jsxs("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-4",children:[c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[c.jsx("h1",{className:"text-3xl font-bold tracking-tight text-dash-text",children:t.name}),c.jsx(AH,{status:t.health}),c.jsx(Y7,{variant:"beta"})]}),c.jsxs("p",{className:"text-dash-text-secondary mono text-sm flex items-center gap-2 italic",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),t.path]})]}),c.jsx("div",{className:"flex items-center gap-3",children:c.jsx("span",{className:"text-[10px] text-dash-text-muted font-bold uppercase tracking-widest bg-dash-surface border border-dash-border px-2 py-1 rounded",children:s.length>0?`${s.length} ${e("sessions")}`:e("noSessions")})})]})}),c.jsxs("section",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6 shrink-0",children:[r&&c.jsx("div",{className:"col-span-2 md:col-span-4 rounded-lg border border-dash-border bg-dash-surface px-3 py-2 text-xs text-dash-text-secondary",children:e("desktopModeQuickActionsHint")}),u?c.jsxs("div",{className:"col-span-2 md:col-span-4 rounded-lg border border-orange-500/30 bg-orange-500/5 px-3 py-2 text-xs text-orange-700 dark:text-orange-300 flex items-center justify-between gap-3",children:[c.jsx("span",{children:u}),r?null:c.jsx("button",{onClick:()=>void y(),className:"rounded border border-orange-500/40 px-2 py-1 font-semibold hover:bg-orange-500/10 transition-colors",children:e("tryAgain")})]}):null,c.jsx(Cv,{icon:"📟",label:e("terminal"),sub:j?`${j.openMode==="open-app"?e("openAppOnly"):e("openAtPath")} • ${j.label}`:e("terminalSub"),onClick:()=>b("terminal",f===on?void 0:f),disabled:r||l||!j&&k.length>0,options:k,value:f,fallbackLabel:o?`${e("useGlobalFallback")} (${w})`:e("useGlobalFallback"),onChange:async E=>{p(E),await P("terminalApp",E)}}),c.jsx(Cv,{icon:"💻",label:e("editor"),sub:S?`${S.openMode==="open-app"?e("openAppOnly"):e("openAtPath")} • ${S.label}`:e("editorSub"),onClick:()=>b("editor",m===on?void 0:m),disabled:r||l||!S&&v.length>0,options:v,value:m,fallbackLabel:o?`${e("useGlobalFallback")} (${C})`:e("useGlobalFallback"),onChange:async E=>{x(E),await P("editorApp",E)}}),c.jsx(dm,{icon:"🤖",label:e("launch"),sub:e("launchSub"),highlight:!0,onClick:()=>b("launch"),disabled:r}),c.jsx(dm,{icon:"⚙️",label:e("config"),sub:e("configSub"),onClick:()=>n(`/config/project/${t.id}`)})]}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 flex-1 min-h-0",children:[c.jsx("div",{className:"lg:col-span-2 flex flex-col gap-6 min-h-0",children:c.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-xl overflow-hidden shadow-sm flex-1 flex flex-col min-h-0",children:[c.jsx("div",{className:"px-4 py-3 border-b border-dash-border flex items-center justify-between bg-dash-surface-hover/50 shrink-0",children:c.jsx("h3",{className:"text-sm font-bold text-dash-text-secondary uppercase tracking-widest",children:e("recentSessions")})}),c.jsx("div",{className:"divide-y divide-dash-border overflow-y-auto flex-1",children:i?c.jsx("div",{className:"p-4 text-center text-dash-text-muted animate-pulse",children:e("loadingSessions")}):s.length===0?c.jsx("div",{className:"p-4 text-center text-dash-text-muted",children:e("noSessionsFound")}):s.map(E=>c.jsxs("button",{type:"button",className:"w-full text-left p-4 hover:bg-dash-surface-hover transition-colors group cursor-pointer",onClick:()=>n(`/sessions/${t.id}/${E.id}`),children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsx("span",{className:"text-xs font-bold text-dash-accent",children:E.timestamp}),c.jsx("span",{className:"text-[10px] text-dash-text-muted font-medium group-hover:text-dash-text-secondary transition-colors",children:E.duration})]}),c.jsx("p",{className:"text-sm text-dash-text-secondary leading-relaxed truncate",children:E.summary})]},E.id))})]})}),c.jsxs("div",{className:"flex flex-col gap-6 min-h-0",children:[c.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-xl p-6 shadow-sm shrink-0",children:[c.jsxs("h3",{className:"text-sm font-bold text-dash-text-secondary uppercase tracking-widest mb-4 flex items-center gap-2",children:[e("planSettingsTitle"),c.jsx("span",{className:"text-[10px] font-normal text-dash-text-muted normal-case",children:t.planSettings?.scope==="global"?e("planScopeGlobal"):e("planScopeProject")})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsx(Gc,{label:e("plansDirectory"),value:t.planSettings?.plansDir??A}),c.jsx(Gc,{label:e("validationMode"),value:t.planSettings?.validationMode??"prompt"}),c.jsx(Gc,{label:e("planScopeLabel"),value:t.planSettings?.scope==="global"?e("planScopeGlobal"):e("planScopeProject")}),c.jsx(Gc,{label:e("activePlansLabel"),value:String(t.planSettings?.activePlanCount??D.length)})]}),c.jsx("button",{onClick:()=>n(`/config/project/${t.id}`),className:"w-full mt-6 py-2 rounded-lg bg-dash-bg text-xs font-bold text-dash-text-secondary hover:bg-dash-surface-hover transition-colors border border-dash-border",children:e("editProjectConfig")})]}),c.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-xl shadow-sm flex flex-col flex-1 min-h-0",children:[c.jsx("div",{className:"p-4 pb-2 border-b border-dash-border shrink-0",children:c.jsxs("h3",{className:"text-sm font-bold text-dash-text-secondary uppercase tracking-widest flex items-center justify-between",children:[e("activePlansTitle"),c.jsx("span",{className:"text-[10px] bg-dash-accent-subtle text-dash-accent px-1.5 py-0.5 rounded-full",children:D.length})]})}),r?c.jsx("p",{className:"px-4 text-[11px] text-dash-text-muted",children:e(DH)}):null,c.jsx("div",{className:"overflow-y-auto flex-1 px-4 py-2 space-y-2",children:D.length===0?c.jsx("div",{className:"text-center text-dash-text-muted py-4",children:e("noActivePlansFound")}):D.map(E=>c.jsxs("div",{className:"flex flex-col gap-2 border-l-2 border-dash-accent/20 pl-3 py-2",children:[c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsx("span",{className:"text-sm font-semibold text-dash-text",children:E.title??E.planDir.split(/[\\/]/).filter(Boolean).pop()}),c.jsx(TH,{status:E.status??"pending"})]}),c.jsx("div",{className:"h-1.5 rounded-full bg-dash-border overflow-hidden",children:c.jsx("div",{className:"h-full bg-dash-accent transition-all",style:{width:`${E.progressPct}%`}})}),c.jsxs("p",{className:"text-[10px] text-dash-text-muted leading-tight",children:[e("progressLabel"),": ",E.progressPct,"% • ",E.completed,"/",E.totalPhases]}),E.blockedBy.length>0?c.jsxs("p",{className:"text-[10px] text-dash-text-muted leading-tight",children:[e("blockedByLabel"),": ",E.blockedBy[0]]}):null,c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{type:"button",onClick:()=>T(E.planDir),disabled:r,className:"text-xs font-bold text-dash-text-muted hover:text-dash-accent transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:e("openPlan")}),c.jsx("button",{type:"button",onClick:I,disabled:r,className:"text-xs font-bold text-dash-text-muted hover:text-dash-accent transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:e("openKanban")})]})]},E.planFile))}),c.jsxs("div",{className:"p-4 pt-2 border-t border-dash-border shrink-0 flex gap-2",children:[c.jsxs("button",{type:"button",onClick:O,disabled:r,className:"flex-1 text-xs font-bold text-dash-text-muted hover:text-dash-accent transition-colors text-center block disabled:cursor-not-allowed disabled:opacity-50",children:[e("plansNav")," →"]}),c.jsxs("button",{type:"button",onClick:I,disabled:r,className:"flex-1 text-xs font-bold text-dash-text-muted hover:text-dash-accent transition-colors text-center block disabled:cursor-not-allowed disabled:opacity-50",children:[e("openKanban")," →"]})]})]})]})]})]})},AH=({status:t})=>{const e={[mr.HEALTHY]:"bg-dash-accent-subtle text-dash-accent border-dash-accent/20",[mr.WARNING]:"bg-orange-500/10 text-orange-600 border-orange-500/20",[mr.ERROR]:"bg-red-500/10 text-red-600 border-red-500/20",[mr.LOADING]:"bg-dash-border/20 text-dash-text-muted border-dash-border",[mr.UNKNOWN]:"bg-dash-border/20 text-dash-text-muted border-dash-border"};return c.jsx("span",{className:`px-2 py-0.5 rounded-full text-[10px] font-bold border uppercase tracking-widest ${e[t]}`,children:t})},Cv=({icon:t,label:e,sub:n,disabled:r,options:s,value:i,fallbackLabel:o,onClick:a,onChange:l})=>{const{t:d}=ee();return c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx(dm,{icon:t,label:e,sub:n,onClick:a,disabled:r}),c.jsxs("select",{value:i,onChange:u=>void l(u.target.value),className:"w-full rounded-md border border-dash-border bg-dash-surface px-2 py-1 text-xs text-dash-text-secondary",children:[c.jsx("option",{value:on,children:o}),s.map(u=>c.jsx("option",{value:u.id,disabled:!u.available,children:`${u.label} • ${d(u.detected?"detected":"notDetected")}`},u.id))]})]})},dm=({icon:t,label:e,sub:n,highlight:r,onClick:s,disabled:i})=>c.jsxs("button",{onClick:s,disabled:i,className:`p-4 rounded-xl border flex flex-col gap-1 transition-all group ${r?"bg-dash-accent-subtle border-dash-accent/30 hover:bg-dash-accent-glow hover:border-dash-accent/50 shadow-sm shadow-dash-accent/5":"bg-dash-surface border-dash-border hover:bg-dash-surface-hover hover:border-dash-text-muted shadow-sm"} ${i?"opacity-50 cursor-not-allowed":""}`,children:[c.jsx("span",{className:"text-2xl mb-1 group-hover:scale-110 transition-transform",children:t}),c.jsx("span",{className:"text-sm font-bold text-dash-text",children:e}),c.jsx("span",{className:"text-[10px] text-dash-text-muted font-medium truncate italic",children:n})]}),Gc=({label:t,value:e})=>c.jsxs("div",{className:"flex items-center justify-between text-xs py-1.5 border-b border-dash-border/50 last:border-0",children:[c.jsx("span",{className:"text-dash-text-muted font-medium",children:t}),c.jsx("span",{className:"text-dash-text font-bold mono uppercase text-[10px] tracking-tight",children:e})]}),TH=({status:t})=>{const e={pending:"bg-amber-400/10 text-amber-700 border-amber-400/20","in-progress":"bg-sky-400/10 text-sky-700 border-sky-400/20","in-review":"bg-violet-400/10 text-violet-700 border-violet-400/20",done:"bg-emerald-400/10 text-emerald-700 border-emerald-400/20",cancelled:"bg-rose-400/10 text-rose-700 border-rose-400/20"};return c.jsx("span",{className:`rounded-full border px-2 py-0.5 text-[10px] font-bold uppercase tracking-widest ${e[t]??e.pending}`,children:t})},LH=()=>{const{t}=ee(),{project:e}=fw(),[n,r]=g.useState(null);if(g.useEffect(()=>{if(!e?.id){r(null);return}r(null);let i=!1;return Mw(e.id).then(o=>{i||r(o)}).catch(()=>{i||r(null)}),()=>{i=!0}},[e?.id]),!e)return c.jsxs("div",{className:"flex flex-col items-center justify-center h-full space-y-4 opacity-50",children:[c.jsx("div",{className:"w-16 h-16 rounded-full bg-dash-surface border border-dash-border flex items-center justify-center",children:c.jsx("span",{className:"text-2xl text-dash-text-muted",children:"📂"})}),c.jsx("p",{className:"text-lg text-dash-text-secondary font-bold",children:t("selectProject")})]});const s=n?.id===e.id?n:e;return c.jsx(MH,{project:s})},RH={Bash:{colorClass:"text-purple-500 dark:text-purple-400",bgClass:"bg-gray-100 dark:bg-[#1a1b26]"},Read:{colorClass:"text-blue-400",bgClass:"bg-blue-500/5"},Write:{colorClass:"text-emerald-400",bgClass:"bg-emerald-500/5"},Edit:{colorClass:"text-amber-400",bgClass:"bg-amber-500/5"},MultiEdit:{colorClass:"text-amber-400",bgClass:"bg-amber-500/5"},Grep:{colorClass:"text-cyan-400",bgClass:"bg-cyan-500/5"},Glob:{colorClass:"text-cyan-400",bgClass:"bg-cyan-500/5"},Agent:{colorClass:"text-violet-400",bgClass:"bg-violet-500/5"},WebSearch:{colorClass:"text-indigo-400",bgClass:"bg-indigo-500/5"},WebFetch:{colorClass:"text-indigo-400",bgClass:"bg-indigo-500/5"},Skill:{colorClass:"text-pink-400",bgClass:"bg-pink-500/5"}},_H={colorClass:"text-dash-text-muted",bgClass:"bg-dash-bg/50"};function IH(t,e){return t.length<=e?t:`${t.slice(0,e)}…`}function $H(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}const BH=({toolName:t,toolInput:e,result:n,isError:r=!1,skillName:s})=>{const{t:i}=ee(),[o,a]=g.useState(!1),l=RH[t]??_H,d=t==="Bash",u=t==="Skill"&&s,h=n?IH(n.trim(),80):null;return c.jsxs("div",{className:`rounded-lg border overflow-hidden ${u?"border-pink-500/20 bg-pink-500/5":`border-dash-border ${l.bgClass}`}`,children:[c.jsxs("button",{type:"button",onClick:()=>a(f=>!f),className:"flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-white/5 transition-colors","aria-expanded":o,children:[c.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:`shrink-0 transition-transform duration-150 ${o?"rotate-90":""}`,children:c.jsx("path",{d:"M6 4l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),u?c.jsxs(c.Fragment,{children:[c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0 text-pink-500 dark:text-pink-400",children:c.jsx("path",{d:"M8.5 1.5L3 9h4.5l-1 5.5L13 7H8.5l1-5.5z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})}),c.jsx("span",{className:"font-semibold text-sm text-pink-600 dark:text-pink-400",children:"Skill:"}),c.jsx("span",{className:"font-mono text-sm text-pink-600 dark:text-pink-400",children:s})]}):c.jsx("span",{className:`font-mono font-semibold text-sm ${l.colorClass}`,children:t}),!o&&h&&c.jsx("span",{className:"ml-2 truncate text-xs text-dash-text-muted",children:h})]}),o&&c.jsxs("div",{className:"border-t border-dash-border/50 flex flex-col gap-0",children:[e&&c.jsxs("div",{className:"px-3 py-2",children:[c.jsx("div",{className:"mb-1 text-[10px] uppercase tracking-wider text-dash-text-muted",children:i("sessionToolInput")}),c.jsx("pre",{className:"max-h-48 overflow-y-auto whitespace-pre-wrap break-words rounded text-xs text-dash-text",children:$H(e)})]}),n&&c.jsxs("div",{className:`px-3 py-2 ${e?"border-t border-dash-border/30":""}`,children:[c.jsx("div",{className:"mb-1 text-[10px] uppercase tracking-wider text-dash-text-muted",children:i("sessionToolResult")}),c.jsx("pre",{className:`max-h-64 overflow-y-auto whitespace-pre-wrap break-words rounded text-xs ${d?"bg-gray-100 dark:bg-[#1a1b26] px-2 py-1.5 text-gray-800 dark:text-[#9ece6a] font-mono":r?"border border-red-500/30 bg-red-500/5 px-2 py-1.5 text-red-400":"text-dash-text"}`,children:n})]})]})]})};function FH(t){const e=[];for(const r of t.matchAll(/<command-name>\/?(.+?)<\/command-name>/g))e.push(r[1].trim());for(const r of t.matchAll(/^###\s+Skill:\s+(.+?)$/gm))e.push(r[1].trim());for(const r of t.matchAll(/Launching skill:\s+(\S+)/g))e.push(r[1].trim());if(/Base directory for this skill:/i.test(t)){const r=t.match(/^#\s+(.+?)(?:\s*[-—]|$)/m);r&&e.push(r[1].trim())}const n=new Set;return e.filter(r=>{const s=r.toLowerCase();return n.has(s)?!1:(n.add(s),!0)})}function lj(t){return t.replace(/<command-message>[\s\S]*?<\/command-message>\s*/g,"").replace(/<command-name>[\s\S]*?<\/command-name>\s*/g,"").replace(/<command-args>[\s\S]*?<\/command-args>\s*/g,"").replace(/^Base directory for this skill:.*$/gm,"").replace(/^<!--.*?-->\s*$/gm,"").replace(/^\n+/,"").trim()}function zH(t){const e=t.match(/<command-args>([\s\S]*?)<\/command-args>/),n=e?e[1].trim():null,r=t.indexOf("Base directory for this skill:"),s=r!==-1?t.slice(r):t;return[n,lj(s)]}function VH(t){if(!t)return null;try{const e=JSON.parse(t);return typeof e.skill=="string"?e.skill:null}catch{return null}}function HH({name:t}){return c.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 mr-2 rounded border border-pink-500/30 bg-pink-500/10 text-pink-600 dark:text-pink-400 text-xs font-semibold align-middle",children:[c.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0",children:c.jsx("path",{d:"M8.5 1.5L3 9h4.5l-1 5.5L13 7H8.5l1-5.5z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})}),"Skill: ",t]})}function um({name:t,text:e}){const n=e.split(`
|
|
294
|
+
`).length;return c.jsxs("details",{className:"rounded-lg border border-pink-500/20 bg-pink-500/5 dark:bg-pink-500/5 overflow-hidden",children:[c.jsxs("summary",{className:"flex cursor-pointer select-none items-center gap-1.5 px-3 py-2 text-sm text-pink-600 dark:text-pink-400 hover:text-pink-500 dark:hover:text-pink-300",children:[c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0",children:c.jsx("path",{d:"M8.5 1.5L3 9h4.5l-1 5.5L13 7H8.5l1-5.5z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})}),c.jsx("span",{className:"font-semibold",children:"Skill:"}),c.jsx("span",{className:"font-mono",children:t}),c.jsxs("span",{className:"ml-auto shrink-0 text-[10px] text-pink-500/50 dark:text-pink-400/40",children:[n," lines"]})]}),c.jsx("div",{className:"max-h-64 overflow-y-auto border-t border-pink-500/10 px-3 pb-3 pt-2",children:c.jsx(ui,{content:e})})]})}function WH({text:t}){const{t:e}=ee();return c.jsxs("details",{className:"rounded-lg border border-dash-border bg-dash-bg/50",children:[c.jsxs("summary",{className:"flex cursor-pointer select-none items-center gap-1.5 px-3 py-2 text-sm text-dash-text-muted hover:text-dash-text",children:[c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0 opacity-60",children:c.jsx("path",{d:"M8 2C5.8 2 4 3.8 4 6c0 .8.2 1.5.6 2.1C3.6 8.6 3 9.7 3 11c0 1.7 1.1 3 2.5 3H8h2.5c1.4 0 2.5-1.3 2.5-3 0-1.3-.6-2.4-1.6-2.9.4-.6.6-1.3.6-2.1 0-2.2-1.8-4-4-4z",fill:"currentColor",opacity:"0.5"})}),c.jsx("span",{children:e("sessionThinking")})]}),c.jsx("pre",{className:"max-h-48 overflow-y-auto whitespace-pre-wrap break-words px-3 pb-3 pt-1 text-sm text-dash-text-muted",children:t})]})}function UH(t){const e=t.split(/^###\s+Skill:\s+/m);return e.length<=1?[]:e.slice(1).map(n=>{const r=n.indexOf(`
|
|
295
|
+
`),s=r!==-1?n.slice(0,r).trim():n.trim(),i=r!==-1?lj(n.slice(r+1)):"";return{name:s,content:i}})}function KH(t){const e=t.match(/^\[([a-z-]+)\]\n([\s\S]*)$/);return e?{tag:e[1],content:e[2]}:{tag:"",content:t}}const GH={"task-notification":"Task Notification","system-reminder":"System Context","local-command-stdout":"Command Output","local-command-caveat":"Command Note","antml:thinking":"Thinking"};function qH({text:t}){const{t:e}=ee(),{tag:n,content:r}=KH(t),s=UH(r);if(s.length>0)return c.jsx("div",{className:"flex flex-col gap-1.5",children:s.map(o=>c.jsx(um,{name:o.name,text:o.content},o.name))});if(n==="local-command-stdout"){const o=r.match(/Launching skill:\s+(\S+)/);if(o)return c.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-xs text-pink-500/70 dark:text-pink-400/60",children:[c.jsx("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0",children:c.jsx("path",{d:"M8.5 1.5L3 9h4.5l-1 5.5L13 7H8.5l1-5.5z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})}),c.jsxs("span",{children:["Launching skill: ",c.jsx("span",{className:"font-mono font-semibold",children:o[1]})]})]})}const i=GH[n]||e("sessionSystemContext");return c.jsxs("details",{className:"rounded-lg border border-dash-border/60 bg-dash-bg/30 overflow-hidden",children:[c.jsxs("summary",{className:"flex cursor-pointer select-none items-center gap-1.5 px-3 py-1.5 text-xs text-dash-text-muted hover:text-dash-text",children:[c.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0 opacity-50",children:[c.jsx("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("path",{d:"M8 7v4.5M8 5.5v.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]}),c.jsx("span",{children:i})]}),c.jsx("div",{className:"max-h-48 overflow-y-auto border-t border-dash-border/40 px-3 pb-2 pt-1",children:c.jsx("pre",{className:"text-[11px] text-dash-text-muted whitespace-pre-wrap break-words font-mono",children:r})})]})}const YH=20;function XH({text:t}){const[e,n]=g.useState(!1),r=t.split(`
|
|
296
|
+
`),s=r.slice(0,6).join(`
|
|
297
|
+
`);return c.jsxs("div",{"data-search-content":!0,children:[c.jsx(ui,{content:e?t:s}),!e&&c.jsxs("div",{className:"mt-1 text-[10px] text-dash-text-muted",children:["...",r.length-6," more lines"]}),c.jsx("button",{type:"button",onClick:()=>n(i=>!i),className:"mt-1 text-[11px] font-semibold text-dash-accent hover:text-dash-accent-hover transition-colors",children:e?"Collapse":"Expand all"})]})}const ZH=({block:t})=>{switch(t.type){case"text":{if(!t.text)return null;const e=FH(t.text);if(e.length>0){const[n,r]=zH(t.text);return n?c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("p",{className:"text-sm text-dash-text leading-relaxed","data-search-content":!0,children:[e.map(s=>c.jsx(HH,{name:s},s)),c.jsx("span",{className:"whitespace-pre-wrap break-words",children:n})]}),r&&c.jsx(um,{name:e[0],text:r})]}):r?c.jsx("div",{className:"flex flex-col gap-1.5",children:e.map(s=>c.jsx(um,{name:s,text:r},s))}):null}return t.text.split(`
|
|
298
|
+
`).length>YH?c.jsx(XH,{text:t.text}):c.jsx("div",{"data-search-content":!0,children:c.jsx(ui,{content:t.text})})}case"thinking":return t.text?c.jsx(WH,{text:t.text}):null;case"tool_use":{const e=t.toolName==="Skill"?VH(t.toolInput):null;return c.jsx(BH,{toolName:t.toolName??"Unknown",toolInput:t.toolInput,result:t.result,isError:t.isError,skillName:e??void 0})}case"system":return t.text?c.jsx(qH,{text:t.text}):null;case"tool_result":return null;default:return null}};function QH(t){const e=[];for(const n of t){const r=e[e.length-1];r&&r.role===n.role?r.messages.push(n):e.push({role:n.role,timestamp:n.timestamp??"",messages:[n]})}return e}function JH({group:t}){const{t:e}=ee(),n=t.role==="user",r=t.messages.length;return c.jsxs("div",{className:`flex flex-col gap-2 rounded-lg border p-4 ${n?"bg-blue-50/50 dark:bg-blue-900/10 border-blue-200/60 dark:border-blue-800/40":"bg-dash-surface border-dash-border"}`,children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider ${n?"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300":"bg-dash-accent-subtle text-dash-accent"}`,children:e(n?"sessionUser":"sessionAssistant")}),t.timestamp&&c.jsx("span",{className:"text-[10px] text-dash-text-muted",children:new Date(t.timestamp).toLocaleTimeString()}),r>1&&c.jsxs("span",{className:"text-[10px] text-dash-text-muted ml-auto",children:[r," ",e("sessionGroupMessages")]})]}),t.messages.map((s,i)=>c.jsx("div",{className:"flex flex-col gap-1.5",children:s.contentBlocks.map((o,a)=>c.jsx(ZH,{block:o,role:t.role},`${o.type}-${o.toolUseId??a}`))},s.timestamp??`msg-${i}`))]})}const eW=({messages:t})=>{const e=QH(t);return c.jsx("div",{className:"flex flex-col gap-3",children:e.map((n,r)=>c.jsx(JH,{group:n},`group-${n.timestamp||r}`))})},Gg="data-search-mark",hm="bg-yellow-300/40 text-dash-text rounded-sm px-0.5",tW="ring-2 ring-dash-accent bg-yellow-300/60";function Rf(t){for(const e of t.querySelectorAll(`mark[${Gg}]`)){const n=e.parentNode;n&&(n.replaceChild(document.createTextNode(e.textContent??""),e),n.normalize())}}function nW(t,e){const n=e.toLowerCase(),r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode(a){const l=a.parentElement;return!l||l.tagName==="MARK"||!l.closest("[data-search-content]")?NodeFilter.FILTER_REJECT:a.textContent?.toLowerCase().includes(n)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}),s=[];let i=r.nextNode();for(;i;)s.push(i),i=r.nextNode();let o=0;for(const a of s){const l=a.textContent??"",d=a.parentNode;if(!d)continue;const u=document.createDocumentFragment();let h=0,f=l.toLowerCase().indexOf(n,0);for(;f!==-1;){f>h&&u.appendChild(document.createTextNode(l.slice(h,f)));const p=document.createElement("mark");p.setAttribute(Gg,""),p.setAttribute("data-match-index",String(o)),p.className=hm,p.textContent=l.slice(f,f+e.length),u.appendChild(p),o++,h=f+e.length,f=l.toLowerCase().indexOf(n,h)}h<l.length&&u.appendChild(document.createTextNode(l.slice(h))),d.replaceChild(u,a)}return o}const rW=({containerRef:t,visible:e})=>{const{t:n}=ee(),[r,s]=g.useState(""),[i,o]=g.useState(""),[a,l]=g.useState(0),[d,u]=g.useState(0),h=g.useRef(null);g.useEffect(()=>{const p=setTimeout(()=>o(r),300);return()=>clearTimeout(p)},[r]),g.useEffect(()=>{e&&h.current?.focus()},[e]),g.useEffect(()=>{const p=t.current;if(!p)return;if(Rf(p),!i.trim()){l(0),u(0);return}const m=nW(p,i.trim());l(m),u(m>0?1:0)},[i,t]),g.useEffect(()=>{const p=t.current;if(!p||a===0)return;const m=p.querySelectorAll(`mark[${Gg}]`);m.forEach((x,b)=>{x.className=b===d-1?`${hm} ${tW}`:hm}),m[d-1]?.scrollIntoView({behavior:"smooth",block:"center"})},[d,a,t]),g.useEffect(()=>{!e&&t.current&&Rf(t.current)},[e,t]),g.useEffect(()=>()=>{t.current&&Rf(t.current)},[t]);const f=g.useCallback(p=>{a!==0&&u(m=>(m-1+p+a)%a+1)},[a]);return e?c.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-dash-border bg-dash-surface",children:[c.jsxs("svg",{className:"w-4 h-4 text-dash-text-muted shrink-0",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:[c.jsx("circle",{cx:"11",cy:"11",r:"8"}),c.jsx("path",{d:"m21 21-4.35-4.35"})]}),c.jsx("input",{ref:h,type:"text",value:r,onChange:p=>s(p.target.value),placeholder:n("sessionSearchPlaceholder"),className:"flex-1 bg-dash-bg border border-dash-border rounded-lg px-3 py-1.5 text-sm text-dash-text outline-none focus:border-dash-accent min-w-0"}),c.jsx("span",{className:"text-xs text-dash-text-muted whitespace-nowrap shrink-0",children:a===0?n("sessionNoResults"):`${d}/${a} ${n("sessionSearchResults")}`}),c.jsx("button",{type:"button",onClick:()=>f(-1),disabled:a===0,className:"p-1 rounded hover:bg-dash-hover disabled:opacity-40","aria-label":"previous match",children:c.jsx("svg",{className:"w-4 h-4 text-dash-text",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:c.jsx("path",{d:"m18 15-6-6-6 6"})})}),c.jsx("button",{type:"button",onClick:()=>f(1),disabled:a===0,className:"p-1 rounded hover:bg-dash-hover disabled:opacity-40","aria-label":"next match",children:c.jsx("svg",{className:"w-4 h-4 text-dash-text",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:c.jsx("path",{d:"m6 9 6 6 6-6"})})})]}):null},$s=50;function sW({messageCount:t,toolCallCount:e,duration:n}){const{t:r}=ee();return c.jsxs("div",{className:"flex items-center gap-4 px-3 py-2 rounded-lg bg-dash-surface border border-dash-border text-xs text-dash-text-muted",children:[c.jsxs("span",{children:[c.jsx("strong",{className:"text-dash-text",children:t})," ",r("sessionMessages")]}),c.jsxs("span",{children:[c.jsx("strong",{className:"text-dash-text",children:e})," ",r("sessionToolCalls")]}),n&&c.jsxs("span",{children:[r("sessionDuration"),": ",c.jsx("strong",{className:"text-dash-text",children:n})]})]})}function jv({offset:t,limit:e,total:n,onPrev:r,onNext:s}){const i=t+1,o=Math.min(t+e,n);return n<=e?null:c.jsxs("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg bg-dash-surface border border-dash-border text-xs text-dash-text-muted",children:[c.jsxs("span",{children:[i,"–",o," / ",n]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"button",onClick:r,disabled:t<=0,className:"px-2 py-1 rounded border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:"←"}),c.jsx("button",{type:"button",onClick:s,disabled:o>=n,className:"px-2 py-1 rounded border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:"→"})]})]})}const iW=()=>{const{t}=ee(),e=Ft(),{projectId:n,sessionId:r}=zl(),s=g.useRef(null),[i,o]=g.useState(!1),[a,l]=g.useState(0),{data:d,loading:u,error:h}=qP(n,r,$s,a),f=d?.summary.messageCount??0,p=!u&&!h&&d&&d.messages.length>0;return c.jsxs("div",{className:"flex flex-col h-full p-6 gap-4 max-w-4xl mx-auto w-full",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("button",{type:"button",onClick:()=>e(`/project/${encodeURIComponent(n??"")}`),className:"w-8 h-8 rounded-lg flex items-center justify-center text-dash-text-muted hover:bg-dash-surface-hover hover:text-dash-text transition-colors shrink-0","aria-label":t("sessionBack"),children:c.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("h1",{className:"text-xl font-bold text-dash-text",children:t("sessionDetail")}),c.jsx("p",{className:"text-[10px] text-dash-text-muted font-mono truncate",children:r})]}),p&&c.jsx("button",{type:"button",onClick:()=>o(m=>!m),className:`w-8 h-8 rounded-lg flex items-center justify-center transition-colors shrink-0 ${i?"bg-dash-accent/10 text-dash-accent":"text-dash-text-muted hover:bg-dash-surface-hover hover:text-dash-text"}`,"aria-label":"Search",children:c.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:t("sessionReadOnly")})]}),u&&c.jsx("div",{className:"flex flex-1 items-center justify-center text-dash-text-muted text-sm",children:t("sessionLoading")}),!u&&h&&c.jsxs("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm",children:[t("sessionError"),": ",h]}),!u&&!h&&d&&d.messages.length===0&&c.jsx("div",{className:"flex flex-1 items-center justify-center text-dash-text-muted text-sm",children:t("noSessionsData")}),p&&c.jsxs(c.Fragment,{children:[c.jsx(sW,{messageCount:d.summary.messageCount,toolCallCount:d.summary.toolCallCount,duration:d.summary.duration}),c.jsx(rW,{containerRef:s,visible:i}),c.jsx(jv,{offset:a,limit:$s,total:f,onPrev:()=>l(m=>Math.max(0,m-$s)),onNext:()=>l(m=>m+$s)}),c.jsx("div",{ref:s,className:"overflow-y-auto flex-1",children:c.jsx(eW,{messages:d.messages})}),c.jsx(jv,{offset:a,limit:$s,total:f,onPrev:()=>l(m=>Math.max(0,m-$s)),onNext:()=>l(m=>m+$s)})]})]})},cj="/api";async function oW(){const t=await fetch(`${cj}/skills/browse`);if(!t.ok)throw new Error("Failed to fetch skills browser list");return(await t.json()).skills}async function aW(t){const e=await fetch(`${cj}/skills/browse/${encodeURIComponent(t)}`);if(!e.ok)throw e.status===404?new Error(`Skill "${t}" not found`):new Error("Failed to fetch skill detail");return e.json()}function dj(){const[t,e]=g.useState([]),[n,r]=g.useState(!0),[s,i]=g.useState(null),o=g.useCallback(async()=>{r(!0),i(null);try{const a=await oW();e(a)}catch(a){i(a instanceof Error?a.message:"Failed to load skills")}finally{r(!1)}},[]);return g.useEffect(()=>{o()},[o]),{skills:t,loading:n,error:s,reload:o}}function lW(t){const[e,n]=g.useState(null),[r,s]=g.useState(!0),[i,o]=g.useState(null),a=g.useCallback(async()=>{s(!0),o(null);try{const l=await aW(t);n(l)}catch(l){o(l instanceof Error?l.message:"Failed to load skill detail")}finally{s(!1)}},[t]);return g.useEffect(()=>{a()},[a]),{detail:e,loading:r,error:i,reload:a}}function cW(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3.5 h-3.5 shrink-0 text-dash-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}const dW=Qe.forwardRef(({skill:t,selected:e,onClick:n},r)=>c.jsxs("button",{ref:r,type:"button",onClick:n,className:["w-full flex items-start gap-2 px-3 py-2 rounded-md transition-colors text-left group",e?"bg-dash-accent/10 border border-dash-accent/30":"hover:bg-dash-surface-hover border border-transparent"].join(" "),children:[c.jsx(cW,{}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[c.jsx("span",{className:"text-sm font-semibold text-dash-accent font-mono",children:t.name}),t.source==="github"&&c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-medium shrink-0",children:"GitHub"})]}),t.description&&c.jsx("p",{className:"text-xs text-dash-text-muted mt-0.5 truncate",children:t.description})]})]})),uW=({name:t})=>{const{t:e}=ee(),{detail:n,loading:r,error:s}=lW(t);return r?c.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-dash-text-muted",children:e("loadingSkills")}):s?c.jsx("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm",children:s}):n?c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("h2",{className:"text-base font-semibold text-dash-text font-mono truncate flex-1",children:n.name}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:e("sessionReadOnly")})]}),n.description&&c.jsx("div",{className:"rounded-lg border border-dash-border bg-dash-surface px-4 py-3",children:c.jsx("p",{className:"text-sm text-dash-text-muted",children:n.description})}),c.jsx("div",{className:"flex items-center gap-2 text-xs text-dash-text-muted",children:c.jsxs("span",{className:"font-mono px-2 py-0.5 rounded bg-dash-surface border border-dash-border text-dash-accent",children:["~/.claude/skills/",n.name,"/SKILL.md"]})}),n.triggers&&n.triggers.length>0&&c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsxs("span",{className:"text-xs text-dash-text-muted",children:[e("skillTriggers"),":"]}),n.triggers.map(i=>c.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-dash-surface border border-dash-border text-dash-accent",children:i},i))]}),c.jsx("div",{className:"rounded-lg border border-dash-border bg-dash-surface p-5 overflow-x-auto",children:c.jsx(ui,{content:n.content})})]}):null},hW=({message:t})=>c.jsx("div",{className:"flex items-center justify-center h-full text-sm text-dash-text-muted",children:t});function fW({label:t,count:e}){return c.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[c.jsx("span",{className:"text-xs font-bold text-dash-text-muted uppercase tracking-wider flex-1",children:t}),c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold",children:e})]})}const pW=()=>{const{t}=ee(),[e]=Hl(),{skills:n,loading:r,error:s}=dj(),[i,o]=g.useState(""),[a,l]=g.useState(null),d=g.useRef(new Map);g.useEffect(()=>{const x=e.get("name");if(x&&n.length>0){const b=x.toLowerCase(),y=`ck-${b}`,k=n.find(v=>v.name===x||v.name.toLowerCase()===b||v.name.toLowerCase()===y);k&&(l(k.name),requestAnimationFrame(()=>{const v=d.current.get(k.name);v&&v.scrollIntoView({behavior:"smooth",block:"center"})}))}},[e,n]);const{size:u,isDragging:h,startDrag:f}=yo({storageKey:"ck-skills-panel-width",defaultSize:380,minSize:260,maxSize:650}),p=g.useMemo(()=>{if(!i.trim())return n;const x=i.toLowerCase();return n.filter(b=>b.name.toLowerCase().includes(x)||b.description?.toLowerCase().includes(x)||b.triggers?.some(y=>y.toLowerCase().includes(x)))},[n,i]),m=g.useMemo(()=>{const x=new Map;for(const b of p){const y=b.source==="github"?"GitHub":t("skillLocal"),k=x.get(y)??[];k.push(b),x.set(y,k)}return x},[p,t]);return c.jsxs("div",{className:"flex h-full overflow-hidden",children:[c.jsxs("div",{style:{width:`${u}px`},className:"shrink-0 flex flex-col overflow-hidden border-r border-dash-border",children:[c.jsxs("div",{className:"shrink-0 px-4 pt-4 pb-3 border-b border-dash-border",children:[c.jsxs("div",{className:"flex items-start justify-between mb-3",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-base font-bold text-dash-text",children:t("skillsBrowser")}),!r&&!s&&c.jsx("p",{className:"text-xs text-dash-text-muted mt-0.5",children:t("skillsCount").replace("{count}",String(n.length))}),c.jsx("p",{className:"text-[11px] text-dash-text-muted font-mono mt-0.5",children:"~/.claude/skills/"})]}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:t("sessionReadOnly")})]}),c.jsxs("div",{className:"relative",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-dash-text-muted pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),c.jsx("input",{type:"text",value:i,onChange:x=>o(x.target.value),placeholder:t("searchSkillsBrowserPlaceholder"),className:"w-full pl-9 pr-4 py-2 text-sm bg-dash-surface border border-dash-border rounded-lg text-dash-text placeholder:text-dash-text-muted focus:outline-none focus:border-dash-accent/50 transition-colors"}),i&&c.jsx("button",{type:"button",onClick:()=>o(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-dash-text-muted hover:text-dash-text transition-colors",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-2 py-2",children:[r&&c.jsx("div",{className:"flex flex-1 items-center justify-center text-dash-text-muted text-sm p-8",children:t("loadingSkills")}),!r&&s&&c.jsx("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm m-2",children:s}),!r&&!s&&m.size===0&&c.jsx("div",{className:"flex items-center justify-center p-8 text-dash-text-muted text-sm",children:t("noSkillsBrowserFound")}),!r&&!s&&m.size>0&&c.jsx("div",{className:"flex flex-col gap-2 pb-4",children:Array.from(m.entries()).map(([x,b])=>c.jsxs("div",{children:[m.size>1&&c.jsx(fW,{label:x,count:b.length}),c.jsx("div",{className:"space-y-0.5",children:b.map(y=>c.jsx(dW,{ref:k=>{k?d.current.set(y.name,k):d.current.delete(y.name)},skill:y,selected:a===y.name,onClick:()=>l(y.name)},y.name))})]},x))})]})]}),c.jsx(_n,{onMouseDown:f,isDragging:h,direction:"horizontal"}),c.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:a?c.jsx(uW,{name:a}):c.jsx(hW,{message:t("selectToView")})})]})},uj=["model","context","quota","directory","git","cost","changes","agents","todos"],gu={contextLow:"green",contextMid:"yellow",contextHigh:"red",accent:"cyan",muted:"dim",separator:"dim",quotaLow:"green",quotaHigh:"yellow"},mW=[["model","context","quota"],["directory","git","cost","changes"],["agents","todos"]],hj={model:{icon:"🤖"},quota:{icon:"⌛"},directory:{icon:"📁"},git:{icon:"🌿"},cost:{icon:"💰"},changes:{icon:"📝"},agents:{icon:"🔄"},todos:{icon:"✅"}},as={baseMode:"full",lines:mW,sectionConfig:hj,theme:gu,responsiveBreakpoint:.85,maxAgentRows:4,todoTruncation:50},gW={model:"claude-sonnet-4-6",context:"▰▰▰▰▰▰▱▱▱▱▱▱ 52%",quota:"5h 31% wk 33%",directory:"~/projects/myapp",git:"main (2, +1, 3↑)",cost:"$0.042",changes:"+128 -34",agents:"○ planner ● researcher",todos:"▸ Implement auth (3 done, 4 pending)"},fj={green:"#4ade80",yellow:"#facc15",red:"#f87171",cyan:"#22d3ee",blue:"#60a5fa",magenta:"#e879f9",white:"#f1f5f9",dim:"#64748b",default:"#94a3b8",brightGreen:"#86efac",brightYellow:"#fde68a",brightRed:"#fca5a5",brightCyan:"#67e8f9",brightBlue:"#93c5fd",brightMagenta:"#f0abfc",brightWhite:"#ffffff"},qg={model:"cyan",directory:"blue",git:"magenta",cost:"dim",changes:"brightYellow",agents:"brightCyan",todos:"brightGreen"},Nv=[{name:"Default",labelKey:"statuslinePresetDefault",theme:gu,sectionColors:qg},{name:"Monochrome",labelKey:"statuslinePresetMonochrome",theme:{contextLow:"white",contextMid:"white",contextHigh:"white",accent:"white",muted:"dim",separator:"dim",quotaLow:"white",quotaHigh:"white"},sectionColors:{model:"white",directory:"white",git:"white",cost:"dim",changes:"white",agents:"white",todos:"white"}},{name:"Nord",labelKey:"statuslinePresetNord",theme:{contextLow:"brightCyan",contextMid:"blue",contextHigh:"magenta",accent:"brightCyan",muted:"dim",separator:"dim",quotaLow:"brightCyan",quotaHigh:"brightBlue"},sectionColors:{model:"brightCyan",directory:"brightBlue",git:"brightCyan",cost:"dim",changes:"brightYellow",agents:"blue",todos:"brightCyan"}},{name:"Dracula",labelKey:"statuslinePresetDracula",theme:{contextLow:"brightGreen",contextMid:"brightYellow",contextHigh:"brightRed",accent:"brightMagenta",muted:"dim",separator:"dim",quotaLow:"brightCyan",quotaHigh:"brightMagenta"},sectionColors:{model:"brightMagenta",directory:"brightCyan",git:"brightGreen",cost:"dim",changes:"brightYellow",agents:"brightMagenta",todos:"brightGreen"}},{name:"Catppuccin",labelKey:"statuslinePresetCatppuccin",theme:{contextLow:"brightGreen",contextMid:"brightYellow",contextHigh:"red",accent:"brightBlue",muted:"dim",separator:"dim",quotaLow:"brightBlue",quotaHigh:"brightMagenta"},sectionColors:{model:"brightBlue",directory:"brightYellow",git:"brightMagenta",cost:"dim",changes:"brightGreen",agents:"brightBlue",todos:"brightCyan"}},{name:"Gruvbox",labelKey:"statuslinePresetGruvbox",theme:{contextLow:"brightGreen",contextMid:"yellow",contextHigh:"red",accent:"brightYellow",muted:"dim",separator:"dim",quotaLow:"brightYellow",quotaHigh:"red"},sectionColors:{model:"brightYellow",directory:"brightGreen",git:"red",cost:"dim",changes:"yellow",agents:"brightYellow",todos:"brightGreen"}},{name:"Tokyo Night",labelKey:"statuslinePresetTokyoNight",theme:{contextLow:"cyan",contextMid:"brightBlue",contextHigh:"brightMagenta",accent:"brightBlue",muted:"dim",separator:"dim",quotaLow:"brightCyan",quotaHigh:"brightMagenta"},sectionColors:{model:"brightBlue",directory:"cyan",git:"brightMagenta",cost:"dim",changes:"brightCyan",agents:"brightBlue",todos:"brightGreen"}},{name:"Solarized",labelKey:"statuslinePresetSolarized",theme:{contextLow:"green",contextMid:"yellow",contextHigh:"red",accent:"blue",muted:"dim",separator:"dim",quotaLow:"cyan",quotaHigh:"yellow"},sectionColors:{model:"blue",directory:"cyan",git:"green",cost:"dim",changes:"yellow",agents:"blue",todos:"green"}},{name:"Rose Pine",labelKey:"statuslinePresetRosePine",theme:{contextLow:"brightGreen",contextMid:"brightYellow",contextHigh:"brightRed",accent:"magenta",muted:"dim",separator:"dim",quotaLow:"magenta",quotaHigh:"brightRed"},sectionColors:{model:"magenta",directory:"brightBlue",git:"brightMagenta",cost:"dim",changes:"brightYellow",agents:"magenta",todos:"brightGreen"}},{name:"One Dark",labelKey:"statuslinePresetOneDark",theme:{contextLow:"green",contextMid:"brightYellow",contextHigh:"brightRed",accent:"brightCyan",muted:"dim",separator:"dim",quotaLow:"brightCyan",quotaHigh:"brightRed"},sectionColors:{model:"brightCyan",directory:"blue",git:"brightRed",cost:"dim",changes:"brightYellow",agents:"brightCyan",todos:"green"}},{name:"Ayu",labelKey:"statuslinePresetAyu",theme:{contextLow:"brightGreen",contextMid:"brightYellow",contextHigh:"red",accent:"yellow",muted:"dim",separator:"white",quotaLow:"brightYellow",quotaHigh:"red"},sectionColors:{model:"yellow",directory:"brightCyan",git:"brightYellow",cost:"dim",changes:"brightGreen",agents:"yellow",todos:"brightGreen"}},{name:"Kanagawa",labelKey:"statuslinePresetKanagawa",theme:{contextLow:"cyan",contextMid:"brightYellow",contextHigh:"red",accent:"brightMagenta",muted:"dim",separator:"dim",quotaLow:"brightBlue",quotaHigh:"brightMagenta"},sectionColors:{model:"brightMagenta",directory:"cyan",git:"brightYellow",cost:"dim",changes:"brightBlue",agents:"brightMagenta",todos:"cyan"}},{name:"Stealth",labelKey:"statuslinePresetStealth",theme:{contextLow:"dim",contextMid:"dim",contextHigh:"brightRed",accent:"dim",muted:"dim",separator:"dim",quotaLow:"dim",quotaHigh:"brightRed"},sectionColors:{model:"dim",directory:"dim",git:"dim",cost:"dim",changes:"dim",agents:"dim",todos:"dim"}},{name:"Hacker",labelKey:"statuslinePresetHacker",theme:{contextLow:"green",contextMid:"brightGreen",contextHigh:"brightGreen",accent:"brightGreen",muted:"green",separator:"green",quotaLow:"green",quotaHigh:"brightGreen"},sectionColors:{model:"brightGreen",directory:"green",git:"brightGreen",cost:"green",changes:"brightGreen",agents:"green",todos:"brightGreen"}}],xW=({sectionId:t,label:e,config:n,onConfigChange:r,onRemove:s})=>{const{t:i}=ee(),[o,a]=g.useState(!1),{attributes:l,listeners:d,setNodeRef:u,transform:h,transition:f,isDragging:p}=f9({id:t}),m={transform:Ps.Transform.toString(h),transition:f,opacity:p?.4:1,zIndex:p?50:void 0},x=w=>{r({...n,icon:w.target.value||void 0})},b=w=>{r({...n,label:w.target.value||void 0})},y=w=>{const C=Number.parseInt(w.target.value,10);r({...n,maxWidth:Number.isNaN(C)?void 0:Math.max(10,Math.min(200,C))})},k=n.icon??"",v=n.label??e;return c.jsxs("div",{ref:u,style:m,className:"relative",children:[c.jsxs("div",{className:`group flex items-center gap-1 px-2 py-1 rounded-md border cursor-pointer select-none transition-all ${p?"border-dash-accent bg-dash-accent/20 shadow-lg":"border-dash-border bg-dash-surface hover:border-dash-accent/60 hover:bg-dash-surface-hover"}`,children:[c.jsx("span",{...l,...d,className:"text-dash-text-muted cursor-grab active:cursor-grabbing shrink-0 opacity-50 group-hover:opacity-100 transition-opacity","aria-label":"drag handle",children:"⠿"}),c.jsxs("button",{type:"button",onClick:()=>a(w=>!w),className:"flex items-center gap-1 text-xs text-dash-text min-w-0","aria-label":i(o?"statuslineCollapseSettings":"statuslineExpandSettings"),children:[k&&c.jsx("span",{className:"shrink-0",children:k}),c.jsx("span",{className:"truncate",children:v}),c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:`w-3 h-3 shrink-0 text-dash-text-muted transition-transform ${o?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),s&&c.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),s()},className:"text-dash-text-muted/40 hover:text-red-400 transition-colors shrink-0","aria-label":"remove section",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&c.jsxs("div",{className:"absolute top-full left-0 z-20 mt-1 w-56 p-3 rounded-lg border border-dash-border bg-dash-surface shadow-xl space-y-2",children:[c.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[c.jsxs("div",{children:[c.jsx("label",{htmlFor:`chip-icon-${t}`,className:"block text-[10px] font-medium text-dash-text-muted mb-1",children:i("statuslineIconOverride")}),c.jsx("input",{id:`chip-icon-${t}`,type:"text",value:n.icon??"",onChange:x,placeholder:i("statuslineIconPlaceholder"),maxLength:20,className:"w-full text-xs px-2 py-1 rounded border border-dash-border bg-dash-bg text-dash-text placeholder-dash-text-muted focus:outline-none focus:border-dash-accent"})]}),c.jsxs("div",{children:[c.jsx("label",{htmlFor:`chip-label-${t}`,className:"block text-[10px] font-medium text-dash-text-muted mb-1",children:i("statuslineLabelOverride")}),c.jsx("input",{id:`chip-label-${t}`,type:"text",value:n.label??"",onChange:b,placeholder:e,maxLength:50,className:"w-full text-xs px-2 py-1 rounded border border-dash-border bg-dash-bg text-dash-text placeholder-dash-text-muted focus:outline-none focus:border-dash-accent"})]})]}),c.jsxs("div",{children:[c.jsx("label",{htmlFor:`chip-maxwidth-${t}`,className:"block text-[10px] font-medium text-dash-text-muted mb-1",children:i("statuslineMaxWidth")}),c.jsx("input",{id:`chip-maxwidth-${t}`,type:"number",min:10,max:200,value:n.maxWidth??"",onChange:y,placeholder:i("statuslineMaxWidthPlaceholder"),className:"w-full text-xs px-2 py-1 rounded border border-dash-border bg-dash-bg text-dash-text placeholder-dash-text-muted focus:outline-none focus:border-dash-accent"})]}),c.jsx("button",{type:"button",onClick:()=>a(!1),className:"w-full text-[10px] py-0.5 text-dash-text-muted hover:text-dash-text transition-colors",children:i("closeModal")})]})]})},bW={model:"statuslineSectionModelLabel",context:"statuslineSectionContextLabel",quota:"statuslineSectionQuotaLabel",directory:"statuslineSectionDirectoryLabel",git:"statuslineSectionGitLabel",cost:"statuslineSectionCostLabel",changes:"statuslineSectionChangesLabel",agents:"statuslineSectionAgentsLabel",todos:"statuslineSectionTodosLabel"},Pv=({containerId:t,sectionIds:e,sectionConfig:n,onConfigChange:r,onRemoveSection:s,headerLabel:i,onRemove:o,isPool:a=!1})=>{const{t:l}=ee(),{setNodeRef:d,isOver:u}=MC({id:t});return c.jsxs("div",{className:`rounded-lg border transition-colors ${a?"border-dash-border/50 bg-dash-bg/50":u?"border-dash-accent/60 bg-dash-accent/5":"border-dash-border bg-dash-surface"}`,children:[i&&c.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-dash-border/50",children:[c.jsx("span",{className:`text-xs font-medium uppercase tracking-wider ${a?"text-dash-text-muted/70":"text-dash-text-muted"}`,children:i}),o&&c.jsx("button",{type:"button",onClick:o,className:"text-xs text-dash-text-muted hover:text-red-400 transition-colors px-1","aria-label":l("statuslineRemoveLine"),children:l("statuslineRemoveLine")})]}),c.jsx("div",{ref:d,className:"p-2 min-h-[44px]",children:c.jsx(o9,{items:e,strategy:s9,children:c.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.length===0?c.jsx("span",{className:"text-xs text-dash-text-muted/50 italic px-1 py-0.5",children:a?l("statuslineDragToLine"):"—"}):e.map(h=>c.jsx(xW,{sectionId:h,label:l(bW[h]??"statuslineSectionModelLabel"),config:n[h]??{},onConfigChange:f=>r(h,f),onRemove:!a&&s?()=>s(h):void 0},h))})})})]})};function Ov(t,e,n){for(let r=0;r<t.length;r++)if(t[r].includes(n))return`line-${r}`;return e.includes(n)?"pool":null}const yW=({lines:t,sectionConfig:e,onLinesChange:n,onSectionConfigChange:r})=>{const{t:s}=ee(),[i,o]=g.useState(null),a=$_(yy(Rg),yy(Tg,{coordinateGetter:g9})),l=new Set(t.flat()),d=uj.filter(b=>!l.has(b)),u=b=>{o(String(b.active.id))},h=b=>{o(null);const{active:y,over:k}=b;if(!k)return;const v=String(y.id),w=String(k.id),C=Ov(t,d,v);let j=Ov(t,d,w);if(j||(w.startsWith("line-")||w==="pool")&&(j=w),!C||!j||v===w)return;const S=t.map(A=>[...A]),P=A=>{if(A==="pool")return[...d];const N=Number.parseInt(A.replace("line-",""),10);return S[N]??[]},D=(A,N)=>{if(A==="pool")return;const T=Number.parseInt(A.replace("line-",""),10);S[T]=N};if(C===j){const A=P(C),N=A.indexOf(v),T=A.indexOf(w);N!==-1&&T!==-1&&D(C,Ig(A,N,T))}else{const A=P(C),N=P(j),T=A.filter(M=>M!==v),I=N.indexOf(w),O=I===-1?N.length:I,E=[...N.slice(0,O),v,...N.slice(O)];C!=="pool"&&D(C,T),j!=="pool"&&D(j,E)}n(S)},f=()=>{n([...t,[]])},p=b=>{t[b];const y=t.filter((k,v)=>v!==b);n(y)},m=(b,y)=>{r({...e,[b]:y})},x=(b,y)=>{const k=t.map((v,w)=>w===b?v.filter(C=>C!==y):[...v]);n(k)};return c.jsxs("div",{className:"space-y-2",children:[c.jsx("p",{className:"text-xs text-dash-text-muted px-1",children:s("statuslineDragHint")}),c.jsxs(_I,{sensors:a,collisionDetection:z_,onDragStart:u,onDragEnd:h,children:[c.jsx("div",{className:"space-y-2",children:t.map((b,y)=>c.jsx(Pv,{containerId:`line-${y}`,sectionIds:b,sectionConfig:e,onConfigChange:m,onRemoveSection:k=>x(y,k),headerLabel:`${s("statuslineLine")} ${y+1}`,onRemove:()=>p(y)},`line-zone-${y}`))}),c.jsxs("button",{type:"button",onClick:f,className:"w-full text-xs px-3 py-2 rounded-lg border border-dashed border-dash-border text-dash-text-muted hover:border-dash-accent/60 hover:text-dash-text transition-colors",children:["+ ",s("statuslineAddLine")]}),c.jsxs("div",{className:"pt-0.5",children:[c.jsx("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider mb-1 px-1",children:s("statuslineHiddenSections")}),c.jsx(Pv,{containerId:"pool",sectionIds:d,sectionConfig:e,onConfigChange:m,isPool:!0})]}),c.jsx(e9,{children:i?c.jsx("div",{className:"px-2 py-1 rounded-md border border-dash-accent bg-dash-accent/20 text-xs text-dash-text shadow-xl opacity-90",children:i}):null})]})]})},xn=fj;function vW(t){return xn[t]??xn.default}const wW=({sectionId:t,config:e,theme:n})=>{const r=gW[t]??t,s=e.icon??"";let i=e.color??qg[t]??n.accent;t==="context"&&!e.color&&(i=n.contextMid),t==="quota"&&!e.color&&(i=n.quotaLow);const o=vW(i),a=e.label?`${s} ${e.label}: ${r}`:s?`${s} ${r}`:r,l=e.maxWidth&&a.length>e.maxWidth?`${a.slice(0,e.maxWidth-1)}…`:a;return c.jsx("span",{className:"font-mono text-xs whitespace-nowrap",style:{color:o},children:l})},kW=c.jsx("span",{className:"font-mono text-xs",style:{color:xn.dim},children:" │ "}),SW=({sectionIds:t,sectionConfig:e,theme:n})=>{const{t:r}=ee();return c.jsx("div",{className:"flex items-center gap-0 py-0.5 px-2 rounded mb-0.5 last:mb-0 overflow-hidden",style:{backgroundColor:"#313244"},children:t.length===0?c.jsx("span",{className:"text-xs font-mono opacity-30",style:{color:xn.dim},children:r("statuslinePreviewEmptyLine")}):t.map((s,i)=>c.jsxs("span",{className:"flex items-center shrink-0",children:[c.jsx(wW,{sectionId:s,config:e[s]??{},theme:n}),i<t.length-1&&kW]},s))})},CW=({lines:t,sectionConfig:e,theme:n})=>{const{t:r}=ee(),s=t.reduce((i,o)=>i+o.length,0);return c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"text-xs text-dash-text-muted",children:r("statuslinePreview")}),c.jsxs("span",{className:"text-xs text-dash-text-muted/60",children:[s," ",r("statuslineSectionsVisible")]})]}),c.jsxs("div",{className:"rounded-lg overflow-hidden border border-dash-border shadow-lg",children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-[#1e1e2e] border-b border-[#313244]",children:[c.jsxs("div",{className:"flex gap-1.5",children:[c.jsx("span",{className:"w-3 h-3 rounded-full bg-[#f38ba8]"}),c.jsx("span",{className:"w-3 h-3 rounded-full bg-[#f9e2af]"}),c.jsx("span",{className:"w-3 h-3 rounded-full bg-[#a6e3a1]"})]}),c.jsx("span",{className:"text-xs text-[#6c7086] font-mono ml-2",children:r("statuslinePreviewTitle")})]}),c.jsxs("div",{className:"bg-[#1e1e2e] px-3 py-2 font-mono text-xs overflow-x-auto select-none",children:[c.jsxs("div",{className:"mb-1",children:[c.jsx("span",{style:{color:xn.green},children:"user@machine"}),c.jsx("span",{style:{color:xn.dim},children:":"}),c.jsx("span",{style:{color:xn.blue},children:"~/projects/myapp"}),c.jsx("span",{style:{color:xn.white},children:" $ "})]}),t.length===0?c.jsx("div",{className:"py-0.5 px-2 rounded mb-0.5",style:{backgroundColor:"#313244"},children:c.jsx("span",{className:"text-xs font-mono opacity-30",style:{color:xn.dim},children:r("statuslinePreviewNoLines")})}):t.map((i,o)=>c.jsx(SW,{sectionIds:i,sectionConfig:e,theme:n},o)),c.jsxs("div",{className:"mt-1 flex items-center",children:[c.jsx("span",{style:{color:xn.green},children:"user@machine"}),c.jsx("span",{style:{color:xn.dim},children:":"}),c.jsx("span",{style:{color:xn.blue},children:"~/projects/myapp"}),c.jsx("span",{style:{color:xn.white},children:" $ "}),c.jsx("span",{className:"inline-block w-2 h-4 bg-white/70 animate-pulse ml-0.5"})]})]})]})]})},jW={model:"statuslineSectionModelLabel",context:"statuslineSectionContextLabel",quota:"statuslineSectionQuotaLabel",directory:"statuslineSectionDirectoryLabel",git:"statuslineSectionGitLabel",cost:"statuslineSectionCostLabel",changes:"statuslineSectionChangesLabel",agents:"statuslineSectionAgentsLabel",todos:"statuslineSectionTodosLabel"},NW=["green","yellow","red","cyan","blue","magenta","white","dim","brightGreen","brightYellow","brightRed","brightCyan","brightBlue","brightMagenta","brightWhite"],xu=fj,_r=({field:t,label:e,value:n,onChange:r})=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-3 h-3 rounded-full shrink-0 border border-white/20",style:{backgroundColor:xu[n]??xu.default}}),c.jsx("label",{htmlFor:`color-${t}`,className:"text-xs text-dash-text-muted w-24 shrink-0",children:e}),c.jsx("select",{id:`color-${t}`,value:n,onChange:s=>r(s.target.value),className:"flex-1 text-xs px-2 py-1 rounded border border-dash-border bg-dash-bg text-dash-text focus:outline-none focus:border-dash-accent",children:NW.map(s=>c.jsx("option",{value:s,children:s},s))})]}),PW=({theme:t,sectionConfig:e,onChange:n,onSectionConfigChange:r})=>{const{t:s}=ee(),i=(d,u)=>{n({...t,[d]:u})},o=(d,u)=>{r({...e,[d]:{...e[d],color:u}})},a=d=>{n({...d.theme});const u={...e};for(const[h,f]of Object.entries(d.sectionColors))u[h]={...u[h],color:f};r(u)},l=Nv.findIndex(d=>d.theme.contextLow===t.contextLow&&d.theme.contextMid===t.contextMid&&d.theme.contextHigh===t.contextHigh&&d.theme.accent===t.accent&&d.theme.muted===t.muted&&d.theme.separator===t.separator&&d.theme.quotaLow===t.quotaLow&&d.theme.quotaHigh===t.quotaHigh);return c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-medium text-dash-text-muted mb-2 uppercase tracking-wider",children:s("statuslineTheme")}),c.jsx("div",{className:"grid grid-cols-2 gap-2",children:Nv.map((d,u)=>c.jsx("button",{type:"button",onClick:()=>a(d),className:`text-xs px-3 py-2 rounded border transition-colors text-left ${l===u?"border-dash-accent bg-dash-accent/10 text-dash-accent":"border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text"}`,children:c.jsxs("span",{className:"flex items-center gap-1",children:[[d.sectionColors.model,d.theme.contextMid,d.sectionColors.git,d.sectionColors.changes].map((h,f)=>c.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:xu[h]??xu.default}},f)),c.jsx("span",{className:"ml-0.5",children:s(d.labelKey)})]})},d.name))})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider",children:["▰ ",s("statuslineColorContextGroup")]}),c.jsx(_r,{field:"contextLow",label:s("statuslineColorContextLow"),value:t.contextLow,onChange:d=>i("contextLow",d)}),c.jsx(_r,{field:"contextMid",label:s("statuslineColorContextMid"),value:t.contextMid,onChange:d=>i("contextMid",d)}),c.jsx(_r,{field:"contextHigh",label:s("statuslineColorContextHigh"),value:t.contextHigh,onChange:d=>i("contextHigh",d)})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider",children:["⌛ ",s("statuslineColorQuotaGroup")]}),c.jsx(_r,{field:"quotaLow",label:s("statuslineQuotaLow"),value:t.quotaLow,onChange:d=>i("quotaLow",d)}),c.jsx(_r,{field:"quotaHigh",label:s("statuslineQuotaHigh"),value:t.quotaHigh,onChange:d=>i("quotaHigh",d)})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider",children:s("statuslineColorGeneralGroup")}),c.jsx(_r,{field:"accent",label:s("statuslineColorAccent"),value:t.accent,onChange:d=>i("accent",d)}),c.jsx(_r,{field:"muted",label:s("statuslineColorMuted"),value:t.muted,onChange:d=>i("muted",d)}),c.jsx(_r,{field:"separator",label:s("statuslineColorSeparator"),value:t.separator,onChange:d=>i("separator",d)})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider",children:s("statuslineColorSectionGroup")}),uj.filter(d=>d!=="context"&&d!=="quota").map(d=>{const u=e[d]?.icon??hj[d]?.icon??"",h=s(jW[d]??"statuslineSectionModelLabel");return c.jsx(_r,{field:`section-${d}`,label:u?`${u} ${h}`:h,value:e[d]?.color??qg[d]??"default",onChange:f=>o(d,f)},d)})]})]})]})};function OW(t){return{baseMode:t.baseMode??as.baseMode,lines:t.lines??as.lines,sectionConfig:t.sectionConfig??as.sectionConfig,theme:t.theme?{...gu,...t.theme}:gu,responsiveBreakpoint:t.responsiveBreakpoint??as.responsiveBreakpoint,maxAgentRows:t.maxAgentRows??as.maxAgentRows,todoTruncation:t.todoTruncation??as.todoTruncation}}const EW=()=>{const{t}=ee(),[e,n]=g.useState(as),[r,s]=g.useState(!0),[i,o]=g.useState(!1),[a,l]=g.useState(null),[d,u]=g.useState(!1),[h,f]=g.useState(!1),{size:p,isDragging:m,startDrag:x}=yo({storageKey:"ck-statusline-preview-width",defaultSize:500,minSize:300,maxSize:900,direction:"horizontal",invert:!0});g.useEffect(()=>{let C=!1;return Ld("global").then(j=>{if(C)return;const S=j.config.statuslineLayout;S&&n(OW(S))}).catch(()=>{C||f(!0)}).finally(()=>{C||s(!1)}),()=>{C=!0}},[]);const b=g.useCallback(async()=>{o(!0),l(null),u(!1);try{await yE("statuslineLayout",e,"global"),u(!0),setTimeout(()=>u(!1),3e3)}catch(C){l(C instanceof Error?C.message:"Unknown error")}finally{o(!1)}},[e]),y=g.useCallback(()=>{n(as),u(!1),l(null)},[]),k=g.useCallback(C=>{n(j=>({...j,lines:C}))},[]),v=g.useCallback(C=>{n(j=>({...j,sectionConfig:C}))},[]),w=g.useCallback(C=>{n(j=>({...j,theme:C}))},[]);return r?c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsx("div",{className:"text-dash-text-muted text-sm",children:t("loading")})}):c.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[c.jsx("div",{className:"shrink-0 px-6 py-4 border-b border-dash-border bg-dash-surface",children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-lg font-bold text-dash-text",children:t("statuslineBuilder")}),c.jsx("p",{className:"text-sm text-dash-text-muted mt-0.5",children:t("statuslineBuilderDescription")})]}),d&&c.jsx("div",{className:"text-xs text-green-400 bg-green-400/10 border border-green-400/20 rounded px-3 py-1.5",children:t("statuslineSaved")}),h&&c.jsx("div",{className:"bg-orange-50 dark:bg-orange-950 text-orange-700 dark:text-orange-300 px-4 py-2 rounded-md text-sm border border-orange-200 dark:border-orange-800",children:t("statuslineLoadErrorSaveDisabled")}),a&&c.jsxs("div",{className:"text-xs text-red-400 bg-red-400/10 border border-red-400/20 rounded px-3 py-1.5",children:[t("statuslineSaveError"),": ",a]})]})}),c.jsxs("div",{className:"flex-1 overflow-hidden flex",children:[c.jsxs("div",{className:"flex-1 min-w-0 flex flex-col border-r border-dash-border overflow-hidden",children:[c.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:c.jsx(PW,{theme:e.theme,sectionConfig:e.sectionConfig,onChange:w,onSectionConfigChange:v})}),c.jsxs("div",{className:"shrink-0 px-4 py-3 border-t border-dash-border bg-dash-surface flex gap-2",children:[c.jsx("button",{type:"button",onClick:y,className:"text-xs px-3 py-1.5 rounded border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text transition-colors",children:t("statuslineResetDefaults")}),c.jsx("button",{type:"button",onClick:b,disabled:i||h,className:"flex-1 text-xs px-3 py-1.5 rounded border border-dash-accent bg-dash-accent/10 text-dash-accent hover:bg-dash-accent/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed font-medium",children:i?`${t("saving")}…`:t("statuslineSave")})]})]}),c.jsx(_n,{direction:"horizontal",isDragging:m,onMouseDown:x}),c.jsxs("div",{className:"shrink-0 overflow-y-auto p-4 bg-dash-bg space-y-4",style:{width:p},children:[c.jsx(CW,{lines:e.lines,sectionConfig:e.sectionConfig,theme:e.theme}),c.jsx(yW,{lines:e.lines,sectionConfig:e.sectionConfig,onLinesChange:k,onSectionConfigChange:v})]})]})]})},DW=({components:t,isChecking:e,isUpdating:n,onCheckAll:r,onUpdateAll:s,className:i})=>{const{t:o}=ee(),a=t.filter(u=>u.status==="update-available").length,l=t.length>0&&t.every(u=>u.status==="up-to-date"||u.status==="idle"),d=t.filter(u=>u.status==="up-to-date").length;return c.jsxs("div",{className:`flex flex-wrap items-center gap-2 ${i??""}`,children:[c.jsxs("div",{className:"inline-flex items-center gap-2 rounded-lg border border-dash-border bg-dash-surface px-3 py-2 text-xs",children:[c.jsx("output",{className:"inline-flex items-center gap-2","aria-live":"polite","aria-atomic":"true",children:e?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),c.jsx("span",{className:"text-dash-text-secondary",children:o("checkingAll")})]}):a>0?c.jsx("span",{className:"text-amber-500 font-semibold",children:o("updatesAvailable").replace("{count}",a.toString())}):l?c.jsx("span",{className:"text-emerald-500 font-semibold",children:o("allUpToDate")}):c.jsx("span",{className:"text-dash-text-secondary font-medium",children:o("readyToScan")})}),d>0&&c.jsx("span",{className:"mono text-dash-text-muted border-l border-dash-border pl-2",children:d})]}),c.jsx("button",{type:"button",onClick:r,disabled:e||n,className:"dash-focus-ring px-3 py-2 rounded-lg text-xs font-semibold border border-dash-border bg-dash-surface text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:o("checkAll")}),a>0&&c.jsx("button",{type:"button",onClick:s,disabled:n,className:"dash-focus-ring px-3 py-2 rounded-lg text-xs font-semibold bg-dash-accent text-dash-bg hover:bg-dash-accent-hover disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:o("updateAll")})]})},MW=({value:t,onChange:e,disabled:n=!1})=>{const{t:r}=ee();return c.jsxs("fieldset",{className:"inline-flex items-center rounded-xl border border-dash-border bg-dash-surface p-1 gap-1",role:"radiogroup","aria-label":"Update channel",children:[c.jsxs("label",{className:`dash-focus-ring px-3.5 py-2 text-xs font-semibold rounded-lg transition-colors cursor-pointer ${t==="stable"?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover"} ${n?"opacity-50 cursor-not-allowed":""}`,children:[c.jsx("input",{type:"radio",name:"channel",value:"stable",checked:t==="stable",onChange:()=>e("stable"),disabled:n,className:"sr-only"}),r("channelStable")]}),c.jsxs("label",{className:`dash-focus-ring px-3.5 py-2 text-xs font-semibold rounded-lg transition-colors cursor-pointer ${t==="beta"?"bg-amber-500/15 text-amber-500":"text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover"} ${n?"opacity-50 cursor-not-allowed":""}`,children:[c.jsx("input",{type:"radio",name:"channel",value:"beta",checked:t==="beta",onChange:()=>e("beta"),disabled:n,className:"sr-only"}),r("channelBeta")]})]})},AW={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}},pj=({status:t,ariaLabel:e,size:n="sm"})=>{const r=AW[t],s=n==="sm"?"w-2 h-2":"w-2.5 h-2.5";return c.jsx("span",{className:`
|
|
299
|
+
inline-block rounded-full ${s} ${r.color}
|
|
300
|
+
${r.pulse?"animate-pulse motion-reduce:animate-none":""}
|
|
301
|
+
`,role:"status","aria-label":e})},Yg=({isOpen:t,onClose:e,target:n,kitName:r,targetVersion:s,onComplete:i,mode:o="single",components:a=[]})=>{const{t:l}=ee(),[d,u]=g.useState("running"),[h,f]=g.useState([]),[p,m]=g.useState([]),[x,b]=g.useState(!1),[y,k]=g.useState(0),v=g.useRef(null),w=g.useRef(null);g.useEffect(()=>{x&&w.current&&w.current.scrollIntoView({behavior:"smooth"})},[x]);const C=g.useCallback(async()=>{if(a.length===0){u("success");return}for(let S=0;S<a.length;S++){k(S);const P=a[S];try{const D=P.id==="cli",A=new URLSearchParams({target:D?"cli":"kit"});D||A.set("kit",P.id);const N=new EventSource(`/api/system/update?${A}`);v.current=N,await new Promise((T,I)=>{N.onmessage=O=>{try{const E=JSON.parse(O.data);E.type==="phase"&&E.name&&f(M=>[...M,`[${P.name}] ${E.name}`]),E.type==="output"&&E.text&&m(M=>[...M,E.text]),E.type==="error"&&(u("error"),m(M=>[...M,`[ERROR ${P.name}] ${E.message||"Unknown error"}`]),N.close(),I()),E.type==="complete"&&(E.code===0?(N.close(),T()):(u("error"),N.close(),I()))}catch(E){console.error("Failed to parse SSE message:",E),N.close(),I(E)}},N.onerror=()=>{u("error"),m(O=>[...O,`[ERROR ${P.name}] Connection lost`]),N.close(),I()}})}catch(D){console.error(`Failed to update ${P.name}:`,D)}}u("success"),i()},[a,i]);g.useEffect(()=>{if(t)if(o==="batch")C();else{const S=new URLSearchParams({target:n});r&&S.set("kit",r),s&&S.set("version",s);const P=new EventSource(`/api/system/update?${S}`);return v.current=P,P.onmessage=D=>{try{const A=JSON.parse(D.data);A.type==="phase"&&A.name&&f(N=>[...N,A.name]),A.type==="output"&&A.text&&m(N=>[...N,A.text]),A.type==="error"&&(u("error"),m(N=>[...N,`[ERROR] ${A.message||"Unknown error"}`])),A.type==="complete"&&(u(A.code===0?"success":"error"),P.close(),A.code===0&&i())}catch(A){console.error("Failed to parse SSE message:",A)}},P.onerror=()=>{u("error"),m(D=>[...D,"[ERROR] Connection lost"]),P.close()},()=>{P.close()}}},[t,n,r,s,i,o,C]);const j=()=>{d!=="running"&&(u("running"),f([]),m([]),b(!1),k(0),e())};return t?c.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:c.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-lg shadow-lg w-full max-w-2xl max-h-[80vh] flex flex-col",children:[c.jsx("div",{className:"px-6 py-4 border-b border-dash-border",children:c.jsx("h2",{className:"text-lg font-bold text-dash-text",children:l(d==="running"?"updating":d==="success"?"updateSuccess":"updateFailed")})}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[o==="batch"&&a.length>0&&c.jsxs("div",{className:"text-sm text-dash-text-secondary",children:[d==="running"&&c.jsxs("span",{children:["Updating ",y+1," of ",a.length,":"," ",a[y]?.name]}),d==="success"&&c.jsxs("span",{className:"text-emerald-500",children:["All ",a.length," components updated"]})]}),h.length>0&&c.jsx("div",{className:"space-y-2",children:h.map((S,P)=>c.jsxs("div",{className:"flex items-center gap-2 text-sm text-dash-text-secondary",children:[c.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-dash-accent"}),c.jsx("span",{children:S})]},`${S}-${P}`))}),d==="running"&&c.jsxs("div",{className:"flex items-center gap-2 text-sm text-dash-text-muted",children:[c.jsx("span",{className:"w-4 h-4 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),c.jsx("span",{children:l("updating")})]}),p.length>0&&c.jsxs("div",{children:[c.jsx("button",{type:"button",onClick:()=>b(!x),className:"text-xs text-dash-accent hover:text-dash-accent-hover transition-colors",children:l(x?"hideDetails":"showDetails")}),x&&c.jsxs("div",{className:"mt-2 bg-dash-bg border border-dash-border rounded p-3 max-h-64 overflow-y-auto",children:[c.jsx("pre",{className:"text-xs mono text-dash-text whitespace-pre-wrap",children:p.join(`
|
|
302
|
+
`)}),c.jsx("div",{ref:w})]})]})]}),c.jsx("div",{className:"px-6 py-4 border-t border-dash-border flex justify-end",children:c.jsx("button",{type:"button",onClick:j,disabled:d==="running",className:`px-4 py-2 rounded text-sm font-medium transition-colors ${d==="running"?"bg-dash-bg text-dash-text-muted cursor-not-allowed":"bg-dash-accent text-white hover:bg-dash-accent-hover"}`,children:l("closeModal")})})]})}):null},mj=({target:t,kitName:e,currentVersion:n,latestVersion:r,onVersionSelect:s})=>{const{t:i}=ee(),[o,a]=g.useState([]),[l,d]=g.useState(!1),[u,h]=g.useState(r);g.useEffect(()=>{(async()=>{d(!0);try{const m=new URLSearchParams({target:t});e&&m.set("kit",e);const b=await(await fetch(`/api/system/versions?${m}`)).json();b.versions&&a(b.versions)}catch(m){console.error("Failed to fetch versions:",m)}finally{d(!1)}})()},[t,e]);const f=p=>{h(p),s(p)};return l?c.jsxs("span",{className:"text-xs text-dash-text-muted flex items-center gap-1.5",children:[c.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),i("loadingVersions")]}):c.jsx("select",{value:u,onChange:p=>f(p.target.value),className:`text-xs text-amber-500 hover:text-amber-600 font-medium transition-colors
|
|
303
|
+
bg-transparent border border-amber-500/30 rounded px-2 py-1
|
|
304
|
+
focus:outline-none focus:ring-2 focus:ring-amber-500/50
|
|
305
|
+
cursor-pointer appearance-none`,title:i("selectVersion"),children:o.map(p=>{const m=p.version===r,x=p.version===n,b=`v${p.version.replace(/^v/,"")}${m?` (${i("latestVersion")})`:""}${p.isPrerelease?` [${i("prereleaseLabel")}]`:""}${x?` - ${i("currentVersionLabel")}`:""}`;return c.jsx("option",{value:p.version,disabled:x,children:b},p.version)})})},TW=({version:t,installedAt:e,channel:n="stable",externalStatus:r,externalLatestVersion:s,onStatusChange:i,disabled:o,packageManager:a,installLocation:l})=>{const{t:d}=ee(),[u,h]=g.useState("idle"),[f,p]=g.useState(null),[m,x]=g.useState(!1),[b,y]=g.useState(null),k=r??u,v=s??f,w=async()=>{const j=P=>{i||h(P)},S=P=>{i||p(P)};j("checking"),i&&i("checking",null);try{const D=await(await fetch(`/api/system/check-updates?target=cli&channel=${n}`)).json();D.updateAvailable?(j("update-available"),S(D.latest),i&&i("update-available",D.latest)):(j("up-to-date"),i&&i("up-to-date",null))}catch{j("idle"),i&&i("idle",null)}},C=async()=>{window.location.reload()};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"dash-panel p-5 transition-colors hover:border-dash-accent/30",children:[c.jsxs("div",{className:"flex items-center justify-between gap-4",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap min-w-0",children:[c.jsx(pj,{status:k,ariaLabel:d(k==="up-to-date"?"upToDate":k==="update-available"?"updateAvailable":"checking")}),c.jsx("h3",{className:"text-base font-semibold text-dash-text",children:d("cliCard")}),n==="beta"&&c.jsx("span",{className:"px-2 py-0.5 text-[11px] font-semibold bg-amber-500/15 text-amber-500 rounded border border-amber-500/20",children:d("betaBadge")})]}),c.jsx(LW,{status:k,currentVersion:t,latestVersion:v,onCheck:w,onUpdate:()=>x(!0),onVersionSelect:y,disabled:o})]}),c.jsxs("div",{className:"mt-3 space-y-3",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-dash-text-secondary",children:[c.jsxs("span",{className:"px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70 mono",children:[d("currentVersionLabel"),": v",t.replace(/^v/,"")]}),e&&c.jsx("span",{className:"px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70 text-dash-text-muted",children:new Date(e).toLocaleDateString()})]}),(a||l)&&c.jsxs("div",{className:"grid grid-cols-1 gap-1 text-xs sm:grid-cols-2",children:[a&&c.jsx(Ev,{label:d("cliPackageManager"),value:a}),l&&c.jsx(Ev,{label:d("cliInstallLocation"),value:l,mono:!0})]}),k==="update-available"&&v&&c.jsxs("div",{className:"inline-flex items-center rounded-md border border-amber-500/25 bg-amber-500/10 px-2.5 py-1 text-xs text-amber-500 font-medium",children:["v",t.replace(/^v/,"")," ","->"," v",v.replace(/^v/,"")]})]})]}),c.jsx(Yg,{isOpen:m,onClose:()=>x(!1),target:"cli",targetVersion:b??v??void 0,onComplete:C})]})},LW=({status:t,currentVersion:e,latestVersion:n,onCheck:r,onUpdate:s,onVersionSelect:i,disabled:o})=>{const{t:a}=ee();return t==="checking"?c.jsxs("span",{className:"text-xs text-dash-text-muted flex items-center gap-1.5 px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70",children:[c.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),a("checking")]}):t==="up-to-date"?c.jsx("span",{className:"px-2.5 py-1 text-xs rounded-md border border-emerald-500/30 bg-emerald-500/10 text-emerald-500 font-semibold",children:a("upToDate")}):t==="update-available"&&n?c.jsx("div",{className:"flex items-center gap-2",children:c.jsx(mj,{target:"cli",currentVersion:e,latestVersion:n,onVersionSelect:l=>{i(l),s()}})}):c.jsx("button",{type:"button",onClick:r,disabled:o,className:"dash-focus-ring px-3 py-2 rounded-lg text-xs font-semibold border border-dash-border bg-dash-surface text-dash-accent hover:text-dash-accent-hover hover:bg-dash-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:a("checkForUpdates")})},Ev=({label:t,value:e,mono:n})=>c.jsxs("div",{className:"flex items-center justify-between rounded border border-dash-border/60 bg-dash-bg/50 px-2 py-1",children:[c.jsx("span",{className:"text-dash-text-muted text-[10px] uppercase tracking-wide shrink-0 mr-2",children:t}),c.jsx("span",{className:`break-all text-right text-dash-text-secondary ${n?"mono text-[11px]":"text-xs"}`,children:e})]});function RW(t){let e=0,n=0,r=0;for(const s of t)s.ownership==="ck"?e++:s.ownership==="user"?n++:s.ownership==="ck-modified"&&r++;return{ck:e,user:n,modified:r}}function _W(t){const e=new Set,n=new Set,r=new Set;let s=0,i=0,o=0;for(const a of t){const l=a.path;if(l.startsWith("skills/")){const d=l.split("/");d.length>=2&&d[1]&&e.add(d[1])}else if(l.startsWith("commands/")){const d=l.split("/");d.length>=2&&d[1]&&n.add(d[1])}else if(l.startsWith("hooks/")){const d=l.split("/");d.length>=2&&d[1]&&r.add(d[1])}else l==="hooks.json"?i++:l.startsWith("rules/")?s++:l.startsWith("settings/")||l==="settings.json"?i++:o++}return{skills:e.size,commands:n.size,rules:s,hooks:r.size,settings:i,other:o}}const IW=({kitName:t,kit:e,channel:n="stable",externalStatus:r,externalLatestVersion:s,onStatusChange:i,disabled:o})=>{const{t:a}=ee(),[l,d]=g.useState("idle"),[u,h]=g.useState(null),[f,p]=g.useState(!1),[m,x]=g.useState(null),b=r??l,y=s??u,k=e.files??[],v=_W(k),w=Object.values(v).reduce((P,D)=>P+D,0),C=RW(k),j=async()=>{const P=A=>{i||d(A)},D=A=>{i||h(A)};P("checking"),i&&i("checking",null);try{const N=await(await fetch(`/api/system/check-updates?target=kit&kit=${t}&channel=${n}`)).json();N.updateAvailable?(P("update-available"),D(N.latest),i&&i("update-available",N.latest)):(P("up-to-date"),i&&i("up-to-date",null))}catch{P("idle"),i&&i("idle",null)}},S=async()=>{window.location.reload()};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"dash-panel p-5 space-y-4 transition-colors hover:border-dash-accent/30",children:[c.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx(pj,{status:b,ariaLabel:a(b==="up-to-date"?"upToDate":b==="update-available"?"updateAvailable":"checking")}),c.jsxs("h3",{className:"text-base font-semibold text-dash-text capitalize",children:[t," Kit"]}),n==="beta"&&c.jsx("span",{className:"px-2 py-0.5 text-[11px] font-semibold bg-amber-500/15 text-amber-500 rounded border border-amber-500/20",children:a("betaBadge")})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-dash-text-secondary",children:[c.jsxs("span",{className:"px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70 mono",children:[a("currentVersionLabel"),": v",(e.version??"?").replace(/^v/,"")]}),e.installedAt&&c.jsx("span",{className:"px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70 text-dash-text-muted",children:new Date(e.installedAt).toLocaleDateString()}),c.jsxs("span",{className:"px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70 mono",children:[a("components"),": ",w]})]}),b==="update-available"&&y&&c.jsxs("div",{className:"inline-flex items-center rounded-md border border-amber-500/25 bg-amber-500/10 px-2.5 py-1 text-xs text-amber-500 font-medium",children:["v",(e.version??"?").replace(/^v/,"")," ","->"," v",y.replace(/^v/,"")]})]}),c.jsx($W,{status:b,currentVersion:e.version??"0.0.0",latestVersion:y,kitName:t,onCheck:j,onUpdate:()=>p(!0),onVersionSelect:x,disabled:o})]}),k.length>0&&c.jsx("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-2 xl:grid-cols-3",children:Object.entries(v).filter(([,P])=>P>0).map(([P,D])=>c.jsxs("div",{className:"flex items-center justify-between px-2.5 py-2 bg-dash-bg/70 border border-dash-border rounded-lg text-xs",children:[c.jsx("span",{className:"text-dash-text-secondary capitalize",children:P}),c.jsx("span",{className:"font-bold mono text-dash-text",children:D})]},P))}),(C.user>0||C.modified>0)&&c.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-dash-text-muted",children:[C.user>0&&c.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-md border border-dash-border bg-dash-bg/70",children:[c.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500 shrink-0"}),C.user," ",a("ownershipUser")]}),C.modified>0&&c.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-md border border-dash-border bg-dash-bg/70",children:[c.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-500 shrink-0"}),C.modified," ",a("ownershipModified")]})]}),k.length===0&&c.jsx("p",{className:"text-xs text-dash-text-muted",children:a("noTrackedFiles")})]}),c.jsx(Yg,{isOpen:f,onClose:()=>p(!1),target:"kit",kitName:t,targetVersion:m??y??void 0,onComplete:S})]})},$W=({status:t,currentVersion:e,latestVersion:n,kitName:r,onCheck:s,onUpdate:i,onVersionSelect:o,disabled:a})=>{const{t:l}=ee();return t==="checking"?c.jsxs("span",{className:"text-xs text-dash-text-muted flex items-center gap-1.5 px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70",children:[c.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),l("checking")]}):t==="up-to-date"?c.jsx("span",{className:"px-2.5 py-1 text-xs rounded-md border border-emerald-500/30 bg-emerald-500/10 text-emerald-500 font-semibold",children:l("upToDate")}):t==="update-available"&&n?c.jsx("div",{className:"flex items-center gap-2",children:c.jsx(mj,{target:"kit",kitName:r,currentVersion:e,latestVersion:n,onVersionSelect:d=>{o(d),i()}})}):c.jsx("button",{type:"button",onClick:s,disabled:a,className:"dash-focus-ring px-3 py-2 rounded-lg text-xs font-semibold border border-dash-border bg-dash-surface text-dash-accent hover:text-dash-accent-hover hover:bg-dash-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:l("checkForUpdates")})},Dv="claudekit-update-channel",Mv="claudekit-system-filter",BW=t=>/-(alpha|beta|rc|dev|next)/.test(t),FW=t=>t==="all"||t==="updates"||t==="up-to-date"||t==="cli"||t==="kits"?t:"all",Av=t=>t==="update-available"?0:t==="checking"?1:t==="idle"?2:3,zW=({metadata:t})=>{const{t:e}=ee(),[n,r]=g.useState(null),[s,i]=g.useState([]),[o,a]=g.useState(!1),[l,d]=g.useState(!1),[u,h]=g.useState(!1),[f,p]=g.useState("stable"),[m,x]=g.useState(()=>FW(localStorage.getItem(Mv))),b=nt(),y=g.useRef(!1),k=g.useRef(0),v=g.useMemo(()=>!t.kits||typeof t.kits!="object"?[]:Object.entries(t.kits),[t.kits]),w=v.length>0,C=t.name,j=t.version,S=t.installedAt,P=v.length>0||C;g.useEffect(()=>{if(!n)return;const K=[];if(K.push({id:"cli",type:"cli",status:"idle",currentVersion:n.cliVersion,latestVersion:null}),w&&v.length>0)for(const[te,le]of v){const J=le;K.push({id:te,type:"kit",status:"idle",currentVersion:J.version??"?",latestVersion:null})}else C&&K.push({id:C,type:"kit",status:"idle",currentVersion:j??"?",latestVersion:null});i(K)},[n,w,v,C,j]),g.useEffect(()=>{FP().then(r).catch(()=>r(null))},[]),g.useEffect(()=>{const K=localStorage.getItem(Dv);K==="stable"||K==="beta"?p(K):n?.cliVersion&&p(BW(n.cliVersion)?"beta":"stable")},[n?.cliVersion]);const D=K=>{p(K),localStorage.setItem(Dv,K)};g.useEffect(()=>{localStorage.setItem(Mv,m)},[m]);const A=(K,te,le)=>{i(J=>J.map(de=>de.id===K?{...de,status:te,latestVersion:le}:de))},N=g.useCallback(async()=>{if(b||s.length===0||s.length===0)return;const K=k.current+1;k.current=K,a(!0),i(te=>te.map(le=>le.status==="checking"&&le.latestVersion===null?le:{...le,status:"checking",latestVersion:null}));try{const te=s.map(async J=>{try{const de=J.type==="cli"?`target=cli&channel=${f}`:`target=kit&kit=${J.id}&channel=${f}`,Te=await(await fetch(`/api/system/check-updates?${de}`)).json();return{id:J.id,status:Te.updateAvailable?"update-available":"up-to-date",latestVersion:Te.latest}}catch{return{id:J.id,status:"idle",latestVersion:null}}}),le=await Promise.all(te);if(k.current!==K)return;i(J=>J.map(de=>{const Ce=le.find(Te=>Te.id===de.id);return Ce?{...de,status:Ce.status,latestVersion:Ce.latestVersion}:de}))}finally{k.current===K&&a(!1)}},[f,b,s]),T=K=>{x(K),(K==="updates"||K==="up-to-date")&&!o&&!l&&s.length>0&&s.every(le=>le.status==="idle")&&(y.current=!0,N())},I=()=>{h(!0)},O=()=>{window.location.reload()},E=s.filter(K=>K.status==="update-available").length,M=s.filter(K=>K.status==="up-to-date").length,R=s.filter(K=>K.status==="up-to-date"||K.status==="update-available").length,_=s.some(K=>K.status==="checking"),$=w&&v.length>0?v.length:C?1:0,F=s.find(K=>K.id==="cli")?.status??"idle",z=g.useMemo(()=>w&&v.length>0?v.map(([K,te])=>({id:K,kitName:K,kit:te})):C?[{id:C,kitName:C,kit:{version:j,installedAt:S}}]:[],[w,v,C,j,S]),V=g.useMemo(()=>{const te=[...z.map(le=>({...le,status:s.find(J=>J.id===le.id)?.status??"idle"}))].sort((le,J)=>{const de=Av(le.status)-Av(J.status);return de!==0?de:le.kitName.localeCompare(J.kitName)});return m==="updates"?te.filter(le=>le.status==="update-available"):m==="up-to-date"?te.filter(le=>le.status==="up-to-date"):m==="cli"?[]:te},[z,s,m]),Z=m==="all"||m==="cli"||m==="updates"&&F==="update-available"||m==="up-to-date"&&F==="up-to-date",U=(Z?1:0)+V.length;g.useEffect(()=>{if(!(b||!(m==="updates"||m==="up-to-date")||y.current)&&!(o||l||s.length===0)){if(!s.every(te=>te.status==="idle")){y.current=!0;return}y.current=!0,N()}},[N,o,l,s,m,b]);const Q=g.useMemo(()=>U!==0?"":(m==="updates"||m==="up-to-date")&&_?e("checkingAll"):(m==="updates"||m==="up-to-date")&&R===0?e("runCheckAllForFilter"):m==="updates"&&R>0&&E===0?e("noUpdatesFound"):m==="up-to-date"&&R>0&&M===0?e("noUpToDateYet"):e("noComponentsMatchFilter"),[U,m,_,R,E,M,e]),se=!P&&m!=="cli",ce=e("componentFilterUpdatesCount").replace("{count}",E.toString()),X=e("componentFilterUpToDateCount").replace("{count}",M.toString());return c.jsxs("div",{className:"relative",children:[c.jsxs("div",{className:"pointer-events-none absolute inset-0 -z-10 overflow-hidden",children:[c.jsx("div",{className:"absolute -top-20 -right-8 h-56 w-56 rounded-full bg-dash-accent/10 blur-3xl"}),c.jsx("div",{className:"absolute -bottom-24 -left-10 h-64 w-64 rounded-full bg-dash-accent/5 blur-3xl"})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsx("section",{className:"dash-panel dash-sticky-glass p-4 md:p-5 sticky top-0 z-10",children:c.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsx("p",{className:"mono text-[10px] uppercase tracking-[0.16em] text-dash-text-muted",children:e("systemControlTower")}),c.jsx("h2",{className:"text-xl md:text-2xl font-semibold text-dash-text",children:e("systemOverviewTitle")}),c.jsx("p",{className:"text-sm text-dash-text-secondary max-w-2xl",children:e("systemOverviewDesc")})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(MW,{value:f,onChange:D,disabled:o||l}),s.length>0&&!b&&c.jsx(DW,{components:s,isChecking:o,isUpdating:l,onCheckAll:N,onUpdateAll:I})]})]})}),b&&c.jsxs("div",{className:"rounded-xl border border-dash-border bg-dash-surface px-4 py-3 text-sm text-dash-text-secondary",children:["Desktop mode uses native reads only. Run ",c.jsx("code",{className:"mono",children:"ck update"}),","," ",c.jsx("code",{className:"mono",children:"ck migrate"}),", or related CLI commands in the terminal for server-backed operations."]}),c.jsxs("section",{className:"grid grid-cols-2 gap-3 xl:grid-cols-5",children:[c.jsx(Uo,{label:e("components"),value:s.length.toString()}),c.jsx(Uo,{label:e("kitsLabel"),value:$.toString()}),c.jsx(Uo,{label:e("updateAvailable"),value:E.toString(),tone:"accent"}),c.jsx(Uo,{label:e("upToDate"),value:M.toString(),tone:"success"}),c.jsx(Uo,{label:e("checkedComponents"),value:R.toString()})]}),c.jsxs("section",{className:"space-y-3",children:[c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 px-1",children:[c.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text",children:e("installedComponentsHeading")}),c.jsxs("fieldset",{className:"flex items-center gap-2",children:[c.jsx("legend",{className:"sr-only",children:e("installedComponentsHeading")}),c.jsx(Ko,{label:e("componentFilterAll"),value:m,activeValue:"all",onClick:()=>T("all")}),c.jsx(Ko,{label:ce,value:m,activeValue:"updates",onClick:()=>T("updates")}),c.jsx(Ko,{label:X,value:m,activeValue:"up-to-date",onClick:()=>T("up-to-date")}),c.jsx(Ko,{label:e("componentFilterCli"),value:m,activeValue:"cli",onClick:()=>T("cli")}),c.jsx(Ko,{label:e("componentFilterKits"),value:m,activeValue:"kits",onClick:()=>T("kits")})]})]}),Z&&c.jsx(TW,{version:n?.cliVersion??"...",installedAt:void 0,externalStatus:s.find(K=>K.id==="cli")?.status,externalLatestVersion:s.find(K=>K.id==="cli")?.latestVersion??null,onStatusChange:(K,te)=>A("cli",K,te),disabled:b||o||l,channel:f,packageManager:n?.packageManager,installLocation:n?.installLocation}),V.map(K=>{const te=s.find(le=>le.id===K.id);return c.jsx(IW,{kitName:K.kitName,kit:K.kit,externalStatus:te?.status,externalLatestVersion:te?.latestVersion??null,onStatusChange:(le,J)=>A(K.id,le,J),disabled:b||o||l,channel:f},K.id)}),se&&c.jsx("div",{className:"dash-panel-muted p-6 text-center opacity-80",children:c.jsx("p",{className:"text-sm text-dash-text-secondary",children:e("noKitInstalled")})}),!se&&U===0&&c.jsx("div",{className:"dash-panel-muted p-6 text-center opacity-80",children:c.jsx("p",{className:"text-sm text-dash-text-secondary",children:Q})})]}),n&&c.jsx(VW,{systemInfo:n})]}),c.jsx(Yg,{isOpen:u,onClose:()=>h(!1),target:"cli",mode:"batch",components:s.filter(K=>K.status==="update-available").map(K=>({id:K.id,name:K.id==="cli"?"CLI":`${K.id} Kit`})),onComplete:O})]})},Uo=({label:t,value:e,tone:n="default"})=>{const r=n==="accent"?"text-dash-accent":n==="success"?"text-emerald-500":"text-dash-text";return c.jsxs("div",{className:"dash-panel p-3",children:[c.jsx("p",{className:"text-[11px] uppercase tracking-wide text-dash-text-muted",children:t}),c.jsx("p",{className:`mt-1 mono text-xl font-semibold ${r}`,children:e})]})};function Tv({label:t,value:e,ok:n}){const r=n===!0?"bg-emerald-500":n===!1?"bg-red-500":"bg-dash-text-muted/40";return c.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-dash-border bg-dash-bg/70 px-3 py-2",children:[c.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${r}`}),c.jsx("span",{className:"text-xs text-dash-text-muted flex-1",children:t}),c.jsx("span",{className:"mono text-xs text-dash-text-secondary break-all text-right",children:e})]})}function VW({systemInfo:t}){const{t:e}=ee(),n=[{label:"Claude CLI",value:`v${t.cliVersion}`,ok:!!t.cliVersion},{label:"Git",value:t.gitVersion??"not found",ok:!!t.gitVersion},{label:"GitHub CLI",value:t.ghVersion??"not found",ok:t.ghVersion?!0:null},{label:"Node.js",value:t.nodeVersion,ok:!!t.nodeVersion},{label:"Bun",value:t.bunVersion??"not found",ok:!!t.bunVersion},{label:e("envShell"),value:t.shell??"unknown",ok:t.shell?!0:null}],r=[{label:e("osVersion"),value:t.os},{label:e("claudeConfigPath"),value:t.configPath},{label:e("envHomeDir"),value:t.homeDir??"~"}];return t.cpuCores&&r.push({label:e("envCpuCores"),value:`${t.cpuCores} cores`}),t.totalMemoryGb&&r.push({label:e("envTotalMemory"),value:`${t.totalMemoryGb} GB`}),c.jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[c.jsxs("div",{className:"dash-panel p-4 space-y-3",children:[c.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text",children:"Health Check"}),c.jsx("div",{className:"space-y-1.5",children:n.map(s=>c.jsx(Tv,{label:s.label,value:s.value,ok:s.ok},s.label))})]}),c.jsxs("div",{className:"dash-panel p-4 space-y-3",children:[c.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text",children:e("environment")}),c.jsx("div",{className:"space-y-1.5",children:r.map(s=>c.jsx(Tv,{label:s.label,value:s.value,ok:null},s.label))})]})]})}const Ko=({label:t,value:e,activeValue:n,onClick:r})=>{const s=e===n;return c.jsx("button",{type:"button",onClick:r,"aria-pressed":s,className:`dash-focus-ring px-2.5 py-1.5 rounded-lg text-[11px] font-semibold border transition-colors ${s?"border-dash-accent/30 bg-dash-accent-subtle text-dash-accent":"border-dash-border bg-dash-surface text-dash-text-muted hover:text-dash-text hover:bg-dash-surface-hover"}`,children:t})},_f="~/.claude/settings.json",qc="{}",HW=()=>{const{t}=ee(),[e,n]=g.useState(!0),[r,s]=g.useState(_f),[i,o]=g.useState(qc),[a,l]=g.useState(qc),[d,u]=g.useState(0),[h,f]=g.useState(!1),[p,m]=g.useState(!1),[x,b]=g.useState(null),[y,k]=g.useState("idle"),[v,w]=g.useState(null),[C,j]=g.useState(null);g.useEffect(()=>{let N=!1;return(async()=>{n(!0),m(!1),b(null);try{const I=await LP();if(N)return;const O=JSON.stringify(I.settings??{},null,2);s(I.path||_f),f(!!I.exists),o(O),l(O),w(null),b(null)}catch(I){if(N)return;const O=I instanceof Error?I.message:String(I);console.error("[SystemSettingsJsonCard] fetchSettingsFile failed:",I),b(O),m(!0),f(!1),s(_f),o(qc),l(qc)}finally{N||n(!1)}})(),()=>{N=!0}},[]);const S=N=>{l(N),j(null);try{JSON.parse(N),w(null)}catch(T){w(T instanceof Error?T.message:"Invalid JSON")}},P=()=>{l(i),w(null),j(null),k("idle")},D=async()=>{if(!(e||v)){k("saving"),j(null);try{const N=JSON.parse(a),T=JSON.stringify(N,null,2),I=await RP(N);o(T),l(T),f(!0),k("saved"),j(I.backupPath?`${t("settingsBackupSaved")}: ${I.backupPath}`:t("saved")),setTimeout(()=>k("idle"),2e3)}catch(N){k("error"),j(N instanceof Error?N.message:t("saveFailed")),setTimeout(()=>k("idle"),3e3)}}},A=a!==i;return c.jsxs("section",{className:"h-full min-h-0 flex flex-col rounded-xl border border-dash-border bg-dash-surface p-3 shadow-sm",children:[c.jsxs("div",{className:"mb-2 flex items-end justify-between gap-3 px-1",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text",children:t("settingsJsonHeading")}),c.jsx("p",{className:"mono text-[11px] text-dash-text-muted truncate",children:r})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{type:"button",onClick:P,disabled:e||!A||y==="saving",className:"px-3 py-1.5 rounded-lg bg-dash-surface text-xs font-bold text-dash-text-secondary hover:bg-dash-surface-hover transition-colors border border-dash-border disabled:opacity-50 disabled:cursor-not-allowed",children:t("discard")}),c.jsx("button",{type:"button",onClick:D,disabled:e||y==="saving"||!!v||!A,className:`px-3 py-1.5 rounded-lg text-xs font-bold transition-all tracking-widest uppercase disabled:opacity-50 disabled:cursor-not-allowed ${y==="saved"?"bg-green-500 text-white shadow-lg shadow-green-500/20":y==="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(y==="saving"?"saving":y==="saved"?"saved":y==="error"?"saveFailed":"saveChanges")})]})]}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(Og,{width:100,isLoading:e,jsonText:a,cursorLine:d,syntaxError:v,onChange:S,onCursorLineChange:u})}),C&&c.jsx("p",{className:`mt-2 px-1 text-xs ${y==="error"?"text-red-500":"text-dash-text-muted"}`,children:C}),!e&&!p&&!h&&c.jsx("p",{className:"mt-2 px-1 text-xs text-dash-text-muted",children:t("settingsJsonMissing")}),!e&&p&&c.jsxs("div",{className:"mt-2 px-1 text-xs text-red-500",children:[c.jsx("p",{children:t("settingsJsonLoadFailed")}),x&&c.jsxs("p",{className:"mt-1 break-words",children:[t("settingsLoadFailedDetail")," ",x]})]})]})},Lv=()=>{const[t,e]=g.useState({}),{sizes:n,isDragging:r,startDrag:s}=Eg({storageKey:"claudekit-global-system-panels",defaultSizes:[70,30],minSizes:[45,20]});return g.useEffect(()=>{$P().then(e).catch(()=>e({}))},[]),c.jsxs("div",{className:"h-full flex min-h-0",children:[c.jsx("div",{style:{width:`${n[0]}%`},className:"min-w-0 h-full overflow-auto pr-1",children:c.jsx(zW,{metadata:t})}),c.jsx(_n,{direction:"horizontal",isDragging:r,onMouseDown:i=>s(0,i)}),c.jsx("div",{style:{width:`${n[1]}%`},className:"min-w-0 h-full overflow-hidden",children:c.jsx(HW,{})})]})},WW={beginner:"workflowComplexityBeginner",intermediate:"workflowComplexityIntermediate",advanced:"workflowComplexityAdvanced"},UW={beginner:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300",intermediate:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300",advanced:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300"},Rv=({complexity:t})=>{const{t:e}=ee();return c.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded-full ${UW[t]}`,children:e(WW[t])})};function vt(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,r;n<t.length;n++)(r=vt(t[n]))!==""&&(e+=(e&&" ")+r);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}var KW={value:()=>{}};function ah(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new vd(n)}function vd(t){this._=t}function GW(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",s=n.indexOf(".");if(s>=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}vd.prototype=ah.prototype={constructor:vd,on:function(t,e){var n=this._,r=GW(t+"",n),s,i=-1,o=r.length;if(arguments.length<2){for(;++i<o;)if((s=(t=r[i]).type)&&(s=qW(n[s],t.name)))return s;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<o;)if(s=(t=r[i]).type)n[s]=_v(n[s],t.name,e);else if(e==null)for(s in n)n[s]=_v(n[s],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new vd(t)},call:function(t,e){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,i;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=this._[t],r=0,s=i.length;r<s;++r)i[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],s=0,i=r.length;s<i;++s)r[s].value.apply(e,n)}};function qW(t,e){for(var n=0,r=t.length,s;n<r;++n)if((s=t[n]).name===e)return s.value}function _v(t,e,n){for(var r=0,s=t.length;r<s;++r)if(t[r].name===e){t[r]=KW,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var fm="http://www.w3.org/1999/xhtml";const Iv={svg:"http://www.w3.org/2000/svg",xhtml:fm,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function lh(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),Iv.hasOwnProperty(e)?{space:Iv[e],local:t}:t}function YW(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===fm&&e.documentElement.namespaceURI===fm?e.createElement(t):e.createElementNS(n,t)}}function XW(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function gj(t){var e=lh(t);return(e.local?XW:YW)(e)}function ZW(){}function Xg(t){return t==null?ZW:function(){return this.querySelector(t)}}function QW(t){typeof t!="function"&&(t=Xg(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s<n;++s)for(var i=e[s],o=i.length,a=r[s]=new Array(o),l,d,u=0;u<o;++u)(l=i[u])&&(d=t.call(l,l.__data__,u,i))&&("__data__"in l&&(d.__data__=l.__data__),a[u]=d);return new kn(r,this._parents)}function JW(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function eU(){return[]}function xj(t){return t==null?eU:function(){return this.querySelectorAll(t)}}function tU(t){return function(){return JW(t.apply(this,arguments))}}function nU(t){typeof t=="function"?t=tU(t):t=xj(t);for(var e=this._groups,n=e.length,r=[],s=[],i=0;i<n;++i)for(var o=e[i],a=o.length,l,d=0;d<a;++d)(l=o[d])&&(r.push(t.call(l,l.__data__,d,o)),s.push(l));return new kn(r,s)}function bj(t){return function(){return this.matches(t)}}function yj(t){return function(e){return e.matches(t)}}var rU=Array.prototype.find;function sU(t){return function(){return rU.call(this.children,t)}}function iU(){return this.firstElementChild}function oU(t){return this.select(t==null?iU:sU(typeof t=="function"?t:yj(t)))}var aU=Array.prototype.filter;function lU(){return Array.from(this.children)}function cU(t){return function(){return aU.call(this.children,t)}}function dU(t){return this.selectAll(t==null?lU:cU(typeof t=="function"?t:yj(t)))}function uU(t){typeof t!="function"&&(t=bj(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s<n;++s)for(var i=e[s],o=i.length,a=r[s]=[],l,d=0;d<o;++d)(l=i[d])&&t.call(l,l.__data__,d,i)&&a.push(l);return new kn(r,this._parents)}function vj(t){return new Array(t.length)}function hU(){return new kn(this._enter||this._groups.map(vj),this._parents)}function bu(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}bu.prototype={constructor:bu,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function fU(t){return function(){return t}}function pU(t,e,n,r,s,i){for(var o=0,a,l=e.length,d=i.length;o<d;++o)(a=e[o])?(a.__data__=i[o],r[o]=a):n[o]=new bu(t,i[o]);for(;o<l;++o)(a=e[o])&&(s[o]=a)}function mU(t,e,n,r,s,i,o){var a,l,d=new Map,u=e.length,h=i.length,f=new Array(u),p;for(a=0;a<u;++a)(l=e[a])&&(f[a]=p=o.call(l,l.__data__,a,e)+"",d.has(p)?s[a]=l:d.set(p,l));for(a=0;a<h;++a)p=o.call(t,i[a],a,i)+"",(l=d.get(p))?(r[a]=l,l.__data__=i[a],d.delete(p)):n[a]=new bu(t,i[a]);for(a=0;a<u;++a)(l=e[a])&&d.get(f[a])===l&&(s[a]=l)}function gU(t){return t.__data__}function xU(t,e){if(!arguments.length)return Array.from(this,gU);var n=e?mU:pU,r=this._parents,s=this._groups;typeof t!="function"&&(t=fU(t));for(var i=s.length,o=new Array(i),a=new Array(i),l=new Array(i),d=0;d<i;++d){var u=r[d],h=s[d],f=h.length,p=bU(t.call(u,u&&u.__data__,d,r)),m=p.length,x=a[d]=new Array(m),b=o[d]=new Array(m),y=l[d]=new Array(f);n(u,h,x,b,y,p,e);for(var k=0,v=0,w,C;k<m;++k)if(w=x[k]){for(k>=v&&(v=k+1);!(C=b[v])&&++v<m;);w._next=C||null}}return o=new kn(o,r),o._enter=a,o._exit=l,o}function bU(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function yU(){return new kn(this._exit||this._groups.map(vj),this._parents)}function vU(t,e,n){var r=this.enter(),s=this,i=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(s=e(s),s&&(s=s.selection())),n==null?i.remove():n(i),r&&s?r.merge(s).order():s}function wU(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,s=n.length,i=r.length,o=Math.min(s,i),a=new Array(s),l=0;l<o;++l)for(var d=n[l],u=r[l],h=d.length,f=a[l]=new Array(h),p,m=0;m<h;++m)(p=d[m]||u[m])&&(f[m]=p);for(;l<s;++l)a[l]=n[l];return new kn(a,this._parents)}function kU(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],s=r.length-1,i=r[s],o;--s>=0;)(o=r[s])&&(i&&o.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(o,i),i=o);return this}function SU(t){t||(t=CU);function e(h,f){return h&&f?t(h.__data__,f.__data__):!h-!f}for(var n=this._groups,r=n.length,s=new Array(r),i=0;i<r;++i){for(var o=n[i],a=o.length,l=s[i]=new Array(a),d,u=0;u<a;++u)(d=o[u])&&(l[u]=d);l.sort(e)}return new kn(s,this._parents).order()}function CU(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function jU(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function NU(){return Array.from(this)}function PU(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],s=0,i=r.length;s<i;++s){var o=r[s];if(o)return o}return null}function OU(){let t=0;for(const e of this)++t;return t}function EU(){return!this.node()}function DU(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var s=e[n],i=0,o=s.length,a;i<o;++i)(a=s[i])&&t.call(a,a.__data__,i,s);return this}function MU(t){return function(){this.removeAttribute(t)}}function AU(t){return function(){this.removeAttributeNS(t.space,t.local)}}function TU(t,e){return function(){this.setAttribute(t,e)}}function LU(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function RU(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function _U(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function IU(t,e){var n=lh(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?AU:MU:typeof e=="function"?n.local?_U:RU:n.local?LU:TU)(n,e))}function wj(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function $U(t){return function(){this.style.removeProperty(t)}}function BU(t,e,n){return function(){this.style.setProperty(t,e,n)}}function FU(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function zU(t,e,n){return arguments.length>1?this.each((e==null?$U:typeof e=="function"?FU:BU)(t,e,n??"")):co(this.node(),t)}function co(t,e){return t.style.getPropertyValue(e)||wj(t).getComputedStyle(t,null).getPropertyValue(e)}function VU(t){return function(){delete this[t]}}function HU(t,e){return function(){this[t]=e}}function WU(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function UU(t,e){return arguments.length>1?this.each((e==null?VU:typeof e=="function"?WU:HU)(t,e)):this.node()[t]}function kj(t){return t.trim().split(/^|\s+/)}function Zg(t){return t.classList||new Sj(t)}function Sj(t){this._node=t,this._names=kj(t.getAttribute("class")||"")}Sj.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Cj(t,e){for(var n=Zg(t),r=-1,s=e.length;++r<s;)n.add(e[r])}function jj(t,e){for(var n=Zg(t),r=-1,s=e.length;++r<s;)n.remove(e[r])}function KU(t){return function(){Cj(this,t)}}function GU(t){return function(){jj(this,t)}}function qU(t,e){return function(){(e.apply(this,arguments)?Cj:jj)(this,t)}}function YU(t,e){var n=kj(t+"");if(arguments.length<2){for(var r=Zg(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof e=="function"?qU:e?KU:GU)(n,e))}function XU(){this.textContent=""}function ZU(t){return function(){this.textContent=t}}function QU(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function JU(t){return arguments.length?this.each(t==null?XU:(typeof t=="function"?QU:ZU)(t)):this.node().textContent}function eK(){this.innerHTML=""}function tK(t){return function(){this.innerHTML=t}}function nK(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function rK(t){return arguments.length?this.each(t==null?eK:(typeof t=="function"?nK:tK)(t)):this.node().innerHTML}function sK(){this.nextSibling&&this.parentNode.appendChild(this)}function iK(){return this.each(sK)}function oK(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function aK(){return this.each(oK)}function lK(t){var e=typeof t=="function"?t:gj(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function cK(){return null}function dK(t,e){var n=typeof t=="function"?t:gj(t),r=e==null?cK:typeof e=="function"?e:Xg(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function uK(){var t=this.parentNode;t&&t.removeChild(this)}function hK(){return this.each(uK)}function fK(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function pK(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function mK(t){return this.select(t?pK:fK)}function gK(t){return arguments.length?this.property("__data__",t):this.node().__data__}function xK(t){return function(e){t.call(this,e,this.__data__)}}function bK(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function yK(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,s=e.length,i;n<s;++n)i=e[n],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e[++r]=i;++r?e.length=r:delete this.__on}}}function vK(t,e,n){return function(){var r=this.__on,s,i=xK(e);if(r){for(var o=0,a=r.length;o<a;++o)if((s=r[o]).type===t.type&&s.name===t.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=i,s.options=n),s.value=e;return}}this.addEventListener(t.type,i,n),s={type:t.type,name:t.name,value:e,listener:i,options:n},r?r.push(s):this.__on=[s]}}function wK(t,e,n){var r=bK(t+""),s,i=r.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,d=a.length,u;l<d;++l)for(s=0,u=a[l];s<i;++s)if((o=r[s]).type===u.type&&o.name===u.name)return u.value}return}for(a=e?vK:yK,s=0;s<i;++s)this.each(a(r[s],e,n));return this}function Nj(t,e,n){var r=wj(t),s=r.CustomEvent;typeof s=="function"?s=new s(e,n):(s=r.document.createEvent("Event"),n?(s.initEvent(e,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(e,!1,!1)),t.dispatchEvent(s)}function kK(t,e){return function(){return Nj(this,t,e)}}function SK(t,e){return function(){return Nj(this,t,e.apply(this,arguments))}}function CK(t,e){return this.each((typeof e=="function"?SK:kK)(t,e))}function*jK(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],s=0,i=r.length,o;s<i;++s)(o=r[s])&&(yield o)}var Pj=[null];function kn(t,e){this._groups=t,this._parents=e}function lc(){return new kn([[document.documentElement]],Pj)}function NK(){return this}kn.prototype=lc.prototype={constructor:kn,select:QW,selectAll:nU,selectChild:oU,selectChildren:dU,filter:uU,data:xU,enter:hU,exit:yU,join:vU,merge:wU,selection:NK,order:kU,sort:SU,call:jU,nodes:NU,node:PU,size:OU,empty:EU,each:DU,attr:IU,style:zU,property:UU,classed:YU,text:JU,html:rK,raise:iK,lower:aK,append:lK,insert:dK,remove:hK,clone:mK,datum:gK,on:wK,dispatch:CK,[Symbol.iterator]:jK};function vn(t){return typeof t=="string"?new kn([[document.querySelector(t)]],[document.documentElement]):new kn([[t]],Pj)}function PK(t){let e;for(;e=t.sourceEvent;)t=e;return t}function Kn(t,e){if(t=PK(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var s=e.getBoundingClientRect();return[t.clientX-s.left-e.clientLeft,t.clientY-s.top-e.clientTop]}}return[t.pageX,t.pageY]}const OK={passive:!1},El={capture:!0,passive:!1};function If(t){t.stopImmediatePropagation()}function Gi(t){t.preventDefault(),t.stopImmediatePropagation()}function Oj(t){var e=t.document.documentElement,n=vn(t).on("dragstart.drag",Gi,El);"onselectstart"in e?n.on("selectstart.drag",Gi,El):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Ej(t,e){var n=t.document.documentElement,r=vn(t).on("dragstart.drag",null);e&&(r.on("click.drag",Gi,El),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Yc=t=>()=>t;function pm(t,{sourceEvent:e,subject:n,target:r,identifier:s,active:i,x:o,y:a,dx:l,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:u}})}pm.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function EK(t){return!t.ctrlKey&&!t.button}function DK(){return this.parentNode}function MK(t,e){return e??{x:t.x,y:t.y}}function AK(){return navigator.maxTouchPoints||"ontouchstart"in this}function Dj(){var t=EK,e=DK,n=MK,r=AK,s={},i=ah("start","drag","end"),o=0,a,l,d,u,h=0;function f(w){w.on("mousedown.drag",p).filter(r).on("touchstart.drag",b).on("touchmove.drag",y,OK).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(w,C){if(!(u||!t.call(this,w,C))){var j=v(this,e.call(this,w,C),w,C,"mouse");j&&(vn(w.view).on("mousemove.drag",m,El).on("mouseup.drag",x,El),Oj(w.view),If(w),d=!1,a=w.clientX,l=w.clientY,j("start",w))}}function m(w){if(Gi(w),!d){var C=w.clientX-a,j=w.clientY-l;d=C*C+j*j>h}s.mouse("drag",w)}function x(w){vn(w.view).on("mousemove.drag mouseup.drag",null),Ej(w.view,d),Gi(w),s.mouse("end",w)}function b(w,C){if(t.call(this,w,C)){var j=w.changedTouches,S=e.call(this,w,C),P=j.length,D,A;for(D=0;D<P;++D)(A=v(this,S,w,C,j[D].identifier,j[D]))&&(If(w),A("start",w,j[D]))}}function y(w){var C=w.changedTouches,j=C.length,S,P;for(S=0;S<j;++S)(P=s[C[S].identifier])&&(Gi(w),P("drag",w,C[S]))}function k(w){var C=w.changedTouches,j=C.length,S,P;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),S=0;S<j;++S)(P=s[C[S].identifier])&&(If(w),P("end",w,C[S]))}function v(w,C,j,S,P,D){var A=i.copy(),N=Kn(D||j,C),T,I,O;if((O=n.call(w,new pm("beforestart",{sourceEvent:j,target:f,identifier:P,active:o,x:N[0],y:N[1],dx:0,dy:0,dispatch:A}),S))!=null)return T=O.x-N[0]||0,I=O.y-N[1]||0,function E(M,R,_){var $=N,F;switch(M){case"start":s[P]=E,F=o++;break;case"end":delete s[P],--o;case"drag":N=Kn(_||R,C),F=o;break}A.call(M,w,new pm(M,{sourceEvent:R,subject:O,target:f,identifier:P,active:F,x:N[0]+T,y:N[1]+I,dx:N[0]-$[0],dy:N[1]-$[1],dispatch:A}),S)}}return f.filter=function(w){return arguments.length?(t=typeof w=="function"?w:Yc(!!w),f):t},f.container=function(w){return arguments.length?(e=typeof w=="function"?w:Yc(w),f):e},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:Yc(w),f):n},f.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:Yc(!!w),f):r},f.on=function(){var w=i.on.apply(i,arguments);return w===i?f:w},f.clickDistance=function(w){return arguments.length?(h=(w=+w)*w,f):Math.sqrt(h)},f}function Qg(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Mj(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function cc(){}var Dl=.7,yu=1/Dl,qi="\\s*([+-]?\\d+)\\s*",Ml="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Cr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",TK=/^#([0-9a-f]{3,8})$/,LK=new RegExp(`^rgb\\(${qi},${qi},${qi}\\)$`),RK=new RegExp(`^rgb\\(${Cr},${Cr},${Cr}\\)$`),_K=new RegExp(`^rgba\\(${qi},${qi},${qi},${Ml}\\)$`),IK=new RegExp(`^rgba\\(${Cr},${Cr},${Cr},${Ml}\\)$`),$K=new RegExp(`^hsl\\(${Ml},${Cr},${Cr}\\)$`),BK=new RegExp(`^hsla\\(${Ml},${Cr},${Cr},${Ml}\\)$`),$v={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Qg(cc,oi,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Bv,formatHex:Bv,formatHex8:FK,formatHsl:zK,formatRgb:Fv,toString:Fv});function Bv(){return this.rgb().formatHex()}function FK(){return this.rgb().formatHex8()}function zK(){return Aj(this).formatHsl()}function Fv(){return this.rgb().formatRgb()}function oi(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=TK.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?zv(e):n===3?new hn(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Xc(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Xc(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=LK.exec(t))?new hn(e[1],e[2],e[3],1):(e=RK.exec(t))?new hn(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=_K.exec(t))?Xc(e[1],e[2],e[3],e[4]):(e=IK.exec(t))?Xc(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=$K.exec(t))?Wv(e[1],e[2]/100,e[3]/100,1):(e=BK.exec(t))?Wv(e[1],e[2]/100,e[3]/100,e[4]):$v.hasOwnProperty(t)?zv($v[t]):t==="transparent"?new hn(NaN,NaN,NaN,0):null}function zv(t){return new hn(t>>16&255,t>>8&255,t&255,1)}function Xc(t,e,n,r){return r<=0&&(t=e=n=NaN),new hn(t,e,n,r)}function VK(t){return t instanceof cc||(t=oi(t)),t?(t=t.rgb(),new hn(t.r,t.g,t.b,t.opacity)):new hn}function mm(t,e,n,r){return arguments.length===1?VK(t):new hn(t,e,n,r??1)}function hn(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}Qg(hn,mm,Mj(cc,{brighter(t){return t=t==null?yu:Math.pow(yu,t),new hn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Dl:Math.pow(Dl,t),new hn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new hn(Js(this.r),Js(this.g),Js(this.b),vu(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Vv,formatHex:Vv,formatHex8:HK,formatRgb:Hv,toString:Hv}));function Vv(){return`#${Xs(this.r)}${Xs(this.g)}${Xs(this.b)}`}function HK(){return`#${Xs(this.r)}${Xs(this.g)}${Xs(this.b)}${Xs((isNaN(this.opacity)?1:this.opacity)*255)}`}function Hv(){const t=vu(this.opacity);return`${t===1?"rgb(":"rgba("}${Js(this.r)}, ${Js(this.g)}, ${Js(this.b)}${t===1?")":`, ${t})`}`}function vu(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Js(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Xs(t){return t=Js(t),(t<16?"0":"")+t.toString(16)}function Wv(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Yn(t,e,n,r)}function Aj(t){if(t instanceof Yn)return new Yn(t.h,t.s,t.l,t.opacity);if(t instanceof cc||(t=oi(t)),!t)return new Yn;if(t instanceof Yn)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,s=Math.min(e,n,r),i=Math.max(e,n,r),o=NaN,a=i-s,l=(i+s)/2;return a?(e===i?o=(n-r)/a+(n<r)*6:n===i?o=(r-e)/a+2:o=(e-n)/a+4,a/=l<.5?i+s:2-i-s,o*=60):a=l>0&&l<1?0:o,new Yn(o,a,l,t.opacity)}function WK(t,e,n,r){return arguments.length===1?Aj(t):new Yn(t,e,n,r??1)}function Yn(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}Qg(Yn,WK,Mj(cc,{brighter(t){return t=t==null?yu:Math.pow(yu,t),new Yn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Dl:Math.pow(Dl,t),new Yn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,s=2*n-r;return new hn($f(t>=240?t-240:t+120,s,r),$f(t,s,r),$f(t<120?t+240:t-120,s,r),this.opacity)},clamp(){return new Yn(Uv(this.h),Zc(this.s),Zc(this.l),vu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=vu(this.opacity);return`${t===1?"hsl(":"hsla("}${Uv(this.h)}, ${Zc(this.s)*100}%, ${Zc(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Uv(t){return t=(t||0)%360,t<0?t+360:t}function Zc(t){return Math.max(0,Math.min(1,t||0))}function $f(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Jg=t=>()=>t;function UK(t,e){return function(n){return t+n*e}}function KK(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function GK(t){return(t=+t)==1?Tj:function(e,n){return n-e?KK(e,n,t):Jg(isNaN(e)?n:e)}}function Tj(t,e){var n=e-t;return n?UK(t,n):Jg(isNaN(t)?e:t)}const wu=function t(e){var n=GK(e);function r(s,i){var o=n((s=mm(s)).r,(i=mm(i)).r),a=n(s.g,i.g),l=n(s.b,i.b),d=Tj(s.opacity,i.opacity);return function(u){return s.r=o(u),s.g=a(u),s.b=l(u),s.opacity=d(u),s+""}}return r.gamma=t,r}(1);function qK(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),s;return function(i){for(s=0;s<n;++s)r[s]=t[s]*(1-i)+e[s]*i;return r}}function YK(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function XK(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,s=new Array(r),i=new Array(n),o;for(o=0;o<r;++o)s[o]=ga(t[o],e[o]);for(;o<n;++o)i[o]=e[o];return function(a){for(o=0;o<r;++o)i[o]=s[o](a);return i}}function ZK(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function pr(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function QK(t,e){var n={},r={},s;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(s in e)s in t?n[s]=ga(t[s],e[s]):r[s]=e[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var gm=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Bf=new RegExp(gm.source,"g");function JK(t){return function(){return t}}function eG(t){return function(e){return t(e)+""}}function Lj(t,e){var n=gm.lastIndex=Bf.lastIndex=0,r,s,i,o=-1,a=[],l=[];for(t=t+"",e=e+"";(r=gm.exec(t))&&(s=Bf.exec(e));)(i=s.index)>n&&(i=e.slice(n,i),a[o]?a[o]+=i:a[++o]=i),(r=r[0])===(s=s[0])?a[o]?a[o]+=s:a[++o]=s:(a[++o]=null,l.push({i:o,x:pr(r,s)})),n=Bf.lastIndex;return n<e.length&&(i=e.slice(n),a[o]?a[o]+=i:a[++o]=i),a.length<2?l[0]?eG(l[0].x):JK(e):(e=l.length,function(d){for(var u=0,h;u<e;++u)a[(h=l[u]).i]=h.x(d);return a.join("")})}function ga(t,e){var n=typeof e,r;return e==null||n==="boolean"?Jg(e):(n==="number"?pr:n==="string"?(r=oi(e))?(e=r,wu):Lj:e instanceof oi?wu:e instanceof Date?ZK:YK(e)?qK:Array.isArray(e)?XK:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?QK:pr)(t,e)}var Kv=180/Math.PI,xm={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Rj(t,e,n,r,s,i){var o,a,l;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,l/=a),t*r<e*n&&(t=-t,e=-e,l=-l,o=-o),{translateX:s,translateY:i,rotate:Math.atan2(e,t)*Kv,skewX:Math.atan(l)*Kv,scaleX:o,scaleY:a}}var Qc;function tG(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?xm:Rj(e.a,e.b,e.c,e.d,e.e,e.f)}function nG(t){return t==null||(Qc||(Qc=document.createElementNS("http://www.w3.org/2000/svg","g")),Qc.setAttribute("transform",t),!(t=Qc.transform.baseVal.consolidate()))?xm:(t=t.matrix,Rj(t.a,t.b,t.c,t.d,t.e,t.f))}function _j(t,e,n,r){function s(d){return d.length?d.pop()+" ":""}function i(d,u,h,f,p,m){if(d!==h||u!==f){var x=p.push("translate(",null,e,null,n);m.push({i:x-4,x:pr(d,h)},{i:x-2,x:pr(u,f)})}else(h||f)&&p.push("translate("+h+e+f+n)}function o(d,u,h,f){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),f.push({i:h.push(s(h)+"rotate(",null,r)-2,x:pr(d,u)})):u&&h.push(s(h)+"rotate("+u+r)}function a(d,u,h,f){d!==u?f.push({i:h.push(s(h)+"skewX(",null,r)-2,x:pr(d,u)}):u&&h.push(s(h)+"skewX("+u+r)}function l(d,u,h,f,p,m){if(d!==h||u!==f){var x=p.push(s(p)+"scale(",null,",",null,")");m.push({i:x-4,x:pr(d,h)},{i:x-2,x:pr(u,f)})}else(h!==1||f!==1)&&p.push(s(p)+"scale("+h+","+f+")")}return function(d,u){var h=[],f=[];return d=t(d),u=t(u),i(d.translateX,d.translateY,u.translateX,u.translateY,h,f),o(d.rotate,u.rotate,h,f),a(d.skewX,u.skewX,h,f),l(d.scaleX,d.scaleY,u.scaleX,u.scaleY,h,f),d=u=null,function(p){for(var m=-1,x=f.length,b;++m<x;)h[(b=f[m]).i]=b.x(p);return h.join("")}}}var rG=_j(tG,"px, ","px)","deg)"),sG=_j(nG,", ",")",")"),iG=1e-12;function Gv(t){return((t=Math.exp(t))+1/t)/2}function oG(t){return((t=Math.exp(t))-1/t)/2}function aG(t){return((t=Math.exp(2*t))-1)/(t+1)}const wd=function t(e,n,r){function s(i,o){var a=i[0],l=i[1],d=i[2],u=o[0],h=o[1],f=o[2],p=u-a,m=h-l,x=p*p+m*m,b,y;if(x<iG)y=Math.log(f/d)/e,b=function(S){return[a+S*p,l+S*m,d*Math.exp(e*S*y)]};else{var k=Math.sqrt(x),v=(f*f-d*d+r*x)/(2*d*n*k),w=(f*f-d*d-r*x)/(2*f*n*k),C=Math.log(Math.sqrt(v*v+1)-v),j=Math.log(Math.sqrt(w*w+1)-w);y=(j-C)/e,b=function(S){var P=S*y,D=Gv(C),A=d/(n*k)*(D*aG(e*P+C)-oG(C));return[a+A*p,l+A*m,d*D/Gv(e*P+C)]}}return b.duration=y*1e3*e/Math.SQRT2,b}return s.rho=function(i){var o=Math.max(.001,+i),a=o*o,l=a*a;return t(o,a,l)},s}(Math.SQRT2,2,4);var uo=0,na=0,Go=0,Ij=1e3,ku,ra,Su=0,ai=0,ch=0,Al=typeof performance=="object"&&performance.now?performance:Date,$j=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function e0(){return ai||($j(lG),ai=Al.now()+ch)}function lG(){ai=0}function Cu(){this._call=this._time=this._next=null}Cu.prototype=Bj.prototype={constructor:Cu,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?e0():+n)+(e==null?0:+e),!this._next&&ra!==this&&(ra?ra._next=this:ku=this,ra=this),this._call=t,this._time=n,bm()},stop:function(){this._call&&(this._call=null,this._time=1/0,bm())}};function Bj(t,e,n){var r=new Cu;return r.restart(t,e,n),r}function cG(){e0(),++uo;for(var t=ku,e;t;)(e=ai-t._time)>=0&&t._call.call(void 0,e),t=t._next;--uo}function qv(){ai=(Su=Al.now())+ch,uo=na=0;try{cG()}finally{uo=0,uG(),ai=0}}function dG(){var t=Al.now(),e=t-Su;e>Ij&&(ch-=e,Su=t)}function uG(){for(var t,e=ku,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:ku=n);ra=t,bm(r)}function bm(t){if(!uo){na&&(na=clearTimeout(na));var e=t-ai;e>24?(t<1/0&&(na=setTimeout(qv,t-Al.now()-ch)),Go&&(Go=clearInterval(Go))):(Go||(Su=Al.now(),Go=setInterval(dG,Ij)),uo=1,$j(qv))}}function Yv(t,e,n){var r=new Cu;return e=e==null?0:+e,r.restart(s=>{r.stop(),t(s+e)},e,n),r}var hG=ah("start","end","cancel","interrupt"),fG=[],Fj=0,Xv=1,ym=2,kd=3,Zv=4,vm=5,Sd=6;function dh(t,e,n,r,s,i){var o=t.__transition;if(!o)t.__transition={};else if(n in o)return;pG(t,n,{name:e,index:r,group:s,on:hG,tween:fG,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Fj})}function t0(t,e){var n=ar(t,e);if(n.state>Fj)throw new Error("too late; already scheduled");return n}function Mr(t,e){var n=ar(t,e);if(n.state>kd)throw new Error("too late; already running");return n}function ar(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function pG(t,e,n){var r=t.__transition,s;r[e]=n,n.timer=Bj(i,0,n.time);function i(d){n.state=Xv,n.timer.restart(o,n.delay,n.time),n.delay<=d&&o(d-n.delay)}function o(d){var u,h,f,p;if(n.state!==Xv)return l();for(u in r)if(p=r[u],p.name===n.name){if(p.state===kd)return Yv(o);p.state===Zv?(p.state=Sd,p.timer.stop(),p.on.call("interrupt",t,t.__data__,p.index,p.group),delete r[u]):+u<e&&(p.state=Sd,p.timer.stop(),p.on.call("cancel",t,t.__data__,p.index,p.group),delete r[u])}if(Yv(function(){n.state===kd&&(n.state=Zv,n.timer.restart(a,n.delay,n.time),a(d))}),n.state=ym,n.on.call("start",t,t.__data__,n.index,n.group),n.state===ym){for(n.state=kd,s=new Array(f=n.tween.length),u=0,h=-1;u<f;++u)(p=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(s[++h]=p);s.length=h+1}}function a(d){for(var u=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(l),n.state=vm,1),h=-1,f=s.length;++h<f;)s[h].call(t,u);n.state===vm&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){n.state=Sd,n.timer.stop(),delete r[e];for(var d in r)return;delete t.__transition}}function Cd(t,e){var n=t.__transition,r,s,i=!0,o;if(n){e=e==null?null:e+"";for(o in n){if((r=n[o]).name!==e){i=!1;continue}s=r.state>ym&&r.state<vm,r.state=Sd,r.timer.stop(),r.on.call(s?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[o]}i&&delete t.__transition}}function mG(t){return this.each(function(){Cd(this,t)})}function gG(t,e){var n,r;return function(){var s=Mr(this,t),i=s.tween;if(i!==n){r=n=i;for(var o=0,a=r.length;o<a;++o)if(r[o].name===e){r=r.slice(),r.splice(o,1);break}}s.tween=r}}function xG(t,e,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=Mr(this,t),o=i.tween;if(o!==r){s=(r=o).slice();for(var a={name:e,value:n},l=0,d=s.length;l<d;++l)if(s[l].name===e){s[l]=a;break}l===d&&s.push(a)}i.tween=s}}function bG(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=ar(this.node(),n).tween,s=0,i=r.length,o;s<i;++s)if((o=r[s]).name===t)return o.value;return null}return this.each((e==null?gG:xG)(n,t,e))}function n0(t,e,n){var r=t._id;return t.each(function(){var s=Mr(this,r);(s.value||(s.value={}))[e]=n.apply(this,arguments)}),function(s){return ar(s,r).value[e]}}function zj(t,e){var n;return(typeof e=="number"?pr:e instanceof oi?wu:(n=oi(e))?(e=n,wu):Lj)(t,e)}function yG(t){return function(){this.removeAttribute(t)}}function vG(t){return function(){this.removeAttributeNS(t.space,t.local)}}function wG(t,e,n){var r,s=n+"",i;return function(){var o=this.getAttribute(t);return o===s?null:o===r?i:i=e(r=o,n)}}function kG(t,e,n){var r,s=n+"",i;return function(){var o=this.getAttributeNS(t.space,t.local);return o===s?null:o===r?i:i=e(r=o,n)}}function SG(t,e,n){var r,s,i;return function(){var o,a=n(this),l;return a==null?void this.removeAttribute(t):(o=this.getAttribute(t),l=a+"",o===l?null:o===r&&l===s?i:(s=l,i=e(r=o,a)))}}function CG(t,e,n){var r,s,i;return function(){var o,a=n(this),l;return a==null?void this.removeAttributeNS(t.space,t.local):(o=this.getAttributeNS(t.space,t.local),l=a+"",o===l?null:o===r&&l===s?i:(s=l,i=e(r=o,a)))}}function jG(t,e){var n=lh(t),r=n==="transform"?sG:zj;return this.attrTween(t,typeof e=="function"?(n.local?CG:SG)(n,r,n0(this,"attr."+t,e)):e==null?(n.local?vG:yG)(n):(n.local?kG:wG)(n,r,e))}function NG(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function PG(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function OG(t,e){var n,r;function s(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&PG(t,i)),n}return s._value=e,s}function EG(t,e){var n,r;function s(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&NG(t,i)),n}return s._value=e,s}function DG(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=lh(t);return this.tween(n,(r.local?OG:EG)(r,e))}function MG(t,e){return function(){t0(this,t).delay=+e.apply(this,arguments)}}function AG(t,e){return e=+e,function(){t0(this,t).delay=e}}function TG(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?MG:AG)(e,t)):ar(this.node(),e).delay}function LG(t,e){return function(){Mr(this,t).duration=+e.apply(this,arguments)}}function RG(t,e){return e=+e,function(){Mr(this,t).duration=e}}function _G(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?LG:RG)(e,t)):ar(this.node(),e).duration}function IG(t,e){if(typeof e!="function")throw new Error;return function(){Mr(this,t).ease=e}}function $G(t){var e=this._id;return arguments.length?this.each(IG(e,t)):ar(this.node(),e).ease}function BG(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;Mr(this,t).ease=n}}function FG(t){if(typeof t!="function")throw new Error;return this.each(BG(this._id,t))}function zG(t){typeof t!="function"&&(t=bj(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s<n;++s)for(var i=e[s],o=i.length,a=r[s]=[],l,d=0;d<o;++d)(l=i[d])&&t.call(l,l.__data__,d,i)&&a.push(l);return new qr(r,this._parents,this._name,this._id)}function VG(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,s=n.length,i=Math.min(r,s),o=new Array(r),a=0;a<i;++a)for(var l=e[a],d=n[a],u=l.length,h=o[a]=new Array(u),f,p=0;p<u;++p)(f=l[p]||d[p])&&(h[p]=f);for(;a<r;++a)o[a]=e[a];return new qr(o,this._parents,this._name,this._id)}function HG(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function WG(t,e,n){var r,s,i=HG(e)?t0:Mr;return function(){var o=i(this,t),a=o.on;a!==r&&(s=(r=a).copy()).on(e,n),o.on=s}}function UG(t,e){var n=this._id;return arguments.length<2?ar(this.node(),n).on.on(t):this.each(WG(n,t,e))}function KG(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function GG(){return this.on("end.remove",KG(this._id))}function qG(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Xg(t));for(var r=this._groups,s=r.length,i=new Array(s),o=0;o<s;++o)for(var a=r[o],l=a.length,d=i[o]=new Array(l),u,h,f=0;f<l;++f)(u=a[f])&&(h=t.call(u,u.__data__,f,a))&&("__data__"in u&&(h.__data__=u.__data__),d[f]=h,dh(d[f],e,n,f,d,ar(u,n)));return new qr(i,this._parents,e,n)}function YG(t){var e=this._name,n=this._id;typeof t!="function"&&(t=xj(t));for(var r=this._groups,s=r.length,i=[],o=[],a=0;a<s;++a)for(var l=r[a],d=l.length,u,h=0;h<d;++h)if(u=l[h]){for(var f=t.call(u,u.__data__,h,l),p,m=ar(u,n),x=0,b=f.length;x<b;++x)(p=f[x])&&dh(p,e,n,x,f,m);i.push(f),o.push(u)}return new qr(i,o,e,n)}var XG=lc.prototype.constructor;function ZG(){return new XG(this._groups,this._parents)}function QG(t,e){var n,r,s;return function(){var i=co(this,t),o=(this.style.removeProperty(t),co(this,t));return i===o?null:i===n&&o===r?s:s=e(n=i,r=o)}}function Vj(t){return function(){this.style.removeProperty(t)}}function JG(t,e,n){var r,s=n+"",i;return function(){var o=co(this,t);return o===s?null:o===r?i:i=e(r=o,n)}}function eq(t,e,n){var r,s,i;return function(){var o=co(this,t),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(t),co(this,t))),o===l?null:o===r&&l===s?i:(s=l,i=e(r=o,a))}}function tq(t,e){var n,r,s,i="style."+e,o="end."+i,a;return function(){var l=Mr(this,t),d=l.on,u=l.value[i]==null?a||(a=Vj(e)):void 0;(d!==n||s!==u)&&(r=(n=d).copy()).on(o,s=u),l.on=r}}function nq(t,e,n){var r=(t+="")=="transform"?rG:zj;return e==null?this.styleTween(t,QG(t,r)).on("end.style."+t,Vj(t)):typeof e=="function"?this.styleTween(t,eq(t,r,n0(this,"style."+t,e))).each(tq(this._id,t)):this.styleTween(t,JG(t,r,e),n).on("end.style."+t,null)}function rq(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function sq(t,e,n){var r,s;function i(){var o=e.apply(this,arguments);return o!==s&&(r=(s=o)&&rq(t,o,n)),r}return i._value=e,i}function iq(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,sq(t,e,n??""))}function oq(t){return function(){this.textContent=t}}function aq(t){return function(){var e=t(this);this.textContent=e??""}}function lq(t){return this.tween("text",typeof t=="function"?aq(n0(this,"text",t)):oq(t==null?"":t+""))}function cq(t){return function(e){this.textContent=t.call(this,e)}}function dq(t){var e,n;function r(){var s=t.apply(this,arguments);return s!==n&&(e=(n=s)&&cq(s)),e}return r._value=t,r}function uq(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,dq(t))}function hq(){for(var t=this._name,e=this._id,n=Hj(),r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],a=o.length,l,d=0;d<a;++d)if(l=o[d]){var u=ar(l,e);dh(l,t,n,d,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new qr(r,this._parents,t,n)}function fq(){var t,e,n=this,r=n._id,s=n.size();return new Promise(function(i,o){var a={value:o},l={value:function(){--s===0&&i()}};n.each(function(){var d=Mr(this,r),u=d.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(l)),d.on=e}),s===0&&i()})}var pq=0;function qr(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Hj(){return++pq}var Ir=lc.prototype;qr.prototype={constructor:qr,select:qG,selectAll:YG,selectChild:Ir.selectChild,selectChildren:Ir.selectChildren,filter:zG,merge:VG,selection:ZG,transition:hq,call:Ir.call,nodes:Ir.nodes,node:Ir.node,size:Ir.size,empty:Ir.empty,each:Ir.each,on:UG,attr:jG,attrTween:DG,style:nq,styleTween:iq,text:lq,textTween:uq,remove:GG,tween:bG,delay:TG,duration:_G,ease:$G,easeVarying:FG,end:fq,[Symbol.iterator]:Ir[Symbol.iterator]};function mq(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var gq={time:null,delay:0,duration:250,ease:mq};function xq(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function bq(t){var e,n;t instanceof qr?(e=t._id,t=t._name):(e=Hj(),(n=gq).time=e0(),t=t==null?null:t+"");for(var r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],a=o.length,l,d=0;d<a;++d)(l=o[d])&&dh(l,t,e,d,o,n||xq(l,e));return new qr(r,this._parents,t,e)}lc.prototype.interrupt=mG;lc.prototype.transition=bq;const Jc=t=>()=>t;function yq(t,{sourceEvent:e,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function Hr(t,e,n){this.k=t,this.x=e,this.y=n}Hr.prototype={constructor:Hr,scale:function(t){return t===1?this:new Hr(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Hr(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var uh=new Hr(1,0,0);Wj.prototype=Hr.prototype;function Wj(t){for(;!t.__zoom;)if(!(t=t.parentNode))return uh;return t.__zoom}function Ff(t){t.stopImmediatePropagation()}function qo(t){t.preventDefault(),t.stopImmediatePropagation()}function vq(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function wq(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Qv(){return this.__zoom||uh}function kq(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Sq(){return navigator.maxTouchPoints||"ontouchstart"in this}function Cq(t,e,n){var r=t.invertX(e[0][0])-n[0][0],s=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],o=t.invertY(e[1][1])-n[1][1];return t.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o))}function Uj(){var t=vq,e=wq,n=Cq,r=kq,s=Sq,i=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],a=250,l=wd,d=ah("start","zoom","end"),u,h,f,p=500,m=150,x=0,b=10;function y(O){O.property("__zoom",Qv).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",A).filter(s).on("touchstart.zoom",N).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",I).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(O,E,M,R){var _=O.selection?O.selection():O;_.property("__zoom",Qv),O!==_?C(O,E,M,R):_.interrupt().each(function(){j(this,arguments).event(R).start().zoom(null,typeof E=="function"?E.apply(this,arguments):E).end()})},y.scaleBy=function(O,E,M,R){y.scaleTo(O,function(){var _=this.__zoom.k,$=typeof E=="function"?E.apply(this,arguments):E;return _*$},M,R)},y.scaleTo=function(O,E,M,R){y.transform(O,function(){var _=e.apply(this,arguments),$=this.__zoom,F=M==null?w(_):typeof M=="function"?M.apply(this,arguments):M,z=$.invert(F),V=typeof E=="function"?E.apply(this,arguments):E;return n(v(k($,V),F,z),_,o)},M,R)},y.translateBy=function(O,E,M,R){y.transform(O,function(){return n(this.__zoom.translate(typeof E=="function"?E.apply(this,arguments):E,typeof M=="function"?M.apply(this,arguments):M),e.apply(this,arguments),o)},null,R)},y.translateTo=function(O,E,M,R,_){y.transform(O,function(){var $=e.apply(this,arguments),F=this.__zoom,z=R==null?w($):typeof R=="function"?R.apply(this,arguments):R;return n(uh.translate(z[0],z[1]).scale(F.k).translate(typeof E=="function"?-E.apply(this,arguments):-E,typeof M=="function"?-M.apply(this,arguments):-M),$,o)},R,_)};function k(O,E){return E=Math.max(i[0],Math.min(i[1],E)),E===O.k?O:new Hr(E,O.x,O.y)}function v(O,E,M){var R=E[0]-M[0]*O.k,_=E[1]-M[1]*O.k;return R===O.x&&_===O.y?O:new Hr(O.k,R,_)}function w(O){return[(+O[0][0]+ +O[1][0])/2,(+O[0][1]+ +O[1][1])/2]}function C(O,E,M,R){O.on("start.zoom",function(){j(this,arguments).event(R).start()}).on("interrupt.zoom end.zoom",function(){j(this,arguments).event(R).end()}).tween("zoom",function(){var _=this,$=arguments,F=j(_,$).event(R),z=e.apply(_,$),V=M==null?w(z):typeof M=="function"?M.apply(_,$):M,Z=Math.max(z[1][0]-z[0][0],z[1][1]-z[0][1]),U=_.__zoom,Q=typeof E=="function"?E.apply(_,$):E,se=l(U.invert(V).concat(Z/U.k),Q.invert(V).concat(Z/Q.k));return function(ce){if(ce===1)ce=Q;else{var X=se(ce),K=Z/X[2];ce=new Hr(K,V[0]-X[0]*K,V[1]-X[1]*K)}F.zoom(null,ce)}})}function j(O,E,M){return!M&&O.__zooming||new S(O,E)}function S(O,E){this.that=O,this.args=E,this.active=0,this.sourceEvent=null,this.extent=e.apply(O,E),this.taps=0}S.prototype={event:function(O){return O&&(this.sourceEvent=O),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(O,E){return this.mouse&&O!=="mouse"&&(this.mouse[1]=E.invert(this.mouse[0])),this.touch0&&O!=="touch"&&(this.touch0[1]=E.invert(this.touch0[0])),this.touch1&&O!=="touch"&&(this.touch1[1]=E.invert(this.touch1[0])),this.that.__zoom=E,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(O){var E=vn(this.that).datum();d.call(O,this.that,new yq(O,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:d}),E)}};function P(O,...E){if(!t.apply(this,arguments))return;var M=j(this,E).event(O),R=this.__zoom,_=Math.max(i[0],Math.min(i[1],R.k*Math.pow(2,r.apply(this,arguments)))),$=Kn(O);if(M.wheel)(M.mouse[0][0]!==$[0]||M.mouse[0][1]!==$[1])&&(M.mouse[1]=R.invert(M.mouse[0]=$)),clearTimeout(M.wheel);else{if(R.k===_)return;M.mouse=[$,R.invert($)],Cd(this),M.start()}qo(O),M.wheel=setTimeout(F,m),M.zoom("mouse",n(v(k(R,_),M.mouse[0],M.mouse[1]),M.extent,o));function F(){M.wheel=null,M.end()}}function D(O,...E){if(f||!t.apply(this,arguments))return;var M=O.currentTarget,R=j(this,E,!0).event(O),_=vn(O.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",Z,!0),$=Kn(O,M),F=O.clientX,z=O.clientY;Oj(O.view),Ff(O),R.mouse=[$,this.__zoom.invert($)],Cd(this),R.start();function V(U){if(qo(U),!R.moved){var Q=U.clientX-F,se=U.clientY-z;R.moved=Q*Q+se*se>x}R.event(U).zoom("mouse",n(v(R.that.__zoom,R.mouse[0]=Kn(U,M),R.mouse[1]),R.extent,o))}function Z(U){_.on("mousemove.zoom mouseup.zoom",null),Ej(U.view,R.moved),qo(U),R.event(U).end()}}function A(O,...E){if(t.apply(this,arguments)){var M=this.__zoom,R=Kn(O.changedTouches?O.changedTouches[0]:O,this),_=M.invert(R),$=M.k*(O.shiftKey?.5:2),F=n(v(k(M,$),R,_),e.apply(this,E),o);qo(O),a>0?vn(this).transition().duration(a).call(C,F,R,O):vn(this).call(y.transform,F,R,O)}}function N(O,...E){if(t.apply(this,arguments)){var M=O.touches,R=M.length,_=j(this,E,O.changedTouches.length===R).event(O),$,F,z,V;for(Ff(O),F=0;F<R;++F)z=M[F],V=Kn(z,this),V=[V,this.__zoom.invert(V),z.identifier],_.touch0?!_.touch1&&_.touch0[2]!==V[2]&&(_.touch1=V,_.taps=0):(_.touch0=V,$=!0,_.taps=1+!!u);u&&(u=clearTimeout(u)),$&&(_.taps<2&&(h=V[0],u=setTimeout(function(){u=null},p)),Cd(this),_.start())}}function T(O,...E){if(this.__zooming){var M=j(this,E).event(O),R=O.changedTouches,_=R.length,$,F,z,V;for(qo(O),$=0;$<_;++$)F=R[$],z=Kn(F,this),M.touch0&&M.touch0[2]===F.identifier?M.touch0[0]=z:M.touch1&&M.touch1[2]===F.identifier&&(M.touch1[0]=z);if(F=M.that.__zoom,M.touch1){var Z=M.touch0[0],U=M.touch0[1],Q=M.touch1[0],se=M.touch1[1],ce=(ce=Q[0]-Z[0])*ce+(ce=Q[1]-Z[1])*ce,X=(X=se[0]-U[0])*X+(X=se[1]-U[1])*X;F=k(F,Math.sqrt(ce/X)),z=[(Z[0]+Q[0])/2,(Z[1]+Q[1])/2],V=[(U[0]+se[0])/2,(U[1]+se[1])/2]}else if(M.touch0)z=M.touch0[0],V=M.touch0[1];else return;M.zoom("touch",n(v(F,z,V),M.extent,o))}}function I(O,...E){if(this.__zooming){var M=j(this,E).event(O),R=O.changedTouches,_=R.length,$,F;for(Ff(O),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),$=0;$<_;++$)F=R[$],M.touch0&&M.touch0[2]===F.identifier?delete M.touch0:M.touch1&&M.touch1[2]===F.identifier&&delete M.touch1;if(M.touch1&&!M.touch0&&(M.touch0=M.touch1,delete M.touch1),M.touch0)M.touch0[1]=this.__zoom.invert(M.touch0[0]);else if(M.end(),M.taps===2&&(F=Kn(F,this),Math.hypot(h[0]-F[0],h[1]-F[1])<b)){var z=vn(this).on("dblclick.zoom");z&&z.apply(this,arguments)}}}return y.wheelDelta=function(O){return arguments.length?(r=typeof O=="function"?O:Jc(+O),y):r},y.filter=function(O){return arguments.length?(t=typeof O=="function"?O:Jc(!!O),y):t},y.touchable=function(O){return arguments.length?(s=typeof O=="function"?O:Jc(!!O),y):s},y.extent=function(O){return arguments.length?(e=typeof O=="function"?O:Jc([[+O[0][0],+O[0][1]],[+O[1][0],+O[1][1]]]),y):e},y.scaleExtent=function(O){return arguments.length?(i[0]=+O[0],i[1]=+O[1],y):[i[0],i[1]]},y.translateExtent=function(O){return arguments.length?(o[0][0]=+O[0][0],o[1][0]=+O[1][0],o[0][1]=+O[0][1],o[1][1]=+O[1][1],y):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},y.constrain=function(O){return arguments.length?(n=O,y):n},y.duration=function(O){return arguments.length?(a=+O,y):a},y.interpolate=function(O){return arguments.length?(l=O,y):l},y.on=function(){var O=d.on.apply(d,arguments);return O===d?y:O},y.clickDistance=function(O){return arguments.length?(x=(O=+O)*O,y):Math.sqrt(x)},y.tapDistance=function(O){return arguments.length?(b=+O,y):b},y}const Pr={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${t} handle id: "${t==="source"?n:r}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Tl=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Kj=["Enter"," ","Escape"],Gj={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var ho;(function(t){t.Strict="strict",t.Loose="loose"})(ho||(ho={}));var ei;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(ei||(ei={}));var Ll;(function(t){t.Partial="partial",t.Full="full"})(Ll||(Ll={}));const qj={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var us;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(us||(us={}));var ju;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(ju||(ju={}));var ke;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(ke||(ke={}));const Jv={[ke.Left]:ke.Right,[ke.Right]:ke.Left,[ke.Top]:ke.Bottom,[ke.Bottom]:ke.Top};function Yj(t){return t===null?null:t?"valid":"invalid"}const Xj=t=>"id"in t&&"source"in t&&"target"in t,jq=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),r0=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),dc=(t,e=[0,0])=>{const{width:n,height:r}=Yr(t),s=t.origin??e,i=n*s[0],o=r*s[1];return{x:t.position.x-i,y:t.position.y-o}},Nq=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((r,s)=>{const i=typeof s=="string";let o=!e.nodeLookup&&!i?s:void 0;e.nodeLookup&&(o=i?e.nodeLookup.get(s):r0(s)?s:e.nodeLookup.get(s.id));const a=o?Nu(o,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return hh(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return fh(n)},uc=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return t.forEach(s=>{(e.filter===void 0||e.filter(s))&&(n=hh(n,Nu(s)),r=!0)}),r?fh(n):{x:0,y:0,width:0,height:0}},s0=(t,e,[n,r,s]=[0,0,1],i=!1,o=!1)=>{const a={...fc(e,[n,r,s]),width:e.width/s,height:e.height/s},l=[];for(const d of t.values()){const{measured:u,selectable:h=!0,hidden:f=!1}=d;if(o&&!h||f)continue;const p=u.width??d.width??d.initialWidth??null,m=u.height??d.height??d.initialHeight??null,x=Rl(a,po(d)),b=(p??0)*(m??0),y=i&&x>0;(!d.internals.handleBounds||y||x>=b||d.dragging)&&l.push(d)}return l},Pq=(t,e)=>{const n=new Set;return t.forEach(r=>{n.add(r.id)}),e.filter(r=>n.has(r.source)||n.has(r.target))};function Oq(t,e){const n=new Map,r=e?.nodes?new Set(e.nodes.map(s=>s.id)):null;return t.forEach(s=>{s.measured.width&&s.measured.height&&(e?.includeHiddenNodes||!s.hidden)&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function Eq({nodes:t,width:e,height:n,panZoom:r,minZoom:s,maxZoom:i},o){if(t.size===0)return Promise.resolve(!0);const a=Oq(t,o),l=uc(a),d=i0(l,e,n,o?.minZoom??s,o?.maxZoom??i,o?.padding??.1);return await r.setViewport(d,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),Promise.resolve(!0)}function Zj({nodeId:t,nextPosition:e,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const o=n.get(t),a=o.parentId?n.get(o.parentId):void 0,{x:l,y:d}=a?a.internals.positionAbsolute:{x:0,y:0},u=o.origin??r;let h=o.extent||s;if(o.extent==="parent"&&!o.expandParent)if(!a)i?.("005",Pr.error005());else{const p=a.measured.width,m=a.measured.height;p&&m&&(h=[[l,d],[l+p,d+m]])}else a&&mo(o.extent)&&(h=[[o.extent[0][0]+l,o.extent[0][1]+d],[o.extent[1][0]+l,o.extent[1][1]+d]]);const f=mo(h)?li(e,h,o.measured):e;return(o.measured.width===void 0||o.measured.height===void 0)&&i?.("015",Pr.error015()),{position:{x:f.x-l+(o.measured.width??0)*u[0],y:f.y-d+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function Dq({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(t.map(f=>f.id)),o=[];for(const f of n){if(f.deletable===!1)continue;const p=i.has(f.id),m=!p&&f.parentId&&o.find(x=>x.id===f.parentId);(p||m)&&o.push(f)}const a=new Set(e.map(f=>f.id)),l=r.filter(f=>f.deletable!==!1),u=Pq(o,l);for(const f of l)a.has(f.id)&&!u.find(m=>m.id===f.id)&&u.push(f);if(!s)return{edges:u,nodes:o};const h=await s({nodes:o,edges:u});return typeof h=="boolean"?h?{edges:u,nodes:o}:{edges:[],nodes:[]}:h}const fo=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),li=(t={x:0,y:0},e,n)=>({x:fo(t.x,e[0][0],e[1][0]-(n?.width??0)),y:fo(t.y,e[0][1],e[1][1]-(n?.height??0))});function Qj(t,e,n){const{width:r,height:s}=Yr(n),{x:i,y:o}=n.internals.positionAbsolute;return li(t,[[i,o],[i+r,o+s]],e)}const e1=(t,e,n)=>t<e?fo(Math.abs(t-e),1,e)/e:t>n?-fo(Math.abs(t-n),1,e)/e:0,Jj=(t,e,n=15,r=40)=>{const s=e1(t.x,r,e.width-r)*n,i=e1(t.y,r,e.height-r)*n;return[s,i]},hh=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),wm=({x:t,y:e,width:n,height:r})=>({x:t,y:e,x2:t+n,y2:e+r}),fh=({x:t,y:e,x2:n,y2:r})=>({x:t,y:e,width:n-t,height:r-e}),po=(t,e=[0,0])=>{const{x:n,y:r}=r0(t)?t.internals.positionAbsolute:dc(t,e);return{x:n,y:r,width:t.measured?.width??t.width??t.initialWidth??0,height:t.measured?.height??t.height??t.initialHeight??0}},Nu=(t,e=[0,0])=>{const{x:n,y:r}=r0(t)?t.internals.positionAbsolute:dc(t,e);return{x:n,y:r,x2:n+(t.measured?.width??t.width??t.initialWidth??0),y2:r+(t.measured?.height??t.height??t.initialHeight??0)}},e5=(t,e)=>fh(hh(wm(t),wm(e))),Rl=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),r=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*r)},t1=t=>Qn(t.width)&&Qn(t.height)&&Qn(t.x)&&Qn(t.y),Qn=t=>!isNaN(t)&&isFinite(t),Mq=(t,e)=>{},hc=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),fc=({x:t,y:e},[n,r,s],i=!1,o=[1,1])=>{const a={x:(t-n)/s,y:(e-r)/s};return i?hc(a,o):a},Pu=({x:t,y:e},[n,r,s])=>({x:t*s+n,y:e*s+r});function ki(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`[React Flow] The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Aq(t,e,n){if(typeof t=="string"||typeof t=="number"){const r=ki(t,n),s=ki(t,e);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof t=="object"){const r=ki(t.top??t.y??0,n),s=ki(t.bottom??t.y??0,n),i=ki(t.left??t.x??0,e),o=ki(t.right??t.x??0,e);return{top:r,right:o,bottom:s,left:i,x:i+o,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Tq(t,e,n,r,s,i){const{x:o,y:a}=Pu(t,[e,n,r]),{x:l,y:d}=Pu({x:t.x+t.width,y:t.y+t.height},[e,n,r]),u=s-l,h=i-d;return{left:Math.floor(o),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(h)}}const i0=(t,e,n,r,s,i)=>{const o=Aq(i,e,n),a=(e-o.x)/t.width,l=(n-o.y)/t.height,d=Math.min(a,l),u=fo(d,r,s),h=t.x+t.width/2,f=t.y+t.height/2,p=e/2-h*u,m=n/2-f*u,x=Tq(t,p,m,u,e,n),b={left:Math.min(x.left-o.left,0),top:Math.min(x.top-o.top,0),right:Math.min(x.right-o.right,0),bottom:Math.min(x.bottom-o.bottom,0)};return{x:p-b.left+b.right,y:m-b.top+b.bottom,zoom:u}},_l=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function mo(t){return t!=null&&t!=="parent"}function Yr(t){return{width:t.measured?.width??t.width??t.initialWidth??0,height:t.measured?.height??t.height??t.initialHeight??0}}function t5(t){return(t.measured?.width??t.width??t.initialWidth)!==void 0&&(t.measured?.height??t.height??t.initialHeight)!==void 0}function n5(t,e={width:0,height:0},n,r,s){const i={...t},o=r.get(n);if(o){const a=o.origin||s;i.x+=o.internals.positionAbsolute.x-(e.width??0)*a[0],i.y+=o.internals.positionAbsolute.y-(e.height??0)*a[1]}return i}function n1(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function Lq(){let t,e;return{promise:new Promise((r,s)=>{t=r,e=s}),resolve:t,reject:e}}function Rq(t){return{...Gj,...t||{}}}function xa(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:o}=Jn(t),a=fc({x:i-(s?.left??0),y:o-(s?.top??0)},r),{x:l,y:d}=n?hc(a,e):a;return{xSnapped:l,ySnapped:d,...a}}const o0=t=>({width:t.offsetWidth,height:t.offsetHeight}),r5=t=>t?.getRootNode?.()||window?.document,_q=["INPUT","SELECT","TEXTAREA"];function s5(t){const e=t.composedPath?.()?.[0]||t.target;return e?.nodeType!==1?!1:_q.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const i5=t=>"clientX"in t,Jn=(t,e)=>{const n=i5(t),r=n?t.clientX:t.touches?.[0].clientX,s=n?t.clientY:t.touches?.[0].clientY;return{x:r-(e?.left??0),y:s-(e?.top??0)}},r1=(t,e,n,r,s)=>{const i=e.querySelectorAll(`.${t}`);return!i||!i.length?null:Array.from(i).map(o=>{const a=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:t,nodeId:s,position:o.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...o0(o)}})};function o5({sourceX:t,sourceY:e,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:o,targetControlY:a}){const l=t*.125+s*.375+o*.375+n*.125,d=e*.125+i*.375+a*.375+r*.125,u=Math.abs(l-t),h=Math.abs(d-e);return[l,d,u,h]}function ed(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function s1({pos:t,x1:e,y1:n,x2:r,y2:s,c:i}){switch(t){case ke.Left:return[e-ed(e-r,i),n];case ke.Right:return[e+ed(r-e,i),n];case ke.Top:return[e,n-ed(n-s,i)];case ke.Bottom:return[e,n+ed(s-n,i)]}}function a5({sourceX:t,sourceY:e,sourcePosition:n=ke.Bottom,targetX:r,targetY:s,targetPosition:i=ke.Top,curvature:o=.25}){const[a,l]=s1({pos:n,x1:t,y1:e,x2:r,y2:s,c:o}),[d,u]=s1({pos:i,x1:r,y1:s,x2:t,y2:e,c:o}),[h,f,p,m]=o5({sourceX:t,sourceY:e,targetX:r,targetY:s,sourceControlX:a,sourceControlY:l,targetControlX:d,targetControlY:u});return[`M${t},${e} C${a},${l} ${d},${u} ${r},${s}`,h,f,p,m]}function l5({sourceX:t,sourceY:e,targetX:n,targetY:r}){const s=Math.abs(n-t)/2,i=n<t?n+s:n-s,o=Math.abs(r-e)/2,a=r<e?r+o:r-o;return[i,a,s,o]}function Iq({sourceNode:t,targetNode:e,selected:n=!1,zIndex:r=0,elevateOnSelect:s=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const o=s&&n?r+1e3:r,a=Math.max(t.parentId||s&&t.selected?t.internals.z:0,e.parentId||s&&e.selected?e.internals.z:0);return o+a}function $q({sourceNode:t,targetNode:e,width:n,height:r,transform:s}){const i=hh(Nu(t),Nu(e));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const o={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:r/s[2]};return Rl(o,fh(i))>0}const Bq=({source:t,sourceHandle:e,target:n,targetHandle:r})=>`xy-edge__${t}${e||""}-${n}${r||""}`,Fq=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),zq=(t,e,n={})=>{if(!t.source||!t.target)return e;const r=n.getEdgeId||Bq;let s;return Xj(t)?s={...t}:s={...t,id:r(t)},Fq(s,e)?e:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,e.concat(s))};function c5({sourceX:t,sourceY:e,targetX:n,targetY:r}){const[s,i,o,a]=l5({sourceX:t,sourceY:e,targetX:n,targetY:r});return[`M ${t},${e}L ${n},${r}`,s,i,o,a]}const i1={[ke.Left]:{x:-1,y:0},[ke.Right]:{x:1,y:0},[ke.Top]:{x:0,y:-1},[ke.Bottom]:{x:0,y:1}},Vq=({source:t,sourcePosition:e=ke.Bottom,target:n})=>e===ke.Left||e===ke.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},o1=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function Hq({source:t,sourcePosition:e=ke.Bottom,target:n,targetPosition:r=ke.Top,center:s,offset:i,stepPosition:o}){const a=i1[e],l=i1[r],d={x:t.x+a.x*i,y:t.y+a.y*i},u={x:n.x+l.x*i,y:n.y+l.y*i},h=Vq({source:d,sourcePosition:e,target:u}),f=h.x!==0?"x":"y",p=h[f];let m=[],x,b;const y={x:0,y:0},k={x:0,y:0},[,,v,w]=l5({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){f==="x"?(x=s.x??d.x+(u.x-d.x)*o,b=s.y??(d.y+u.y)/2):(x=s.x??(d.x+u.x)/2,b=s.y??d.y+(u.y-d.y)*o);const P=[{x,y:d.y},{x,y:u.y}],D=[{x:d.x,y:b},{x:u.x,y:b}];a[f]===p?m=f==="x"?P:D:m=f==="x"?D:P}else{const P=[{x:d.x,y:u.y}],D=[{x:u.x,y:d.y}];if(f==="x"?m=a.x===p?D:P:m=a.y===p?P:D,e===r){const O=Math.abs(t[f]-n[f]);if(O<=i){const E=Math.min(i-1,i-O);a[f]===p?y[f]=(d[f]>t[f]?-1:1)*E:k[f]=(u[f]>n[f]?-1:1)*E}}if(e!==r){const O=f==="x"?"y":"x",E=a[f]===l[O],M=d[O]>u[O],R=d[O]<u[O];(a[f]===1&&(!E&&M||E&&R)||a[f]!==1&&(!E&&R||E&&M))&&(m=f==="x"?P:D)}const A={x:d.x+y.x,y:d.y+y.y},N={x:u.x+k.x,y:u.y+k.y},T=Math.max(Math.abs(A.x-m[0].x),Math.abs(N.x-m[0].x)),I=Math.max(Math.abs(A.y-m[0].y),Math.abs(N.y-m[0].y));T>=I?(x=(A.x+N.x)/2,b=m[0].y):(x=m[0].x,b=(A.y+N.y)/2)}const C={x:d.x+y.x,y:d.y+y.y},j={x:u.x+k.x,y:u.y+k.y};return[[t,...C.x!==m[0].x||C.y!==m[0].y?[C]:[],...m,...j.x!==m[m.length-1].x||j.y!==m[m.length-1].y?[j]:[],n],x,b,v,w]}function Wq(t,e,n,r){const s=Math.min(o1(t,e)/2,o1(e,n)/2,r),{x:i,y:o}=e;if(t.x===i&&i===n.x||t.y===o&&o===n.y)return`L${i} ${o}`;if(t.y===o){const d=t.x<n.x?-1:1,u=t.y<n.y?1:-1;return`L ${i+s*d},${o}Q ${i},${o} ${i},${o+s*u}`}const a=t.x<n.x?1:-1,l=t.y<n.y?-1:1;return`L ${i},${o+s*l}Q ${i},${o} ${i+s*a},${o}`}function km({sourceX:t,sourceY:e,sourcePosition:n=ke.Bottom,targetX:r,targetY:s,targetPosition:i=ke.Top,borderRadius:o=5,centerX:a,centerY:l,offset:d=20,stepPosition:u=.5}){const[h,f,p,m,x]=Hq({source:{x:t,y:e},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:a,y:l},offset:d,stepPosition:u});let b=`M${h[0].x} ${h[0].y}`;for(let y=1;y<h.length-1;y++)b+=Wq(h[y-1],h[y],h[y+1],o);return b+=`L${h[h.length-1].x} ${h[h.length-1].y}`,[b,f,p,m,x]}function a1(t){return t&&!!(t.internals.handleBounds||t.handles?.length)&&!!(t.measured.width||t.width||t.initialWidth)}function Uq(t){const{sourceNode:e,targetNode:n}=t;if(!a1(e)||!a1(n))return null;const r=e.internals.handleBounds||l1(e.handles),s=n.internals.handleBounds||l1(n.handles),i=c1(r?.source??[],t.sourceHandle),o=c1(t.connectionMode===ho.Strict?s?.target??[]:(s?.target??[]).concat(s?.source??[]),t.targetHandle);if(!i||!o)return t.onError?.("008",Pr.error008(i?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const a=i?.position||ke.Bottom,l=o?.position||ke.Top,d=ci(e,i,a),u=ci(n,o,l);return{sourceX:d.x,sourceY:d.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function l1(t){if(!t)return null;const e=[],n=[];for(const r of t)r.width=r.width??1,r.height=r.height??1,r.type==="source"?e.push(r):r.type==="target"&&n.push(r);return{source:e,target:n}}function ci(t,e,n=ke.Left,r=!1){const s=(e?.x??0)+t.internals.positionAbsolute.x,i=(e?.y??0)+t.internals.positionAbsolute.y,{width:o,height:a}=e??Yr(t);if(r)return{x:s+o/2,y:i+a/2};switch(e?.position??n){case ke.Top:return{x:s+o/2,y:i};case ke.Right:return{x:s+o,y:i+a/2};case ke.Bottom:return{x:s+o/2,y:i+a};case ke.Left:return{x:s,y:i+a/2}}}function c1(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function Sm(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(r=>`${r}=${t[r]}`).join("&")}`:""}function Kq(t,{id:e,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return t.reduce((o,a)=>([a.markerStart||r,a.markerEnd||s].forEach(l=>{if(l&&typeof l=="object"){const d=Sm(l,e);i.has(d)||(o.push({id:d,color:l.color||n,...l}),i.add(d))}}),o),[]).sort((o,a)=>o.id.localeCompare(a.id))}const d5=1e3,Gq=10,a0={nodeOrigin:[0,0],nodeExtent:Tl,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},qq={...a0,checkEquality:!0};function l0(t,e){const n={...t};for(const r in e)e[r]!==void 0&&(n[r]=e[r]);return n}function Yq(t,e,n){const r=l0(a0,n);for(const s of t.values())if(s.parentId)d0(s,t,e,r);else{const i=dc(s,r.nodeOrigin),o=mo(s.extent)?s.extent:r.nodeExtent,a=li(i,o,Yr(s));s.internals.positionAbsolute=a}}function Xq(t,e){if(!t.handles)return t.measured?e?.internals.handleBounds:void 0;const n=[],r=[];for(const s of t.handles){const i={id:s.id,width:s.width??1,height:s.height??1,nodeId:t.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(i):s.type==="target"&&r.push(i)}return{source:n,target:r}}function c0(t){return t==="manual"}function Cm(t,e,n,r={}){const s=l0(qq,r),i={i:0},o=new Map(e),a=s?.elevateNodesOnSelect&&!c0(s.zIndexMode)?d5:0;let l=t.length>0,d=!1;e.clear(),n.clear();for(const u of t){let h=o.get(u.id);if(s.checkEquality&&u===h?.internals.userNode)e.set(u.id,h);else{const f=dc(u,s.nodeOrigin),p=mo(u.extent)?u.extent:s.nodeExtent,m=li(f,p,Yr(u));h={...s.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:m,handleBounds:Xq(u,h),z:u5(u,a,s.zIndexMode),userNode:u}},e.set(u.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(l=!1),u.parentId&&d0(h,e,n,r,i),d||(d=u.selected??!1)}return{nodesInitialized:l,hasSelectedNodes:d}}function Zq(t,e){if(!t.parentId)return;const n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function d0(t,e,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:o,nodeExtent:a,zIndexMode:l}=l0(a0,r),d=t.parentId,u=e.get(d);if(!u){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Zq(t,n),s&&!u.parentId&&u.internals.rootParentIndex===void 0&&l==="auto"&&(u.internals.rootParentIndex=++s.i,u.internals.z=u.internals.z+s.i*Gq),s&&u.internals.rootParentIndex!==void 0&&(s.i=u.internals.rootParentIndex);const h=i&&!c0(l)?d5:0,{x:f,y:p,z:m}=Qq(t,u,o,a,h,l),{positionAbsolute:x}=t.internals,b=f!==x.x||p!==x.y;(b||m!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:b?{x:f,y:p}:x,z:m}})}function u5(t,e,n){const r=Qn(t.zIndex)?t.zIndex:0;return c0(n)?r:r+(t.selected?e:0)}function Qq(t,e,n,r,s,i){const{x:o,y:a}=e.internals.positionAbsolute,l=Yr(t),d=dc(t,n),u=mo(t.extent)?li(d,t.extent,l):d;let h=li({x:o+u.x,y:a+u.y},r,l);t.extent==="parent"&&(h=Qj(h,l,e));const f=u5(t,s,i),p=e.internals.z??0;return{x:h.x,y:h.y,z:p>=f?p+1:f}}function u0(t,e,n,r=[0,0]){const s=[],i=new Map;for(const o of t){const a=e.get(o.parentId);if(!a)continue;const l=i.get(o.parentId)?.expandedRect??po(a),d=e5(l,o.rect);i.set(o.parentId,{expandedRect:d,parent:a})}return i.size>0&&i.forEach(({expandedRect:o,parent:a},l)=>{const d=a.internals.positionAbsolute,u=Yr(a),h=a.origin??r,f=o.x<d.x?Math.round(Math.abs(d.x-o.x)):0,p=o.y<d.y?Math.round(Math.abs(d.y-o.y)):0,m=Math.max(u.width,Math.round(o.width)),x=Math.max(u.height,Math.round(o.height)),b=(m-u.width)*h[0],y=(x-u.height)*h[1];(f>0||p>0||b||y)&&(s.push({id:l,type:"position",position:{x:a.position.x-f+b,y:a.position.y-p+y}}),n.get(l)?.forEach(k=>{t.some(v=>v.id===k.id)||s.push({id:k.id,type:"position",position:{x:k.position.x+f,y:k.position.y+p}})})),(u.width<o.width||u.height<o.height||f||p)&&s.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:m+(f?h[0]*f-b:0),height:x+(p?h[1]*p-y:0)}})}),s}function Jq(t,e,n,r,s,i,o){const a=r?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const d=[],u=window.getComputedStyle(a),{m22:h}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const p of t.values()){const m=e.get(p.id);if(!m)continue;if(m.hidden){e.set(m.id,{...m,internals:{...m.internals,handleBounds:void 0}}),l=!0;continue}const x=o0(p.nodeElement),b=m.measured.width!==x.width||m.measured.height!==x.height;if(!!(x.width&&x.height&&(b||!m.internals.handleBounds||p.force))){const k=p.nodeElement.getBoundingClientRect(),v=mo(m.extent)?m.extent:i;let{positionAbsolute:w}=m.internals;m.parentId&&m.extent==="parent"?w=Qj(w,x,e.get(m.parentId)):v&&(w=li(w,v,x));const C={...m,measured:x,internals:{...m.internals,positionAbsolute:w,handleBounds:{source:r1("source",p.nodeElement,k,h,m.id),target:r1("target",p.nodeElement,k,h,m.id)}}};e.set(m.id,C),m.parentId&&d0(C,e,n,{nodeOrigin:s,zIndexMode:o}),l=!0,b&&(d.push({id:m.id,type:"dimensions",dimensions:x}),m.expandParent&&m.parentId&&f.push({id:m.id,parentId:m.parentId,rect:po(C,s)}))}}if(f.length>0){const p=u0(f,e,n,s);d.push(...p)}return{changes:d,updatedInternals:l}}async function eY({delta:t,panZoom:e,transform:n,translateExtent:r,width:s,height:i}){if(!e||!t.x&&!t.y)return Promise.resolve(!1);const o=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.y,zoom:n[2]},[[0,0],[s,i]],r),a=!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2]);return Promise.resolve(a)}function d1(t,e,n,r,s,i){let o=s;const a=r.get(o)||new Map;r.set(o,a.set(n,e)),o=`${s}-${t}`;const l=r.get(o)||new Map;if(r.set(o,l.set(n,e)),i){o=`${s}-${t}-${i}`;const d=r.get(o)||new Map;r.set(o,d.set(n,e))}}function h5(t,e,n){t.clear(),e.clear();for(const r of n){const{source:s,target:i,sourceHandle:o=null,targetHandle:a=null}=r,l={edgeId:r.id,source:s,target:i,sourceHandle:o,targetHandle:a},d=`${s}-${o}--${i}-${a}`,u=`${i}-${a}--${s}-${o}`;d1("source",l,u,t,s,o),d1("target",l,d,t,i,a),e.set(r.id,r)}}function f5(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return n?n.selected?!0:f5(n,e):!1}function u1(t,e,n){let r=t;do{if(r?.matches?.(e))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function tY(t,e,n,r){const s=new Map;for(const[i,o]of t)if((o.selected||o.id===r)&&(!o.parentId||!f5(o,t))&&(o.draggable||e&&typeof o.draggable>"u")){const a=t.get(i);a&&s.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return s}function zf({nodeId:t,dragItems:e,nodeLookup:n,dragging:r=!0}){const s=[];for(const[o,a]of e){const l=n.get(o)?.internals.userNode;l&&s.push({...l,position:a.position,dragging:r})}if(!t)return[s[0],s];const i=n.get(t)?.internals.userNode;return[i?{...i,position:e.get(t)?.position||i.position,dragging:r}:s[0],s]}function nY({dragItems:t,snapGrid:e,x:n,y:r}){const s=t.values().next().value;if(!s)return null;const i={x:n-s.distance.x,y:r-s.distance.y},o=hc(i,e);return{x:o.x-i.x,y:o.y-i.y}}function rY({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},o=0,a=new Map,l=!1,d={x:0,y:0},u=null,h=!1,f=null,p=!1,m=!1,x=null;function b({noDragClassName:k,handleSelector:v,domNode:w,isSelectable:C,nodeId:j,nodeClickDistance:S=0}){f=vn(w);function P({x:T,y:I}){const{nodeLookup:O,nodeExtent:E,snapGrid:M,snapToGrid:R,nodeOrigin:_,onNodeDrag:$,onSelectionDrag:F,onError:z,updateNodePositions:V}=e();i={x:T,y:I};let Z=!1;const U=a.size>1,Q=U&&E?wm(uc(a)):null,se=U&&R?nY({dragItems:a,snapGrid:M,x:T,y:I}):null;for(const[ce,X]of a){if(!O.has(ce))continue;let K={x:T-X.distance.x,y:I-X.distance.y};R&&(K=se?{x:Math.round(K.x+se.x),y:Math.round(K.y+se.y)}:hc(K,M));let te=null;if(U&&E&&!X.extent&&Q){const{positionAbsolute:de}=X.internals,Ce=de.x-Q.x+E[0][0],Te=de.x+X.measured.width-Q.x2+E[1][0],De=de.y-Q.y+E[0][1],tt=de.y+X.measured.height-Q.y2+E[1][1];te=[[Ce,De],[Te,tt]]}const{position:le,positionAbsolute:J}=Zj({nodeId:ce,nextPosition:K,nodeLookup:O,nodeExtent:te||E,nodeOrigin:_,onError:z});Z=Z||X.position.x!==le.x||X.position.y!==le.y,X.position=le,X.internals.positionAbsolute=J}if(m=m||Z,!!Z&&(V(a,!0),x&&(r||$||!j&&F))){const[ce,X]=zf({nodeId:j,dragItems:a,nodeLookup:O});r?.(x,a,ce,X),$?.(x,ce,X),j||F?.(x,X)}}async function D(){if(!u)return;const{transform:T,panBy:I,autoPanSpeed:O,autoPanOnNodeDrag:E}=e();if(!E){l=!1,cancelAnimationFrame(o);return}const[M,R]=Jj(d,u,O);(M!==0||R!==0)&&(i.x=(i.x??0)-M/T[2],i.y=(i.y??0)-R/T[2],await I({x:M,y:R})&&P(i)),o=requestAnimationFrame(D)}function A(T){const{nodeLookup:I,multiSelectionActive:O,nodesDraggable:E,transform:M,snapGrid:R,snapToGrid:_,selectNodesOnDrag:$,onNodeDragStart:F,onSelectionDragStart:z,unselectNodesAndEdges:V}=e();h=!0,(!$||!C)&&!O&&j&&(I.get(j)?.selected||V()),C&&$&&j&&t?.(j);const Z=xa(T.sourceEvent,{transform:M,snapGrid:R,snapToGrid:_,containerBounds:u});if(i=Z,a=tY(I,E,Z,j),a.size>0&&(n||F||!j&&z)){const[U,Q]=zf({nodeId:j,dragItems:a,nodeLookup:I});n?.(T.sourceEvent,a,U,Q),F?.(T.sourceEvent,U,Q),j||z?.(T.sourceEvent,Q)}}const N=Dj().clickDistance(S).on("start",T=>{const{domNode:I,nodeDragThreshold:O,transform:E,snapGrid:M,snapToGrid:R}=e();u=I?.getBoundingClientRect()||null,p=!1,m=!1,x=T.sourceEvent,O===0&&A(T),i=xa(T.sourceEvent,{transform:E,snapGrid:M,snapToGrid:R,containerBounds:u}),d=Jn(T.sourceEvent,u)}).on("drag",T=>{const{autoPanOnNodeDrag:I,transform:O,snapGrid:E,snapToGrid:M,nodeDragThreshold:R,nodeLookup:_}=e(),$=xa(T.sourceEvent,{transform:O,snapGrid:E,snapToGrid:M,containerBounds:u});if(x=T.sourceEvent,(T.sourceEvent.type==="touchmove"&&T.sourceEvent.touches.length>1||j&&!_.has(j))&&(p=!0),!p){if(!l&&I&&h&&(l=!0,D()),!h){const F=Jn(T.sourceEvent,u),z=F.x-d.x,V=F.y-d.y;Math.sqrt(z*z+V*V)>R&&A(T)}(i.x!==$.xSnapped||i.y!==$.ySnapped)&&a&&h&&(d=Jn(T.sourceEvent,u),P($))}}).on("end",T=>{if(!(!h||p)&&(l=!1,h=!1,cancelAnimationFrame(o),a.size>0)){const{nodeLookup:I,updateNodePositions:O,onNodeDragStop:E,onSelectionDragStop:M}=e();if(m&&(O(a,!1),m=!1),s||E||!j&&M){const[R,_]=zf({nodeId:j,dragItems:a,nodeLookup:I,dragging:!1});s?.(T.sourceEvent,a,R,_),E?.(T.sourceEvent,R,_),j||M?.(T.sourceEvent,_)}}}).filter(T=>{const I=T.target;return!T.button&&(!k||!u1(I,`.${k}`,w))&&(!v||u1(I,v,w))});f.call(N)}function y(){f?.on(".drag",null)}return{update:b,destroy:y}}function sY(t,e,n){const r=[],s={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const i of e.values())Rl(s,po(i))>0&&r.push(i);return r}const iY=250;function oY(t,e,n,r){let s=[],i=1/0;const o=sY(t,n,e+iY);for(const a of o){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const d of l){if(r.nodeId===d.nodeId&&r.type===d.type&&r.id===d.id)continue;const{x:u,y:h}=ci(a,d,d.position,!0),f=Math.sqrt(Math.pow(u-t.x,2)+Math.pow(h-t.y,2));f>e||(f<i?(s=[{...d,x:u,y:h}],i=f):f===i&&s.push({...d,x:u,y:h}))}}if(!s.length)return null;if(s.length>1){const a=r.type==="source"?"target":"source";return s.find(l=>l.type===a)??s[0]}return s[0]}function p5(t,e,n,r,s,i=!1){const o=r.get(t);if(!o)return null;const a=s==="strict"?o.internals.handleBounds?.[e]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],l=(n?a?.find(d=>d.id===n):a?.[0])??null;return l&&i?{...l,...ci(o,l,l.position,!0)}:l}function m5(t,e){return t||(e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null)}function aY(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}const g5=()=>!0;function lY(t,{connectionMode:e,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:o,domNode:a,nodeLookup:l,lib:d,autoPanOnConnect:u,flowId:h,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:x,onConnectEnd:b,isValidConnection:y=g5,onReconnectEnd:k,updateConnection:v,getTransform:w,getFromHandle:C,autoPanSpeed:j,dragThreshold:S=1,handleDomNode:P}){const D=r5(t.target);let A=0,N;const{x:T,y:I}=Jn(t),O=m5(i,P),E=a?.getBoundingClientRect();let M=!1;if(!E||!O)return;const R=p5(s,O,r,l,e);if(!R)return;let _=Jn(t,E),$=!1,F=null,z=!1,V=null;function Z(){if(!u||!E)return;const[le,J]=Jj(_,E,j);f({x:le,y:J}),A=requestAnimationFrame(Z)}const U={...R,nodeId:s,type:O,position:R.position},Q=l.get(s);let ce={inProgress:!0,isValid:null,from:ci(Q,U,ke.Left,!0),fromHandle:U,fromPosition:U.position,fromNode:Q,to:_,toHandle:null,toPosition:Jv[U.position],toNode:null,pointer:_};function X(){M=!0,v(ce),m?.(t,{nodeId:s,handleId:r,handleType:O})}S===0&&X();function K(le){if(!M){const{x:tt,y:qt}=Jn(le),Nt=tt-T,mt=qt-I;if(!(Nt*Nt+mt*mt>S*S))return;X()}if(!C()||!U){te(le);return}const J=w();_=Jn(le,E),N=oY(fc(_,J,!1,[1,1]),n,l,U),$||(Z(),$=!0);const de=x5(le,{handle:N,connectionMode:e,fromNodeId:s,fromHandleId:r,fromType:o?"target":"source",isValidConnection:y,doc:D,lib:d,flowId:h,nodeLookup:l});V=de.handleDomNode,F=de.connection,z=aY(!!N,de.isValid);const Ce=l.get(s),Te=Ce?ci(Ce,U,ke.Left,!0):ce.from,De={...ce,from:Te,isValid:z,to:de.toHandle&&z?Pu({x:de.toHandle.x,y:de.toHandle.y},J):_,toHandle:de.toHandle,toPosition:z&&de.toHandle?de.toHandle.position:Jv[U.position],toNode:de.toHandle?l.get(de.toHandle.nodeId):null,pointer:_};v(De),ce=De}function te(le){if(!("touches"in le&&le.touches.length>0)){if(M){(N||V)&&F&&z&&x?.(F);const{inProgress:J,...de}=ce,Ce={...de,toPosition:ce.toHandle?ce.toPosition:null};b?.(le,Ce),i&&k?.(le,Ce)}p(),cancelAnimationFrame(A),$=!1,z=!1,F=null,V=null,D.removeEventListener("mousemove",K),D.removeEventListener("mouseup",te),D.removeEventListener("touchmove",K),D.removeEventListener("touchend",te)}}D.addEventListener("mousemove",K),D.addEventListener("mouseup",te),D.addEventListener("touchmove",K),D.addEventListener("touchend",te)}function x5(t,{handle:e,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:o,lib:a,flowId:l,isValidConnection:d=g5,nodeLookup:u}){const h=i==="target",f=e?o.querySelector(`.${a}-flow__handle[data-id="${l}-${e?.nodeId}-${e?.id}-${e?.type}"]`):null,{x:p,y:m}=Jn(t),x=o.elementFromPoint(p,m),b=x?.classList.contains(`${a}-flow__handle`)?x:f,y={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const k=m5(void 0,b),v=b.getAttribute("data-nodeid"),w=b.getAttribute("data-handleid"),C=b.classList.contains("connectable"),j=b.classList.contains("connectableend");if(!v||!k)return y;const S={source:h?v:r,sourceHandle:h?w:s,target:h?r:v,targetHandle:h?s:w};y.connection=S;const D=C&&j&&(n===ho.Strict?h&&k==="source"||!h&&k==="target":v!==r||w!==s);y.isValid=D&&d(S),y.toHandle=p5(v,k,w,u,n,!0)}return y}const jm={onPointerDown:lY,isValid:x5};function cY({domNode:t,panZoom:e,getTransform:n,getViewScale:r}){const s=vn(t);function i({translateExtent:a,width:l,height:d,zoomStep:u=1,pannable:h=!0,zoomable:f=!0,inversePan:p=!1}){const m=v=>{if(v.sourceEvent.type!=="wheel"||!e)return;const w=n(),C=v.sourceEvent.ctrlKey&&_l()?10:1,j=-v.sourceEvent.deltaY*(v.sourceEvent.deltaMode===1?.05:v.sourceEvent.deltaMode?1:.002)*u,S=w[2]*Math.pow(2,j*C);e.scaleTo(S)};let x=[0,0];const b=v=>{(v.sourceEvent.type==="mousedown"||v.sourceEvent.type==="touchstart")&&(x=[v.sourceEvent.clientX??v.sourceEvent.touches[0].clientX,v.sourceEvent.clientY??v.sourceEvent.touches[0].clientY])},y=v=>{const w=n();if(v.sourceEvent.type!=="mousemove"&&v.sourceEvent.type!=="touchmove"||!e)return;const C=[v.sourceEvent.clientX??v.sourceEvent.touches[0].clientX,v.sourceEvent.clientY??v.sourceEvent.touches[0].clientY],j=[C[0]-x[0],C[1]-x[1]];x=C;const S=r()*Math.max(w[2],Math.log(w[2]))*(p?-1:1),P={x:w[0]-j[0]*S,y:w[1]-j[1]*S},D=[[0,0],[l,d]];e.setViewportConstrained({x:P.x,y:P.y,zoom:w[2]},D,a)},k=Uj().on("start",b).on("zoom",h?y:null).on("zoom.wheel",f?m:null);s.call(k,{})}function o(){s.on("zoom",null)}return{update:i,destroy:o,pointer:Kn}}const ph=t=>({x:t.x,y:t.y,zoom:t.k}),Vf=({x:t,y:e,zoom:n})=>uh.translate(t,e).scale(n),Ti=(t,e)=>t.target.closest(`.${e}`),b5=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),dY=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,Hf=(t,e=0,n=dY,r=()=>{})=>{const s=typeof e=="number"&&e>0;return s||r(),s?t.transition().duration(e).ease(n).on("end",r):t},y5=t=>{const e=t.ctrlKey&&_l()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function uY({zoomPanValues:t,noWheelClassName:e,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:o,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:d}){return u=>{if(Ti(u,e))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const h=n.property("__zoom").k||1;if(u.ctrlKey&&o){const b=Kn(u),y=y5(u),k=h*Math.pow(2,y);r.scaleTo(n,k,b,u);return}const f=u.deltaMode===1?20:1;let p=s===ei.Vertical?0:u.deltaX*f,m=s===ei.Horizontal?0:u.deltaY*f;!_l()&&u.shiftKey&&s!==ei.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/h)*i,-(m/h)*i,{internal:!0});const x=ph(n.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?(l?.(u,x),t.panScrollTimeout=setTimeout(()=>{d?.(u,x),t.isPanScrolling=!1},150)):(t.isPanScrolling=!0,a?.(u,x))}}function hY({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",o=!e&&i&&!r.ctrlKey,a=Ti(r,t);if(r.ctrlKey&&i&&a&&r.preventDefault(),o||a)return null;r.preventDefault(),n.call(this,r,s)}}function fY({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;const s=ph(r.transform);t.mouseButton=r.sourceEvent?.button||0,t.isZoomingOrPanning=!0,t.prevViewport=s,r.sourceEvent?.type==="mousedown"&&e(!0),n&&n?.(r.sourceEvent,s)}}function pY({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{t.usedRightMouseButton=!!(n&&b5(e,t.mouseButton??0)),i.sourceEvent?.sync||r([i.transform.x,i.transform.y,i.transform.k]),s&&!i.sourceEvent?.internal&&s?.(i.sourceEvent,ph(i.transform))}}function mY({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:i}){return o=>{if(!o.sourceEvent?.internal&&(t.isZoomingOrPanning=!1,i&&b5(e,t.mouseButton??0)&&!t.usedRightMouseButton&&o.sourceEvent&&i(o.sourceEvent),t.usedRightMouseButton=!1,r(!1),s)){const a=ph(o.transform);t.prevViewport=a,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{s?.(o.sourceEvent,a)},n?150:0)}}}function gY({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:o,noWheelClassName:a,noPanClassName:l,lib:d,connectionInProgress:u}){return h=>{const f=t||e,p=n&&h.ctrlKey,m=h.type==="wheel";if(h.button===1&&h.type==="mousedown"&&(Ti(h,`${d}-flow__node`)||Ti(h,`${d}-flow__edge`)))return!0;if(!r&&!f&&!s&&!i&&!n||o||u&&!m||Ti(h,a)&&m||Ti(h,l)&&(!m||s&&m&&!t)||!n&&h.ctrlKey&&m)return!1;if(!n&&h.type==="touchstart"&&h.touches?.length>1)return h.preventDefault(),!1;if(!f&&!s&&!p&&m||!r&&(h.type==="mousedown"||h.type==="touchstart")||Array.isArray(r)&&!r.includes(h.button)&&h.type==="mousedown")return!1;const x=Array.isArray(r)&&r.includes(h.button)||!h.button||h.button<=1;return(!h.ctrlKey||m)&&x}}function xY({domNode:t,minZoom:e,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:o,onPanZoomEnd:a,onDraggingChange:l}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=t.getBoundingClientRect(),h=Uj().scaleExtent([e,n]).translateExtent(r),f=vn(t).call(h);k({x:s.x,y:s.y,zoom:fo(s.zoom,e,n)},[[0,0],[u.width,u.height]],r);const p=f.on("wheel.zoom"),m=f.on("dblclick.zoom");h.wheelDelta(y5);function x(N,T){return f?new Promise(I=>{h?.interpolate(T?.interpolate==="linear"?ga:wd).transform(Hf(f,T?.duration,T?.ease,()=>I(!0)),N)}):Promise.resolve(!1)}function b({noWheelClassName:N,noPanClassName:T,onPaneContextMenu:I,userSelectionActive:O,panOnScroll:E,panOnDrag:M,panOnScrollMode:R,panOnScrollSpeed:_,preventScrolling:$,zoomOnPinch:F,zoomOnScroll:z,zoomOnDoubleClick:V,zoomActivationKeyPressed:Z,lib:U,onTransformChange:Q,connectionInProgress:se,paneClickDistance:ce,selectionOnDrag:X}){O&&!d.isZoomingOrPanning&&y();const K=E&&!Z&&!O;h.clickDistance(X?1/0:!Qn(ce)||ce<0?0:ce);const te=K?uY({zoomPanValues:d,noWheelClassName:N,d3Selection:f,d3Zoom:h,panOnScrollMode:R,panOnScrollSpeed:_,zoomOnPinch:F,onPanZoomStart:o,onPanZoom:i,onPanZoomEnd:a}):hY({noWheelClassName:N,preventScrolling:$,d3ZoomHandler:p});if(f.on("wheel.zoom",te,{passive:!1}),!O){const J=fY({zoomPanValues:d,onDraggingChange:l,onPanZoomStart:o});h.on("start",J);const de=pY({zoomPanValues:d,panOnDrag:M,onPaneContextMenu:!!I,onPanZoom:i,onTransformChange:Q});h.on("zoom",de);const Ce=mY({zoomPanValues:d,panOnDrag:M,panOnScroll:E,onPaneContextMenu:I,onPanZoomEnd:a,onDraggingChange:l});h.on("end",Ce)}const le=gY({zoomActivationKeyPressed:Z,panOnDrag:M,zoomOnScroll:z,panOnScroll:E,zoomOnDoubleClick:V,zoomOnPinch:F,userSelectionActive:O,noPanClassName:T,noWheelClassName:N,lib:U,connectionInProgress:se});h.filter(le),V?f.on("dblclick.zoom",m):f.on("dblclick.zoom",null)}function y(){h.on("zoom",null)}async function k(N,T,I){const O=Vf(N),E=h?.constrain()(O,T,I);return E&&await x(E),new Promise(M=>M(E))}async function v(N,T){const I=Vf(N);return await x(I,T),new Promise(O=>O(I))}function w(N){if(f){const T=Vf(N),I=f.property("__zoom");(I.k!==N.zoom||I.x!==N.x||I.y!==N.y)&&h?.transform(f,T,null,{sync:!0})}}function C(){const N=f?Wj(f.node()):{x:0,y:0,k:1};return{x:N.x,y:N.y,zoom:N.k}}function j(N,T){return f?new Promise(I=>{h?.interpolate(T?.interpolate==="linear"?ga:wd).scaleTo(Hf(f,T?.duration,T?.ease,()=>I(!0)),N)}):Promise.resolve(!1)}function S(N,T){return f?new Promise(I=>{h?.interpolate(T?.interpolate==="linear"?ga:wd).scaleBy(Hf(f,T?.duration,T?.ease,()=>I(!0)),N)}):Promise.resolve(!1)}function P(N){h?.scaleExtent(N)}function D(N){h?.translateExtent(N)}function A(N){const T=!Qn(N)||N<0?0:N;h?.clickDistance(T)}return{update:b,destroy:y,setViewport:v,setViewportConstrained:k,getViewport:C,scaleTo:j,scaleBy:S,setScaleExtent:P,setTranslateExtent:D,syncViewport:w,setClickDistance:A}}var go;(function(t){t.Line="line",t.Handle="handle"})(go||(go={}));function bY({width:t,prevWidth:e,height:n,prevHeight:r,affectsX:s,affectsY:i}){const o=t-e,a=n-r,l=[o>0?1:o<0?-1:0,a>0?1:a<0?-1:0];return o&&s&&(l[0]=l[0]*-1),a&&i&&(l[1]=l[1]*-1),l}function h1(t){const e=t.includes("right")||t.includes("left"),n=t.includes("bottom")||t.includes("top"),r=t.includes("left"),s=t.includes("top");return{isHorizontal:e,isVertical:n,affectsX:r,affectsY:s}}function ts(t,e){return Math.max(0,e-t)}function ns(t,e){return Math.max(0,t-e)}function td(t,e,n){return Math.max(0,e-t,t-n)}function f1(t,e){return t?!e:e}function yY(t,e,n,r,s,i,o,a){let{affectsX:l,affectsY:d}=e;const{isHorizontal:u,isVertical:h}=e,f=u&&h,{xSnapped:p,ySnapped:m}=n,{minWidth:x,maxWidth:b,minHeight:y,maxHeight:k}=r,{x:v,y:w,width:C,height:j,aspectRatio:S}=t;let P=Math.floor(u?p-t.pointerX:0),D=Math.floor(h?m-t.pointerY:0);const A=C+(l?-P:P),N=j+(d?-D:D),T=-i[0]*C,I=-i[1]*j;let O=td(A,x,b),E=td(N,y,k);if(o){let _=0,$=0;l&&P<0?_=ts(v+P+T,o[0][0]):!l&&P>0&&(_=ns(v+A+T,o[1][0])),d&&D<0?$=ts(w+D+I,o[0][1]):!d&&D>0&&($=ns(w+N+I,o[1][1])),O=Math.max(O,_),E=Math.max(E,$)}if(a){let _=0,$=0;l&&P>0?_=ns(v+P,a[0][0]):!l&&P<0&&(_=ts(v+A,a[1][0])),d&&D>0?$=ns(w+D,a[0][1]):!d&&D<0&&($=ts(w+N,a[1][1])),O=Math.max(O,_),E=Math.max(E,$)}if(s){if(u){const _=td(A/S,y,k)*S;if(O=Math.max(O,_),o){let $=0;!l&&!d||l&&!d&&f?$=ns(w+I+A/S,o[1][1])*S:$=ts(w+I+(l?P:-P)/S,o[0][1])*S,O=Math.max(O,$)}if(a){let $=0;!l&&!d||l&&!d&&f?$=ts(w+A/S,a[1][1])*S:$=ns(w+(l?P:-P)/S,a[0][1])*S,O=Math.max(O,$)}}if(h){const _=td(N*S,x,b)/S;if(E=Math.max(E,_),o){let $=0;!l&&!d||d&&!l&&f?$=ns(v+N*S+T,o[1][0])/S:$=ts(v+(d?D:-D)*S+T,o[0][0])/S,E=Math.max(E,$)}if(a){let $=0;!l&&!d||d&&!l&&f?$=ts(v+N*S,a[1][0])/S:$=ns(v+(d?D:-D)*S,a[0][0])/S,E=Math.max(E,$)}}}D=D+(D<0?E:-E),P=P+(P<0?O:-O),s&&(f?A>N*S?D=(f1(l,d)?-P:P)/S:P=(f1(l,d)?-D:D)*S:u?(D=P/S,d=l):(P=D*S,l=d));const M=l?v+P:v,R=d?w+D:w;return{width:C+(l?-P:P),height:j+(d?-D:D),x:i[0]*P*(l?-1:1)+M,y:i[1]*D*(d?-1:1)+R}}const v5={width:0,height:0,x:0,y:0},vY={...v5,pointerX:0,pointerY:0,aspectRatio:1};function wY(t){return[[0,0],[t.measured.width,t.measured.height]]}function kY(t,e,n){const r=e.position.x+t.position.x,s=e.position.y+t.position.y,i=t.measured.width??0,o=t.measured.height??0,a=n[0]*i,l=n[1]*o;return[[r-a,s-l],[r+i-a,s+o-l]]}function SY({domNode:t,nodeId:e,getStoreItems:n,onChange:r,onEnd:s}){const i=vn(t);let o={controlDirection:h1("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:d,boundaries:u,keepAspectRatio:h,resizeDirection:f,onResizeStart:p,onResize:m,onResizeEnd:x,shouldResize:b}){let y={...v5},k={...vY};o={boundaries:u,resizeDirection:f,keepAspectRatio:h,controlDirection:h1(d)};let v,w=null,C=[],j,S,P,D=!1;const A=Dj().on("start",N=>{const{nodeLookup:T,transform:I,snapGrid:O,snapToGrid:E,nodeOrigin:M,paneDomNode:R}=n();if(v=T.get(e),!v)return;w=R?.getBoundingClientRect()??null;const{xSnapped:_,ySnapped:$}=xa(N.sourceEvent,{transform:I,snapGrid:O,snapToGrid:E,containerBounds:w});y={width:v.measured.width??0,height:v.measured.height??0,x:v.position.x??0,y:v.position.y??0},k={...y,pointerX:_,pointerY:$,aspectRatio:y.width/y.height},j=void 0,v.parentId&&(v.extent==="parent"||v.expandParent)&&(j=T.get(v.parentId),S=j&&v.extent==="parent"?wY(j):void 0),C=[],P=void 0;for(const[F,z]of T)if(z.parentId===e&&(C.push({id:F,position:{...z.position},extent:z.extent}),z.extent==="parent"||z.expandParent)){const V=kY(z,v,z.origin??M);P?P=[[Math.min(V[0][0],P[0][0]),Math.min(V[0][1],P[0][1])],[Math.max(V[1][0],P[1][0]),Math.max(V[1][1],P[1][1])]]:P=V}p?.(N,{...y})}).on("drag",N=>{const{transform:T,snapGrid:I,snapToGrid:O,nodeOrigin:E}=n(),M=xa(N.sourceEvent,{transform:T,snapGrid:I,snapToGrid:O,containerBounds:w}),R=[];if(!v)return;const{x:_,y:$,width:F,height:z}=y,V={},Z=v.origin??E,{width:U,height:Q,x:se,y:ce}=yY(k,o.controlDirection,M,o.boundaries,o.keepAspectRatio,Z,S,P),X=U!==F,K=Q!==z,te=se!==_&&X,le=ce!==$&&K;if(!te&&!le&&!X&&!K)return;if((te||le||Z[0]===1||Z[1]===1)&&(V.x=te?se:y.x,V.y=le?ce:y.y,y.x=V.x,y.y=V.y,C.length>0)){const Te=se-_,De=ce-$;for(const tt of C)tt.position={x:tt.position.x-Te+Z[0]*(U-F),y:tt.position.y-De+Z[1]*(Q-z)},R.push(tt)}if((X||K)&&(V.width=X&&(!o.resizeDirection||o.resizeDirection==="horizontal")?U:y.width,V.height=K&&(!o.resizeDirection||o.resizeDirection==="vertical")?Q:y.height,y.width=V.width,y.height=V.height),j&&v.expandParent){const Te=Z[0]*(V.width??0);V.x&&V.x<Te&&(y.x=Te,k.x=k.x-(V.x-Te));const De=Z[1]*(V.height??0);V.y&&V.y<De&&(y.y=De,k.y=k.y-(V.y-De))}const J=bY({width:y.width,prevWidth:F,height:y.height,prevHeight:z,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),de={...y,direction:J};b?.(N,de)!==!1&&(D=!0,m?.(N,de),r(V,R))}).on("end",N=>{D&&(x?.(N,{...y}),s?.({...y}),D=!1)});i.call(A)}function l(){i.on(".drag",null)}return{update:a,destroy:l}}const CY={},p1=t=>{let e;const n=new Set,r=(u,h)=>{const f=typeof u=="function"?u(e):u;if(!Object.is(f,e)){const p=e;e=h??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(m=>m(e,p))}},s=()=>e,l={setState:r,getState:s,getInitialState:()=>d,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(CY?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=e=t(r,s,l);return l},jY=t=>t?p1(t):p1,{useDebugValue:NY}=Qe,{useSyncExternalStoreWithSelector:PY}=S_,OY=t=>t;function w5(t,e=OY,n){const r=PY(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return NY(r),r}const m1=(t,e)=>{const n=jY(t),r=(s,i=e)=>w5(n,s,i);return Object.assign(r,n),r},EY=(t,e)=>t?m1(t,e):m1;function it(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[r,s]of t)if(!Object.is(s,e.get(r)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const r of t)if(!e.has(r))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(e,r)||!Object.is(t[r],e[r]))return!1;return!0}const mh=g.createContext(null),DY=mh.Provider,k5=Pr.error001();function Ue(t,e){const n=g.useContext(mh);if(n===null)throw new Error(k5);return w5(n,t,e)}function ot(){const t=g.useContext(mh);if(t===null)throw new Error(k5);return g.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe}),[t])}const g1={display:"none"},MY={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},S5="react-flow__node-desc",C5="react-flow__edge-desc",AY="react-flow__aria-live",TY=t=>t.ariaLiveMessage,LY=t=>t.ariaLabelConfig;function RY({rfId:t}){const e=Ue(TY);return c.jsx("div",{id:`${AY}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:MY,children:e})}function _Y({rfId:t,disableKeyboardA11y:e}){const n=Ue(LY);return c.jsxs(c.Fragment,{children:[c.jsx("div",{id:`${S5}-${t}`,style:g1,children:e?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),c.jsx("div",{id:`${C5}-${t}`,style:g1,children:n["edge.a11yDescription.default"]}),!e&&c.jsx(RY,{rfId:t})]})}const gh=g.forwardRef(({position:t="top-left",children:e,className:n,style:r,...s},i)=>{const o=`${t}`.split("-");return c.jsx("div",{className:vt(["react-flow__panel",n,...o]),style:r,ref:i,...s,children:e})});gh.displayName="Panel";function IY({proOptions:t,position:e="bottom-right"}){return t?.hideAttribution?null:c.jsx(gh,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:c.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const $Y=t=>{const e=[],n=[];for(const[,r]of t.nodeLookup)r.selected&&e.push(r.internals.userNode);for(const[,r]of t.edgeLookup)r.selected&&n.push(r);return{selectedNodes:e,selectedEdges:n}},nd=t=>t.id;function BY(t,e){return it(t.selectedNodes.map(nd),e.selectedNodes.map(nd))&&it(t.selectedEdges.map(nd),e.selectedEdges.map(nd))}function FY({onSelectionChange:t}){const e=ot(),{selectedNodes:n,selectedEdges:r}=Ue($Y,BY);return g.useEffect(()=>{const s={nodes:n,edges:r};t?.(s),e.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[n,r,t]),null}const zY=t=>!!t.onSelectionChangeHandlers;function VY({onSelectionChange:t}){const e=Ue(zY);return t||e?c.jsx(FY,{onSelectionChange:t}):null}const Nm=typeof window<"u"?g.useLayoutEffect:g.useEffect,j5=[0,0],HY={x:0,y:0,zoom:1},WY=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],x1=[...WY,"rfId"],UY=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges}),b1={translateExtent:Tl,nodeOrigin:j5,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function KY(t){const{setNodes:e,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:o,reset:a,setDefaultNodesAndEdges:l}=Ue(UY,it),d=ot();Nm(()=>(l(t.defaultNodes,t.defaultEdges),()=>{u.current=b1,a()}),[]);const u=g.useRef(b1);return Nm(()=>{for(const h of x1){const f=t[h],p=u.current[h];f!==p&&(typeof t[h]>"u"||(h==="nodes"?e(f):h==="edges"?n(f):h==="minZoom"?r(f):h==="maxZoom"?s(f):h==="translateExtent"?i(f):h==="nodeExtent"?o(f):h==="ariaLabelConfig"?d.setState({ariaLabelConfig:Rq(f)}):h==="fitView"?d.setState({fitViewQueued:f}):h==="fitViewOptions"?d.setState({fitViewOptions:f}):d.setState({[h]:f})))}u.current=t},x1.map(h=>t[h])),null}function y1(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function GY(t){const[e,n]=g.useState(t==="system"?null:t);return g.useEffect(()=>{if(t!=="system"){n(t);return}const r=y1(),s=()=>n(r?.matches?"dark":"light");return s(),r?.addEventListener("change",s),()=>{r?.removeEventListener("change",s)}},[t]),e!==null?e:y1()?.matches?"dark":"light"}const v1=typeof document<"u"?document:null;function Il(t=null,e={target:v1,actInsideInputWithModifier:!0}){const[n,r]=g.useState(!1),s=g.useRef(!1),i=g.useRef(new Set([])),[o,a]=g.useMemo(()=>{if(t!==null){const d=(Array.isArray(t)?t:[t]).filter(h=>typeof h=="string").map(h=>h.replace("+",`
|
|
306
|
+
`).replace(`
|
|
307
|
+
|
|
308
|
+
`,`
|
|
309
|
+
+`).split(`
|
|
310
|
+
`)),u=d.reduce((h,f)=>h.concat(...f),[]);return[d,u]}return[[],[]]},[t]);return g.useEffect(()=>{const l=e?.target??v1,d=e?.actInsideInputWithModifier??!0;if(t!==null){const u=p=>{if(s.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!s.current||s.current&&!d)&&s5(p))return!1;const x=k1(p.code,a);if(i.current.add(p[x]),w1(o,i.current,!1)){const b=p.composedPath?.()?.[0]||p.target,y=b?.nodeName==="BUTTON"||b?.nodeName==="A";e.preventDefault!==!1&&(s.current||!y)&&p.preventDefault(),r(!0)}},h=p=>{const m=k1(p.code,a);w1(o,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(p[m]),p.key==="Meta"&&i.current.clear(),s.current=!1},f=()=>{i.current.clear(),r(!1)};return l?.addEventListener("keydown",u),l?.addEventListener("keyup",h),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{l?.removeEventListener("keydown",u),l?.removeEventListener("keyup",h),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[t,r]),n}function w1(t,e,n){return t.filter(r=>n||r.length===e.size).some(r=>r.every(s=>e.has(s)))}function k1(t,e){return e.includes(t)?"code":"key"}const qY=()=>{const t=ot();return g.useMemo(()=>({zoomIn:e=>{const{panZoom:n}=t.getState();return n?n.scaleBy(1.2,e):Promise.resolve(!1)},zoomOut:e=>{const{panZoom:n}=t.getState();return n?n.scaleBy(1/1.2,e):Promise.resolve(!1)},zoomTo:(e,n)=>{const{panZoom:r}=t.getState();return r?r.scaleTo(e,n):Promise.resolve(!1)},getZoom:()=>t.getState().transform[2],setViewport:async(e,n)=>{const{transform:[r,s,i],panZoom:o}=t.getState();return o?(await o.setViewport({x:e.x??r,y:e.y??s,zoom:e.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[e,n,r]=t.getState().transform;return{x:e,y:n,zoom:r}},setCenter:async(e,n,r)=>t.getState().setCenter(e,n,r),fitBounds:async(e,n)=>{const{width:r,height:s,minZoom:i,maxZoom:o,panZoom:a}=t.getState(),l=i0(e,r,s,i,o,n?.padding??.1);return a?(await a.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(e,n={})=>{const{transform:r,snapGrid:s,snapToGrid:i,domNode:o}=t.getState();if(!o)return e;const{x:a,y:l}=o.getBoundingClientRect(),d={x:e.x-a,y:e.y-l},u=n.snapGrid??s,h=n.snapToGrid??i;return fc(d,r,h,u)},flowToScreenPosition:e=>{const{transform:n,domNode:r}=t.getState();if(!r)return e;const{x:s,y:i}=r.getBoundingClientRect(),o=Pu(e,n);return{x:o.x+s,y:o.y+i}}}),[])};function N5(t,e){const n=[],r=new Map,s=[];for(const i of t)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const o=r.get(i.id);o?o.push(i):r.set(i.id,[i])}for(const i of e){const o=r.get(i.id);if(!o){n.push(i);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){n.push({...o[0].item});continue}const a={...i};for(const l of o)YY(l,a);n.push(a)}return s.length&&s.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function YY(t,e){switch(t.type){case"select":{e.selected=t.selected;break}case"position":{typeof t.position<"u"&&(e.position=t.position),typeof t.dragging<"u"&&(e.dragging=t.dragging);break}case"dimensions":{typeof t.dimensions<"u"&&(e.measured={...t.dimensions},t.setAttributes&&((t.setAttributes===!0||t.setAttributes==="width")&&(e.width=t.dimensions.width),(t.setAttributes===!0||t.setAttributes==="height")&&(e.height=t.dimensions.height))),typeof t.resizing=="boolean"&&(e.resizing=t.resizing);break}}}function P5(t,e){return N5(t,e)}function O5(t,e){return N5(t,e)}function Fs(t,e){return{id:t,type:"select",selected:e}}function Li(t,e=new Set,n=!1){const r=[];for(const[s,i]of t){const o=e.has(s);!(i.selected===void 0&&!o)&&i.selected!==o&&(n&&(i.selected=o),r.push(Fs(i.id,o)))}return r}function S1({items:t=[],lookup:e}){const n=[],r=new Map(t.map(s=>[s.id,s]));for(const[s,i]of t.entries()){const o=e.get(i.id),a=o?.internals?.userNode??o;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:"replace"}),a===void 0&&n.push({item:i,type:"add",index:s})}for(const[s]of e)r.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function C1(t){return{id:t.id,type:"remove"}}const j1=t=>jq(t),XY=t=>Xj(t);function E5(t){return g.forwardRef(t)}function N1(t){const[e,n]=g.useState(BigInt(0)),[r]=g.useState(()=>ZY(()=>n(s=>s+BigInt(1))));return Nm(()=>{const s=r.get();s.length&&(t(s),r.reset())},[e]),r}function ZY(t){let e=[];return{get:()=>e,reset:()=>{e=[]},push:n=>{e.push(n),t()}}}const D5=g.createContext(null);function QY({children:t}){const e=ot(),n=g.useCallback(a=>{const{nodes:l=[],setNodes:d,hasDefaultNodes:u,onNodesChange:h,nodeLookup:f,fitViewQueued:p,onNodesChangeMiddlewareMap:m}=e.getState();let x=l;for(const y of a)x=typeof y=="function"?y(x):y;let b=S1({items:x,lookup:f});for(const y of m.values())b=y(b);u&&d(x),b.length>0?h?.(b):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:k,setNodes:v}=e.getState();y&&v(k)})},[]),r=N1(n),s=g.useCallback(a=>{const{edges:l=[],setEdges:d,hasDefaultEdges:u,onEdgesChange:h,edgeLookup:f}=e.getState();let p=l;for(const m of a)p=typeof m=="function"?m(p):m;u?d(p):h&&h(S1({items:p,lookup:f}))},[]),i=N1(s),o=g.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return c.jsx(D5.Provider,{value:o,children:t})}function JY(){const t=g.useContext(D5);if(!t)throw new Error("useBatchContext must be used within a BatchProvider");return t}const eX=t=>!!t.panZoom;function h0(){const t=qY(),e=ot(),n=JY(),r=Ue(eX),s=g.useMemo(()=>{const i=h=>e.getState().nodeLookup.get(h),o=h=>{n.nodeQueue.push(h)},a=h=>{n.edgeQueue.push(h)},l=h=>{const{nodeLookup:f,nodeOrigin:p}=e.getState(),m=j1(h)?h:f.get(h.id),x=m.parentId?n5(m.position,m.measured,m.parentId,f,p):m.position,b={...m,position:x,width:m.measured?.width??m.width,height:m.measured?.height??m.height};return po(b)},d=(h,f,p={replace:!1})=>{o(m=>m.map(x=>{if(x.id===h){const b=typeof f=="function"?f(x):f;return p.replace&&j1(b)?b:{...x,...b}}return x}))},u=(h,f,p={replace:!1})=>{a(m=>m.map(x=>{if(x.id===h){const b=typeof f=="function"?f(x):f;return p.replace&&XY(b)?b:{...x,...b}}return x}))};return{getNodes:()=>e.getState().nodes.map(h=>({...h})),getNode:h=>i(h)?.internals.userNode,getInternalNode:i,getEdges:()=>{const{edges:h=[]}=e.getState();return h.map(f=>({...f}))},getEdge:h=>e.getState().edgeLookup.get(h),setNodes:o,setEdges:a,addNodes:h=>{const f=Array.isArray(h)?h:[h];n.nodeQueue.push(p=>[...p,...f])},addEdges:h=>{const f=Array.isArray(h)?h:[h];n.edgeQueue.push(p=>[...p,...f])},toObject:()=>{const{nodes:h=[],edges:f=[],transform:p}=e.getState(),[m,x,b]=p;return{nodes:h.map(y=>({...y})),edges:f.map(y=>({...y})),viewport:{x:m,y:x,zoom:b}}},deleteElements:async({nodes:h=[],edges:f=[]})=>{const{nodes:p,edges:m,onNodesDelete:x,onEdgesDelete:b,triggerNodeChanges:y,triggerEdgeChanges:k,onDelete:v,onBeforeDelete:w}=e.getState(),{nodes:C,edges:j}=await Dq({nodesToRemove:h,edgesToRemove:f,nodes:p,edges:m,onBeforeDelete:w}),S=j.length>0,P=C.length>0;if(S){const D=j.map(C1);b?.(j),k(D)}if(P){const D=C.map(C1);x?.(C),y(D)}return(P||S)&&v?.({nodes:C,edges:j}),{deletedNodes:C,deletedEdges:j}},getIntersectingNodes:(h,f=!0,p)=>{const m=t1(h),x=m?h:l(h),b=p!==void 0;return x?(p||e.getState().nodes).filter(y=>{const k=e.getState().nodeLookup.get(y.id);if(k&&!m&&(y.id===h.id||!k.internals.positionAbsolute))return!1;const v=po(b?y:k),w=Rl(v,x);return f&&w>0||w>=v.width*v.height||w>=x.width*x.height}):[]},isNodeIntersecting:(h,f,p=!0)=>{const x=t1(h)?h:l(h);if(!x)return!1;const b=Rl(x,f);return p&&b>0||b>=f.width*f.height||b>=x.width*x.height},updateNode:d,updateNodeData:(h,f,p={replace:!1})=>{d(h,m=>{const x=typeof f=="function"?f(m):f;return p.replace?{...m,data:x}:{...m,data:{...m.data,...x}}},p)},updateEdge:u,updateEdgeData:(h,f,p={replace:!1})=>{u(h,m=>{const x=typeof f=="function"?f(m):f;return p.replace?{...m,data:x}:{...m,data:{...m.data,...x}}},p)},getNodesBounds:h=>{const{nodeLookup:f,nodeOrigin:p}=e.getState();return Nq(h,{nodeLookup:f,nodeOrigin:p})},getHandleConnections:({type:h,id:f,nodeId:p})=>Array.from(e.getState().connectionLookup.get(`${p}-${h}${f?`-${f}`:""}`)?.values()??[]),getNodeConnections:({type:h,handleId:f,nodeId:p})=>Array.from(e.getState().connectionLookup.get(`${p}${h?f?`-${h}-${f}`:`-${h}`:""}`)?.values()??[]),fitView:async h=>{const f=e.getState().fitViewResolver??Lq();return e.setState({fitViewQueued:!0,fitViewOptions:h,fitViewResolver:f}),n.nodeQueue.push(p=>[...p]),f.promise}}},[]);return g.useMemo(()=>({...s,...t,viewportInitialized:r}),[r])}const P1=t=>t.selected,tX=typeof window<"u"?window:void 0;function nX({deleteKeyCode:t,multiSelectionKeyCode:e}){const n=ot(),{deleteElements:r}=h0(),s=Il(t,{actInsideInputWithModifier:!1}),i=Il(e,{target:tX});g.useEffect(()=>{if(s){const{edges:o,nodes:a}=n.getState();r({nodes:a.filter(P1),edges:o.filter(P1)}),n.setState({nodesSelectionActive:!1})}},[s]),g.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function rX(t){const e=ot();g.useEffect(()=>{const n=()=>{if(!t.current||!(t.current.checkVisibility?.()??!0))return!1;const r=o0(t.current);(r.height===0||r.width===0)&&e.getState().onError?.("004",Pr.error004()),e.setState({width:r.width||500,height:r.height||500})};if(t.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(t.current),()=>{window.removeEventListener("resize",n),r&&t.current&&r.unobserve(t.current)}}},[])}const xh={position:"absolute",width:"100%",height:"100%",top:0,left:0},sX=t=>({userSelectionActive:t.userSelectionActive,lib:t.lib,connectionInProgress:t.connection.inProgress});function iX({onPaneContextMenu:t,zoomOnScroll:e=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=ei.Free,zoomOnDoubleClick:o=!0,panOnDrag:a=!0,defaultViewport:l,translateExtent:d,minZoom:u,maxZoom:h,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:x,noPanClassName:b,onViewportChange:y,isControlledViewport:k,paneClickDistance:v,selectionOnDrag:w}){const C=ot(),j=g.useRef(null),{userSelectionActive:S,lib:P,connectionInProgress:D}=Ue(sX,it),A=Il(f),N=g.useRef();rX(j);const T=g.useCallback(I=>{y?.({x:I[0],y:I[1],zoom:I[2]}),k||C.setState({transform:I})},[y,k]);return g.useEffect(()=>{if(j.current){N.current=xY({domNode:j.current,minZoom:u,maxZoom:h,translateExtent:d,viewport:l,onDraggingChange:M=>C.setState(R=>R.paneDragging===M?R:{paneDragging:M}),onPanZoomStart:(M,R)=>{const{onViewportChangeStart:_,onMoveStart:$}=C.getState();$?.(M,R),_?.(R)},onPanZoom:(M,R)=>{const{onViewportChange:_,onMove:$}=C.getState();$?.(M,R),_?.(R)},onPanZoomEnd:(M,R)=>{const{onViewportChangeEnd:_,onMoveEnd:$}=C.getState();$?.(M,R),_?.(R)}});const{x:I,y:O,zoom:E}=N.current.getViewport();return C.setState({panZoom:N.current,transform:[I,O,E],domNode:j.current.closest(".react-flow")}),()=>{N.current?.destroy()}}},[]),g.useEffect(()=>{N.current?.update({onPaneContextMenu:t,zoomOnScroll:e,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:o,panOnDrag:a,zoomActivationKeyPressed:A,preventScrolling:p,noPanClassName:b,userSelectionActive:S,noWheelClassName:x,lib:P,onTransformChange:T,connectionInProgress:D,selectionOnDrag:w,paneClickDistance:v})},[t,e,n,r,s,i,o,a,A,p,b,S,x,P,T,D,w,v]),c.jsx("div",{className:"react-flow__renderer",ref:j,style:xh,children:m})}const oX=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function aX(){const{userSelectionActive:t,userSelectionRect:e}=Ue(oX,it);return t&&e?c.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}const Wf=(t,e)=>n=>{n.target===e.current&&t?.(n)},lX=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,connectionInProgress:t.connection.inProgress,dragging:t.paneDragging});function cX({isSelecting:t,selectionKeyPressed:e,selectionMode:n=Ll.Full,panOnDrag:r,paneClickDistance:s,selectionOnDrag:i,onSelectionStart:o,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:d,onPaneScroll:u,onPaneMouseEnter:h,onPaneMouseMove:f,onPaneMouseLeave:p,children:m}){const x=ot(),{userSelectionActive:b,elementsSelectable:y,dragging:k,connectionInProgress:v}=Ue(lX,it),w=y&&(t||b),C=g.useRef(null),j=g.useRef(),S=g.useRef(new Set),P=g.useRef(new Set),D=g.useRef(!1),A=_=>{if(D.current||v){D.current=!1;return}l?.(_),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},N=_=>{if(Array.isArray(r)&&r?.includes(2)){_.preventDefault();return}d?.(_)},T=u?_=>u(_):void 0,I=_=>{D.current&&(_.stopPropagation(),D.current=!1)},O=_=>{const{domNode:$}=x.getState();if(j.current=$?.getBoundingClientRect(),!j.current)return;const F=_.target===C.current;if(!F&&!!_.target.closest(".nokey")||!t||!(i&&F||e)||_.button!==0||!_.isPrimary)return;_.target?.setPointerCapture?.(_.pointerId),D.current=!1;const{x:Z,y:U}=Jn(_.nativeEvent,j.current);x.setState({userSelectionRect:{width:0,height:0,startX:Z,startY:U,x:Z,y:U}}),F||(_.stopPropagation(),_.preventDefault())},E=_=>{const{userSelectionRect:$,transform:F,nodeLookup:z,edgeLookup:V,connectionLookup:Z,triggerNodeChanges:U,triggerEdgeChanges:Q,defaultEdgeOptions:se,resetSelectedElements:ce}=x.getState();if(!j.current||!$)return;const{x:X,y:K}=Jn(_.nativeEvent,j.current),{startX:te,startY:le}=$;if(!D.current){const De=e?0:s;if(Math.hypot(X-te,K-le)<=De)return;ce(),o?.(_)}D.current=!0;const J={startX:te,startY:le,x:X<te?X:te,y:K<le?K:le,width:Math.abs(X-te),height:Math.abs(K-le)},de=S.current,Ce=P.current;S.current=new Set(s0(z,J,F,n===Ll.Partial,!0).map(De=>De.id)),P.current=new Set;const Te=se?.selectable??!0;for(const De of S.current){const tt=Z.get(De);if(tt)for(const{edgeId:qt}of tt.values()){const Nt=V.get(qt);Nt&&(Nt.selectable??Te)&&P.current.add(qt)}}if(!n1(de,S.current)){const De=Li(z,S.current,!0);U(De)}if(!n1(Ce,P.current)){const De=Li(V,P.current);Q(De)}x.setState({userSelectionRect:J,userSelectionActive:!0,nodesSelectionActive:!1})},M=_=>{_.button===0&&(_.target?.releasePointerCapture?.(_.pointerId),!b&&_.target===C.current&&x.getState().userSelectionRect&&A?.(_),x.setState({userSelectionActive:!1,userSelectionRect:null}),D.current&&(a?.(_),x.setState({nodesSelectionActive:S.current.size>0})))},R=r===!0||Array.isArray(r)&&r.includes(0);return c.jsxs("div",{className:vt(["react-flow__pane",{draggable:R,dragging:k,selection:t}]),onClick:w?void 0:Wf(A,C),onContextMenu:Wf(N,C),onWheel:Wf(T,C),onPointerEnter:w?void 0:h,onPointerMove:w?E:f,onPointerUp:w?M:void 0,onPointerDownCapture:w?O:void 0,onClickCapture:w?I:void 0,onPointerLeave:p,ref:C,style:xh,children:[m,c.jsx(aX,{})]})}function Pm({id:t,store:e,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:o,nodeLookup:a,onError:l}=e.getState(),d=a.get(t);if(!d){l?.("012",Pr.error012(t));return}e.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&o)&&(i({nodes:[d],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):s([t])}function M5({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:o}){const a=ot(),[l,d]=g.useState(!1),u=g.useRef();return g.useEffect(()=>{u.current=rY({getStoreItems:()=>a.getState(),onNodeMouseDown:h=>{Pm({id:h,store:a,nodeRef:t})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),g.useEffect(()=>{if(!(e||!t.current||!u.current))return u.current.update({noDragClassName:n,handleSelector:r,domNode:t.current,isSelectable:i,nodeId:s,nodeClickDistance:o}),()=>{u.current?.destroy()}},[n,r,e,i,t,s,o]),l}const dX=t=>e=>e.selected&&(e.draggable||t&&typeof e.draggable>"u");function A5(){const t=ot();return g.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:o,onError:a,updateNodePositions:l,nodeLookup:d,nodeOrigin:u}=t.getState(),h=new Map,f=dX(o),p=s?i[0]:5,m=s?i[1]:5,x=n.direction.x*p*n.factor,b=n.direction.y*m*n.factor;for(const[,y]of d){if(!f(y))continue;let k={x:y.internals.positionAbsolute.x+x,y:y.internals.positionAbsolute.y+b};s&&(k=hc(k,i));const{position:v,positionAbsolute:w}=Zj({nodeId:y.id,nextPosition:k,nodeLookup:d,nodeExtent:r,nodeOrigin:u,onError:a});y.position=v,y.internals.positionAbsolute=w,h.set(y.id,y)}l(h)},[])}const f0=g.createContext(null),uX=f0.Provider;f0.Consumer;const T5=()=>g.useContext(f0),hX=t=>({connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName,rfId:t.rfId}),fX=(t,e,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:o}=r,{fromHandle:a,toHandle:l,isValid:d}=o,u=l?.nodeId===t&&l?.id===e&&l?.type===n;return{connectingFrom:a?.nodeId===t&&a?.id===e&&a?.type===n,connectingTo:u,clickConnecting:s?.nodeId===t&&s?.id===e&&s?.type===n,isPossibleEndHandle:i===ho.Strict?a?.type!==n:t!==a?.nodeId||e!==a?.id,connectionInProcess:!!a,clickConnectionInProcess:!!s,valid:u&&d}};function pX({type:t="source",position:e=ke.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:o,onConnect:a,children:l,className:d,onMouseDown:u,onTouchStart:h,...f},p){const m=o||null,x=t==="target",b=ot(),y=T5(),{connectOnClick:k,noPanClassName:v,rfId:w}=Ue(hX,it),{connectingFrom:C,connectingTo:j,clickConnecting:S,isPossibleEndHandle:P,connectionInProcess:D,clickConnectionInProcess:A,valid:N}=Ue(fX(y,m,t),it);y||b.getState().onError?.("010",Pr.error010());const T=E=>{const{defaultEdgeOptions:M,onConnect:R,hasDefaultEdges:_}=b.getState(),$={...M,...E};if(_){const{edges:F,setEdges:z}=b.getState();z(zq($,F))}R?.($),a?.($)},I=E=>{if(!y)return;const M=i5(E.nativeEvent);if(s&&(M&&E.button===0||!M)){const R=b.getState();jm.onPointerDown(E.nativeEvent,{handleDomNode:E.currentTarget,autoPanOnConnect:R.autoPanOnConnect,connectionMode:R.connectionMode,connectionRadius:R.connectionRadius,domNode:R.domNode,nodeLookup:R.nodeLookup,lib:R.lib,isTarget:x,handleId:m,nodeId:y,flowId:R.rfId,panBy:R.panBy,cancelConnection:R.cancelConnection,onConnectStart:R.onConnectStart,onConnectEnd:(..._)=>b.getState().onConnectEnd?.(..._),updateConnection:R.updateConnection,onConnect:T,isValidConnection:n||((..._)=>b.getState().isValidConnection?.(..._)??!0),getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,autoPanSpeed:R.autoPanSpeed,dragThreshold:R.connectionDragThreshold})}M?u?.(E):h?.(E)},O=E=>{const{onClickConnectStart:M,onClickConnectEnd:R,connectionClickStartHandle:_,connectionMode:$,isValidConnection:F,lib:z,rfId:V,nodeLookup:Z,connection:U}=b.getState();if(!y||!_&&!s)return;if(!_){M?.(E.nativeEvent,{nodeId:y,handleId:m,handleType:t}),b.setState({connectionClickStartHandle:{nodeId:y,type:t,id:m}});return}const Q=r5(E.target),se=n||F,{connection:ce,isValid:X}=jm.isValid(E.nativeEvent,{handle:{nodeId:y,id:m,type:t},connectionMode:$,fromNodeId:_.nodeId,fromHandleId:_.id||null,fromType:_.type,isValidConnection:se,flowId:V,doc:Q,lib:z,nodeLookup:Z});X&&ce&&T(ce);const K=structuredClone(U);delete K.inProgress,K.toPosition=K.toHandle?K.toHandle.position:null,R?.(E,K),b.setState({connectionClickStartHandle:null})};return c.jsx("div",{"data-handleid":m,"data-nodeid":y,"data-handlepos":e,"data-id":`${w}-${y}-${m}-${t}`,className:vt(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",v,d,{source:!x,target:x,connectable:r,connectablestart:s,connectableend:i,clickconnecting:S,connectingfrom:C,connectingto:j,valid:N,connectionindicator:r&&(!D||P)&&(D||A?i:s)}]),onMouseDown:I,onTouchStart:I,onClick:k?O:void 0,ref:p,...f,children:l})}const xo=g.memo(E5(pX));function mX({data:t,isConnectable:e,sourcePosition:n=ke.Bottom}){return c.jsxs(c.Fragment,{children:[t?.label,c.jsx(xo,{type:"source",position:n,isConnectable:e})]})}function gX({data:t,isConnectable:e,targetPosition:n=ke.Top,sourcePosition:r=ke.Bottom}){return c.jsxs(c.Fragment,{children:[c.jsx(xo,{type:"target",position:n,isConnectable:e}),t?.label,c.jsx(xo,{type:"source",position:r,isConnectable:e})]})}function xX(){return null}function bX({data:t,isConnectable:e,targetPosition:n=ke.Top}){return c.jsxs(c.Fragment,{children:[c.jsx(xo,{type:"target",position:n,isConnectable:e}),t?.label]})}const Ou={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},O1={input:mX,default:gX,output:bX,group:xX};function yX(t){return t.internals.handleBounds===void 0?{width:t.width??t.initialWidth??t.style?.width,height:t.height??t.initialHeight??t.style?.height}:{width:t.width??t.style?.width,height:t.height??t.style?.height}}const vX=t=>{const{width:e,height:n,x:r,y:s}=uc(t.nodeLookup,{filter:i=>!!i.selected});return{width:Qn(e)?e:null,height:Qn(n)?n:null,userSelectionActive:t.userSelectionActive,transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]}) translate(${r}px,${s}px)`}};function wX({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const r=ot(),{width:s,height:i,transformString:o,userSelectionActive:a}=Ue(vX,it),l=A5(),d=g.useRef(null);g.useEffect(()=>{n||d.current?.focus({preventScroll:!0})},[n]);const u=!a&&s!==null&&i!==null;if(M5({nodeRef:d,disabled:!u}),!u)return null;const h=t?p=>{const m=r.getState().nodes.filter(x=>x.selected);t(p,m)}:void 0,f=p=>{Object.prototype.hasOwnProperty.call(Ou,p.key)&&(p.preventDefault(),l({direction:Ou[p.key],factor:p.shiftKey?4:1}))};return c.jsx("div",{className:vt(["react-flow__nodesselection","react-flow__container",e]),style:{transform:o},children:c.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:h,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:s,height:i}})})}const E1=typeof window<"u"?window:void 0,kX=t=>({nodesSelectionActive:t.nodesSelectionActive,userSelectionActive:t.userSelectionActive});function L5({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,paneClickDistance:a,deleteKeyCode:l,selectionKeyCode:d,selectionOnDrag:u,selectionMode:h,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:x,zoomActivationKeyCode:b,elementsSelectable:y,zoomOnScroll:k,zoomOnPinch:v,panOnScroll:w,panOnScrollSpeed:C,panOnScrollMode:j,zoomOnDoubleClick:S,panOnDrag:P,defaultViewport:D,translateExtent:A,minZoom:N,maxZoom:T,preventScrolling:I,onSelectionContextMenu:O,noWheelClassName:E,noPanClassName:M,disableKeyboardA11y:R,onViewportChange:_,isControlledViewport:$}){const{nodesSelectionActive:F,userSelectionActive:z}=Ue(kX,it),V=Il(d,{target:E1}),Z=Il(x,{target:E1}),U=Z||P,Q=Z||w,se=u&&U!==!0,ce=V||z||se;return nX({deleteKeyCode:l,multiSelectionKeyCode:m}),c.jsx(iX,{onPaneContextMenu:i,elementsSelectable:y,zoomOnScroll:k,zoomOnPinch:v,panOnScroll:Q,panOnScrollSpeed:C,panOnScrollMode:j,zoomOnDoubleClick:S,panOnDrag:!V&&U,defaultViewport:D,translateExtent:A,minZoom:N,maxZoom:T,zoomActivationKeyCode:b,preventScrolling:I,noWheelClassName:E,noPanClassName:M,onViewportChange:_,isControlledViewport:$,paneClickDistance:a,selectionOnDrag:se,children:c.jsxs(cX,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,panOnDrag:U,isSelecting:!!ce,selectionMode:h,selectionKeyPressed:V,paneClickDistance:a,selectionOnDrag:se,children:[t,F&&c.jsx(wX,{onSelectionContextMenu:O,noPanClassName:M,disableKeyboardA11y:R})]})})}L5.displayName="FlowRenderer";const SX=g.memo(L5),CX=t=>e=>t?s0(e.nodeLookup,{x:0,y:0,width:e.width,height:e.height},e.transform,!0).map(n=>n.id):Array.from(e.nodeLookup.keys());function jX(t){return Ue(g.useCallback(CX(t),[t]),it)}const NX=t=>t.updateNodeInternals;function PX(){const t=Ue(NX),[e]=g.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const i=s.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:s.target,force:!0})}),t(r)}));return g.useEffect(()=>()=>{e?.disconnect()},[e]),e}function OX({node:t,nodeType:e,hasDimensions:n,resizeObserver:r}){const s=ot(),i=g.useRef(null),o=g.useRef(null),a=g.useRef(t.sourcePosition),l=g.useRef(t.targetPosition),d=g.useRef(e),u=n&&!!t.internals.handleBounds;return g.useEffect(()=>{i.current&&!t.hidden&&(!u||o.current!==i.current)&&(o.current&&r?.unobserve(o.current),r?.observe(i.current),o.current=i.current)},[u,t.hidden]),g.useEffect(()=>()=>{o.current&&(r?.unobserve(o.current),o.current=null)},[]),g.useEffect(()=>{if(i.current){const h=d.current!==e,f=a.current!==t.sourcePosition,p=l.current!==t.targetPosition;(h||f||p)&&(d.current=e,a.current=t.sourcePosition,l.current=t.targetPosition,s.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:i.current,force:!0}]])))}},[t.id,e,t.sourcePosition,t.targetPosition]),i}function EX({id:t,onClick:e,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:o,nodesDraggable:a,elementsSelectable:l,nodesConnectable:d,nodesFocusable:u,resizeObserver:h,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:x,nodeTypes:b,nodeClickDistance:y,onError:k}){const{node:v,internals:w,isParent:C}=Ue(X=>{const K=X.nodeLookup.get(t),te=X.parentLookup.has(t);return{node:K,internals:K.internals,isParent:te}},it);let j=v.type||"default",S=b?.[j]||O1[j];S===void 0&&(k?.("003",Pr.error003(j)),j="default",S=b?.default||O1.default);const P=!!(v.draggable||a&&typeof v.draggable>"u"),D=!!(v.selectable||l&&typeof v.selectable>"u"),A=!!(v.connectable||d&&typeof v.connectable>"u"),N=!!(v.focusable||u&&typeof v.focusable>"u"),T=ot(),I=t5(v),O=OX({node:v,nodeType:j,hasDimensions:I,resizeObserver:h}),E=M5({nodeRef:O,disabled:v.hidden||!P,noDragClassName:f,handleSelector:v.dragHandle,nodeId:t,isSelectable:D,nodeClickDistance:y}),M=A5();if(v.hidden)return null;const R=Yr(v),_=yX(v),$=D||P||e||n||r||s,F=n?X=>n(X,{...w.userNode}):void 0,z=r?X=>r(X,{...w.userNode}):void 0,V=s?X=>s(X,{...w.userNode}):void 0,Z=i?X=>i(X,{...w.userNode}):void 0,U=o?X=>o(X,{...w.userNode}):void 0,Q=X=>{const{selectNodesOnDrag:K,nodeDragThreshold:te}=T.getState();D&&(!K||!P||te>0)&&Pm({id:t,store:T,nodeRef:O}),e&&e(X,{...w.userNode})},se=X=>{if(!(s5(X.nativeEvent)||m)){if(Kj.includes(X.key)&&D){const K=X.key==="Escape";Pm({id:t,store:T,unselect:K,nodeRef:O})}else if(P&&v.selected&&Object.prototype.hasOwnProperty.call(Ou,X.key)){X.preventDefault();const{ariaLabelConfig:K}=T.getState();T.setState({ariaLiveMessage:K["node.a11yDescription.ariaLiveMessage"]({direction:X.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),M({direction:Ou[X.key],factor:X.shiftKey?4:1})}}},ce=()=>{if(m||!O.current?.matches(":focus-visible"))return;const{transform:X,width:K,height:te,autoPanOnNodeFocus:le,setCenter:J}=T.getState();if(!le)return;s0(new Map([[t,v]]),{x:0,y:0,width:K,height:te},X,!0).length>0||J(v.position.x+R.width/2,v.position.y+R.height/2,{zoom:X[2]})};return c.jsx("div",{className:vt(["react-flow__node",`react-flow__node-${j}`,{[p]:P},v.className,{selected:v.selected,selectable:D,parent:C,draggable:P,dragging:E}]),ref:O,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:$?"all":"none",visibility:I?"visible":"hidden",...v.style,..._},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:F,onMouseMove:z,onMouseLeave:V,onContextMenu:Z,onClick:Q,onDoubleClick:U,onKeyDown:N?se:void 0,tabIndex:N?0:void 0,onFocus:N?ce:void 0,role:v.ariaRole??(N?"group":void 0),"aria-roledescription":"node","aria-describedby":m?void 0:`${S5}-${x}`,"aria-label":v.ariaLabel,...v.domAttributes,children:c.jsx(uX,{value:t,children:c.jsx(S,{id:t,data:v.data,type:j,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:v.selected??!1,selectable:D,draggable:P,deletable:v.deletable??!0,isConnectable:A,sourcePosition:v.sourcePosition,targetPosition:v.targetPosition,dragging:E,dragHandle:v.dragHandle,zIndex:w.z,parentId:v.parentId,...R})})})}var DX=g.memo(EX);const MX=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,onError:t.onError});function R5(t){const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=Ue(MX,it),o=jX(t.onlyRenderVisibleElements),a=PX();return c.jsx("div",{className:"react-flow__nodes",style:xh,children:o.map(l=>c.jsx(DX,{id:l,nodeTypes:t.nodeTypes,nodeExtent:t.nodeExtent,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,resizeObserver:a,nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:t.nodeClickDistance,onError:i},l))})}R5.displayName="NodeRenderer";const AX=g.memo(R5);function TX(t){return Ue(g.useCallback(n=>{if(!t)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const i=n.nodeLookup.get(s.source),o=n.nodeLookup.get(s.target);i&&o&&$q({sourceNode:i,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[t]),it)}const LX=({color:t="none",strokeWidth:e=1})=>{const n={strokeWidth:e,...t&&{stroke:t}};return c.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},RX=({color:t="none",strokeWidth:e=1})=>{const n={strokeWidth:e,...t&&{stroke:t,fill:t}};return c.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},D1={[ju.Arrow]:LX,[ju.ArrowClosed]:RX};function _X(t){const e=ot();return g.useMemo(()=>Object.prototype.hasOwnProperty.call(D1,t)?D1[t]:(e.getState().onError?.("009",Pr.error009(t)),null),[t])}const IX=({id:t,type:e,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:o,orient:a="auto-start-reverse"})=>{const l=_X(e);return l?c.jsx("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:a,refX:"0",refY:"0",children:c.jsx(l,{color:n,strokeWidth:o})}):null},_5=({defaultColor:t,rfId:e})=>{const n=Ue(i=>i.edges),r=Ue(i=>i.defaultEdgeOptions),s=g.useMemo(()=>Kq(n,{id:e,defaultColor:t,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,e,t]);return s.length?c.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:c.jsx("defs",{children:s.map(i=>c.jsx(IX,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};_5.displayName="MarkerDefinitions";var $X=g.memo(_5);function I5({x:t,y:e,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:o=[2,4],labelBgBorderRadius:a=2,children:l,className:d,...u}){const[h,f]=g.useState({x:1,y:0,width:0,height:0}),p=vt(["react-flow__edge-textwrapper",d]),m=g.useRef(null);return g.useEffect(()=>{if(m.current){const x=m.current.getBBox();f({x:x.x,y:x.y,width:x.width,height:x.height})}},[n]),n?c.jsxs("g",{transform:`translate(${t-h.width/2} ${e-h.height/2})`,className:p,visibility:h.width?"visible":"hidden",...u,children:[s&&c.jsx("rect",{width:h.width+2*o[0],x:-o[0],y:-o[1],height:h.height+2*o[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),c.jsx("text",{className:"react-flow__edge-text",y:h.height/2,dy:"0.3em",ref:m,style:r,children:n}),l]}):null}I5.displayName="EdgeText";const BX=g.memo(I5);function bh({path:t,labelX:e,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:d=20,...u}){return c.jsxs(c.Fragment,{children:[c.jsx("path",{...u,d:t,fill:"none",className:vt(["react-flow__edge-path",u.className])}),d?c.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,r&&Qn(e)&&Qn(n)?c.jsx(BX,{x:e,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function M1({pos:t,x1:e,y1:n,x2:r,y2:s}){return t===ke.Left||t===ke.Right?[.5*(e+r),n]:[e,.5*(n+s)]}function $5({sourceX:t,sourceY:e,sourcePosition:n=ke.Bottom,targetX:r,targetY:s,targetPosition:i=ke.Top}){const[o,a]=M1({pos:n,x1:t,y1:e,x2:r,y2:s}),[l,d]=M1({pos:i,x1:r,y1:s,x2:t,y2:e}),[u,h,f,p]=o5({sourceX:t,sourceY:e,targetX:r,targetY:s,sourceControlX:o,sourceControlY:a,targetControlX:l,targetControlY:d});return[`M${t},${e} C${o},${a} ${l},${d} ${r},${s}`,u,h,f,p]}function B5(t){return g.memo(({id:e,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o,targetPosition:a,label:l,labelStyle:d,labelShowBg:u,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:x,markerStart:b,interactionWidth:y})=>{const[k,v,w]=$5({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:a}),C=t.isInternal?void 0:e;return c.jsx(bh,{id:C,path:k,labelX:v,labelY:w,label:l,labelStyle:d,labelShowBg:u,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:x,markerStart:b,interactionWidth:y})})}const FX=B5({isInternal:!1}),F5=B5({isInternal:!0});FX.displayName="SimpleBezierEdge";F5.displayName="SimpleBezierEdgeInternal";function z5(t){return g.memo(({id:e,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,sourcePosition:p=ke.Bottom,targetPosition:m=ke.Top,markerEnd:x,markerStart:b,pathOptions:y,interactionWidth:k})=>{const[v,w,C]=km({sourceX:n,sourceY:r,sourcePosition:p,targetX:s,targetY:i,targetPosition:m,borderRadius:y?.borderRadius,offset:y?.offset,stepPosition:y?.stepPosition}),j=t.isInternal?void 0:e;return c.jsx(bh,{id:j,path:v,labelX:w,labelY:C,label:o,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:x,markerStart:b,interactionWidth:k})})}const V5=z5({isInternal:!1}),H5=z5({isInternal:!0});V5.displayName="SmoothStepEdge";H5.displayName="SmoothStepEdgeInternal";function W5(t){return g.memo(({id:e,...n})=>{const r=t.isInternal?void 0:e;return c.jsx(V5,{...n,id:r,pathOptions:g.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const zX=W5({isInternal:!1}),U5=W5({isInternal:!0});zX.displayName="StepEdge";U5.displayName="StepEdgeInternal";function K5(t){return g.memo(({id:e,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:p,markerStart:m,interactionWidth:x})=>{const[b,y,k]=c5({sourceX:n,sourceY:r,targetX:s,targetY:i}),v=t.isInternal?void 0:e;return c.jsx(bh,{id:v,path:b,labelX:y,labelY:k,label:o,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:p,markerStart:m,interactionWidth:x})})}const VX=K5({isInternal:!1}),G5=K5({isInternal:!0});VX.displayName="StraightEdge";G5.displayName="StraightEdgeInternal";function q5(t){return g.memo(({id:e,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o=ke.Bottom,targetPosition:a=ke.Top,label:l,labelStyle:d,labelShowBg:u,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:x,markerStart:b,pathOptions:y,interactionWidth:k})=>{const[v,w,C]=a5({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:a,curvature:y?.curvature}),j=t.isInternal?void 0:e;return c.jsx(bh,{id:j,path:v,labelX:w,labelY:C,label:l,labelStyle:d,labelShowBg:u,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:x,markerStart:b,interactionWidth:k})})}const HX=q5({isInternal:!1}),Y5=q5({isInternal:!0});HX.displayName="BezierEdge";Y5.displayName="BezierEdgeInternal";const A1={default:Y5,straight:G5,step:U5,smoothstep:H5,simplebezier:F5},T1={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},WX=(t,e,n)=>n===ke.Left?t-e:n===ke.Right?t+e:t,UX=(t,e,n)=>n===ke.Top?t-e:n===ke.Bottom?t+e:t,L1="react-flow__edgeupdater";function R1({position:t,centerX:e,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:o,type:a}){return c.jsx("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:o,className:vt([L1,`${L1}-${a}`]),cx:WX(e,r,t),cy:UX(n,r,t),r,stroke:"transparent",fill:"transparent"})}function KX({isReconnectable:t,reconnectRadius:e,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:o,sourcePosition:a,targetPosition:l,onReconnect:d,onReconnectStart:u,onReconnectEnd:h,setReconnecting:f,setUpdateHover:p}){const m=ot(),x=(w,C)=>{if(w.button!==0)return;const{autoPanOnConnect:j,domNode:S,connectionMode:P,connectionRadius:D,lib:A,onConnectStart:N,cancelConnection:T,nodeLookup:I,rfId:O,panBy:E,updateConnection:M}=m.getState(),R=C.type==="target",_=(z,V)=>{f(!1),h?.(z,n,C.type,V)},$=z=>d?.(n,z),F=(z,V)=>{f(!0),u?.(w,n,C.type),N?.(z,V)};jm.onPointerDown(w.nativeEvent,{autoPanOnConnect:j,connectionMode:P,connectionRadius:D,domNode:S,handleId:C.id,nodeId:C.nodeId,nodeLookup:I,isTarget:R,edgeUpdaterType:C.type,lib:A,flowId:O,cancelConnection:T,panBy:E,isValidConnection:(...z)=>m.getState().isValidConnection?.(...z)??!0,onConnect:$,onConnectStart:F,onConnectEnd:(...z)=>m.getState().onConnectEnd?.(...z),onReconnectEnd:_,updateConnection:M,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},b=w=>x(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=w=>x(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),k=()=>p(!0),v=()=>p(!1);return c.jsxs(c.Fragment,{children:[(t===!0||t==="source")&&c.jsx(R1,{position:a,centerX:r,centerY:s,radius:e,onMouseDown:b,onMouseEnter:k,onMouseOut:v,type:"source"}),(t===!0||t==="target")&&c.jsx(R1,{position:l,centerX:i,centerY:o,radius:e,onMouseDown:y,onMouseEnter:k,onMouseOut:v,type:"target"})]})}function GX({id:t,edgesFocusable:e,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:o,onMouseEnter:a,onMouseMove:l,onMouseLeave:d,reconnectRadius:u,onReconnect:h,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:x,noPanClassName:b,onError:y,disableKeyboardA11y:k}){let v=Ue(J=>J.edgeLookup.get(t));const w=Ue(J=>J.defaultEdgeOptions);v=w?{...w,...v}:v;let C=v.type||"default",j=x?.[C]||A1[C];j===void 0&&(y?.("011",Pr.error011(C)),C="default",j=x?.default||A1.default);const S=!!(v.focusable||e&&typeof v.focusable>"u"),P=typeof h<"u"&&(v.reconnectable||n&&typeof v.reconnectable>"u"),D=!!(v.selectable||r&&typeof v.selectable>"u"),A=g.useRef(null),[N,T]=g.useState(!1),[I,O]=g.useState(!1),E=ot(),{zIndex:M,sourceX:R,sourceY:_,targetX:$,targetY:F,sourcePosition:z,targetPosition:V}=Ue(g.useCallback(J=>{const de=J.nodeLookup.get(v.source),Ce=J.nodeLookup.get(v.target);if(!de||!Ce)return{zIndex:v.zIndex,...T1};const Te=Uq({id:t,sourceNode:de,targetNode:Ce,sourceHandle:v.sourceHandle||null,targetHandle:v.targetHandle||null,connectionMode:J.connectionMode,onError:y});return{zIndex:Iq({selected:v.selected,zIndex:v.zIndex,sourceNode:de,targetNode:Ce,elevateOnSelect:J.elevateEdgesOnSelect,zIndexMode:J.zIndexMode}),...Te||T1}},[v.source,v.target,v.sourceHandle,v.targetHandle,v.selected,v.zIndex]),it),Z=g.useMemo(()=>v.markerStart?`url('#${Sm(v.markerStart,m)}')`:void 0,[v.markerStart,m]),U=g.useMemo(()=>v.markerEnd?`url('#${Sm(v.markerEnd,m)}')`:void 0,[v.markerEnd,m]);if(v.hidden||R===null||_===null||$===null||F===null)return null;const Q=J=>{const{addSelectedEdges:de,unselectNodesAndEdges:Ce,multiSelectionActive:Te}=E.getState();D&&(E.setState({nodesSelectionActive:!1}),v.selected&&Te?(Ce({nodes:[],edges:[v]}),A.current?.blur()):de([t])),s&&s(J,v)},se=i?J=>{i(J,{...v})}:void 0,ce=o?J=>{o(J,{...v})}:void 0,X=a?J=>{a(J,{...v})}:void 0,K=l?J=>{l(J,{...v})}:void 0,te=d?J=>{d(J,{...v})}:void 0,le=J=>{if(!k&&Kj.includes(J.key)&&D){const{unselectNodesAndEdges:de,addSelectedEdges:Ce}=E.getState();J.key==="Escape"?(A.current?.blur(),de({edges:[v]})):Ce([t])}};return c.jsx("svg",{style:{zIndex:M},children:c.jsxs("g",{className:vt(["react-flow__edge",`react-flow__edge-${C}`,v.className,b,{selected:v.selected,animated:v.animated,inactive:!D&&!s,updating:N,selectable:D}]),onClick:Q,onDoubleClick:se,onContextMenu:ce,onMouseEnter:X,onMouseMove:K,onMouseLeave:te,onKeyDown:S?le:void 0,tabIndex:S?0:void 0,role:v.ariaRole??(S?"group":"img"),"aria-roledescription":"edge","data-id":t,"data-testid":`rf__edge-${t}`,"aria-label":v.ariaLabel===null?void 0:v.ariaLabel||`Edge from ${v.source} to ${v.target}`,"aria-describedby":S?`${C5}-${m}`:void 0,ref:A,...v.domAttributes,children:[!I&&c.jsx(j,{id:t,source:v.source,target:v.target,type:v.type,selected:v.selected,animated:v.animated,selectable:D,deletable:v.deletable??!0,label:v.label,labelStyle:v.labelStyle,labelShowBg:v.labelShowBg,labelBgStyle:v.labelBgStyle,labelBgPadding:v.labelBgPadding,labelBgBorderRadius:v.labelBgBorderRadius,sourceX:R,sourceY:_,targetX:$,targetY:F,sourcePosition:z,targetPosition:V,data:v.data,style:v.style,sourceHandleId:v.sourceHandle,targetHandleId:v.targetHandle,markerStart:Z,markerEnd:U,pathOptions:"pathOptions"in v?v.pathOptions:void 0,interactionWidth:v.interactionWidth}),P&&c.jsx(KX,{edge:v,isReconnectable:P,reconnectRadius:u,onReconnect:h,onReconnectStart:f,onReconnectEnd:p,sourceX:R,sourceY:_,targetX:$,targetY:F,sourcePosition:z,targetPosition:V,setUpdateHover:T,setReconnecting:O})]})})}var qX=g.memo(GX);const YX=t=>({edgesFocusable:t.edgesFocusable,edgesReconnectable:t.edgesReconnectable,elementsSelectable:t.elementsSelectable,connectionMode:t.connectionMode,onError:t.onError});function X5({defaultMarkerColor:t,onlyRenderVisibleElements:e,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:o,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:d,onEdgeClick:u,reconnectRadius:h,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:x}){const{edgesFocusable:b,edgesReconnectable:y,elementsSelectable:k,onError:v}=Ue(YX,it),w=TX(e);return c.jsxs("div",{className:"react-flow__edges",children:[c.jsx($X,{defaultColor:t,rfId:n}),w.map(C=>c.jsx(qX,{id:C,edgesFocusable:b,edgesReconnectable:y,elementsSelectable:k,noPanClassName:s,onReconnect:i,onContextMenu:o,onMouseEnter:a,onMouseMove:l,onMouseLeave:d,onClick:u,reconnectRadius:h,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:v,edgeTypes:r,disableKeyboardA11y:x},C))]})}X5.displayName="EdgeRenderer";const XX=g.memo(X5),ZX=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function QX({children:t}){const e=Ue(ZX);return c.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:e},children:t})}function JX(t){const e=h0(),n=g.useRef(!1);g.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const eZ=t=>t.panZoom?.syncViewport;function tZ(t){const e=Ue(eZ),n=ot();return g.useEffect(()=>{t&&(e?.(t),n.setState({transform:[t.x,t.y,t.zoom]}))},[t,e]),null}function nZ(t){return t.connection.inProgress?{...t.connection,to:fc(t.connection.to,t.transform)}:{...t.connection}}function rZ(t){return nZ}function sZ(t){const e=rZ();return Ue(e,it)}const iZ=t=>({nodesConnectable:t.nodesConnectable,isValid:t.connection.isValid,inProgress:t.connection.inProgress,width:t.width,height:t.height});function oZ({containerStyle:t,style:e,type:n,component:r}){const{nodesConnectable:s,width:i,height:o,isValid:a,inProgress:l}=Ue(iZ,it);return!(i&&s&&l)?null:c.jsx("svg",{style:t,width:i,height:o,className:"react-flow__connectionline react-flow__container",children:c.jsx("g",{className:vt(["react-flow__connection",Yj(a)]),children:c.jsx(Z5,{style:e,type:n,CustomComponent:r,isValid:a})})})}const Z5=({style:t,type:e=us.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:o,fromHandle:a,fromPosition:l,to:d,toNode:u,toHandle:h,toPosition:f,pointer:p}=sZ();if(!s)return;if(n)return c.jsx(n,{connectionLineType:e,connectionLineStyle:t,fromNode:o,fromHandle:a,fromX:i.x,fromY:i.y,toX:d.x,toY:d.y,fromPosition:l,toPosition:f,connectionStatus:Yj(r),toNode:u,toHandle:h,pointer:p});let m="";const x={sourceX:i.x,sourceY:i.y,sourcePosition:l,targetX:d.x,targetY:d.y,targetPosition:f};switch(e){case us.Bezier:[m]=a5(x);break;case us.SimpleBezier:[m]=$5(x);break;case us.Step:[m]=km({...x,borderRadius:0});break;case us.SmoothStep:[m]=km(x);break;default:[m]=c5(x)}return c.jsx("path",{d:m,fill:"none",className:"react-flow__connection-path",style:t})};Z5.displayName="ConnectionLine";const aZ={};function _1(t=aZ){g.useRef(t),ot(),g.useEffect(()=>{},[t])}function lZ(){ot(),g.useRef(!1),g.useEffect(()=>{},[])}function Q5({nodeTypes:t,edgeTypes:e,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:o,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:d,onNodeContextMenu:u,onSelectionContextMenu:h,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:x,connectionLineComponent:b,connectionLineContainerStyle:y,selectionKeyCode:k,selectionOnDrag:v,selectionMode:w,multiSelectionKeyCode:C,panActivationKeyCode:j,zoomActivationKeyCode:S,deleteKeyCode:P,onlyRenderVisibleElements:D,elementsSelectable:A,defaultViewport:N,translateExtent:T,minZoom:I,maxZoom:O,preventScrolling:E,defaultMarkerColor:M,zoomOnScroll:R,zoomOnPinch:_,panOnScroll:$,panOnScrollSpeed:F,panOnScrollMode:z,zoomOnDoubleClick:V,panOnDrag:Z,onPaneClick:U,onPaneMouseEnter:Q,onPaneMouseMove:se,onPaneMouseLeave:ce,onPaneScroll:X,onPaneContextMenu:K,paneClickDistance:te,nodeClickDistance:le,onEdgeContextMenu:J,onEdgeMouseEnter:de,onEdgeMouseMove:Ce,onEdgeMouseLeave:Te,reconnectRadius:De,onReconnect:tt,onReconnectStart:qt,onReconnectEnd:Nt,noDragClassName:mt,noWheelClassName:nn,noPanClassName:rn,disableKeyboardA11y:jn,nodeExtent:Vt,rfId:G,viewport:ie,onViewportChange:Se}){return _1(t),_1(e),lZ(),JX(n),tZ(ie),c.jsx(SX,{onPaneClick:U,onPaneMouseEnter:Q,onPaneMouseMove:se,onPaneMouseLeave:ce,onPaneContextMenu:K,onPaneScroll:X,paneClickDistance:te,deleteKeyCode:P,selectionKeyCode:k,selectionOnDrag:v,selectionMode:w,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:C,panActivationKeyCode:j,zoomActivationKeyCode:S,elementsSelectable:A,zoomOnScroll:R,zoomOnPinch:_,zoomOnDoubleClick:V,panOnScroll:$,panOnScrollSpeed:F,panOnScrollMode:z,panOnDrag:Z,defaultViewport:N,translateExtent:T,minZoom:I,maxZoom:O,onSelectionContextMenu:h,preventScrolling:E,noDragClassName:mt,noWheelClassName:nn,noPanClassName:rn,disableKeyboardA11y:jn,onViewportChange:Se,isControlledViewport:!!ie,children:c.jsxs(QX,{children:[c.jsx(XX,{edgeTypes:e,onEdgeClick:s,onEdgeDoubleClick:o,onReconnect:tt,onReconnectStart:qt,onReconnectEnd:Nt,onlyRenderVisibleElements:D,onEdgeContextMenu:J,onEdgeMouseEnter:de,onEdgeMouseMove:Ce,onEdgeMouseLeave:Te,reconnectRadius:De,defaultMarkerColor:M,noPanClassName:rn,disableKeyboardA11y:jn,rfId:G}),c.jsx(oZ,{style:x,type:m,component:b,containerStyle:y}),c.jsx("div",{className:"react-flow__edgelabel-renderer"}),c.jsx(AX,{nodeTypes:t,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:d,onNodeContextMenu:u,nodeClickDistance:le,onlyRenderVisibleElements:D,noPanClassName:rn,noDragClassName:mt,disableKeyboardA11y:jn,nodeExtent:Vt,rfId:G}),c.jsx("div",{className:"react-flow__viewport-portal"})]})})}Q5.displayName="GraphView";const cZ=g.memo(Q5),I1=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,fitViewOptions:a,minZoom:l=.5,maxZoom:d=2,nodeOrigin:u,nodeExtent:h,zIndexMode:f="basic"}={})=>{const p=new Map,m=new Map,x=new Map,b=new Map,y=r??e??[],k=n??t??[],v=u??[0,0],w=h??Tl;h5(x,b,y);const{nodesInitialized:C}=Cm(k,p,m,{nodeOrigin:v,nodeExtent:w,zIndexMode:f});let j=[0,0,1];if(o&&s&&i){const S=uc(p,{filter:N=>!!((N.width||N.initialWidth)&&(N.height||N.initialHeight))}),{x:P,y:D,zoom:A}=i0(S,s,i,l,d,a?.padding??.1);j=[P,D,A]}return{rfId:"1",width:s??0,height:i??0,transform:j,nodes:k,nodesInitialized:C,nodeLookup:p,parentLookup:m,edges:y,edgeLookup:b,connectionLookup:x,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:l,maxZoom:d,translateExtent:Tl,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:ho.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:v,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:a,fitViewResolver:null,connection:{...qj},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Mq,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Gj,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},dZ=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,fitViewOptions:a,minZoom:l,maxZoom:d,nodeOrigin:u,nodeExtent:h,zIndexMode:f})=>EY((p,m)=>{async function x(){const{nodeLookup:b,panZoom:y,fitViewOptions:k,fitViewResolver:v,width:w,height:C,minZoom:j,maxZoom:S}=m();y&&(await Eq({nodes:b,width:w,height:C,panZoom:y,minZoom:j,maxZoom:S},k),v?.resolve(!0),p({fitViewResolver:null}))}return{...I1({nodes:t,edges:e,width:s,height:i,fitView:o,fitViewOptions:a,minZoom:l,maxZoom:d,nodeOrigin:u,nodeExtent:h,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:b=>{const{nodeLookup:y,parentLookup:k,nodeOrigin:v,elevateNodesOnSelect:w,fitViewQueued:C,zIndexMode:j,nodesSelectionActive:S}=m(),{nodesInitialized:P,hasSelectedNodes:D}=Cm(b,y,k,{nodeOrigin:v,nodeExtent:h,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:j}),A=S&&D;C&&P?(x(),p({nodes:b,nodesInitialized:P,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:A})):p({nodes:b,nodesInitialized:P,nodesSelectionActive:A})},setEdges:b=>{const{connectionLookup:y,edgeLookup:k}=m();h5(y,k,b),p({edges:b})},setDefaultNodesAndEdges:(b,y)=>{if(b){const{setNodes:k}=m();k(b),p({hasDefaultNodes:!0})}if(y){const{setEdges:k}=m();k(y),p({hasDefaultEdges:!0})}},updateNodeInternals:b=>{const{triggerNodeChanges:y,nodeLookup:k,parentLookup:v,domNode:w,nodeOrigin:C,nodeExtent:j,debug:S,fitViewQueued:P,zIndexMode:D}=m(),{changes:A,updatedInternals:N}=Jq(b,k,v,w,C,j,D);N&&(Yq(k,v,{nodeOrigin:C,nodeExtent:j,zIndexMode:D}),P?(x(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),A?.length>0&&(S&&console.log("React Flow: trigger node changes",A),y?.(A)))},updateNodePositions:(b,y=!1)=>{const k=[];let v=[];const{nodeLookup:w,triggerNodeChanges:C,connection:j,updateConnection:S,onNodesChangeMiddlewareMap:P}=m();for(const[D,A]of b){const N=w.get(D),T=!!(N?.expandParent&&N?.parentId&&A?.position),I={id:D,type:"position",position:T?{x:Math.max(0,A.position.x),y:Math.max(0,A.position.y)}:A.position,dragging:y};if(N&&j.inProgress&&j.fromNode.id===N.id){const O=ci(N,j.fromHandle,ke.Left,!0);S({...j,from:O})}T&&N.parentId&&k.push({id:D,parentId:N.parentId,rect:{...A.internals.positionAbsolute,width:A.measured.width??0,height:A.measured.height??0}}),v.push(I)}if(k.length>0){const{parentLookup:D,nodeOrigin:A}=m(),N=u0(k,w,D,A);v.push(...N)}for(const D of P.values())v=D(v);C(v)},triggerNodeChanges:b=>{const{onNodesChange:y,setNodes:k,nodes:v,hasDefaultNodes:w,debug:C}=m();if(b?.length){if(w){const j=P5(b,v);k(j)}C&&console.log("React Flow: trigger node changes",b),y?.(b)}},triggerEdgeChanges:b=>{const{onEdgesChange:y,setEdges:k,edges:v,hasDefaultEdges:w,debug:C}=m();if(b?.length){if(w){const j=O5(b,v);k(j)}C&&console.log("React Flow: trigger edge changes",b),y?.(b)}},addSelectedNodes:b=>{const{multiSelectionActive:y,edgeLookup:k,nodeLookup:v,triggerNodeChanges:w,triggerEdgeChanges:C}=m();if(y){const j=b.map(S=>Fs(S,!0));w(j);return}w(Li(v,new Set([...b]),!0)),C(Li(k))},addSelectedEdges:b=>{const{multiSelectionActive:y,edgeLookup:k,nodeLookup:v,triggerNodeChanges:w,triggerEdgeChanges:C}=m();if(y){const j=b.map(S=>Fs(S,!0));C(j);return}C(Li(k,new Set([...b]))),w(Li(v,new Set,!0))},unselectNodesAndEdges:({nodes:b,edges:y}={})=>{const{edges:k,nodes:v,nodeLookup:w,triggerNodeChanges:C,triggerEdgeChanges:j}=m(),S=b||v,P=y||k,D=[];for(const N of S){if(!N.selected)continue;const T=w.get(N.id);T&&(T.selected=!1),D.push(Fs(N.id,!1))}const A=[];for(const N of P)N.selected&&A.push(Fs(N.id,!1));C(D),j(A)},setMinZoom:b=>{const{panZoom:y,maxZoom:k}=m();y?.setScaleExtent([b,k]),p({minZoom:b})},setMaxZoom:b=>{const{panZoom:y,minZoom:k}=m();y?.setScaleExtent([k,b]),p({maxZoom:b})},setTranslateExtent:b=>{m().panZoom?.setTranslateExtent(b),p({translateExtent:b})},resetSelectedElements:()=>{const{edges:b,nodes:y,triggerNodeChanges:k,triggerEdgeChanges:v,elementsSelectable:w}=m();if(!w)return;const C=y.reduce((S,P)=>P.selected?[...S,Fs(P.id,!1)]:S,[]),j=b.reduce((S,P)=>P.selected?[...S,Fs(P.id,!1)]:S,[]);k(C),v(j)},setNodeExtent:b=>{const{nodes:y,nodeLookup:k,parentLookup:v,nodeOrigin:w,elevateNodesOnSelect:C,nodeExtent:j,zIndexMode:S}=m();b[0][0]===j[0][0]&&b[0][1]===j[0][1]&&b[1][0]===j[1][0]&&b[1][1]===j[1][1]||(Cm(y,k,v,{nodeOrigin:w,nodeExtent:b,elevateNodesOnSelect:C,checkEquality:!1,zIndexMode:S}),p({nodeExtent:b}))},panBy:b=>{const{transform:y,width:k,height:v,panZoom:w,translateExtent:C}=m();return eY({delta:b,panZoom:w,transform:y,translateExtent:C,width:k,height:v})},setCenter:async(b,y,k)=>{const{width:v,height:w,maxZoom:C,panZoom:j}=m();if(!j)return Promise.resolve(!1);const S=typeof k?.zoom<"u"?k.zoom:C;return await j.setViewport({x:v/2-b*S,y:w/2-y*S,zoom:S},{duration:k?.duration,ease:k?.ease,interpolate:k?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{p({connection:{...qj}})},updateConnection:b=>{p({connection:b})},reset:()=>p({...I1()})}},Object.is);function uZ({initialNodes:t,initialEdges:e,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:o,initialMaxZoom:a,initialFitViewOptions:l,fitView:d,nodeOrigin:u,nodeExtent:h,zIndexMode:f,children:p}){const[m]=g.useState(()=>dZ({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:d,minZoom:o,maxZoom:a,fitViewOptions:l,nodeOrigin:u,nodeExtent:h,zIndexMode:f}));return c.jsx(DY,{value:m,children:c.jsx(QY,{children:p})})}function hZ({children:t,nodes:e,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:o,fitView:a,fitViewOptions:l,minZoom:d,maxZoom:u,nodeOrigin:h,nodeExtent:f,zIndexMode:p}){return g.useContext(mh)?c.jsx(c.Fragment,{children:t}):c.jsx(uZ,{initialNodes:e,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:o,fitView:a,initialFitViewOptions:l,initialMinZoom:d,initialMaxZoom:u,nodeOrigin:h,nodeExtent:f,zIndexMode:p,children:t})}const fZ={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function pZ({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:o,onNodeClick:a,onEdgeClick:l,onInit:d,onMove:u,onMoveStart:h,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:x,onClickConnectStart:b,onClickConnectEnd:y,onNodeMouseEnter:k,onNodeMouseMove:v,onNodeMouseLeave:w,onNodeContextMenu:C,onNodeDoubleClick:j,onNodeDragStart:S,onNodeDrag:P,onNodeDragStop:D,onNodesDelete:A,onEdgesDelete:N,onDelete:T,onSelectionChange:I,onSelectionDragStart:O,onSelectionDrag:E,onSelectionDragStop:M,onSelectionContextMenu:R,onSelectionStart:_,onSelectionEnd:$,onBeforeDelete:F,connectionMode:z,connectionLineType:V=us.Bezier,connectionLineStyle:Z,connectionLineComponent:U,connectionLineContainerStyle:Q,deleteKeyCode:se="Backspace",selectionKeyCode:ce="Shift",selectionOnDrag:X=!1,selectionMode:K=Ll.Full,panActivationKeyCode:te="Space",multiSelectionKeyCode:le=_l()?"Meta":"Control",zoomActivationKeyCode:J=_l()?"Meta":"Control",snapToGrid:de,snapGrid:Ce,onlyRenderVisibleElements:Te=!1,selectNodesOnDrag:De,nodesDraggable:tt,autoPanOnNodeFocus:qt,nodesConnectable:Nt,nodesFocusable:mt,nodeOrigin:nn=j5,edgesFocusable:rn,edgesReconnectable:jn,elementsSelectable:Vt=!0,defaultViewport:G=HY,minZoom:ie=.5,maxZoom:Se=2,translateExtent:Pe=Tl,preventScrolling:Ye=!0,nodeExtent:Wn,defaultMarkerColor:Ht="#b1b1b7",zoomOnScroll:Xr=!0,zoomOnPinch:To=!0,panOnScroll:pn=!1,panOnScrollSpeed:Zr=.5,panOnScrollMode:Ts=ei.Free,zoomOnDoubleClick:mi=!0,panOnDrag:gi=!0,onPaneClick:xi,onPaneMouseEnter:Qr,onPaneMouseMove:bi,onPaneMouseLeave:ct,onPaneScroll:At,onPaneContextMenu:Pt,paneClickDistance:Nn=1,nodeClickDistance:Tt=0,children:gt,onReconnect:Lt,onReconnectStart:Un,onReconnectEnd:ut,onEdgeContextMenu:Pn,onEdgeDoubleClick:L,onEdgeMouseEnter:B,onEdgeMouseMove:H,onEdgeMouseLeave:Y,reconnectRadius:ne=10,onNodesChange:me,onEdgesChange:he,noDragClassName:xe="nodrag",noWheelClassName:ye="nowheel",noPanClassName:we="nopan",fitView:Ne,fitViewOptions:ve,connectOnClick:He,attributionPosition:We,proOptions:wt,defaultEdgeOptions:xt,elevateNodesOnSelect:Rt=!0,elevateEdgesOnSelect:qe=!1,disableKeyboardA11y:Yt=!1,autoPanOnConnect:Ar,autoPanOnNodeDrag:Ls,autoPanSpeed:lr,connectionRadius:On,isValidConnection:Lo,onError:Rs,style:Tr,id:_s,nodeDragThreshold:yi,connectionDragThreshold:$e,viewport:Ot,onViewportChange:Jr,width:Lr,height:rt,colorMode:vi="light",debug:pc,onScroll:mc,ariaLabelConfig:r3,zIndexMode:p0="basic",...s3},i3){const yh=_s||"1",o3=GY(vi),a3=g.useCallback(m0=>{m0.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),mc?.(m0)},[mc]);return c.jsx("div",{"data-testid":"rf__wrapper",...s3,onScroll:a3,style:{...Tr,...fZ},ref:i3,className:vt(["react-flow",s,o3]),id:_s,role:"application",children:c.jsxs(hZ,{nodes:t,edges:e,width:Lr,height:rt,fitView:Ne,fitViewOptions:ve,minZoom:ie,maxZoom:Se,nodeOrigin:nn,nodeExtent:Wn,zIndexMode:p0,children:[c.jsx(KY,{nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:x,onClickConnectStart:b,onClickConnectEnd:y,nodesDraggable:tt,autoPanOnNodeFocus:qt,nodesConnectable:Nt,nodesFocusable:mt,edgesFocusable:rn,edgesReconnectable:jn,elementsSelectable:Vt,elevateNodesOnSelect:Rt,elevateEdgesOnSelect:qe,minZoom:ie,maxZoom:Se,nodeExtent:Wn,onNodesChange:me,onEdgesChange:he,snapToGrid:de,snapGrid:Ce,connectionMode:z,translateExtent:Pe,connectOnClick:He,defaultEdgeOptions:xt,fitView:Ne,fitViewOptions:ve,onNodesDelete:A,onEdgesDelete:N,onDelete:T,onNodeDragStart:S,onNodeDrag:P,onNodeDragStop:D,onSelectionDrag:E,onSelectionDragStart:O,onSelectionDragStop:M,onMove:u,onMoveStart:h,onMoveEnd:f,noPanClassName:we,nodeOrigin:nn,rfId:yh,autoPanOnConnect:Ar,autoPanOnNodeDrag:Ls,autoPanSpeed:lr,onError:Rs,connectionRadius:On,isValidConnection:Lo,selectNodesOnDrag:De,nodeDragThreshold:yi,connectionDragThreshold:$e,onBeforeDelete:F,debug:pc,ariaLabelConfig:r3,zIndexMode:p0}),c.jsx(cZ,{onInit:d,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:k,onNodeMouseMove:v,onNodeMouseLeave:w,onNodeContextMenu:C,onNodeDoubleClick:j,nodeTypes:i,edgeTypes:o,connectionLineType:V,connectionLineStyle:Z,connectionLineComponent:U,connectionLineContainerStyle:Q,selectionKeyCode:ce,selectionOnDrag:X,selectionMode:K,deleteKeyCode:se,multiSelectionKeyCode:le,panActivationKeyCode:te,zoomActivationKeyCode:J,onlyRenderVisibleElements:Te,defaultViewport:G,translateExtent:Pe,minZoom:ie,maxZoom:Se,preventScrolling:Ye,zoomOnScroll:Xr,zoomOnPinch:To,zoomOnDoubleClick:mi,panOnScroll:pn,panOnScrollSpeed:Zr,panOnScrollMode:Ts,panOnDrag:gi,onPaneClick:xi,onPaneMouseEnter:Qr,onPaneMouseMove:bi,onPaneMouseLeave:ct,onPaneScroll:At,onPaneContextMenu:Pt,paneClickDistance:Nn,nodeClickDistance:Tt,onSelectionContextMenu:R,onSelectionStart:_,onSelectionEnd:$,onReconnect:Lt,onReconnectStart:Un,onReconnectEnd:ut,onEdgeContextMenu:Pn,onEdgeDoubleClick:L,onEdgeMouseEnter:B,onEdgeMouseMove:H,onEdgeMouseLeave:Y,reconnectRadius:ne,defaultMarkerColor:Ht,noDragClassName:xe,noWheelClassName:ye,noPanClassName:we,rfId:yh,disableKeyboardA11y:Yt,nodeExtent:Wn,viewport:Ot,onViewportChange:Jr}),c.jsx(VY,{onSelectionChange:I}),gt,c.jsx(IY,{proOptions:wt,position:We}),c.jsx(_Y,{rfId:yh,disableKeyboardA11y:Yt})]})})}var mZ=E5(pZ);function gZ(t){const[e,n]=g.useState(t),r=g.useCallback(s=>n(i=>P5(s,i)),[]);return[e,n,r]}function xZ(t){const[e,n]=g.useState(t),r=g.useCallback(s=>n(i=>O5(s,i)),[]);return[e,n,r]}function bZ({dimensions:t,lineWidth:e,variant:n,className:r}){return c.jsx("path",{strokeWidth:e,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`,className:vt(["react-flow__background-pattern",n,r])})}function yZ({radius:t,className:e}){return c.jsx("circle",{cx:t,cy:t,r:t,className:vt(["react-flow__background-pattern","dots",e])})}var bs;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(bs||(bs={}));const vZ={[bs.Dots]:1,[bs.Lines]:1,[bs.Cross]:6},wZ=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function J5({id:t,variant:e=bs.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:o,bgColor:a,style:l,className:d,patternClassName:u}){const h=g.useRef(null),{transform:f,patternId:p}=Ue(wZ,it),m=r||vZ[e],x=e===bs.Dots,b=e===bs.Cross,y=Array.isArray(n)?n:[n,n],k=[y[0]*f[2]||1,y[1]*f[2]||1],v=m*f[2],w=Array.isArray(i)?i:[i,i],C=b?[v,v]:k,j=[w[0]*f[2]||1+C[0]/2,w[1]*f[2]||1+C[1]/2],S=`${p}${t||""}`;return c.jsxs("svg",{className:vt(["react-flow__background",d]),style:{...l,...xh,"--xy-background-color-props":a,"--xy-background-pattern-color-props":o},ref:h,"data-testid":"rf__background",children:[c.jsx("pattern",{id:S,x:f[0]%k[0],y:f[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${j[0]},-${j[1]})`,children:x?c.jsx(yZ,{radius:v/2,className:u}):c.jsx(bZ,{dimensions:C,lineWidth:s,variant:e,className:u})}),c.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${S})`})]})}J5.displayName="Background";const kZ=g.memo(J5);function SZ(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:c.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function CZ(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:c.jsx("path",{d:"M0 0h32v4.2H0z"})})}function jZ(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:c.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function NZ(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:c.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function PZ(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:c.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function rd({children:t,className:e,...n}){return c.jsx("button",{type:"button",className:vt(["react-flow__controls-button",e]),...n,children:t})}const OZ=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom,ariaLabelConfig:t.ariaLabelConfig});function e3({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:o,onFitView:a,onInteractiveChange:l,className:d,children:u,position:h="bottom-left",orientation:f="vertical","aria-label":p}){const m=ot(),{isInteractive:x,minZoomReached:b,maxZoomReached:y,ariaLabelConfig:k}=Ue(OZ,it),{zoomIn:v,zoomOut:w,fitView:C}=h0(),j=()=>{v(),i?.()},S=()=>{w(),o?.()},P=()=>{C(s),a?.()},D=()=>{m.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),l?.(!x)},A=f==="horizontal"?"horizontal":"vertical";return c.jsxs(gh,{className:vt(["react-flow__controls",A,d]),position:h,style:t,"data-testid":"rf__controls","aria-label":p??k["controls.ariaLabel"],children:[e&&c.jsxs(c.Fragment,{children:[c.jsx(rd,{onClick:j,className:"react-flow__controls-zoomin",title:k["controls.zoomIn.ariaLabel"],"aria-label":k["controls.zoomIn.ariaLabel"],disabled:y,children:c.jsx(SZ,{})}),c.jsx(rd,{onClick:S,className:"react-flow__controls-zoomout",title:k["controls.zoomOut.ariaLabel"],"aria-label":k["controls.zoomOut.ariaLabel"],disabled:b,children:c.jsx(CZ,{})})]}),n&&c.jsx(rd,{className:"react-flow__controls-fitview",onClick:P,title:k["controls.fitView.ariaLabel"],"aria-label":k["controls.fitView.ariaLabel"],children:c.jsx(jZ,{})}),r&&c.jsx(rd,{className:"react-flow__controls-interactive",onClick:D,title:k["controls.interactive.ariaLabel"],"aria-label":k["controls.interactive.ariaLabel"],children:x?c.jsx(PZ,{}):c.jsx(NZ,{})}),u]})}e3.displayName="Controls";g.memo(e3);function EZ({id:t,x:e,y:n,width:r,height:s,style:i,color:o,strokeColor:a,strokeWidth:l,className:d,borderRadius:u,shapeRendering:h,selected:f,onClick:p}){const{background:m,backgroundColor:x}=i||{},b=o||m||x;return c.jsx("rect",{className:vt(["react-flow__minimap-node",{selected:f},d]),x:e,y:n,rx:u,ry:u,width:r,height:s,style:{fill:b,stroke:a,strokeWidth:l},shapeRendering:h,onClick:p?y=>p(y,t):void 0})}const DZ=g.memo(EZ),MZ=t=>t.nodes.map(e=>e.id),Uf=t=>t instanceof Function?t:()=>t;function AZ({nodeStrokeColor:t,nodeColor:e,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=DZ,onClick:o}){const a=Ue(MZ,it),l=Uf(e),d=Uf(t),u=Uf(n),h=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return c.jsx(c.Fragment,{children:a.map(f=>c.jsx(LZ,{id:f,nodeColorFunc:l,nodeStrokeColorFunc:d,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:o,shapeRendering:h},f))})}function TZ({id:t,nodeColorFunc:e,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:o,NodeComponent:a,onClick:l}){const{node:d,x:u,y:h,width:f,height:p}=Ue(m=>{const x=m.nodeLookup.get(t);if(!x)return{node:void 0,x:0,y:0,width:0,height:0};const b=x.internals.userNode,{x:y,y:k}=x.internals.positionAbsolute,{width:v,height:w}=Yr(b);return{node:b,x:y,y:k,width:v,height:w}},it);return!d||d.hidden||!t5(d)?null:c.jsx(a,{x:u,y:h,width:f,height:p,style:d.style,selected:!!d.selected,className:r(d),color:e(d),borderRadius:s,strokeColor:n(d),strokeWidth:i,shapeRendering:o,onClick:l,id:d.id})}const LZ=g.memo(TZ);var RZ=g.memo(AZ);const _Z=200,IZ=150,$Z=t=>!t.hidden,BZ=t=>{const e={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:e,boundingRect:t.nodeLookup.size>0?e5(uc(t.nodeLookup,{filter:$Z}),e):e,rfId:t.rfId,panZoom:t.panZoom,translateExtent:t.translateExtent,flowWidth:t.width,flowHeight:t.height,ariaLabelConfig:t.ariaLabelConfig}},FZ="react-flow__minimap-desc";function t3({style:t,className:e,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:o,nodeComponent:a,bgColor:l,maskColor:d,maskStrokeColor:u,maskStrokeWidth:h,position:f="bottom-right",onClick:p,onNodeClick:m,pannable:x=!1,zoomable:b=!1,ariaLabel:y,inversePan:k,zoomStep:v=1,offsetScale:w=5}){const C=ot(),j=g.useRef(null),{boundingRect:S,viewBB:P,rfId:D,panZoom:A,translateExtent:N,flowWidth:T,flowHeight:I,ariaLabelConfig:O}=Ue(BZ,it),E=t?.width??_Z,M=t?.height??IZ,R=S.width/E,_=S.height/M,$=Math.max(R,_),F=$*E,z=$*M,V=w*$,Z=S.x-(F-S.width)/2-V,U=S.y-(z-S.height)/2-V,Q=F+V*2,se=z+V*2,ce=`${FZ}-${D}`,X=g.useRef(0),K=g.useRef();X.current=$,g.useEffect(()=>{if(j.current&&A)return K.current=cY({domNode:j.current,panZoom:A,getTransform:()=>C.getState().transform,getViewScale:()=>X.current}),()=>{K.current?.destroy()}},[A]),g.useEffect(()=>{K.current?.update({translateExtent:N,width:T,height:I,inversePan:k,pannable:x,zoomStep:v,zoomable:b})},[x,b,k,v,N,T,I]);const te=p?de=>{const[Ce,Te]=K.current?.pointer(de)||[0,0];p(de,{x:Ce,y:Te})}:void 0,le=m?g.useCallback((de,Ce)=>{const Te=C.getState().nodeLookup.get(Ce).internals.userNode;m(de,Te)},[]):void 0,J=y??O["minimap.ariaLabel"];return c.jsx(gh,{position:f,style:{...t,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof h=="number"?h*$:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o=="number"?o:void 0},className:vt(["react-flow__minimap",e]),"data-testid":"rf__minimap",children:c.jsxs("svg",{width:E,height:M,viewBox:`${Z} ${U} ${Q} ${se}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ce,ref:j,onClick:te,children:[J&&c.jsx("title",{id:ce,children:J}),c.jsx(RZ,{onClick:le,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:o,nodeComponent:a}),c.jsx("path",{className:"react-flow__minimap-mask",d:`M${Z-V},${U-V}h${Q+V*2}v${se+V*2}h${-Q-V*2}z
|
|
311
|
+
M${P.x},${P.y}h${P.width}v${P.height}h${-P.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}t3.displayName="MiniMap";g.memo(t3);const zZ=t=>e=>t?`${Math.max(1/e.transform[2],1)}`:void 0,VZ={[go.Line]:"right",[go.Handle]:"bottom-right"};function HZ({nodeId:t,position:e,variant:n=go.Handle,className:r,style:s=void 0,children:i,color:o,minWidth:a=10,minHeight:l=10,maxWidth:d=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:h=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:x,onResize:b,onResizeEnd:y}){const k=T5(),v=typeof t=="string"?t:k,w=ot(),C=g.useRef(null),j=n===go.Handle,S=Ue(g.useCallback(zZ(j&&p),[j,p]),it),P=g.useRef(null),D=e??VZ[n];g.useEffect(()=>{if(!(!C.current||!v))return P.current||(P.current=SY({domNode:C.current,nodeId:v,getStoreItems:()=>{const{nodeLookup:N,transform:T,snapGrid:I,snapToGrid:O,nodeOrigin:E,domNode:M}=w.getState();return{nodeLookup:N,transform:T,snapGrid:I,snapToGrid:O,nodeOrigin:E,paneDomNode:M}},onChange:(N,T)=>{const{triggerNodeChanges:I,nodeLookup:O,parentLookup:E,nodeOrigin:M}=w.getState(),R=[],_={x:N.x,y:N.y},$=O.get(v);if($&&$.expandParent&&$.parentId){const F=$.origin??M,z=N.width??$.measured.width??0,V=N.height??$.measured.height??0,Z={id:$.id,parentId:$.parentId,rect:{width:z,height:V,...n5({x:N.x??$.position.x,y:N.y??$.position.y},{width:z,height:V},$.parentId,O,F)}},U=u0([Z],O,E,M);R.push(...U),_.x=N.x?Math.max(F[0]*z,N.x):void 0,_.y=N.y?Math.max(F[1]*V,N.y):void 0}if(_.x!==void 0&&_.y!==void 0){const F={id:v,type:"position",position:{..._}};R.push(F)}if(N.width!==void 0&&N.height!==void 0){const z={id:v,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:N.width,height:N.height}};R.push(z)}for(const F of T){const z={...F,type:"position"};R.push(z)}I(R)},onEnd:({width:N,height:T})=>{const I={id:v,type:"dimensions",resizing:!1,dimensions:{width:N,height:T}};w.getState().triggerNodeChanges([I])}})),P.current.update({controlPosition:D,boundaries:{minWidth:a,minHeight:l,maxWidth:d,maxHeight:u},keepAspectRatio:h,resizeDirection:f,onResizeStart:x,onResize:b,onResizeEnd:y,shouldResize:m}),()=>{P.current?.destroy()}},[D,a,l,d,u,h,x,b,y,m]);const A=D.split("-");return c.jsx("div",{className:vt(["react-flow__resize-control","nodrag",...A,n,r]),ref:C,style:{...s,scale:S,...o&&{[j?"backgroundColor":"borderColor"]:o}},children:i})}g.memo(HZ);function WZ(t){const e=[],n=[];return t.steps.forEach((o,a)=>{e.push({id:o.id,type:"skillNode",position:{x:50+a*280,y:100},data:{step:o,category:t.category,index:a}}),a<t.steps.length-1&&n.push({id:`e-${o.id}-${t.steps[a+1].id}`,source:o.id,target:t.steps[a+1].id,label:o.transitionLabel||"",animated:!0,style:{stroke:`url(#edge-grad-${a%6})`,strokeWidth:3,filter:"drop-shadow(0px 0px 3px rgba(100,100,100,0.15))"}})}),{nodes:e,edges:n}}const $1=[{border:"border-rose-500 shadow-rose-500/20",gradient:"from-rose-400 to-orange-500",handle:"border-rose-500 dark:border-rose-400 bg-rose-500",badge:"bg-rose-50/80 dark:bg-rose-500/10 border-rose-200 dark:border-rose-500/20 text-rose-700 dark:text-rose-400"},{border:"border-amber-500 shadow-amber-500/20",gradient:"from-amber-400 to-yellow-500",handle:"border-amber-500 dark:border-amber-400 bg-amber-500",badge:"bg-amber-50/80 dark:bg-amber-500/10 border-amber-200 dark:border-amber-500/20 text-amber-700 dark:text-amber-400"},{border:"border-emerald-500 shadow-emerald-500/20",gradient:"from-emerald-400 to-teal-500",handle:"border-emerald-500 dark:border-emerald-400 bg-emerald-500",badge:"bg-emerald-50/80 dark:bg-emerald-500/10 border-emerald-200 dark:border-emerald-500/20 text-emerald-700 dark:text-emerald-400"},{border:"border-cyan-500 shadow-cyan-500/20",gradient:"from-cyan-400 to-blue-500",handle:"border-cyan-500 dark:border-cyan-400 bg-cyan-500",badge:"bg-cyan-50/80 dark:bg-cyan-500/10 border-cyan-200 dark:border-cyan-500/20 text-cyan-700 dark:text-cyan-400"},{border:"border-violet-500 shadow-violet-500/20",gradient:"from-violet-400 to-purple-500",handle:"border-violet-500 dark:border-violet-400 bg-violet-500",badge:"bg-violet-50/80 dark:bg-violet-500/10 border-violet-200 dark:border-violet-500/20 text-violet-700 dark:text-violet-400"},{border:"border-fuchsia-500 shadow-fuchsia-500/20",gradient:"from-fuchsia-400 to-pink-500",handle:"border-fuchsia-500 dark:border-fuchsia-400 bg-fuchsia-500",badge:"bg-fuchsia-50/80 dark:bg-fuchsia-500/10 border-fuchsia-200 dark:border-fuchsia-500/20 text-fuchsia-700 dark:text-fuchsia-400"}],UZ=({data:t,selected:e})=>{const n=t.index??0,r=$1[n%$1.length];return c.jsxs("div",{className:`relative px-5 py-4 min-w-[220px] rounded-xl bg-white/80 dark:bg-[#14151a]/90 backdrop-blur-xl border transition-all duration-300 overflow-hidden ${e?`${r.border} scale-[1.02] z-10 shadow-lg`:"border-gray-200 dark:border-gray-800 shadow-sm hover:border-gray-300 dark:hover:border-gray-600 z-0"}`,"aria-label":`Workflow step: ${t.step.skill}`,children:[c.jsx("div",{className:`absolute inset-0 bg-gradient-to-br ${r.gradient} opacity-[0.03] dark:opacity-10 pointer-events-none`}),c.jsx("div",{className:`absolute left-0 top-0 bottom-0 w-1 bg-gradient-to-b ${r.gradient}`}),c.jsx(xo,{type:"target",position:ke.Left,className:`w-3 h-3 -ml-[7px] rounded-full border-2 bg-white dark:bg-[#1C1F26] ${r.handle} ${e?"scale-110":""} transition-transform`}),c.jsx("div",{className:"relative font-bold text-sm text-gray-900 dark:text-white capitalize truncate mb-1",children:t.step.skill.replace(/-/g," ")}),c.jsx("div",{className:`relative text-xs font-mono px-2 py-1 rounded inline-block border ${r.badge}`,children:t.step.command}),c.jsx(xo,{type:"source",position:ke.Right,className:`w-3 h-3 -mr-[7px] rounded-full border-2 bg-white dark:bg-[#1C1F26] ${r.handle} ${e?"scale-110":""} transition-transform`})]})};function KZ(){const[t,e]=g.useState(()=>document.documentElement.classList.contains("dark"));return g.useEffect(()=>{const n=new MutationObserver(()=>{e(document.documentElement.classList.contains("dark"))});return n.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>n.disconnect()},[]),t}const GZ=({workflow:t})=>{const[e,n,r]=gZ([]),[s,i,o]=xZ([]),a=KZ(),l=g.useMemo(()=>({skillNode:UZ}),[]);g.useEffect(()=>{if(t){const{nodes:u,edges:h}=WZ(t);n(u),i(h)}},[t,n,i]);const d={hideAttribution:!0};return c.jsxs("div",{className:"w-full h-full min-h-[400px] rounded-xl border border-gray-200 dark:border-dash-border overflow-hidden bg-gray-50 dark:bg-[#111216] relative",children:[c.jsx("svg",{style:{position:"absolute",top:0,left:0,width:0,height:0},children:c.jsxs("defs",{children:[c.jsxs("linearGradient",{id:"edge-grad-0",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[c.jsx("stop",{offset:"0%",stopColor:"#fb7185"}),c.jsx("stop",{offset:"100%",stopColor:"#fbbf24"})]}),c.jsxs("linearGradient",{id:"edge-grad-1",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[c.jsx("stop",{offset:"0%",stopColor:"#fbbf24"}),c.jsx("stop",{offset:"100%",stopColor:"#34d399"})]}),c.jsxs("linearGradient",{id:"edge-grad-2",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[c.jsx("stop",{offset:"0%",stopColor:"#34d399"}),c.jsx("stop",{offset:"100%",stopColor:"#22d3ee"})]}),c.jsxs("linearGradient",{id:"edge-grad-3",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[c.jsx("stop",{offset:"0%",stopColor:"#22d3ee"}),c.jsx("stop",{offset:"100%",stopColor:"#a78bfa"})]}),c.jsxs("linearGradient",{id:"edge-grad-4",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[c.jsx("stop",{offset:"0%",stopColor:"#a78bfa"}),c.jsx("stop",{offset:"100%",stopColor:"#e879f9"})]}),c.jsxs("linearGradient",{id:"edge-grad-5",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[c.jsx("stop",{offset:"0%",stopColor:"#e879f9"}),c.jsx("stop",{offset:"100%",stopColor:"#fb7185"})]})]})}),c.jsx(mZ,{nodes:e,edges:s,onNodesChange:r,onEdgesChange:o,nodeTypes:l,fitView:!0,fitViewOptions:{padding:.3},colorMode:a?"dark":"light",proOptions:d,panOnScroll:!0,zoomOnScroll:!1,children:c.jsx(kZ,{color:a?"#333":"#eee",gap:16})})]})},B1=({command:t})=>{const e=Ft(),n=t.match(/\/ck:([a-z0-9-]+)/i),r=n?n[1]:t.replace("/",""),s=i=>{i.stopPropagation(),e(`/skills?name=${r}`)};return c.jsx("button",{onClick:s,className:"inline-flex items-center px-2 py-1 bg-gray-100 hover:bg-gray-200 dark:bg-[#2A2E38] dark:hover:bg-[#323642] text-gray-800 dark:text-gray-200 text-xs font-mono rounded border border-gray-200 dark:border-gray-700 transition-colors",title:`View ${r} skill`,children:t})},qZ=({workflow:t,isSelected:e,onClick:n})=>{const{t:r}=ee();return e?c.jsxs("div",{className:"flex flex-col xl:flex-row bg-white dark:bg-[#14151a] rounded-xl border-2 border-blue-400 dark:border-blue-500 shadow-lg overflow-hidden min-h-[500px]",children:[c.jsxs("div",{className:"flex flex-col p-6 w-full xl:w-2/5 shrink-0 bg-white dark:bg-[#14151a]",children:[c.jsxs("div",{className:"flex justify-between items-start mb-4",children:[c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsx(Rv,{complexity:t.complexity}),c.jsx("span",{className:"text-xs font-mono text-gray-500 dark:text-dash-text-muted",children:t.timeEstimate})]}),c.jsx("button",{onClick:s=>{s.stopPropagation(),n()},className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 transition-colors p-1","aria-label":"Close",children:c.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:c.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),c.jsx("button",{type:"button",onClick:s=>{s.stopPropagation(),n()},className:"text-left w-full cursor-pointer hover:opacity-80 transition-opacity",children:c.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-dash-text mb-2",children:r(t.nameKey)})}),c.jsx("p",{className:"text-base text-gray-600 dark:text-dash-text-secondary mb-8",children:r(t.descriptionKey)}),c.jsxs("div",{className:"flex-grow",children:[c.jsx("h4",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider mb-4 border-b border-gray-100 dark:border-gray-800 pb-2",children:r("workflowImplementationRecipe")}),c.jsxs("div",{className:"relative pl-4 space-y-6",children:[c.jsx("div",{className:"absolute top-2 bottom-2 left-[5px] border-l-2 border-dashed border-gray-200 dark:border-gray-800"}),t.steps.map(s=>c.jsxs("div",{className:"relative",children:[c.jsx("div",{className:"absolute -left-[14px] top-1.5 w-[11px] h-[11px] rounded-full bg-blue-500 border-[3px] border-white dark:border-[#14151a]"}),c.jsxs("div",{className:"ml-4",children:[c.jsx(B1,{command:s.command||""}),s.transitionLabel&&c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-2",children:s.transitionLabel})]})]},s.id))]})]})]}),c.jsx("div",{className:"flex-grow p-4 bg-gray-50 dark:bg-[#0c0d12] border-t xl:border-t-0 xl:border-l border-gray-200 dark:border-gray-800 overflow-hidden relative",children:c.jsx(GZ,{workflow:t})})]}):c.jsxs("div",{className:"flex flex-col bg-white dark:bg-[#14151a] rounded-xl border border-gray-200 dark:border-dash-border hover:border-blue-400 dark:hover:border-blue-500 hover:shadow-md transition-all cursor-pointer p-5 h-full group relative",onClick:n,children:[c.jsxs("div",{className:"flex justify-between items-start mb-3",children:[c.jsx(Rv,{complexity:t.complexity}),c.jsx("span",{className:"text-xs font-mono text-gray-500 dark:text-dash-text-muted",children:t.timeEstimate})]}),c.jsx("h3",{className:"text-lg font-bold text-gray-900 dark:text-dash-text mb-2 group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors",children:r(t.nameKey)}),c.jsx("p",{className:"text-sm text-gray-600 dark:text-dash-text-secondary mb-6 flex-grow",children:r(t.descriptionKey)}),c.jsx("div",{className:"mt-auto pt-4 border-t border-gray-100 dark:border-dash-border",children:c.jsx("div",{className:"flex flex-wrap items-center gap-2",children:t.steps.map((s,i)=>c.jsxs(Qe.Fragment,{children:[c.jsx(B1,{command:s.command||""}),i<t.steps.length-1&&c.jsx("span",{className:"text-gray-400 dark:text-dash-text-muted text-xs",children:"→"})]},s.id))})})]})},YZ=({workflows:t,selectedWorkflowId:e,onSelectWorkflow:n})=>c.jsx("div",{className:`grid gap-6 ${e?"grid-cols-1":"grid-cols-1 md:grid-cols-2 xl:grid-cols-3"}`,children:t.filter(r=>!e||r.id===e).map(r=>c.jsx(qZ,{workflow:r,isSelected:e===r.id,onClick:()=>n(e===r.id?null:r.id)},r.id))}),XZ=[{id:"getting-started",labelKey:"workflowCategoryGettingStarted"},{id:"design-frontend",labelKey:"workflowCategoryDesignFrontend"},{id:"debugging-fixes",labelKey:"workflowCategoryDebuggingFixes"},{id:"planning-review",labelKey:"workflowCategoryPlanningReview"},{id:"research-docs",labelKey:"workflowCategoryResearchDocs"},{id:"shipping",labelKey:"workflowCategoryShipping"},{id:"backend-infra",labelKey:"workflowCategoryBackendInfra"},{id:"media-creative",labelKey:"workflowCategoryMediaCreative"},{id:"advanced",labelKey:"workflowCategoryAdvanced"}],ZZ=[{id:"build-feature",name:"Build a New Feature",nameKey:"workflowBuildFeature",category:"getting-started",complexity:"beginner",timeEstimate:"~15-30 min",description:"Add new functionality to applications systematically.",descriptionKey:"workflowBuildFeatureDesc",steps:[{id:"s1",skill:"brainstorm",transitionLabel:"explore"},{id:"s2",skill:"plan",transitionLabel:"structure"},{id:"s3",skill:"cook",command:"/ck:cook @plan.md"}],isBuiltIn:!0},{id:"quick-implementation",name:"Quick Implementation",nameKey:"workflowQuickImplementation",category:"getting-started",complexity:"beginner",timeEstimate:"~5-10 min",description:"Fast track implementation for small, understood features.",descriptionKey:"workflowQuickImplementationDesc",steps:[{id:"s1",skill:"scout",transitionLabel:"context"},{id:"s2",skill:"cook",command:"/ck:cook --fast"}],isBuiltIn:!0},{id:"start-new-project",name:"Start New Project",nameKey:"workflowStartNewProject",category:"getting-started",complexity:"intermediate",timeEstimate:"~30-45 min",description:"Bootstrap a brand new project with right foundations.",descriptionKey:"workflowStartNewProjectDesc",steps:[{id:"s1",skill:"research",transitionLabel:"stack options"},{id:"s2",skill:"bootstrap",transitionLabel:"init"},{id:"s3",skill:"project-organization"}],isBuiltIn:!0},{id:"frontend-design",name:"Frontend Design",nameKey:"workflowFrontendDesign",category:"design-frontend",complexity:"intermediate",timeEstimate:"~20-40 min",description:"Create beautiful user interfaces guided by design taste bots.",descriptionKey:"workflowFrontendDesignDesc",steps:[{id:"s1",skill:"ui-ux-pro-max",transitionLabel:"design audit"},{id:"s2",skill:"frontend-development",transitionLabel:"build"}],isBuiltIn:!0},{id:"ai-design-stitch",name:"AI Design Stitch",nameKey:"workflowAiDesignStitch",category:"design-frontend",complexity:"intermediate",timeEstimate:"~15-30 min",description:"Orchestrate Google Stitch for generating designs from prompt.",descriptionKey:"workflowAiDesignStitchDesc",steps:[{id:"s1",skill:"stitch",transitionLabel:"prototype"},{id:"s2",skill:"ui-styling"}],isBuiltIn:!0},{id:"excalidraw",name:"Excalidraw Design",nameKey:"workflowExcalidraw",category:"design-frontend",complexity:"beginner",timeEstimate:"~10-15 min",description:"Visualize architectures or mockups using Excalidraw JSON.",descriptionKey:"workflowExcalidrawDesc",steps:[{id:"s1",skill:"excalidraw",transitionLabel:"draw"}],isBuiltIn:!0},{id:"fix-bug",name:"Fix Bug",nameKey:"workflowFixBug",category:"debugging-fixes",complexity:"beginner",timeEstimate:"~10-20 min",description:"Identify root cause and automatically fix codebase issues.",descriptionKey:"workflowFixBugDesc",steps:[{id:"s1",skill:"debug",transitionLabel:"root cause"},{id:"s2",skill:"fix",transitionLabel:"patch"},{id:"s3",skill:"test"}],isBuiltIn:!0},{id:"security-audit",name:"Security Audit",nameKey:"workflowSecurityAudit",category:"debugging-fixes",complexity:"advanced",timeEstimate:"~30-60 min",description:"Thorough security check on the repository.",descriptionKey:"workflowSecurityAuditDesc",steps:[{id:"s1",skill:"security-scan",transitionLabel:"vulnerabilities"},{id:"s2",skill:"fix"}],isBuiltIn:!0},{id:"test-scenarios",name:"Test Scenarios",nameKey:"workflowTestScenarios",category:"debugging-fixes",complexity:"intermediate",timeEstimate:"~15-25 min",description:"Generate edge cases and test scenarios by decomposing features.",descriptionKey:"workflowTestScenariosDesc",steps:[{id:"s1",skill:"scenario",transitionLabel:"edge cases"},{id:"s2",skill:"test"}],isBuiltIn:!0},{id:"stride-analysis",name:"STRIDE Analysis",nameKey:"workflowStride",category:"debugging-fixes",complexity:"advanced",timeEstimate:"~20-40 min",description:"Perform a STRIDE + OWASP-based security audit threat model.",descriptionKey:"workflowStrideDesc",steps:[{id:"s1",skill:"security",transitionLabel:"threat map"},{id:"s2",skill:"plan"}],isBuiltIn:!0},{id:"code-review",name:"Code Review",nameKey:"workflowCodeReview",category:"planning-review",complexity:"intermediate",timeEstimate:"~10-15 min",description:"Review code quality with adversarial rigor.",descriptionKey:"workflowCodeReviewDesc",steps:[{id:"s1",skill:"code-review"}],isBuiltIn:!0},{id:"plan-validate",name:"Plan + Validate",nameKey:"workflowPlanValidate",category:"planning-review",complexity:"intermediate",timeEstimate:"~20-30 min",description:"Draft an architectural plan and rigorously validate its technical feasible.",descriptionKey:"workflowPlanValidateDesc",steps:[{id:"s1",skill:"plan",transitionLabel:"draft"},{id:"s2",skill:"predict",transitionLabel:"review"}],isBuiltIn:!0},{id:"adversarial-review",name:"Adversarial Review",nameKey:"workflowAdversarialReview",category:"planning-review",complexity:"advanced",timeEstimate:"~10-20 min",description:"Trigger a harsh red-team review mapping out potential failure modes.",descriptionKey:"workflowAdversarialReviewDesc",steps:[{id:"s1",skill:"predict",command:"/ck:predict @plan.md"}],isBuiltIn:!0},{id:"autoresearch",name:"Autonomous Loop",nameKey:"workflowAutoresearch",category:"planning-review",complexity:"advanced",timeEstimate:"~30-120 min",description:"Run an autonomous iterative optimization loop for any metric.",descriptionKey:"workflowAutoresearchDesc",steps:[{id:"s1",skill:"loop",command:"/ck:loop --iterations 5"}],isBuiltIn:!0},{id:"feature-extraction-xia",name:"Extract/Port Feature",nameKey:"workflowXia",category:"planning-review",complexity:"advanced",timeEstimate:"~20-40 min",description:"Port or extract a feature algorithm from an external codebase.",descriptionKey:"workflowXiaDesc",steps:[{id:"s1",skill:"xia",transitionLabel:"analyze source"},{id:"s2",skill:"plan"}],isBuiltIn:!0},{id:"visual-documentation",name:"Visual Documentation",nameKey:"workflowVisualDocumentation",category:"research-docs",complexity:"beginner",timeEstimate:"~15-20 min",description:"Build diagrams outlining current repo logic and architectures.",descriptionKey:"workflowVisualDocumentationDesc",steps:[{id:"s1",skill:"graphify",transitionLabel:"extract graph"},{id:"s2",skill:"mermaidjs-v11",transitionLabel:"render"},{id:"s3",skill:"docs"}],isBuiltIn:!0},{id:"technical-research",name:"Technical Research",nameKey:"workflowTechnicalResearch",category:"research-docs",complexity:"intermediate",timeEstimate:"~10-20 min",description:"Investigate technological solutions deeply before writing code.",descriptionKey:"workflowTechnicalResearchDesc",steps:[{id:"s1",skill:"research",transitionLabel:"gather info"},{id:"s2",skill:"docs-seeker"}],isBuiltIn:!0},{id:"llms-txt-gen",name:"Generate llms.txt",nameKey:"workflowLlmsTxt",category:"research-docs",complexity:"beginner",timeEstimate:"~5-10 min",description:"Analyze the codebase and construct a comprehensive llms.txt file.",descriptionKey:"workflowLlmsTxtDesc",steps:[{id:"s1",skill:"llms"}],isBuiltIn:!0},{id:"devops-deploy",name:"DevOps / Release",nameKey:"workflowDevops",category:"shipping",complexity:"intermediate",timeEstimate:"~15-25 min",description:"Configure Docker, CI/CD and deploy standard web platforms.",descriptionKey:"workflowDevopsDesc",steps:[{id:"s1",skill:"devops",transitionLabel:"configure container"},{id:"s2",skill:"deploy"}],isBuiltIn:!0},{id:"ship-pipeline",name:"Ship Pipeline",nameKey:"workflowShip",category:"shipping",complexity:"intermediate",timeEstimate:"~15-30 min",description:"Merge, test, review, commit, bump semantic version and PR.",descriptionKey:"workflowShipDesc",steps:[{id:"s1",skill:"test",transitionLabel:"ci check"},{id:"s2",skill:"ship"}],isBuiltIn:!0},{id:"database-ops",name:"Database Operations",nameKey:"workflowDatabaseOps",category:"backend-infra",complexity:"intermediate",timeEstimate:"~15-30 min",description:"Write complex aggregation pipelines or optimize database performance.",descriptionKey:"workflowDatabaseOpsDesc",steps:[{id:"s1",skill:"databases",transitionLabel:"schema design"},{id:"s2",skill:"backend-development"}],isBuiltIn:!0},{id:"remotion-video",name:"Remotion Video",nameKey:"workflowRemotion",category:"media-creative",complexity:"advanced",timeEstimate:"~30-60 min",description:"Build programmatic video sequences internally.",descriptionKey:"workflowRemotionDesc",steps:[{id:"s1",skill:"remotion",transitionLabel:"react anim"},{id:"s2",skill:"media-processing",transitionLabel:"render"}],isBuiltIn:!0},{id:"show-off",name:"Show Off Demo",nameKey:"workflowShowOff",category:"media-creative",complexity:"beginner",timeEstimate:"~10-15 min",description:"Build an interactive self-contained HTML showcase for a repo.",descriptionKey:"workflowShowOffDesc",steps:[{id:"s1",skill:"show-off"}],isBuiltIn:!0},{id:"agent-teams",name:"Agent Teams",nameKey:"workflowAgentTeams",category:"advanced",complexity:"advanced",timeEstimate:"~30-60 min",description:"Spawn isolated team members for parallel coordinated labor.",descriptionKey:"workflowAgentTeamsDesc",steps:[{id:"s1",skill:"team",transitionLabel:"delegate"}],isBuiltIn:!0},{id:"worktree-parallelism",name:"Worktree Parallelism",nameKey:"workflowWorktree",category:"advanced",complexity:"intermediate",timeEstimate:"~5-10 min",description:"Instantly isolate feature iterations in new worktrees.",descriptionKey:"workflowWorktreeDesc",steps:[{id:"s1",skill:"worktree"}],isBuiltIn:!0}],QZ=({activeCategory:t,onSelectCategory:e})=>{const{t:n}=ee();return c.jsxs("div",{className:"flex overflow-x-auto space-x-2 pb-2 mb-4 scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-gray-600",children:[c.jsx("button",{onClick:()=>e("all"),className:`px-4 py-2 rounded-lg whitespace-nowrap text-sm font-medium transition-colors ${t==="all"?"bg-blue-600 text-white dark:bg-blue-500":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-[#1C1F26] dark:text-gray-300 dark:hover:bg-[#2A2E38]"}`,children:n("workflowCategoryAll")}),XZ.map(r=>c.jsx("button",{onClick:()=>e(r.id),className:`px-4 py-2 rounded-lg whitespace-nowrap text-sm font-medium transition-colors ${t===r.id?"bg-blue-600 text-white dark:bg-blue-500":"bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-[#1C1F26] dark:text-gray-300 dark:hover:bg-[#2A2E38]"}`,children:n(r.labelKey)},r.id))]})};function JZ(t){const e=new Map;for(const n of t)if(n.triggers&&n.triggers.length>0){const r=n.triggers[0];if(e.set(n.name,r),n.name.startsWith("ck-")){const s=n.name.slice(3);e.has(s)||e.set(s,r)}}return e}function eQ(t,e){return t.steps.map(n=>{const r=n.command;if(r?.includes(" "))return{...n,command:r};const s=e.get(n.skill);if(s){const i=r?.split(" ").slice(1).join(" ")||"";return{...n,command:i?`${s} ${i}`:s}}return{...n,command:r||`/ck:${n.skill}`}})}function tQ(t,e){return t.map(n=>({...n,steps:eQ(n,e)}))}function nQ(t){const e=new Map;for(const n of t)if(e.set(n.name,n.name),n.name.startsWith("ck-")){const r=n.name.slice(3);e.has(r)||e.set(r,n.name)}return e}function rQ(){const{skills:t,loading:e,error:n}=dj(),{workflows:r,resolveSkillName:s}=g.useMemo(()=>{const i=JZ(t),o=nQ(t);return{workflows:tQ(ZZ,i),resolveSkillName:a=>o.get(a)||a}},[t]);return{workflows:r,loading:e,error:n,resolveSkillName:s}}function sQ(){const[t,e]=g.useState("all"),[n,r]=g.useState(null),{workflows:s,loading:i,error:o,resolveSkillName:a}=rQ();return{workflows:g.useMemo(()=>{let d=s;t!=="all"&&(d=s.filter(h=>h.category===t));const u={beginner:0,intermediate:1,advanced:2};return[...d].sort((h,f)=>u[h.complexity]-u[f.complexity])},[t,s]),activeCategory:t,setActiveCategory:e,selectedWorkflowId:n,setSelectedWorkflowId:r,loading:i,error:o,resolveSkillName:a}}function iQ(){const{t}=ee(),[e,n]=g.useState(""),{workflows:r,activeCategory:s,setActiveCategory:i,selectedWorkflowId:o,setSelectedWorkflowId:a,loading:l}=sQ(),d=g.useCallback(h=>{i(h),a(null)},[i,a]),u=g.useMemo(()=>{if(!e.trim())return r;const h=e.toLowerCase();return r.filter(f=>f.name.toLowerCase().includes(h)||f.description.toLowerCase().includes(h)||f.steps.some(p=>p.command.toLowerCase().includes(h)))},[r,e]);return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-white dark:bg-dash-bg text-gray-900 dark:text-dash-text",children:[c.jsx("div",{className:"p-6 border-b border-gray-200 dark:border-dash-border shrink-0",children:c.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-bold",children:t("workflowsTitle")}),c.jsx("p",{className:"text-sm text-gray-500 dark:text-dash-text-secondary mt-1",children:t("workflowsSubtitle")})]}),c.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-4 w-full md:w-auto",children:[c.jsxs("a",{href:"https://vividkit.dev/guides/workflows",target:"_blank",rel:"noreferrer",className:"group hidden md:flex items-center gap-2 px-3 py-1.5 bg-gradient-to-r from-indigo-50 to-purple-50 dark:from-indigo-500/10 dark:to-purple-500/10 border border-indigo-100 dark:border-indigo-500/20 rounded-lg hover:shadow-sm transition-all text-indigo-700 dark:text-indigo-400 hover:border-indigo-300 dark:hover:border-indigo-500/40",children:[c.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),c.jsx("span",{className:"text-xs font-semibold whitespace-nowrap",children:"Inspired by VividKit"})]}),c.jsxs("div",{className:"relative w-full sm:w-64",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),c.jsx("input",{type:"text",value:e,onChange:h=>n(h.target.value),placeholder:t("workflowSearchPlaceholder"),className:"w-full pl-9 pr-4 py-2 text-sm bg-gray-50 dark:bg-dash-surface border border-gray-200 dark:border-dash-border rounded-lg text-gray-900 dark:text-dash-text placeholder:text-gray-400 dark:placeholder:text-dash-text-muted focus:outline-none focus:border-blue-400 dark:focus:border-blue-500 transition-colors"}),e&&c.jsx("button",{type:"button",onClick:()=>n(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 transition-colors",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]})]})}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[c.jsx(QZ,{activeCategory:s,onSelectCategory:d}),l?c.jsx("div",{className:"flex items-center justify-center p-12 text-gray-500 dark:text-dash-text-muted",children:t("loadingWorkflows")}):u.length>0?c.jsx(YZ,{workflows:u,selectedWorkflowId:o,onSelectWorkflow:a}):c.jsx("div",{className:"flex items-center justify-center p-12 text-gray-500 dark:text-dash-text-muted",children:t("workflowNoResults")})]})]})}const oQ=DN([{path:"/",element:c.jsx(EE,{}),children:[{index:!0,element:c.jsx(Lv,{})},{path:"dashboard",element:c.jsx(Lv,{})},{path:"config/global",element:c.jsx(e8,{})},{path:"config/project/:projectId",element:c.jsx(OH,{})},{path:"project/:projectId",element:c.jsx(LH,{})},{path:"onboarding",element:c.jsx(UV,{})},{path:"migrate",element:c.jsx(EV,{})},{path:"statusline",element:c.jsx(EW,{})},{path:"mcp",element:c.jsx(c8,{})},{path:"plans",element:c.jsx(PH,{})},{path:"plans/:planSlug",element:c.jsx(lH,{})},{path:"plans/:planSlug/read",element:c.jsx(kv,{})},{path:"plans/:planSlug/read/*",element:c.jsx(kv,{})},{path:"kanban",element:c.jsx(n8,{})},{path:"sessions/:projectId/:sessionId",element:c.jsx(iW,{})},{path:"agents",element:c.jsx(VE,{})},{path:"commands",element:c.jsx(XE,{})},{path:"skills",element:c.jsx(pW,{})},{path:"workflows",element:c.jsx(iQ,{})},{path:"*",element:c.jsx(gw,{to:"/",replace:!0})}]}]),n3=document.getElementById("root");if(!n3)throw document.body.innerHTML='<div style="padding:20px;color:red;">Fatal: Root element not found</div>',new Error("Root element #root not found");Kf.createRoot(n3).render(c.jsx(Qe.StrictMode,{children:c.jsx(UN,{children:c.jsx(KN,{children:c.jsx(VN,{router:oQ})})})}));
|